<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Ahmad Raza Khokhar</title>
    <description>The latest articles on DEV Community by Ahmad Raza Khokhar (@ahmadrazakhokhar).</description>
    <link>https://dev.to/ahmadrazakhokhar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1225282%2F1ae4cc95-bb7c-4580-a06f-54873fd0c942.png</url>
      <title>DEV Community: Ahmad Raza Khokhar</title>
      <link>https://dev.to/ahmadrazakhokhar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmadrazakhokhar"/>
    <language>en</language>
    <item>
      <title>Diversify Your Hosting Approach for Enhanced Website Performance</title>
      <dc:creator>Ahmad Raza Khokhar</dc:creator>
      <pubDate>Fri, 29 Mar 2024 19:57:31 +0000</pubDate>
      <link>https://dev.to/ahmadrazakhokhar/diversify-your-hosting-approach-for-enhanced-website-performance-2b19</link>
      <guid>https://dev.to/ahmadrazakhokhar/diversify-your-hosting-approach-for-enhanced-website-performance-2b19</guid>
      <description>&lt;p&gt;In today's digital age, optimizing your website's hosting infrastructure is crucial for ensuring optimal performance and reliability. With &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt;' website development service, you can take a proactive approach to hosting, ensuring your website is always available and responsive to user demands.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rethink Traditional Hosting Models for Improved Website Resilience
&lt;/h2&gt;

&lt;p&gt;Gone are the days of relying solely on a single server for hosting your website. With &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt;, we embrace a distributed hosting model that spreads your website's workload across multiple servers. This approach not only enhances performance but also improves resilience, minimizing the risk of downtime due to server failures or traffic spikes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Experience the Benefits of Collaborating with &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Partnering with &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt; for website development offers a myriad of advantages. Our team of experts is dedicated to delivering tailored solutions that align with your specific goals and requirements. Whether you're launching a new website or seeking to optimize an existing one, &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt; provides the expertise and support you need to succeed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Elevate Your Website's Security and Reliability with &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Security is paramount in today's digital landscape, and&lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt; P2P Clouds&lt;/a&gt; is committed to safeguarding your website against threats and vulnerabilities. Our robust security measures and proactive approach to risk management ensure that your website remains protected at all times, providing peace of mind for you and your users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Seamlessly Scale Your Website's Infrastructure to Meet Growing Demands
&lt;/h2&gt;

&lt;p&gt;As your website grows and evolves, so too should your hosting infrastructure. With &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt;, scaling your website's infrastructure is seamless and hassle-free. Our flexible hosting solutions allow you to easily accommodate increased traffic and demand without compromising on performance or reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Maximize Uptime and Availability for Your Website Visitors
&lt;/h2&gt;

&lt;p&gt;Downtime can have a significant impact on your website's reputation and bottom line. That's why &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt; prioritizes uptime and availability, ensuring that your website remains accessible to users at all times. Our redundant systems and failover mechanisms minimize the risk of downtime, providing a seamless experience for your visitors.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ensure Data Integrity and Compliance with &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Protecting your website's data and ensuring compliance with regulations is essential in today's regulatory environment. &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt; helps you achieve this by implementing robust data security measures and ensuring compliance with relevant regulations and standards. With &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt;, you can rest assured that your website's data is secure and compliant.&lt;/p&gt;

&lt;p&gt;In conclusion, partnering with &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt; for website development offers numerous benefits, including enhanced performance, improved resilience, enhanced security, seamless scalability, maximum uptime, and regulatory compliance. With &lt;a href="https://p2pclouds.org/" rel="noopener noreferrer"&gt;P2P Clouds&lt;/a&gt; as your trusted partner, you can take your website to new heights and achieve your business objectives with confidence.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Get a Trusted DAPP Service For Your Vision and Turn it into Reality</title>
      <dc:creator>Ahmad Raza Khokhar</dc:creator>
      <pubDate>Fri, 29 Mar 2024 16:31:39 +0000</pubDate>
      <link>https://dev.to/ahmadrazakhokhar/get-a-trusted-dapp-service-for-your-vision-and-turn-it-into-reality-4job</link>
      <guid>https://dev.to/ahmadrazakhokhar/get-a-trusted-dapp-service-for-your-vision-and-turn-it-into-reality-4job</guid>
      <description>&lt;h2&gt;
  
  
  Take Your App's Security To The Next Level
&lt;/h2&gt;

&lt;p&gt;Blockchain integration in your Decentralized Application ensures a trustworthy and Secure connection. Blockchain Integration is mostly used for payment gateways and integrations, it makes the payment more secure and reliable. Get tension-free for security issues and join hands with the &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Forget the Single Server And Balance Your Load into Nodes
&lt;/h2&gt;

&lt;p&gt;In the world of blockchain, the app converts itself into decentralized applications and divides the load into different nodes which makes it difficult to be attacked by Hackers and Reliable at the same time.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is the Benefit of Joining Hands with &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt;  has gained a very good market reputation and their dedication to work is unmatchable. Excellent customer service and an outstanding support team make it unique in the marketplace. The Efforts and Dedications of &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt; CEO &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://www.linkedin.com/in/mianahmadbasit/" rel="noopener noreferrer"&gt;Mian Ahmad Basit&lt;/a&gt; has brought &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt; to the next level and the extreme efforts resulted in the growth of &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Strengthen Your App's Security with Blockchain
&lt;/h2&gt;

