<?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: DhiraNegi</title>
    <description>The latest articles on DEV Community by DhiraNegi (@dhiranegi).</description>
    <link>https://dev.to/dhiranegi</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%2F414327%2F0086cb85-bb1d-4e0d-8490-3b81c397a3d2.jpg</url>
      <title>DEV Community: DhiraNegi</title>
      <link>https://dev.to/dhiranegi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dhiranegi"/>
    <language>en</language>
    <item>
      <title>Svelte + Webpack + Sass</title>
      <dc:creator>DhiraNegi</dc:creator>
      <pubDate>Fri, 25 Feb 2022 07:58:36 +0000</pubDate>
      <link>https://dev.to/dhiranegi/svelte-webpack-sass-2noe</link>
      <guid>https://dev.to/dhiranegi/svelte-webpack-sass-2noe</guid>
      <description>&lt;p&gt;Solving this particular solution took me quite some more time than expected. So, I thought of sharing it here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Starters&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;npx degit sveltejs/template-webpack svelte-app (for svelte installation with webpack)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;cd svelte-app&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;npm install&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;npm run dev&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After running npm run dev, Svelte will compile and build your application. It will start a local server at localhost:8080.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Main Course&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To begin, you'll need to install sass-loader&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;npm install sass-loader sass webpack --save-dev&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Now, if you get an error regarding 'style-loader' . Run the below command to install style-loader&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;npm install style-loader --save&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Further, you have a starter pack of svelte with webpack and your folder structure have default files and folders.&lt;/p&gt;

&lt;p&gt;If you wish to explore more about the details of the files.&lt;br&gt;
Check it out &lt;a href="https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Client-side_JavaScript_frameworks/Svelte_getting_started" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will have webpack.config.js instead of rollup.config.js&lt;/p&gt;

&lt;p&gt;Make a few changes to webpack.config.js&lt;/p&gt;

&lt;p&gt;Refer the image:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fu22qrx2s0zlifyrgk5js.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fu22qrx2s0zlifyrgk5js.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For now, I have renamed my global css file as global.scss and made some changes in the code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ffo40d2wkh85pd68xn4k1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ffo40d2wkh85pd68xn4k1.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, change the import statement in main.js file.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2F4r8lj07blqk9mygbt4x0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2F4r8lj07blqk9mygbt4x0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dessert&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can now see the changes in your localhost with the scss we wrote in global.scss.&lt;/p&gt;

&lt;p&gt;If you want to see Sass with rollup, you can find it &lt;a href="https://github.com/dceddia/svelte-sass-template" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do have a look at this repo &lt;a href="https://github.com/markoboy/svelte-webpack-babel-scss#get-started" rel="noopener noreferrer"&gt;https://github.com/markoboy/svelte-webpack-babel-scss#get-started&lt;/a&gt; (An extension of the webpack template)&lt;/p&gt;

&lt;p&gt;HAPPY LEARNING 😄&lt;/p&gt;

</description>
      <category>svelte</category>
      <category>beginners</category>
      <category>webpack</category>
      <category>saas</category>
    </item>
    <item>
      <title>ESP with Google Assistant</title>
      <dc:creator>DhiraNegi</dc:creator>
      <pubDate>Sun, 02 Aug 2020 19:00:43 +0000</pubDate>
      <link>https://dev.to/dhiranegi/esp-with-google-assistant-3cj8</link>
      <guid>https://dev.to/dhiranegi/esp-with-google-assistant-3cj8</guid>
      <description>&lt;p&gt;Google Assistant is amazing. Isn't it?&lt;br&gt;
