<?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>Forem: Rishikesh-Programmer</title>
    <description>The latest articles on Forem by Rishikesh-Programmer (@rishikesh00760).</description>
    <link>https://forem.com/rishikesh00760</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%2F900908%2F88247b61-5a18-495b-8842-f356f7374620.jpeg</url>
      <title>Forem: Rishikesh-Programmer</title>
      <link>https://forem.com/rishikesh00760</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/rishikesh00760"/>
    <language>en</language>
    <item>
      <title>Socket.io Simple Chat App</title>
      <dc:creator>Rishikesh-Programmer</dc:creator>
      <pubDate>Thu, 30 Nov 2023 15:23:29 +0000</pubDate>
      <link>https://forem.com/rishikesh00760/socketio-simple-chat-app-3g8</link>
      <guid>https://forem.com/rishikesh00760/socketio-simple-chat-app-3g8</guid>
      <description>&lt;p&gt;Creating a real-time chat app with Socket.io and JavaScript involves both server-side and client-side implementation. Below, I'll guide you through creating a simple chat application using these technologies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js installed on your machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Set Up Your Project&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a new directory for your project.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir socketio-chat-app
cd socketio-chat-app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Initialize your project with npm.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm init -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Install necessary dependencies.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install express socket.io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Create Server-Side Code&lt;/strong&gt;&lt;br&gt;
Create a file named server.js for the server-side code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// server.js
const express = require('express');
const http = require('http');
const socketIO = require('socket.io');

const app = express();
const server = http.createServer(app);
const io = socketIO(server);

app.use(express.static(__dirname + '/public'));

io.on('connection', (socket) =&amp;gt; {
  console.log('A user connected');

  // Listen for chat messages
  socket.on('chat message', (msg) =&amp;gt; {
    io.emit('chat message', msg); // Broadcast the message to all connected clients
  });

  // Listen for disconnection
  socket.on('disconnect', () =&amp;gt; {
    console.log('User disconnected');
  });
});