&lt;p&gt;Blockchain integration enhances security by providing a trustworthy and secure connection for your decentralized application (DApp). It's commonly used for payment gateways, ensuring payments are more secure and reliable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Distribute Workload Across Nodes for Improved Resilience
&lt;/h2&gt;

&lt;p&gt;In the blockchain realm, your app transforms into decentralized applications (DApps) and distributes its workload across different nodes. This decentralization makes it challenging for hackers to attack, while also enhancing reliability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Partner with &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt;?
&lt;/h2&gt;

&lt;p&gt;Partnering with &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt; offers numerous benefits. With a stellar market reputation, unmatched dedication to work, excellent customer service, and outstanding support team, &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt; stands out in the marketplace. CEO Mian Ahmad Basit's efforts have propelled &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt; to new heights, fostering its growth and success.&lt;/p&gt;

&lt;h2&gt;
  
  
  Seamlessly Scale Your Infrastructure
&lt;/h2&gt;

&lt;p&gt;With &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt;, scaling your infrastructure becomes seamless. By leveraging distributed networks and decentralization, your app can easily accommodate increased demand without compromising on performance or security.&lt;/p&gt;

&lt;h2&gt;
  
  
  Maximize Uptime and Reliability
&lt;/h2&gt;

&lt;p&gt;By utilizing &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt;' infrastructure, you can maximize uptime and reliability for your application. Distributed systems ensure that even if one node goes down, the system as a whole remains operational, minimizing disruptions for users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Ensure Data Integrity and Transparency
&lt;/h2&gt;

&lt;p&gt;&lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt;' infrastructure ensures data integrity and transparency. With blockchain technology at its core, every transaction is securely recorded, providing a transparent and excellent ledger of all activities.&lt;/p&gt;

&lt;h2&gt;
  
  
  Simplify Compliance and Regulations
&lt;/h2&gt;

&lt;p&gt;Partnering with &lt;a href="//p2pclouds.org"&gt;P2P Clouds&lt;/a&gt; simplifies compliance with regulations. With built-in features for regulatory compliance and data privacy, you can ensure that your application meets all requirements without hassle.&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>dapp</category>
      <category>decentralized</category>
      <category>secure</category>
    </item>
    <item>
      <title>Basic Solidity Smart Contract</title>
      <dc:creator>Ahmad Raza Khokhar</dc:creator>
      <pubDate>Wed, 21 Feb 2024 07:34:28 +0000</pubDate>
      <link>https://dev.to/ahmadrazakhokhar/basic-solidity-smart-contract-4n0h</link>
      <guid>https://dev.to/ahmadrazakhokhar/basic-solidity-smart-contract-4n0h</guid>
      <description>&lt;h2&gt;
  
  
  This is a contract for making a basic calculator with solidity.
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