I tried to control my esp with google assistant. Here's how I did it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting up Adafruit IO&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to &lt;a href="https://io.adafruit.com/"&gt;https://io.adafruit.com/&lt;/a&gt;  and sign up.&lt;/li&gt;
&lt;li&gt;Go to Feeds and create a new feed. &lt;a href="https://learn.adafruit.com/adafruit-io-basics-feeds/overview"&gt;Feeds&lt;/a&gt; hold data that devices push to Adafruit IO.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Fe5tyyYy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hcr9dc6qrdr8mcpekujw.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Fe5tyyYy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hcr9dc6qrdr8mcpekujw.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select some name and write some description.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7qvGyrc_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kvoeijh76g6zhfeei0zw.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7qvGyrc_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/kvoeijh76g6zhfeei0zw.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup a new &lt;a href="https://learn.adafruit.com/adafruit-io-basics-dashboards/overview"&gt;dashboard&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xKdvorBZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v4vnkck7ucr63scr0pwb.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xKdvorBZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/v4vnkck7ucr63scr0pwb.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Select a name and some description.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wzkK4zBY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7kud7bzs3f0paux3m1zh.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wzkK4zBY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/7kud7bzs3f0paux3m1zh.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on the created dashboard and add a new block (I have taken a toggle block).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KOsCJwKa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rjt6yeomgyzmjsp1yr3e.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KOsCJwKa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rjt6yeomgyzmjsp1yr3e.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select feed you would like to add and add block settings. For now I am adding a button to control the builtin led of nodemcu.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lM3on2RB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tn9o4gb6pr9u75az5ozr.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lM3on2RB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/tn9o4gb6pr9u75az5ozr.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setting up ESP&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install Adafruit MQTT library. Sketch&amp;gt;Include library&amp;gt;Manage libraries and search for adafruit mqtt &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--5-Y6uexE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4b4z1ytpikgqyyp6qa4k.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5-Y6uexE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/4b4z1ytpikgqyyp6qa4k.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Goto File&amp;gt;Examples&amp;gt;Adafruit MQTT Library&amp;gt;mqtt_esp8266&lt;/li&gt;
&lt;li&gt;Update SSID/password and Adafruit IO user name and user key.(You will find your Adafruit IO username and key from your dashboard)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--So8SjyHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dr8cg5dvajmwfiul9qpg.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--So8SjyHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/dr8cg5dvajmwfiul9qpg.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Replace feed name from onoff to espControl&lt;/li&gt;
&lt;li&gt;You need to write the code for the actions you want to perform. Here is a piece of code for controlling builtin led of nodemcu.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F3-CADlp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vbvotyy5nbda7ixnpq2k.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F3-CADlp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/vbvotyy5nbda7ixnpq2k.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Get the complete code : &lt;a href="https://github.com/DhiraNegi/esp-with-google-assistant"&gt;https://github.com/DhiraNegi/esp-with-google-assistant&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Google Assistant Integration&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Just enable this &lt;a href="https://ifttt.com/join"&gt;IFTTT&lt;/a&gt; applet and you are ready to go.&lt;/p&gt;

&lt;p&gt;Try some more stuff as there is always more to learn. &lt;/p&gt;

&lt;p&gt;HAPPY LEARNING 😄&lt;/p&gt;

</description>
      <category>esp</category>
      <category>iot</category>
    </item>
    <item>
      <title>Server Optimization</title>
      <dc:creator>DhiraNegi</dc:creator>
      <pubDate>Fri, 31 Jul 2020 08:35:29 +0000</pubDate>
      <link>https://dev.to/dhiranegi/server-optimization-3k3n</link>
      <guid>https://dev.to/dhiranegi/server-optimization-3k3n</guid>
      <description>&lt;p&gt;For better performance of the webservers, server optimization is done.&lt;br&gt;