const port = process.env.PORT || 3000;
server.listen(port, () =&amp;gt; {
  console.log(`Server listening on port ${port}`);
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Create Client-Side Code&lt;/strong&gt;&lt;br&gt;
Create a directory named public in your project and inside it, create an HTML file index.html.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- public/index.html --&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8"&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
  &amp;lt;title&amp;gt;Socket.io Chat App&amp;lt;/title&amp;gt;
  &amp;lt;script src="https://cdn.socket.io/4.0.1/socket.io.min.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;ul id="messages"&amp;gt;&amp;lt;/ul&amp;gt;
  &amp;lt;form id="form" action=""&amp;gt;
    &amp;lt;input id="m" autocomplete="off" /&amp;gt;&amp;lt;button&amp;gt;Send&amp;lt;/button&amp;gt;
  &amp;lt;/form&amp;gt;

  &amp;lt;script&amp;gt;
    const socket = io();

    // Listen for chat messages
    socket.on('chat message', (msg) =&amp;gt; {
      const messages = document.getElementById('messages');
      const li = document.createElement('li');
      li.textContent = msg;
      messages.appendChild(li);
    });

    // Send chat messages
    document.querySelector('form').addEventListener('submit', (e) =&amp;gt; {
      e.preventDefault();
      const input = document.getElementById('m');
      if (input.value) {
        socket.emit('chat message', input.value);
        input.value = '';
      }
    });
  &amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4: Run Your Application&lt;/strong&gt;&lt;br&gt;
Run your server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;node server.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Visit &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt; in your web browser, and you should be able to see the chat application. Open multiple browser tabs to simulate different users and see real-time chat in action.&lt;/p&gt;

&lt;p&gt;That's it! You've created a basic real-time chat application using Socket.io and JavaScript. Feel free to enhance it by adding features like user authentication, private messaging, or a better user interface.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>node</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Creating a chat application like messenger with node js</title>
      <dc:creator>Rishikesh-Programmer</dc:creator>
      <pubDate>Mon, 07 Aug 2023 14:28:00 +0000</pubDate>
      <link>https://forem.com/rishikesh00760/creating-a-chat-application-like-messenger-with-node-js-3f7e</link>
      <guid>https://forem.com/rishikesh00760/creating-a-chat-application-like-messenger-with-node-js-3f7e</guid>
      <description>&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%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcQZBl0YD0AH8Dmp6vy3ewskcfBUPlL98XzxYg%26usqp%3DCAU" 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%2Fencrypted-tbn0.gstatic.com%2Fimages%3Fq%3Dtbn%3AANd9GcQZBl0YD0AH8Dmp6vy3ewskcfBUPlL98XzxYg%26usqp%3DCAU" width="299" height="168"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Creating a full-fledged chat application like Messenger from scratch is a complex and time-consuming task. However, I can provide you with a basic outline and steps to get you started with building a simple chat application using Node.js and some other technologies.&lt;/p&gt;

&lt;p&gt;Set Up the Project:&lt;br&gt;
First, make sure you have Node.js installed on your system. Create a new directory for your project and initialize a new Node.js project using npm (Node Package Manager).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mkdir chat-app
cd chat-app
npm init -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Dependencies:&lt;br&gt;
For our chat application, we will use Express.js as the web server and Socket.io for real-time communication between clients. Additionally, we'll use other libraries to handle user authentication and UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install express socket.io socket.io-client moment body-parser ejs passport passport-local express-session
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create Server and Basic HTML:&lt;br&gt;
Create a new file named app.js (or index.js) to set up the server and handle the basic routes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// app.js
const express = require('express');
const app = express();
const http = require('http').createServer(app);
const io = require('socket.io')(http);
const moment = require('moment');

// Basic route for serving HTML page
app.get('/', (req, res) =&amp;gt; {
  res.sendFile(__dirname + '/index.html');
});

http.listen(3000, () =&amp;gt; {
  console.log('Server running on http://localhost:3000');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the HTML page:&lt;br&gt;
Create a new file named index.html in the root folder of your project.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- index.html --&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Chat Application&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;h1&amp;gt;Welcome to the Chat Application&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Set up Socket.io for Real-Time Communication:&lt;br&gt;
Modify index.html to include Socket.io library and establish a connection to the server.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- index.html --&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Chat Application&amp;lt;/title&amp;gt;
  &amp;lt;script src="/socket.io/socket.io.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script&amp;gt;
    const socket = io();
  &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;h1&amp;gt;Welcome to the Chat Application&amp;lt;/h1&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Handle User Authentication (Optional):&lt;br&gt;
You may choose to implement user authentication to make your chat application secure. You can use Passport.js with the passport-local strategy for this purpose. I'll provide a basic setup, but it's recommended to further enhance security features for production use.&lt;/p&gt;

&lt;p&gt;Implement Real-Time Messaging:&lt;br&gt;
Now, we'll implement the core functionality of real-time messaging using Socket.io. Add the following code to app.js:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// app.js
const express = require('express');
const app = express();
const http = require('http').createServer(app);
const io = require('socket.io')(http);
const moment = require('moment');

app.use(express.static(__dirname));
app.use(express.urlencoded({ extended: true }));
app.set('view engine', 'ejs');

// Basic route for serving HTML page
app.get('/', (req, res) =&amp;gt; {
  res.render('index');
});

// Socket.io
io.on('connection', (socket) =&amp;gt; {
  console.log('A user connected');

  socket.on('disconnect', () =&amp;gt; {
    console.log('A user disconnected');
  });

  socket.on('chat message', (msg) =&amp;gt; {
    console.log('Message: ', msg);
    io.emit('chat message', {
      username: socket.username,
      message: msg,
      time: moment().format('h:mm A')
    });
  });
});

http.listen(3000, () =&amp;gt; {
  console.log('Server running on http://localhost:3000');
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Update index.html to include the chat interface and handle message submission:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- index.html --&amp;gt;
&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Chat Application&amp;lt;/title&amp;gt;
  &amp;lt;script src="/socket.io/socket.io.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;script&amp;gt;
    const socket = io();

    function sendMessage() {
      const message = document.getElementById('messageInput').value;
      socket.emit('chat message', message);
      document.getElementById('messageInput').value = '';
    }

    socket.on('chat message', (data) =&amp;gt; {
      const messages = document.getElementById('messages');
      const li = document.createElement('li');
      li.textContent = `${data.username} (${data.time}): ${data.message}`;
      messages.appendChild(li);
    });
  &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;h1&amp;gt;Welcome to the Chat Application&amp;lt;/h1&amp;gt;
  &amp;lt;ul id="messages"&amp;gt;&amp;lt;/ul&amp;gt;
  &amp;lt;input type="text" id="messageInput" placeholder="Type your message here"&amp;gt;
  &amp;lt;button onclick="sendMessage()"&amp;gt;Send&amp;lt;/button&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, when you run the application using node app.js, it will start the server at &lt;a href="http://localhost:3000" rel="noopener noreferrer"&gt;http://localhost:3000&lt;/a&gt;, and users can join the chat, send messages, and see real-time updates.&lt;/p&gt;

&lt;p&gt;Keep in mind that this is a basic implementation and lacks many features that a full-fledged messaging app would have, such as user accounts, private messaging, message history, file sharing, and more. If you want to build a production-ready chat application like Messenger, you'll need to implement additional features, consider scalability, and handle various security concerns.&lt;/p&gt;

</description>
      <category>node</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>express</category>
    </item>
    <item>
      <title>Desktop application in C language</title>
      <dc:creator>Rishikesh-Programmer</dc:creator>
      <pubDate>Fri, 23 Jun 2023 14:56:10 +0000</pubDate>
      <link>https://forem.com/rishikesh00760/desktop-application-in-c-language-2j5f</link>
      <guid>https://forem.com/rishikesh00760/desktop-application-in-c-language-2j5f</guid>
      <description>&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%2Flwbn4n4ezpeye2ka058s.jpg" 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%2Flwbn4n4ezpeye2ka058s.jpg" alt="Image description" width="500" height="250"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To create a desktop application in C, you can make use of frameworks and libraries that provide GUI (Graphical User Interface) functionality. One popular framework for developing desktop applications in C is GTK+ (GIMP Toolkit). GTK+ is a cross-platform toolkit that allows you to create GUI applications that can run on different operating systems such as Windows, macOS, and Linux.&lt;/p&gt;

&lt;p&gt;Here's a step-by-step guide to creating a simple desktop application in C using GTK+:&lt;/p&gt;

&lt;p&gt;Install the necessary tools:&lt;/p&gt;

&lt;p&gt;Install a C compiler such as GCC (GNU Compiler Collection) for your operating system.&lt;/p&gt;

&lt;p&gt;Install the GTK+ development libraries. The installation process may vary depending on your operating system.&lt;/p&gt;

&lt;p&gt;Set up your development environment:&lt;/p&gt;

&lt;p&gt;Create a new directory for your project.&lt;br&gt;
Open a text editor or an Integrated Development Environment (IDE) to write your C code.&lt;br&gt;
Write the C code:&lt;/p&gt;

&lt;p&gt;Start by including the necessary GTK+ header files in your code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#include &amp;lt;gtk/gtk.h&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Write the main function and initialize the GTK+ library:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int main(int argc, char *argv[]) {
    gtk_init(&amp;amp;argc, &amp;amp;argv);
    // Rest of your code goes here
    return 0;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create a callback function that will be triggered when the application's window is closed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;static void on_window_closed(GtkWidget *widget, gpointer data) {
    gtk_main_quit();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Create the application window and connect the callback function to the "destroy" signal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GtkWidget *window;

window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(window, "destroy", G_CALLBACK(on_window_closed), NULL);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add additional GUI elements to your window, such as buttons, labels, or text fields, using GTK+ functions.&lt;/p&gt;

&lt;p&gt;Display the window:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gtk_widget_show_all(window);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Start the GTK+ main loop:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gtk_main();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Compile and build the application:&lt;/p&gt;

&lt;p&gt;Open a terminal or command prompt and navigate to your project directory.&lt;/p&gt;

&lt;p&gt;Use the C compiler to compile your code, linking against the GTK+ libraries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gcc -o your_application_name your_code.c `pkg-config --cflags --libs gtk+-3.0`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the application:&lt;/p&gt;

&lt;p&gt;Execute the compiled binary file from the terminal or command prompt:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./your_application_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a basic example to get you started with creating a desktop application in C using GTK+. You can explore the GTK+ documentation and tutorials for more advanced features and functionality. Additionally, other frameworks like Qt and wxWidgets also provide options for creating desktop applications in C, so you may consider exploring those as well.&lt;/p&gt;

</description>
      <category>c</category>
    </item>
    <item>
      <title>Javascript image manipulation</title>
      <dc:creator>Rishikesh-Programmer</dc:creator>
      <pubDate>Mon, 01 Aug 2022 14:08:39 +0000</pubDate>
      <link>https://forem.com/rishikesh00760/javascript-image-manipulation-4k1</link>
      <guid>https://forem.com/rishikesh00760/javascript-image-manipulation-4k1</guid>
      <description>&lt;p&gt;A well known and powerful library for image manipulation is Caman.js. It offers various built-in functions as well as the possibility to be extended. Also, the library is well documented and can be used both in NodeJS and in the browser. The functions provided by CamanJS work with  elements, so before getting started, you can either create a Canvas element yourself or let CamanJS replace an image with a canvas of the same dimensions.&lt;br&gt;
The basic functions cover color manipulations like setting contrast/brightness or modifying the RGB channels individually as well as the possibility to increase or decrease the noise applied to the image. Advanced operations, for example working with layers, blending or cropping an image can be achieved by working with plugins.&lt;br&gt;
For examples, a detailed documentation and downloading CamanJS, check out the official website.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;img id="caman-image" src="otter.jpg" /&amp;gt;
&amp;lt;script src="caman.js"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script&amp;gt;
  Caman('#caman-image', function () {
    this.brightness(50).render();
  });
&amp;lt;/script&amp;gt;

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

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>html</category>
      <category>webdev</category>
      <category>css</category>
    </item>
    <item>
      <title>Calender in react js</title>
      <dc:creator>Rishikesh-Programmer</dc:creator>
      <pubDate>Sun, 31 Jul 2022 13:39:00 +0000</pubDate>
      <link>https://forem.com/rishikesh00760/calender-in-react-js-kjb</link>
      <guid>https://forem.com/rishikesh00760/calender-in-react-js-kjb</guid>
      <description>&lt;p&gt;In this post we are going to make a simple calender in react js&lt;/p&gt;

&lt;p&gt;run the the following commands in the terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app react-calender
cd react-calender
npm i react-calender
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;go to &lt;code&gt;src/app.js&lt;/code&gt; and erase the content in it,&lt;br&gt;
and import react, react-calender&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import Calendar from 'react-calendar';
import 'react-calendar/dist/Calendar.css';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;next, create a function app and export&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function App() {
  // main content goes here...
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and set a value and onchange using react useState&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function App() {
  const [value, onChange] = React.useState(new Date());
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function App() {
  const [value, onChange] = React.useState(new Date());

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;Calendar onChange={onChange} value={value} /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;next go to &lt;code&gt;src/index.js&lt;/code&gt; and paste the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';

import App from './App';

const rootElement = document.getElementById('root');
const root = createRoot(rootElement);

root.render(
  &amp;lt;StrictMode&amp;gt;
    &amp;lt;App /&amp;gt;
  &amp;lt;/StrictMode&amp;gt;
);

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

&lt;/div&gt;



&lt;p&gt;app.js full source code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from 'react';
import Calendar from 'react-calendar';
import 'react-calendar/dist/Calendar.css';

export default function App() {
  const [value, onChange] = React.useState(new Date());

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;Calendar onChange={onChange} value={value} /&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;live demo: &lt;a href="https://reactcalenderbyrishi.stackblitz.io/" rel="noopener noreferrer"&gt;https://reactcalenderbyrishi.stackblitz.io/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;thankyou&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Password generator in javascript</title>
      <dc:creator>Rishikesh-Programmer</dc:creator>
      <pubDate>Sun, 31 Jul 2022 13:12:21 +0000</pubDate>
      <link>https://forem.com/rishikesh00760/password-generator-in-javascript-38nc</link>
      <guid>https://forem.com/rishikesh00760/password-generator-in-javascript-38nc</guid>
      <description>&lt;p&gt;In this post we are going to make a password generator in javascript&lt;/p&gt;

&lt;p&gt;Install uuid&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm i uuid&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create a file named index.html, style.css, index.js.&lt;/p&gt;

&lt;p&gt;index.html full source code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;meta charset="UTF-8" /&amp;gt;
    &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge" /&amp;gt;
    &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0" /&amp;gt;
    &amp;lt;title&amp;gt;Password Genenrator&amp;lt;/title&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;h1&amp;gt;Password Generator&amp;lt;/h1&amp;gt;
    &amp;lt;input
      type="text"
      id="keyword"
      placeholder="Enter a keyword"
      maxlength="30"
    /&amp;gt;
    &amp;lt;button id="generate"&amp;gt;Generate Password&amp;lt;/button&amp;gt;
    &amp;lt;h3 id="password"&amp;gt;
      When you enter a keyword and click the button the password will be
      generated here
    &amp;lt;/h3&amp;gt;
    &amp;lt;script src="index.js"&amp;gt;&amp;lt;/script&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;

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

&lt;/div&gt;



&lt;p&gt;style.css full source code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;* {
  padding: 0px;
  margin: 0px;
}
h1 {
  text-align: center;
  color: blueviolet;
  font-family: cursive;
}
#keyword {
  width: 1000px;
  height: 35px;
  text-align: center;
  border: 3px solid #111;
  font-family: 'Courier New', Courier, monospace;
  background-color: #333;
  border-radius: 10px;
  color: white;
  margin-left: 150px;
  margin-top: 5px;
}
#generate {
  margin-top: 20px;
  display: block;
  margin-left: 580px;
  border: none;
  background: none;
  font-size: 20px;
  cursor: pointer;
}
#password {
  /*margin-left: 0px;
  margin-right: 0px;*/
  margin-top: 50px;
  text-align: center;
  padding: 20px;
  color: #333;
  font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
  font-size: medium;
  background-color: #f2f2f2;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;index.js full source code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { v4 as uuidV4 } from 'uuid';
import './style.css';
const keyword = document.getElementById('keyword');
const generate = document.getElementById('generate');
const password = document.getElementById('password');

generate.addEventListener('click', function () {
  if (keyword.value == '') {
    password.innerText = 'Keyword is needed';
  } else {
    const text = `${keyword.value}`;
    const modifiedText = text.replace(' ', '-');
    password.innerText = modifiedText + '-' + uuidV4();
  }
});

document.addEventListener('dblclick', function () {
  if (!document.fullscreenElement) {
    document.documentElement.requestFullscreen();
  } else if (document.exitFullscreen) {
    document.exitFullscreen();
  }
});

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

&lt;/div&gt;



&lt;p&gt;Live demo: &lt;a href="https://passwordgeneratorrishikesh.stackblitz.io/" rel="noopener noreferrer"&gt;https://passwordgeneratorrishikesh.stackblitz.io/&lt;/a&gt;&lt;br&gt;
source code: &lt;a href="https://stackblitz.com/edit/passwordgeneratorrishikesh" rel="noopener noreferrer"&gt;https://stackblitz.com/edit/passwordgeneratorrishikesh&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thank you!!!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