contract calculator {
    uint256 result;
    //addition
    function add(uint128 num) public {
        result += num;
    }
    //substraction
    function substract(uint128 num) public {
        result -= num;
    }
    //multiplication
    function multiplication(uint128 num) public {
        result *= num;
    }
    //showing the out put 
    function output() public view  returns (uint256){
        return result;
    } 
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  How to deploy this contract?
&lt;/h2&gt;

&lt;p&gt;To deploy this contract to blockchain, you must make a test network in Remix IDE (an online ethereum code editor and compiler) named as sepolia faucet and grab some test coins from their respective site. Secondly, put the inject provider such as Meta-Mask at the top by simply copying the wallet address.&lt;br&gt;
Now hit the deploy button in Remix:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzvmq9r16xwhsr1rek2e.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fjzvmq9r16xwhsr1rek2e.png" alt=" " width="800" height="449"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now just test your deployment buttons and we are good to go!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you enjoyed the article, and if this was helpful then just leave a like below.&lt;br&gt;
Regards,&lt;br&gt;
&lt;strong&gt;Ahmad Raza Khokhar.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>solidity</category>
      <category>smartcontract</category>
      <category>blockchain</category>
      <category>ethereum</category>
    </item>
    <item>
      <title>How to perform Firebase CRUD Operations ?</title>
      <dc:creator>Ahmad Raza Khokhar</dc:creator>
      <pubDate>Sat, 27 Jan 2024 15:44:06 +0000</pubDate>
      <link>https://dev.to/ahmadrazakhokhar/how-to-perform-firebase-crud-operations--28ak</link>
      <guid>https://dev.to/ahmadrazakhokhar/how-to-perform-firebase-crud-operations--28ak</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Firebase is famous set of backend that is used for Serverless or Headless web applications or mobile applications. In today’s topic, we will discuss how to perform complete CRUD operation in firebase. CRUD operation stands for Create, Read, Update and Delete and these are the major building blocks of any web app or mobile app.First of you will need to make a new project in firebase console Firebase Console after that, Lets start coding with the following steps:&lt;/p&gt;

&lt;h2&gt;
  
  
  Firebase configuration file setup
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import { initializeApp } from "firebase/app";
// import { getAnalytics } from "firebase/analytics";
import { getFirestore } from "firebase/firestore";


const firebaseConfig = {
  apiKey: "API_KEY",
  authDomain: "AUTH_DOMAIN",
  projectId: "Project_ID",
  storageBucket: "Storage_Bucket",
  messagingSenderId: "Messaging_sender_ID",
  appId: "App_ID",
  measurementId: "Measurement_ID"
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);


// const analytics = getAnalytics(app);
export const db = getFirestore(app);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Please replace all the fields in firebase config file with the respective configuration given in your firebase console.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Add document to firestore
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import React, { useState } from "react";
import { dataBase } from "../FireBase/Firebase.config";
import { db } from "../FireBase/Firebase.config";
import {
  collection,
  addDoc,
  updateDoc,
  deleteDoc,
  getDoc,
  getDocs,
} from "firebase/firestore";
export default function AddBook() {
  const [bookName, setBookName] = useState("");
  const [price, setPrice] = useState("");
  const [currency, setCurrency] = useState("");

  async function addBook(e) {
    e.preventDefault();

    try {
        const booksCollection = collection(db, "books");
        const bookData = {bookName, price, currency}
      const querySnapshot = await addDoc(booksCollection, bookData);
      console.log(querySnapshot)
    } catch (error) {
      console.log(`There was an error in adding book: ${error}`);
    }
  }
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;form onSubmit={addBook} className="addBookForm"&amp;gt;
        &amp;lt;label htmlFor="book name"&amp;gt;Book Name&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="text"
          name="book name"
          placeholder="Enter Book Name"
          onChange={(e) =&amp;gt; setBookName(e.target.value)}
        /&amp;gt;
        &amp;lt;label htmlFor="price"&amp;gt;Price&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="text"
          name="price"
          placeholder="Enter Price"
          onChange={(e) =&amp;gt; setPrice(e.target.value)}
        /&amp;gt;
        &amp;lt;label htmlFor="currency"&amp;gt;Currency&amp;lt;/label&amp;gt;
        &amp;lt;input
          type="text"
          placeholder="USD, GBP, etc,."
          onChange={(e) =&amp;gt; setCurrency(e.target.value)}
        /&amp;gt;

        &amp;lt;input type="submit" value="Add Book" /&amp;gt;
      &amp;lt;/form&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this code we are using an example of books for our Firestore database collection. Remember that Firestore automatically creates the collection if the collection doesn’t exists in the database as Mongo DB does. Firestore is also a noSQL database which means it can also create the fields dynamically if those doesn’t exists in the document. noSQL databases scale vertically.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Get all documents from firebase collection
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
//get all
  async function getCollection() {
    try {
      const booksCollection = collection(db, "books");
      const data = await getDocs(booksCollection);

      setBooksData(data.docs);
    } catch (error) {
      console.log(
        `There was an error fetching the data in firestore: ${error}`
      );
    }
  }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Get Document by ID and Update it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
const[ selectedBook, setSelectedBook] = useState(null);
  //Get Document By ID
  const GetDocById = async (id) =&amp;gt; {
    try {
      const booksCollection = collection(db, "books");
      const singleBook = doc(booksCollection, id);
      const response = await getDoc(singleBook);
      const data = response.data();
      setSelectedBook({data:data, id:id})
      setDisplay({display:'block'})
    } catch (error) {
      console.log(`Error in updateDocument: ${error}`)
    }

  };

//update form
 const setDocument = async(id)=&amp;gt;{
    try {
      const booksCollection = collection(db, 'books');
      const bookRef = doc(booksCollection, id);

      const selectedBook = {
        bookName,
        price,
        currency
      }
     await updateDoc(bookRef, selectedBook);
     setDisplay({display:'none'})
    } catch (error) {
      console.log(`Error in setDocument: ${error}`)
    }
  }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  4. Delete firebase document by its id
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//delete
  const deleteDocument = async (id) =&amp;gt; {
    const booksCollection = collection(db, "books");
    const docRef = doc(booksCollection, id);
    await deleteDoc(docRef);
  };
Note: It is necessary to to give the collection reference in order to perform a successful operation. When dealing with single document, its ID is must that will be driven from the button the respective buttons are as below:

                  &amp;lt;button
                    className="deleteDoc"
                    onClick={() =&amp;gt; {
                      deleteDocument(e.id);
                    }}
                  &amp;gt;
                    Delete
                  &amp;lt;/button&amp;gt;
                  &amp;lt;button
                    className="updateDoc"
                    onClick={() =&amp;gt; {
                      updateDocument(e.id);
                    }}
                    onBlur={()=&amp;gt;setDisplay({display:'none'})}
                  &amp;gt;
                    Update
                  &amp;lt;/button&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Thank you for reading the article hope you found this helpful.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Regards,&lt;br&gt;
&lt;strong&gt;Ahmad Raza Khokhar&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>firebase</category>
      <category>firebasecrud</category>
      <category>crudoperations</category>
      <category>crud</category>
    </item>
  </channel>
</rss>