Checkout the previous post for adding web contents to arduino sketch &lt;a href="https://dev.to/dhiranegi/web-contents-in-arduino-sketch-3o0c"&gt;https://dev.to/dhiranegi/web-contents-in-arduino-sketch-3o0c&lt;/a&gt; for a webserver running in esp8266. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Simple minification techniques&lt;/strong&gt; can be used for removal of tabs and whitespaces. Many online tools are available for that. I use &lt;a href="https://htmlcompressor.com/compressor/"&gt;https://htmlcompressor.com/compressor/&lt;/a&gt;&lt;br&gt;
Compress your html and custom js and css file.(graphics and text files can't be compressed using this)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Using GZIP compression Techinque&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Download 7-zip &lt;a href="https://www.7-zip.org/download.html"&gt;https://www.7-zip.org/download.html&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;It's good to make a GZIP folder to keep all your zipped versions of files. To minified versions of files, apply gzip compression.&lt;br&gt;
(7-Zip&amp;gt;add to archive).&lt;/p&gt;

&lt;p&gt;For adding GZIPPED files to arduino sketch, replaces C String with HEX values(convert the files to HEX values with any online tool like &lt;a href="http://tomeko.net/"&gt;http://tomeko.net/&lt;/a&gt;). &lt;/p&gt;

&lt;p&gt;Server has to inform clients that the data being sent is in GZIP format, that is done with content-encoding header by using server.sendHeader() function. Sending "content-encoding" "gzip" header for all server files. Here is one handler function and should be done for all the handler function in the code.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2cb0LWZN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/g0lhy6udnlp0j8e63mw0.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2cb0LWZN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/g0lhy6udnlp0j8e63mw0.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can verify Content compression and server response time reduction with &lt;strong&gt;wireshark&lt;/strong&gt;.&lt;br&gt;
It is possible to further speed up server response time and reduce bandwidth usage by using cache control or expires header.&lt;/p&gt;

&lt;p&gt;ESP Arduino core has some flash memory reserved for file system&lt;br&gt;
called SPI Flash file system. You can choose from Tools&amp;gt;Flash Size&lt;/p&gt;

&lt;p&gt;Flash Layout:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UFJ5k1S---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mp5ydj7lhgvk8f0tq3ro.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UFJ5k1S---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/mp5ydj7lhgvk8f0tq3ro.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Follow the installation process from &lt;a href="https://github.com/esp8266/arduino-esp8266fs-plugin"&gt;https://github.com/esp8266/arduino-esp8266fs-plugin&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Make a folder "data" inside arduino sketch folder and place all GZIPPED files inside that. Do Sketch Data Upload.&lt;br&gt;
You can remove arrays and handler functions from arduino sketch. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reading files with file system library&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You can find an examples here :&lt;br&gt;
File&amp;gt;Examples&amp;gt;ESP8266WebServer&amp;gt;FSBrowser and study it.&lt;/p&gt;

&lt;p&gt;Include FS.h library in your arduino code and initialize it by calling begin function in setup(SPIFFS.begin();)&lt;br&gt;
Call handleFileRead() inside server onNotFound(). You can also send expires header before stream file function is called.&lt;/p&gt;

&lt;p&gt;Get the code &lt;a href="https://github.com/DhiraNegi/server-optimization"&gt;https://github.com/DhiraNegi/server-optimization&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;The method is same for mikroC TCP/IP libaray. Add HTTP header in simple uncompressed form on Start of Gzipped array, then use&lt;/p&gt;

&lt;p&gt;Net_Ethernet_Intern_putByteTCP() &lt;/p&gt;

&lt;p&gt;for sending only single array that contains both HTTP header and Gzipped data.&lt;br&gt;
Use exactly same technique for STM32 or any other ARM chip with Lwip TCP/IP stack.&lt;/p&gt;

&lt;p&gt;HAPPY LEARNING 😄&lt;/p&gt;

</description>
      <category>iot</category>
      <category>esp</category>
      <category>webserver</category>
    </item>
    <item>
      <title>Web contents in arduino sketch </title>
      <dc:creator>DhiraNegi</dc:creator>
      <pubDate>Thu, 23 Jul 2020 12:17:53 +0000</pubDate>
      <link>https://dev.to/dhiranegi/web-contents-in-arduino-sketch-3o0c</link>
      <guid>https://dev.to/dhiranegi/web-contents-in-arduino-sketch-3o0c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Basics of arduino.&lt;/li&gt;
&lt;li&gt;Installed IDE with esp8266 libraries.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;br&gt;
Taking a simple web server example here. I am editing "HelloServer" program you can find in "File&amp;gt;Examples&amp;gt;Esp8266WebServer&amp;gt;HelloServer".&lt;/p&gt;

&lt;p&gt;Whenever server root is requested, this web server sends message, i.e "Hello from ESP8266" &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Adding HTML and CSS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Now, try to put some html to arduino sketch. To achieve that we need to convert html to C string format.(Use any online tool or software). I am using &lt;a href="https://tomeko.net" rel="noopener noreferrer"&gt;https://tomeko.net&lt;/a&gt; .&lt;/p&gt;

&lt;p&gt;Declare a const char array to store the string.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F01sgzuzx346x6nx8fxp1.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F01sgzuzx346x6nx8fxp1.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Using "PROGMEM" keyword to put this array in program memory, because micro controllers usually have small amount of data memory and putting all static web pages in data memory is just wastage of resources.&lt;/p&gt;

&lt;p&gt;We can send index page from esp with the type "text/html".&lt;br&gt;
Replace "server.send" by "server.send_P" which will sends webpage from program memory instead of data memory. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frk40uvwtqe8y1mnbipoi.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Frk40uvwtqe8y1mnbipoi.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Do the same for adding css.&lt;br&gt;
For handling "style.css" request, we need to create a function let's say handleCss.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F02krp6nno48xweh6ctil.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F02krp6nno48xweh6ctil.JPG" alt="Alt Text"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;ESP has to call this function(handleCss) whenever "style.css" is requested by client.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ferq5w1ool0tujhk3zull.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ferq5w1ool0tujhk3zull.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handling Graphic Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's take a simple example. I took this one from w3 schools where the bulb changes its state when clicked.&lt;br&gt;
So, for inserting images in the arduino code we need to convert those image to HEX values.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb6nesvzsjb8l2ajzxsn4.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fb6nesvzsjb8l2ajzxsn4.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, write functions to handle these graphic files.&lt;/p&gt;

&lt;p&gt;There may be many null characters in the image data and server.send() function may transfer only few bytes if we don't specify the file size.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fky7xppng90key59mzhpc.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fky7xppng90key59mzhpc.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whenever bulbon or bulboff image request is received, these funcions should be called.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcqdk6r8e0ns7fftod6xd.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fcqdk6r8e0ns7fftod6xd.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handling JS&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Do the same process of conversion for js files too.&lt;br&gt;
I have two js file i.e, jquery.min.js and main.js.&lt;br&gt;
main.js contains a function which requests server to change digital output status, depending on HIGH or LOW response from ESP server. Depending on that response, it will change the bulb state.&lt;br&gt;
Connect relay or any other device with pin D4.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw4dab59io80jel9cen4w.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fw4dab59io80jel9cen4w.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instructing ESP to call handler functions whenever respective request is received from client.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F06zem6tdxil8kn5jm8hy.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F06zem6tdxil8kn5jm8hy.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Handling Multiple Files&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Try running the server with multiple files following the steps mentioned above and stay connected for compression techniques for optimization . &lt;/p&gt;

&lt;p&gt;Get the code here &lt;br&gt;
&lt;a href="https://github.com/DhiraNegi/web-contents-in-arduino-sketch" rel="noopener noreferrer"&gt;https://github.com/DhiraNegi/web-contents-in-arduino-sketch&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HAPPY LEARNING 😄&lt;/p&gt;

</description>
      <category>esp8266</category>
      <category>css</category>
      <category>html</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Logon Scripting with Powershell</title>
      <dc:creator>DhiraNegi</dc:creator>
      <pubDate>Wed, 22 Jul 2020 09:48:24 +0000</pubDate>
      <link>https://dev.to/dhiranegi/logon-scripting-with-powershell-29if</link>
      <guid>https://dev.to/dhiranegi/logon-scripting-with-powershell-29if</guid>
      <description>&lt;p&gt;Hi,&lt;/p&gt;

&lt;p&gt;Trying out some solution for logging to a website with a powershell script and downloads the contents in a file to the specified location.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--OJ1NEiTp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2cl2b4r9ait89824bllo.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OJ1NEiTp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2cl2b4r9ait89824bllo.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just put the url of the website login page and the id's which can be obtained by the developer tools.&lt;/p&gt;

&lt;p&gt;Edit valid username and password in the script.&lt;br&gt;
Your file will be downloaded at the specified location which is D:\powershell here.&lt;/p&gt;

&lt;p&gt;You can get the script here.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/DhiraNegi/powershell"&gt;https://github.com/DhiraNegi/powershell&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;HAPPY LEARNING 😄&lt;/p&gt;

</description>
      <category>powershell</category>
      <category>scripting</category>
      <category>automation</category>
    </item>
    <item>
      <title>JavaScript Console Object</title>
      <dc:creator>DhiraNegi</dc:creator>
      <pubDate>Mon, 20 Jul 2020 10:22:27 +0000</pubDate>
      <link>https://dev.to/dhiranegi/javascript-console-object-284c</link>
      <guid>https://dev.to/dhiranegi/javascript-console-object-284c</guid>
      <description>&lt;p&gt;I was learning something more about the console object we always use in js. &lt;br&gt;
So, here are some more functions of the console object I wanted to share which can used for debugging.&lt;/p&gt;

&lt;p&gt;Starting with it, there is the console.log() which we frequently use. Here, I am making an ajax call to get the response from an api.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--udYu22A5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1nuhjzd8383jof233thx.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--udYu22A5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/1nuhjzd8383jof233thx.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can view the response in console.&lt;/p&gt;

&lt;p&gt;console.clear() is used to clear the console.&lt;/p&gt;

&lt;p&gt;console.count() or console.count(label) is used to count number of times an event has occurred (like exception occurrence or function called).&lt;/p&gt;

&lt;p&gt;console.assert(Assertion,Error message) is used to test whether an expression is true or not.&lt;/p&gt;

&lt;p&gt;console.dir() is used to represent object in javascript object notation.&lt;/p&gt;

&lt;p&gt;console.dirXml() is used for XML representation. {console.log() also can be used}&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VdWqhvnh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3js9z3k3pm7hm2qeeznr.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VdWqhvnh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/3js9z3k3pm7hm2qeeznr.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;console.error() shows errors and can trace the error in error style.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BWpILMpY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lyg4ycx91ai1cgygwz4e.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BWpILMpY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lyg4ycx91ai1cgygwz4e.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Group functions are mainly used for making a group for other console functions with a title to create a block for debugging more clearly.&lt;br&gt;
console.group(), console.groupCollapsed() and console.groupEnd() &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lFTGPJ7g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lke8rvpq303z3ir641uk.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lFTGPJ7g--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/lke8rvpq303z3ir641uk.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;console.info() displays information of the message.It shows an info icon before the message.&lt;/p&gt;

&lt;p&gt;console.table() displays data in console as table. &lt;/p&gt;

&lt;p&gt;console.time() and console.timeEnd() tracks the time elapsed for any operation.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6UVctBzh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o3anu60wrjjbgw037gcy.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6UVctBzh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/o3anu60wrjjbgw037gcy.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;console.trace()  is used to display a stack from the point where the method was called and understand and diagnose the problem that occurs in the code.&lt;/p&gt;

&lt;p&gt;console.warn() is used to warn the users.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NPWF_p0F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/11cu5glc8ozjbzegbkbl.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NPWF_p0F--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/11cu5glc8ozjbzegbkbl.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Of course, there is always more to learn. &lt;/p&gt;

&lt;p&gt;Happy learning.😄&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
  </channel>
</rss>
