<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Blockchain Hashira]]></title><description><![CDATA[Web3 Dev ❯ Security Researcher ❯ Technical Writer]]></description><link>https://musprodev.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Mon, 09 Nov 2026 03:10:54 GMT</lastBuildDate><atom:link href="https://musprodev.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Metaverse]]></title><description><![CDATA[The next big thing]]></description><link>https://musprodev.hashnode.dev/metaverse</link><guid isPermaLink="true">https://musprodev.hashnode.dev/metaverse</guid><category><![CDATA[AR]]></category><category><![CDATA[Virtual Reality]]></category><category><![CDATA[Augmented Reality]]></category><category><![CDATA[Meta]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Thu, 02 Dec 2021 15:28:46 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1638457954664/cdAdft1S1.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>The metaverse is a hypothesized iteration of the Internet, supporting persistent online 3-D virtual environments through conventional personal computing, as well as virtual and augmented reality headsets. Metaverses, in some limited form, have already been implemented in video games such as Second Life.</p>
<p>Current metaverse ambitions are centered on addressing technological limitations with modern virtual and augmented reality devices, as well as expanding the use of metaverse spaces to business, education, and retail applications.Numerous entertainment and social media companies have invested in metaverse-related research and development.</p>
<p>The metaverse has come to be criticised as a method of public relations building using a purely speculative, "over-hyped" concept based on existing technology. Information privacy and user addiction are concerns within the metaverse, stemming from current challenges facing the social media and video game industries as a whole</p>
<h1 id="heading-elements">Elements</h1>
<p>The metaverse is described as a means of manufacturing immersive digital spaces for a range of human activity. To achieve this, some iterations of the metaverse involve integration between virtual and physical spaces and virtual economies. Additional qualities include digital persistence and synchronicity in order to better establish a sense of presence in a realistic environment, along with implementing existing social media elements such as avatar identity, content creation, and social acceptability</p>
<h1 id="heading-current-implementations">Current Implementations</h1>
<h2 id="heading-video-games">Video games</h2>
<p>Several components of metaverse technologies have already been developed within modern internet-enabled video games. The 2003 video game Second Life is often described as the first metaverse, as it incorporated many aspects of social media into a persistent virtual world. Social functions are often an integral feature in many massively multiplayer online games. Technology journalist Clive Thompson has argued that the emergent, social-based gameplay of Minecraft represents an advanced implementation of the metaverse. Similar statements were made for the game Roblox, which has since employed significant usage of the term in marketing. Other claims of developing a metaverse include the games Active Worlds, Decentraland, and Fortnite in addition to a few early MUD games.</p>
<h2 id="heading-virtual-reality">Virtual reality</h2>
<p>Metaverse development has often focused on bettering virtual reality technologies due to benefits in establishing immersion in virtual environments. In 2019, the social network company Facebook launched a social VR world called Facebook Horizon. Facebook would later be renamed "Meta Platforms" in 2021. Its chairman Mark Zuckerberg declared a company commitment to developing a metaverse ecosystem. Much of the underlying virtual reality technology that Meta Platforms advertised remains to be developed. Microsoft acquired the VR company AltspaceVR in 2017, and is planning on integrating metaverse features into Microsoft Teams.</p>
<h1 id="heading-potential-implementations">Potential Implementations</h1>
<p>Some developers have proposed using metaverse technology for improvements in work productivity.</p>
<p>Within the education sector, metaverse technologies have been proposed as a way to allow for interactive environments for learning. The metaverse could also host virtual reality home tours in the real estate sector.</p>
<h1 id="heading-technology">Technology</h1>
<p>The metaverse is a proposed expansion to existing internet technologies. Access points for the metaverse include general-purpose computers and smartphones, in addition to augmented reality (AR), mixed reality, virtual reality (VR), and virtual world technologies.</p>
<p>Business and commercial interest in metaverse-related research and technology include Facebook, which bought VR company Oculus in 2014, and has announced plans to build a 3-D social space to connect varying services.</p>
<p>The metaverse's dependency on VR technology places limitations on its development and wide-scale adoption. Limitations stemming from the balance between cost and design include the lack of high quality graphics and a lack of mobility. Lightweight wireless headsets lack image quality, which is optimized for bulky, wired VR goggle systems. Another issue for wide-scale adoption of the technology is the cost, with the HTC Vive Pro 2 headset costing US$799 plus controllers in 2021.</p>
<p>In 2021, the South Korean government announced the creation of a national metaverse alliance with the goal to build a unified national VR and AR platform.</p>
<h2 id="heading-technical-standards">Technical Standards</h2>
<p>Common standards, interfaces, and communication protocols among virtual environments are in development. Collaborations and working groups are attempting to create standards and protocols to support interoperability between virtual environments, including:</p>
<p>OpenXR, application programming interfaces (APIs) for interfacing with VR and AR devices, Khronos Group (2019–present)
Virtual Worlds—Standard for Systems Virtual Components Working Group (P1828), IEEE (2010–Present)
Information technology—Media context and control—Part 4: Virtual world object characteristics (ISO/IEC 23005-4:2011), ISO (2008–Present)
Immersive Education Technology Group (IETG), Media Grid (2008–Present)
Virtual World Region Agent Protocol (VWRAP), IETF (2009–2011)
The Metaverse Roadmap, Acceleration Studies Foundation (2006–2007)
The Open Source Metaverse Project (2004–2008)
X3D, the successor to the Virtual Reality Modeling Language (VRML) as the open standard for interactive real-time 3D (web3D). X3D is an accepted standard for integrating virtual and augmented realities with the web</p>
<h1 id="heading-criticism-and-concerns">Criticism and Concerns</h1>
<p>The term arose in the early 1990s, and has come to be criticised as a method of public relations building using a purely speculative, "over-hyped" concept based on existing technology.</p>
<p>Information privacy in the metaverse is an area of concern because the companies involved will likely collect users' personal information through wearable devices and user interactions. Facebook is planning on persisting targeted advertising within the metaverse, raising further worries related to the spread of misinformation and loss of personal privacy. AR pioneer Louis Rosenberg warned that the metaverse could be more polarizing than social media, driving people from their information bubbles to their "own custom realities” and that users could selectively “reality block” the parts of society they don’t like.</p>
<p>User addiction and problematic social media use is another concern for the development of the metaverse. Internet addiction disorder, social media, and video game addiction can have mental and physical repercussions over a prolonged period of time, such as depression, anxiety, and obesity. Experts are also concerned that the metaverse could be used as an 'escape' from reality in a similar fashion to existing internet technologies.</p>
<p>The metaverse may magnify the social impacts of online echo chambers and digitally alienating spaces. Since metaverse developments may be made to algorithmically tailor virtual worlds based on each person's beliefs, the metaverse may further distort users' perceptions of reality with biased content to maintain or increase engagement.</p>
<h1 id="heading-fiction">Fiction</h1>
<h2 id="heading-snow-crash">Snow Crash</h2>
<p>The term metaverse was coined in Neal Stephenson's 1992 science fiction novel Snow Crash, where humans, as avatars, interact with each other and software agents, in a three-dimensional virtual space that uses the metaphor of the real world. Stephenson used the term to describe a virtual reality-based successor to the internet.</p>
<p>Neal Stephenson's metaverse appears to its users as an urban environment developed along a 100-meter-wide road, called the Street, which spans the entire 65536 km (216 km) circumference of a featureless, black, perfectly spherical planet. The virtual real estate is owned by the Global Multimedia Protocol Group, a fictional part of the real Association for Computing Machinery, and is available to be bought and buildings developed thereupon.</p>
<p>Users of the metaverse access it through personal terminals that project a high-quality virtual reality display onto goggles worn by the user, or from grainy black and white public terminals in booths. The users experience it from a first-person perspective. Stephenson describes a sub-culture of people choosing to remain continuously connected to the metaverse; they are given the sobriquet "gargoyles" due to their grotesque appearance.</p>
<p>Within the metaverse, individual users appear as avatars of any form, with the sole restriction of height, "to prevent people from walking around a mile high". Transport within the metaverse is limited to analogs of reality by foot or vehicle, such as the monorail that runs the entire length of the Street, stopping at 256 Express Ports, located evenly at 256 km intervals, and Local Ports, one kilometer apart.</p>
<h2 id="heading-ready-player-one">Ready Player One</h2>
<p>Ready Player One is a 2011 dystopian science fiction novel by Ernest Cline, depicting the world in the year 2045 as being gripped by an energy crisis and global warming, causing widespread social problems and economic stagnation. The primary escape for people is a metaverse called the OASIS, which is accessed with a VR headset and wired gloves. It functions both as an MMORPG and as a virtual society. A film adaptation was released in 2018</p>
<div class="hn-embed-widget" id="buymeacoffee"></div>]]></content:encoded></item><item><title><![CDATA[How to send Html Emails in Gmail]]></title><description><![CDATA[Gmail is hugely popular, with more than 1,5 billion accounts registered worldwide. Both individuals and businesses use it actively and who once becomes an…]]></description><link>https://musprodev.hashnode.dev/how-to-send-html-emails-in-gmail</link><guid isPermaLink="true">https://musprodev.hashnode.dev/how-to-send-html-emails-in-gmail</guid><category><![CDATA[email]]></category><category><![CDATA[email marketing]]></category><category><![CDATA[HTML Emails]]></category><category><![CDATA[HTML5]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Wed, 01 Dec 2021 20:56:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1638391293338/8xB7EsLs4.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Gmail is hugely popular, with more than 1,5 billion accounts registered worldwide. Both individuals and businesses use it actively and who once becomes an avid Gmail user is usually hesitant to ever say adiós. No wonder, Gmail offers everything one needs to send and receive emails and packs it all in a very simple to use interface.</p>
<p>One consequence of simplifying the UI was hiding the good old HTML editor and for a good reason - 99,9% of users don’t need it at all. But without it, adding banners, images, tables or other visual media and making them all look good together on any screen size is really tough (if not impossible). Luckily, with a simple workaround, you can still use HTML templates in your Gmail messages.</p>
<h1 id="heading-copypasting-html-into-gmail">Copy/Pasting HTML Into Gmail</h1>
<p>Now let’s see what happens if we just insert HTML code into a Gmail Compose window. We’re not really sharing this email with our entire mailing list so it can be simple stupid. Let’s try with this one:</p>
<pre><code><span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>Simple HTML.<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h3</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">em</span>&gt;</span>So very simple.<span class="hljs-tag">&lt;/<span class="hljs-name">em</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">h3</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"color: #ff0000;"</span>&gt;</span>Lame joke that follows.<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">p</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">span</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"color: #ff0000;"</span>
    &gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">img</span>
      <span class="hljs-attr">src</span>=<span class="hljs-string">"https://afinde-production.s3.amazonaws.com/uploads/981ebabb-5722-44c1-ad30-fc57fbc8ee9d.jpeg"</span>
      <span class="hljs-attr">alt</span>=<span class="hljs-string">"Lame joke"</span>
      <span class="hljs-attr">width</span>=<span class="hljs-string">"245"</span>
      <span class="hljs-attr">height</span>=<span class="hljs-string">"221"</span>
  /&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">p</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">h2</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"padding-left: 30px;"</span>&gt;</span>do you?<span class="hljs-tag">&lt;/<span class="hljs-name">h2</span>&gt;</span>
<span class="hljs-tag">&lt;<span class="hljs-name">ul</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>yes<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span>no<span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
  <span class="hljs-tag">&lt;<span class="hljs-name">li</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">strong</span>&gt;</span>not entirely sure<span class="hljs-tag">&lt;/<span class="hljs-name">strong</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">li</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">ul</span>&gt;</span>
</code></pre><p>And let’s paste it directly into Gmail and send:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1638391551340/gLP4M-vAX.png" alt="image.png" /></p>
<p>Yup, that doesn’t look quite right. Gmail uses a WYSIWYG editor so whatever you paste into the Compose window, will look just about the same on the receiver’s end. That’s why we’ll need to take a different approach.</p>
<h1 id="heading-inserting-html-into-gmail">Inserting HTML Into Gmail</h1>
<p>First of all, compose or export HTML code and save it as a .html file. Make sure your editor saves files as plaintext, without any additional formatting. It also cannot add .txt or any other extensions to the file name, otherwise, the code won’t be rendered properly. Mac’s TextEdit, for example, needs a few tweaks to work with HTML as expected.</p>
<p>Now, try to save it. Notice how it adds .txt extension by default, making the file useless. Be sure to use File -&gt; Save on Mac and uncheck the part about .txt extension.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1638391623278/8L2ucR1zf.png" alt="image.png" />
Right-click on the file and open it with a browser of your choice. It should render as expected. If you see raw HTML, double-check if the file was saved properly and if your editor relies on plain text.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1638391650902/O7UlnhnIN.png" alt="image.png" />
Copy the entire content of a page, either with Ctrl+A (Windows) / Cmd+A (Mac) or just use a mouse or a trackpad. Then, insert it into your Gmail’s compose window and send it!</p>
<h1 id="heading-what-to-pay-attention-to-when-writing-an-html-email">What To Pay Attention To When Writing An HTML Email?</h1>
<p>Although HTML is a really simple framework, there are several features/limitations of Gmail that you need to be aware of. Here are the main ones:</p>
<ol>
<li>Images Need To Be Hosted Online And Available Publicly
If you were to add images to an email, they would be stored as attachments. This is probably not the ideal way for a recipient to access the pictures. That’s why images need to be uploaded somewhere on the internet and referenced with a link in the HTML code.</li>
</ol>
<p>If possible, store them on your own server or use, for example, Google Drive. When uploading to the latter one, make sure the link is public, not private (trying to access it in the incognito mode should do the job). When uploading to popular image sharing services such as Imgur or Tinypic, make sure you fetch a direct link to an image, not to a folder where it’s stored.</p>
<ol>
<li><p>External Style Sheets Won’t Work
Gmail doesn’t offer support for external styles. You can, however, utilize embedded CSS as well as Inline styles. A good responsive email typically consists of a fair share of Inline CSS, used mainly to maintain a proper structure and styling of a message. Embedded CSS is used to add CSS Reset Styles and rules required to make an email responsive.</p>
</li>
<li><p>You Can’t Use Web Fonts
Gmail doesn’t let you utilize any of the web fonts and there’s no way to import them into your HTML. You’ll need to use one of the available fonts in your emails:</p>
</li>
</ol>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1638391777861/TthKj59Bw.png" alt="image.png" /></p>
<h1 id="heading-utilizing-html-editors">Utilizing HTML Editors</h1>
<p>But do you really need to write an entire HTML code from scratch or test how it looks on different screens? Likely, you don’t. There’s an abundance of free and paid email editors available both online and for download.</p>
<p>Some free editors worth a look are Htmlg.com or W3schood editor. They offer a bit more than the default Google editor. But the biggest value is from the chance to preview your emails as you write or change it.</p>
<p>More sophisticated tools come with lots of templates ready for any occasion. So whether you’re after infographic templates or wish to invite someone to a wedding, you’ll have plenty to choose from.</p>
<p>Pick the right one, adjust it to your needs, preview and download the entire HTML code. Then just follow the instructions above to send it with Gmail or use any other client or email service provider (ESP). Most of these tools run on a freemium model, letting you try some basic templates for free and charging you for more advanced ones.</p>
<h1 id="heading-final-words">Final Words</h1>
<p>As you can see, sending HTML emails via Gmail isn’t difficult at all. The tricky part might be to display them properly in the vast array of browsers and email clients. With a bit of practice and the appropriate toolset, it shouldn’t cause a problem too.</p>
<p>Now, pick the right email design, launch Gmail or an email marketing provider of your choice and send your next campaign without any hassle.</p>
<blockquote>
<p>musprodev@outlook.com</p>
</blockquote>
<div class="hn-embed-widget" id="buymeacoffee"></div>]]></content:encoded></item><item><title><![CDATA[Top 10 Advance Python Concepts That You Must Know]]></title><description><![CDATA[Python is a high-level, object-oriented programming language that has recently been picked up by a lot of students as well as professionals due to its…]]></description><link>https://musprodev.hashnode.dev/top-10-advance-python-concepts-that-you-must-know</link><guid isPermaLink="true">https://musprodev.hashnode.dev/top-10-advance-python-concepts-that-you-must-know</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[Hashnode]]></category><category><![CDATA[Productivity]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Sat, 18 Sep 2021 21:39:24 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1632001040505/Sx_nQQDIj.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Python is a high-level, object-oriented programming language that has recently been picked up by a lot of students as well as professionals due to its versatility, dynamic nature, robustness, and also because it is easy to learn. Not only this, it is now the second most loved and preferred language after JavaScript and can be used in almost all technical fields, be it machine learning, data science, web development, analytics, automation, testing, artificial intelligence, and a lot more. </p>
<p>Learning python is easy as compared to other high-level, object-oriented programming languages such as Java or C++but it has a few advanced concepts that come in handy when developing code that is robust, crisp, highly optimized, efficient, and normalized. Using these concepts in your code, you will be able to reduce bugs in your code as well as increase its efficiency thereby making you a seasoned Python programmer. So let us look at these concepts one by one and understand them in detail!</p>
<h2 id="1-map-function">1 .  MAP FUNCTION</h2>
<p>Python has an inbuilt function called map() which permits us to process all the elements present in an iterable without explicitly using a looping construct. When used, it returns a map object which in turn is an iterator. This map object is the result obtained by applying the specified function to every item present in the iterable.</p>
<p><b>The map() function takes two arguments:</b></p>
<ul>
<li><p>The first argument is a function that is to be applied to each and every element present in the iterable.</p>
</li>
<li><p>The second argument is the iterable itself on which the function is to be mapped.</p>
</li>
</ul>
<h2 id="2-itertools">2 . Itertools</h2>
<p>Python has an amazing standard library called itertools which provides a number of functions that help in writing clean, fast, and memory-efficient code due to lazy evaluation. It is a Python module that implements various iterator building blocks and together they form ‘iterator algebra’ which makes it possible to efficiently build tools in the Python language. The functions in itertools work on iterators itself which in turn return more complex iterators. Some example of functions present in itertools are: count(), cycle(), repeat(), accumulate(), product(), permutations(), combinations() etc. each taking their own set of arguments and operating upon them. The result is generated a lot more faster as compared to the results achieved when using conventional code.</p>
<h2 id="3-lambda-function">3. Lambda Function</h2>
<p>Python’s lambda functions are small anonymous functions as they do not have a name and are contained in a single line of code. The keyword ‘def’ is used to define functions in Python but lambda functions are rather defined by the keyword ‘lambda’. They can take any number of arguments, but the number of expressions can only be one. It makes code concise and easy to read for simple logical operations and is best to use when you need to use the function only a single time.</p>
<h2 id="4-exception-handling">4. Exception Handling</h2>
<p>Exceptions are types of errors that occur when the program is being executed and change the normal flow of the program. An example could be dividing a number by zero or referencing an index that is outside the bounds of an iterable. Therefore, we use try, except, and finally to handle exceptions in Python. The keyword try is used to wrap a block of code which can potentially throw errors, except is used to wrap a block of code to be executed when an exception is raised and handles the error and finally lets us execute the code no matter what. </p>
<h2 id="5-decorators">5. Decorators</h2>
<p>Decorators are a part of Python’s metaprogramming which are used to add additional functionality to existing code without altering the original structure at compile time. It is more like a regular function in Python which can be called and returns a callable. It takes in a function, modifies it by adding functionality, and then returns it.</p>
<h2 id="6-collections">6. Collections</h2>
<p>Collections in Python are general purpose inbuilt containers like set, tuple, dictionary, and lists. Python collections is a module that implements specialized container datatypes. Collections include namedtuple() which is a function for creating tuple subclasses with named fields, OrderedDict which is a dict subclass that remembers the order entries that were added since Python dict aren’t ordered, Counter that is used for counting hashable objects, ChainMap that is used for creating a single view of multiple mappings, etc. </p>
<h2 id="7-generators">7. Generators</h2>
<p>Generators in Python are a special type of function that rather than returning a single value, returns an iterator object which is a sequence of values. It is a utility to create your own iterator function. The keyword yield is used in the generator function instead of the return keyword which pauses its execution. The difference between yield and return is that return terminates the function but yield only pauses the execution of the function and returns the value against it each time. </p>
<h2 id="8-magic-methods">8. Magic Methods</h2>
<p>Also called Dunder (or double underscore) methods, magic methods are special types of functions that are invoked internally. They start and end with double underscores. Some examples include <strong>add</strong>(), <strong>abs</strong>(), <strong>round</strong>(), <strong>floor</strong>(), <strong>str</strong>(), <strong>trunc</strong>(), <strong>lshift</strong>() etc. The expression number + 5 is the same as numer.<strong>add</strong>(5) and this is internally called by other methods or actions. You can directly use these functions as it will decrease the run time of your code due to the fact that now due to direct use, we will be reducing a function call each time.</p>
<h2 id="9-threading">9. Threading</h2>
<p>A Thread is the smallest unit or process that can be scheduled by an operating system. Python contains the Thread class which aids in multithreaded programming. Multithreading is mainly used to speed up computation up to a huge extent as now more than one thread will be performing tasks. To implement threading in Python, you will need to use the threading module (since the thread module is deprecated). </p>
<h2 id="10-regular-expressions">10. Regular Expressions</h2>
<p>Python regular expressions or RegEx are expressions that contain specific characters as patterns to be matched. It is used to check if a string or a set of strings contains a specific pattern. It is extremely powerful, elegant, and concise along with being fast. To use Python’s regular expressions, you need to import re module which contains functions that help in pattern matching like findall(), search(), split(), etc.</p>
<p>These were the top advanced Python concepts that you must know to be an experienced Python developer. These will not only make you a good programmer and developer but will also improve code readability and make it faster.</p>
<h2 id="telegram">TELEGRAM</h2>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://t.me/musprodev">https://t.me/musprodev</a></div>
]]></content:encoded></item><item><title><![CDATA[How to Create a Personal Blog as a Developer on Hashnode]]></title><description><![CDATA[Many developers have thought about starting a blog at some point in their career but few of them actually get round to doing it. Often it’s because of…]]></description><link>https://musprodev.hashnode.dev/how-to-create-a-personal-blog-as-a-developer-on-hashnode</link><guid isPermaLink="true">https://musprodev.hashnode.dev/how-to-create-a-personal-blog-as-a-developer-on-hashnode</guid><category><![CDATA[Hashnode]]></category><category><![CDATA[HashnodeCommunity]]></category><category><![CDATA[Developer Blogging]]></category><category><![CDATA[Blogging]]></category><category><![CDATA[Developer]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Wed, 08 Sep 2021 10:17:20 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1631096173220/BFiFLg7JZ.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Many developers have thought about starting a blog at some point in their career but few of them actually get round to doing it. Often it’s because of concerns like “What on earth could I say about this? I’m not the best on this topic,” or “I won’t be able to deal with the haters’ comments,” or even “I’m a coder, not a writer. I don’t know how to write a publication.”</p>
<p>However, starting a blog could bring many advantages. When you write on the Internet you become more visible than a regular developer. Who are you hoping will read your post? Future colleagues? A recruiter from that awesome company you’d like to work at? The committee responsible for choosing the speakers of a conference you’d like to talk at? All these people will be interested in both your technical skills and your editorial skills.</p>
<p>Also, what better way is there to learn than by explaining to other people? That’s exactly what you’ll be doing when you write a technical post on your blog.</p>
<p>So now we’ve convinced you that starting a blog is what you want to do, how should you go about it?<br />
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1631091513907/1CDWvHuPZ.png" alt="image.png" /></p>
<p><b>HASHNODE</b> is an awesome platform, where a lot of people write amazing stuff. You’ll have nothing to configure, meaning you can start straight away.</p>
<p><b>Hashnode is the easiest way to start a developer blog on your personal domain 🌏 for free and connect with the readers through our global dev community! 👩‍💻👨‍💻</b></p>
<p>A blogging platform built for developers by developers. Blog on personal domain, share ideas, and connect with the global dev community!</p>
<h2 id="how-to-use-hashnode">How to use Hashnode</h2>
<ul>
<li>Go to www.hashnode.com</li>
</ul>
<p><img src="https://telegra.ph/file/9cb9e9ac224197668792e.jpg" /></p>
<ul>
<li>Click on get started </li>
</ul>
<p><img src="https://telegra.ph/file/3fe5b8ba3795b41941c85.jpg" /></p>
<ul>
<li>Sign up using your email,:( I prefer signing in-out with google</li>
</ul>
<p><img src="https://telegra.ph/file/4409232995bf1fc23a13a.jpg" /></p>
<ul>
<li>Fill in the necessary information and click next</li>
</ul>
<p><img src="https://telegra.ph/file/37e7475c7431e19313d11.jpg" /></p>
<ul>
<li>Follow your favourite technologies</li>
</ul>
<p><img src="https://telegra.ph/file/0a7af26f4505af55b227f.jpg" /></p>
<ul>
<li>Click on get started </li>
</ul>
<p><img src="https://telegra.ph/file/8cf4ba510e5b681792d40.jpg" /></p>
<ul>
<li>Enter your personal blog name</li>
</ul>
<p><img src="https://telegra.ph/file/6eafbe5e44789aed9495b.jpg" /></p>
<ul>
<li>Click on "Write an Article"</li>
</ul>
<p><img src="https://telegra.ph/file/be4f18e97a690b27334f4.jpg" /></p>
<ul>
<li>Write your GREAT content</li>
</ul>
<p><img src="https://telegra.ph/file/b0ca8451c8a8f344c8851.jpg" /></p>
<ul>
<li>Click on Publish and your blog is live.</li>
</ul>
<p><img src="https://telegra.ph/file/e0ecc51c6c0ce03e05dc1.jpg" /></p>
<h2 id="share-your-content">Share your content</h2>
<p>Social media is key to making your blog a well-read platform. The more platforms the merrier? Not necessarily. Choose wisely: Some are irrelevant because developers don’t go there to read tech stuff. So don’t waste time juggling 36 social-media accounts. More than anything else, you’ll need this time to write great posts and work on your awesome side projects!</p>
<p>Sharing is caring, so share your posts often. No one likes to talk to themselves. To avoid disappointment with the reaction to your blog at the start, which may lead you to think about closing it after 2 weeks, share your posts with your family, friends, and acquaintances. There’s no easier way to do that than with social media.</p>
<p>The key social-media platforms have their own uses. On Twitter, for example, since the posts scroll rapidly out of sight, you can share the same links to your blog multiple times a day. It is always possible that one of your followers spends their whole day on Twitter and will see the same link several times, so try to use different descriptions with them. You can also retweet people who have retweeted and commented on your posts, which will make them appear in your feed. This is a way to maintain a steady flow of readers. Keep in mind that even if the post already appeared on social media 2 months previously, not all your followers who might be interested in it will have seen it, so repost it.</p>
<h2 id="use-your-network">Use your network</h2>
<p>We developers have a big asset that we can use to our benefit: Programming is a niche market with highly engaged members. Websites such as Hacker News, Dev.to, Medium, and tech subreddits are places packed with developers hungry for great technical posts to read, so feed them yours and use those websites to get known.</p>
<p>On Hacker News and subreddits, you can send your links with a description. On Medium and Dev.to you have to write a post: Just copy and paste your blog posts (with canonical links to your original post) to create interest and draw developers from these platforms to your own blog. You can also make guest posts on Medium or Dev.to publications that already have lots of readers, such as HackerNoon. You’ll find a lot more places like this on the Internet. Using them is important.</p>
<h2 id="engage-with-your-community">Engage with your community</h2>
<p>At this point, you already share your posts everywhere, but it’s not enough! Ask questions, answer comments, talk about your work, your daily life, make videos if you feel comfortable doing so. Your readers are developers, so they are human beings too. People need to be able to relate to you to build a sense of community. An engaged reader will help greatly by sharing your posts on social media, commenting, giving you feedback… Value those readers by taking the time to thank them! If you get some negative feedback or the content is not interesting enough for your readers, just try something else.</p>
<h1 id="thanks-for-reading">THANKS FOR READING</h1>
<blockquote>
<p>CONTACT ME-FOLLOW ME</p>
</blockquote>
<p>● <a target="_blank" href="https://t.me/musprodev">TELEGRAM</a></p>
<p>● <a target="_blank" href="https://wa.me/2348117939262">WHATSAPP</a></p>
<p>● <a target="_blank" href="https://instagram.com/musprodev">INSTAGRAM</a></p>
<p>● <a target="_blank" href="https://twitter.com/muspro15">TWITTER</a></p>
]]></content:encoded></item><item><title><![CDATA[--css variables]]></title><description><![CDATA[Why in the world do do hex or rgb colors have to be so hard to remember? Not to mention how much of a pain it is to find and change them when you change…]]></description><link>https://musprodev.hashnode.dev/css-variables</link><guid isPermaLink="true">https://musprodev.hashnode.dev/css-variables</guid><category><![CDATA[CSS]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[variables]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Web Development]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Mon, 06 Sep 2021 17:01:57 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630947624126/gfUB3LFeU.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Why in the world do do hex or rgb colors have to be so hard to remember? Not to mention how much of a pain it is to find and change them when you change your color scheme. CSS variables to the rescues! If you have never used CSS variables the time to start is now. They are widely supported across browsers and can make you styling a breeze.</p>
<h3 id="what-are-css-variables">What are --css variables</h3>
<p>CSS variables are a way for you to assign certain css values to a keyword and reuse them throughout your application. CSS variables can have local or global scope and can be manipulated with JavaScript. Most often, they are used to help you manage your colors but you can use css variables many different ways. In the simplest form, a css variable is nothing but a keyword that has a value assigned to it.</p>
<p>Syntax
To declare and use a css variable is very simple. There are 3 main things you need to remember: <code>-- ``:root</code> <code>var()</code>.<code>—-</code> is used whenever you assign and declare your variable. To create a variable you must put <code>—-</code> in front of your variable name.</p>
<pre><code><span class="hljs-selector-pseudo">:root</span>{
<span class="hljs-comment">/* my variable name is main-color and my value associated with 
it is #5a9e4b */</span>
<span class="hljs-attribute">--main-color</span>: <span class="hljs-number">#5a9e4b</span>;
}
</code></pre><p><code>:root</code> is how you declare global scope. Scope is basically where all you can access your variable from. Global scope means you have access throughout your css file. You can create a local variable by using the <code>—-variable-name</code> inside of a class. A local variable means that you only have access to this variable locally inside that class.</p>
<pre><code><span class="hljs-comment">/* This is declaring a global variable that I can access from anywhere in my css file. Anything inside of :root is global.*/</span>
<span class="hljs-selector-pseudo">:root</span>{
—-main-<span class="hljs-attribute">color</span>: <span class="hljs-number">#5a9e4b</span>;
}

<span class="hljs-comment">/* This is declaring a local variable. I can only access this variable inside of this class */</span>
<span class="hljs-selector-class">.container</span> {
--main-text-size: <span class="hljs-number">24px</span>;
<span class="hljs-attribute">font-size</span>: var(--main-text-size);
}
</code></pre><p><code>var()</code> is how you call your variables. Remember a variable is nothing but a keyword that has a set value. To pass this value to a css property all you have to do is type the name of your variable inside of the <code>()</code>. It’s that simple!</p>
<pre><code><span class="hljs-comment">/* creating a global variable for main-color */</span>
<span class="hljs-selector-pseudo">:root</span>{
—-main-<span class="hljs-attribute">color</span>: <span class="hljs-number">#5a9e4b</span>;
}

<span class="hljs-comment">/* passing the variable name into the var function. This will put #5a9e4b as the value to the color property. */</span>
<span class="hljs-selector-class">.someClass</span> {
<span class="hljs-attribute">color</span>: var(—-main-color);
}
</code></pre><h2 id="fallbacks">Fallbacks</h2>
<p>Unfortunately not all browsers are created equally. While most browsers are pretty robust its best practice to have some fallbacks in place. There is special syntax that you can use to have a fallback for your value. Its the same var() as before but you add a second argument. <code>var(--main-color, blue);</code> This will use your css <code>variable --main-color</code> and if it is invalid or not defined it will then make the value equal to blue. The <code>var()</code> only takes in two arguments and the second argument can be an additional css variable if you want. <code>var(--main-color</code>, <code>var(--ultimate-fallback));</code> This will try to use main-color first and if its invalid will then use the <code>--ultimate-fallback</code>.</p>
<pre><code><span class="hljs-selector-pseudo">:root</span> {
<span class="hljs-attribute">--main-color</span>: <span class="hljs-number">#5a9e4b</span>;
}

<span class="hljs-selector-tag">p</span> {
<span class="hljs-comment">/* will try --main-color first. If invalid will use blue */</span>
<span class="hljs-attribute">color</span>: <span class="hljs-built_in">var</span>(--main-color, blue);
</code></pre><p>Now this will not act as a fall back for browsers that do not support css variables. To create a fallback for this is a little extra work but possible. CSS reads one line at at time. You can have the same property with two different values for the same class and css will use the last one written. We can take advantage of this with our variables. You can hard code your fallback in your css class and then on the next line add your css variable. Css will read each line and if the browser does not support css variables it will then default to your hard coded fallback. If the browser does support css variables then it will use it since it was used after the fallback.</p>
<pre><code><span class="hljs-selector-pseudo">:root</span> {
<span class="hljs-attribute">--main-color</span>: <span class="hljs-number">#5a9e4b</span>;
}

<span class="hljs-selector-tag">p</span> {
<span class="hljs-comment">/* will use --main-color since it is last color property written. If invalid will then use blue.*/</span>
<span class="hljs-attribute">color</span>: blue;
<span class="hljs-attribute">color</span>: <span class="hljs-built_in">var</span>(--main-color);
</code></pre><h2 id="using-javascript">Using JavaScript</h2>
<p>Since css varaibles have access to the DOM you can change them with JavaScript! You can make some really interesting user interfaces with this trick. To start create your css variables like you normally would. Then use querySelector to get access to the root element. Now that you have access to the root element, all you have to do is use the setProperty() method to change the value of you variable. This will update the value and hence update your entire css file everywhere you used that variable. The setProperty() method is a method on CSSStyleDeclaration Object. I won’t go into detail on this or the other methods you can use. I want to keep this article light and focused on css varaibles instead of JavaScript. Go to https://www.w3schools.com/jsref/obj_cssstyledeclaration.asp If you would like to learn more about what you can do.</p>
<pre><code><span class="hljs-selector-pseudo">:root</span> {
—-primary-<span class="hljs-attribute">color</span>: <span class="hljs-number">#5a9e4b</span>;
}

<span class="hljs-selector-tag">p</span> {
<span class="hljs-attribute">color</span>: var(—-primary-color);
}
</code></pre><p><br /></p>
<pre><code><span class="hljs-comment">//gives me access to the root element</span>
let rootElement = document.querySelector(<span class="hljs-string">':root'</span>);

<span class="hljs-comment">//this will change the style of my </span>
—-primary-color variable to red.
rootElement.style.setProperty(<span class="hljs-string">'- 
-primary-color'</span>, <span class="hljs-string">'red'</span>);
</code></pre><p>In the above example I have a css variable called <code>—-primary-color</code> that is set to the value of #5a9e4b. Then I make the color to all of my </p><p> tags equal to my new variable. In the JavaScript section, I first create a variable that is equal to the root element. Then I can access my variable by using the setProperty('variable name', 'new value') method. The first argument is the variable name and the second argument is the new value. Now all my </p><p> will have red text!</p>
<p>You now have the knowledge needed to start using css varaibles in your applications. This will help increase developement speed, readability, and maintainability. If you enjoy this you can look into things like Sass to further extend your css capabilities.</p>
<blockquote>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://t.me/musprodev">https://t.me/musprodev</a></div>
</blockquote>
<div class="hn-embed-widget" id="share-telegram"></div>]]></content:encoded></item><item><title><![CDATA[How Pros Automate Repetitive Code using VS Code]]></title><description><![CDATA[While Programming, you are bound to encounter Repetitive Code, writing which is a complete waste of time. I am not talking about Non-DRY Code, but…]]></description><link>https://musprodev.hashnode.dev/how-pros-automate-repetitive-code-using-vs-code</link><guid isPermaLink="true">https://musprodev.hashnode.dev/how-pros-automate-repetitive-code-using-vs-code</guid><category><![CDATA[Visual Studio Code]]></category><category><![CDATA[vscode extensions]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[coding]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Mon, 06 Sep 2021 09:24:59 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630920247212/YNu9ccA-Q.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>While Programming, you are bound to encounter Repetitive Code, writing which is a complete waste of time. I am not talking about Non-DRY Code, but Essentials Code that is necessary to be written. An example of this would be connecting State/Dispatch to Props using React-Redux.</p>
<p>Anyone who has worked on a decent-sized React-Redux project knows how many times you have to write the same code to connect the Redux Store Data to the Component Props.</p>
<p>Today we are going to fix that and provide you with a way to streamline ANY Repetitive Code you have and Maximize your Productivity.</p>
<h2 id="what-are-snippets-in-vs-code">What are Snippets in VS Code?</h2>
<p>VS Code is an Amazing Code Editor that provides a plethora of tools to take your productivity to the next level. Snippets are just one such tool.</p>
<p>Snippets can be thought of as Templates that enable you write code once and reuse it, as per requirement. It allows Variables as well as Dynamic User Inputs.</p>
<p>If you have been using VS Code for some time, you are bound to come across Snippets.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630918957581/5rfkCG2EC.png" alt="image.png" /></p>
<p>Some Snippets come pre-built with VS Code. You can install some extensions to add event more Snippets, but most importantly, you can create your own Snippets to cater to your very own needs.</p>
<h3 id="creating-our-first-snippets">Creating our first Snippets</h3>
<p>Creating a Snippets is fairly simple:</p>
<p>1-    Go to File &gt; Preferences &gt; User Snippets (possibly Code &gt; Preferences &gt; User Snippets on macOS).</p>
<p>Or you might use F1 to bring up the Command Palette and search for User Snippets</p>
<p>2-    Select the type of Snippet you want to create (language-specific, project-specific or global)</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630919041360/KJusE2h2x.png" alt="image.png" /></p>
<p>3-   Add the following in the created <code>.code-snippets</code> file</p>
<pre><code>    {

    <span class="hljs-attr">"Signature"</span>: {
    <span class="hljs-attr">"scope"</span>: <span class="hljs-string">"html"</span>,
    <span class="hljs-attr">"prefix"</span>: <span class="hljs-string">"hello"</span>,
    <span class="hljs-attr">"body"</span>: [
        <span class="hljs-string">"Hello!!!"</span>
    ],
    <span class="hljs-attr">"description"</span>: <span class="hljs-string">"Hello"</span>
    }
   }
</code></pre><p>4-    Done! Now when you type "hello" in an HTML file, you would be to use the Snippet</p>
<p>This wasn't a practical example, but we did manage to get our feet wet at making Snippets.</p>
<p>On inspecting the Snippet definition, we find the scope that declares which files the Snippet should be used in. The prefix mentions the prefix text that will trigger the Snippet to show up. The body defines the body of the Snippet(each line of the Snippet would be a new string in array). And finally, description is a short description of the Snippet's function.</p>
<p>Let us make a couple of practical ones to deepen our understanding and solve the issue mentioned in the Intro of the article (connecting State/Dispatch to Props using React-Redux).</p>
<h2 id="snippet-1-leaving-a-signature">Snippet 1: Leaving a Signature</h2>
<p>Let's try making a snippet that leaves a signature like this in any file and isn't restricted to only Python</p>
<pre><code><span class="hljs-string">"""
Name: Tapajyoti Bose
Modified on: 05 September 2021 
08:38:35
"""</span>
</code></pre><p>We would also like the Snippet to update the date and time dynamically, of course.</p>
<p>Luckily, VS Code provides a bunch of variables for this purpose.</p>
<p>We would be using <code>BLOCK_COMMENT_START</code> and <code>BLOCK_COMMENT_END</code> to automatically generate the block comments for any language and <code>CURRENT_DATE</code>, <code>CURRENT_MONTH_NAME</code>, <code>CURRENT_YEAR</code>, <code>CURRENT_HOUR</code>, <code>CURRENT_MINUTE</code>, &amp; <code>CURRENT_SECOND</code> to generate the date and time dynamically.</p>
<p><b>NOTE</b>: To get the complete list of variables, <a target="_blank" href="https://code.visualstudio.com/docs/editor/userdefinedsnippets#_variables">click here</a></p>
<p>So the Snippet would initially look like this:</p>
<pre><code><span class="hljs-string">"Signature"</span>: {
<span class="hljs-string">"scope"</span>: <span class="hljs-string">"python,javascript,typescript,html,css"</span>,
<span class="hljs-string">"prefix"</span>: <span class="hljs-string">"signature"</span>,
<span class="hljs-string">"body"</span>: [
    <span class="hljs-string">"<span class="hljs-variable">$BLOCK_COMMENT_START</span>"</span>,
    <span class="hljs-string">"Name: Tapajyoti Bose"</span>,
    <span class="hljs-string">"Modified on: <span class="hljs-variable">$CURRENT_DATE</span> <span class="hljs-variable">$CURRENT_MONTH_NAME</span> <span class="hljs-variable">$CURRENT_YEAR</span> <span class="hljs-variable">$CURRENT_HOUR</span>:<span class="hljs-variable">$CURRENT_MINUTE</span>:<span class="hljs-variable">$CURRENT_SECOND</span>"</span>,
    <span class="hljs-string">"<span class="hljs-variable">$BLOCK_COMMENT_END</span>"</span>
],
<span class="hljs-string">"description"</span>: <span class="hljs-string">"Leave a signature"</span>
}
</code></pre><p>Now within Python, Javascript, Typescript, HTML, CSS files, you would be able to leave a signature.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630919575853/vMDct44_mI.png" alt="image.png" /></p>
<p>You might be wondering if extending the functionality to all languages would require you to add the names of all languages. Luckily there is an easy solution: just remove the scope from the Snippet definition and Viola! the functionality is extended to all languages!</p>
<h2 id="snippet-2-connecting-redux-to-react-props">Snippet 2: Connecting Redux to React Props</h2>
<p>This is even easier than the Signature Snippet. Just copy the following code in the snippet definition, and you are done:</p>
<pre><code><span class="hljs-string">"Connect Component to Redux"</span>: {
<span class="hljs-string">"scope"</span>: <span class="hljs-string">"javascriptreact,typescriptreact"</span>,
<span class="hljs-string">"prefix"</span>: <span class="hljs-string">"connect"</span>,
<span class="hljs-string">"body"</span>: [
    <span class="hljs-string">"const mapStateToProps = (state) =&gt; ({"</span>,
    <span class="hljs-string">"\t<span class="hljs-subst">$1</span>"</span>,
    <span class="hljs-string">"})"</span>,
    <span class="hljs-string">""</span>,
    <span class="hljs-string">"const mapDispatchToProps = (dispatch) =&gt; ({"</span>,
    <span class="hljs-string">"\t<span class="hljs-subst">$0</span>"</span>,
    <span class="hljs-string">"})"</span>,
    <span class="hljs-string">""</span>,
    <span class="hljs-string">"export default connect(mapStateToProps, mapDispatchToProps)(<span class="hljs-subst">$TM_FILENAME_BASE</span>)"</span>
],
<span class="hljs-string">"description"</span>: <span class="hljs-string">"Connect React Component to Redux"</span>
}
</code></pre><p>Let us examine what is being done.</p>
<p>We are scoping the Snippet to React based projects for obvious reasons.</p>
<p>In the body, you might be seeing $0 and $1 for the first time. These are placeholders for tab-able positions where the user should enter their own logic (the parts of the store they want to connect to the props in this case).</p>
<p>We are using the File Name as the Component Name, as in most cases, the convention is using the Component Name to be the same as the File Name.</p>
<h1 id="thanks-for-reading">THANKS FOR READING</h1>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630919797495/ECcGzhEbPN.png" alt="image.png" /></p>
<blockquote>
<p>Follow my blog and subscribe to my newsletter for future updates</p>
</blockquote>
<p>CONTACT ME</p>
<h3 id="instagramhttpsinstagramcommusprodev">● <a target="_blank" href="https://instagram.com/musprodev">Instagram</a></h3>
<h3 id="twitterhttpstwittercommuspro15">● <a target="_blank" href="https://twitter.com/muspro15">Twitter</a></h3>
<h3 id="telegramhttpstmemusprodev">● <a target="_blank" href="https://t.me/musprodev">Telegram</a></h3>
]]></content:encoded></item><item><title><![CDATA[How to post data from React to Flask.]]></title><description><![CDATA[Before we continue. Let's alter our Flask routes.py to accept input from the React frontend, then commit the database. We'll add the following lines of…]]></description><link>https://musprodev.hashnode.dev/how-to-post-data-from-react-to-flask</link><guid isPermaLink="true">https://musprodev.hashnode.dev/how-to-post-data-from-react-to-flask</guid><category><![CDATA[React]]></category><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[JavaScript]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Mon, 06 Sep 2021 09:00:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630918776706/DFJizrbkr.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="part-1">Part 1</h2>
<h3 id="configuring-the-flask-backend">Configuring the Flask backend.</h3>
<h3 id="1-routespy">1. routes.py</h3>
<p>Before we continue. Let's alter our Flask <code>routes.py</code> to accept input from the React frontend, then commit the database. We'll add the following lines of code to our routes.py file.</p>
<pre><code>@app.route("/add", methods=["POST"], strict_slashes=<span class="hljs-keyword">False</span>)
def add_articles():
title = request.json[<span class="hljs-string">'title'</span>]
body = request.json[<span class="hljs-string">'body'</span>]

article = Articles(
    title=title,
    body=body
    )

db.<span class="hljs-keyword">session</span>.<span class="hljs-keyword">add</span>(article)
db.<span class="hljs-keyword">session</span>.<span class="hljs-keyword">commit</span>()

<span class="hljs-keyword">return</span> article_schema.jsonify(article)
</code></pre><p>The function above basically gets an article title and description in json format, adds the record to the database, and then commits, i.e. saves.</p>
<h2 id="part-2">Part 2</h2>
<h3 id="configuring-the-react-frontend">Configuring the React frontend.</h3>
<p>In contrast to the last tutorial, we will make some changes to our project by introducing a <code>Components</code> directory. Then we'll add some new files, one to manage our API services and another to display a form to the UI, as well as to handle our interaction with the <code>APIService</code>, which provides our data to Flask.</p>
<p><b>2. Components/APIService.js</b></p>
<pre><code><span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-class"><span class="hljs-keyword">class</span> <span class="hljs-title">APIService</span></span>{
<span class="hljs-comment">// Insert an article</span>
<span class="hljs-keyword">static</span> InsertArticle(body){
    <span class="hljs-keyword">return</span> fetch(<span class="hljs-string">`http://localhost:5000/add`</span>,{
        <span class="hljs-string">'method'</span>:<span class="hljs-string">'POST'</span>,
         <span class="hljs-attr">headers</span> : {
        <span class="hljs-string">'Content-Type'</span>:<span class="hljs-string">'application/json'</span>
  },
  <span class="hljs-attr">body</span>:<span class="hljs-built_in">JSON</span>.stringify(body)
})
.then(<span class="hljs-function"><span class="hljs-params">response</span> =&gt;</span> response.json())
.catch(<span class="hljs-function"><span class="hljs-params">error</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(error))
}

}
</code></pre><p>To better organize our files and increase efficiency, we conduct all of the Flask API services in a single file and then call the methods as needed.</p>
<p>The code above requests our Flask routes, which handle data insertion, and then posts our JSON-stringified article title and description. Flask takes care of the rest under the hood.</p>
<p><b>3. Components/Form.js</b></p>
<pre><code><span class="hljs-keyword">import</span> { useState } <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
<span class="hljs-keyword">import</span> APIService <span class="hljs-keyword">from</span> <span class="hljs-string">'../Components/APIService'</span>
</code></pre><p>Because we'll require the React <code>useState</code> hook and the <code>APIService</code> component, we make them available as seen above.</p>
<pre><code><span class="hljs-keyword">const</span> Form = <span class="hljs-function">(<span class="hljs-params">props</span>) =&gt;</span> {
<span class="hljs-keyword">const</span> [title, setTitle] = useState(<span class="hljs-string">''</span>)
<span class="hljs-keyword">const</span> [body, setBody] = useState(<span class="hljs-string">''</span>)

<span class="hljs-keyword">const</span> insertArticle = <span class="hljs-function">() =&gt;</span>{
  APIService.InsertArticle({title,body})
  .then(<span class="hljs-function">(<span class="hljs-params">response</span>) =&gt;</span> props.insertedArticle(response))
  .catch(<span class="hljs-function"><span class="hljs-params">error</span> =&gt;</span> <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'error'</span>,error))
}

<span class="hljs-keyword">const</span> handleSubmit=<span class="hljs-function">(<span class="hljs-params">event</span>)=&gt;</span>{ 
  event.preventDefault()
  insertArticle()
  setTitle(<span class="hljs-string">''</span>)
  setBody(<span class="hljs-string">''</span>)
}

  <span class="hljs-keyword">return</span> (
   <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
   // Form
   <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span></span>
  )}

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> Form;
</code></pre><h3 id="3-appjs">3. App.js</h3>
<p>As we near completion, we need to show the Form component on the UI. We'll import it then display it on the UI as shown in the steps below.</p>
<pre><code><span class="hljs-comment">// import the component</span>
<span class="hljs-keyword">import</span> Form <span class="hljs-keyword">from</span> <span class="hljs-string">'./Components/Form'</span>
</code></pre><p>Previously, we passed the response from our <code>APIService. InsertArticle()</code> as a parameter, it's then received on this end. Using the spread operator we will combine the newly created <code>article</code> with the available articles. The update is initiated using the setArticles method and the result is a list of updated <code>articles.</code></p>
<pre><code><span class="hljs-comment">// update the existing article list</span>
  <span class="hljs-keyword">const</span> insertedArticle = <span class="hljs-function">(<span class="hljs-params">article</span>) =&gt;</span>{
<span class="hljs-keyword">const</span> new_articles = [...articles,article]
setArticles(new_articles)
  }
</code></pre><p>We now have our form ready to display on the UI. We can make it visible by calling the Form Component while passing to it the the data as props like this.</p>
<pre><code> <span class="hljs-tag">&lt;<span class="hljs-name">Form</span> <span class="hljs-attr">insertedArticle</span>=<span class="hljs-string">{insertedArticle</span></span>
</code></pre><p>Also, keeping the form visible all the time isn't ideal, so we made it a toggle button.</p>
<blockquote>
<p>// define variables for the present state of the form and another to change its state
 const [showForm, setShowForm] = useState(false);
      ...
 // toggle between the two states,visible and hidden
      const toggleShowForm = () =&gt; {
    setShowForm(!showForm);
      }
      ...
    // Trigger the hide/show method
  &lt;button 
  onClick={toggleShowForm}
  className="btn btn-primary"</p>
<p>Write an article
<i></i>
  
...
       // display the form conditionally
      {showForm &amp;&amp; (
  </p>
)}<p></p>
</blockquote>
<h3 id="project-preview">Project preview</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630918655555/tHGxjw6w0.png" alt="image.png" /></p>
<p>Thank you for reading. Please like, share, and leave a comment below.</p>
<p>Also do follow my blog to get notified when the next article on editing and deleting the articles we just published is posted.</p>
]]></content:encoded></item><item><title><![CDATA[Notification API: Show notifications from your web app 🔔]]></title><description><![CDATA[Notifications are vital if you want to drive traffic to your web applications. Notifications can be shown even if the user is not active on your…]]></description><link>https://musprodev.hashnode.dev/notification-api-show-notifications-from-your-web-app</link><guid isPermaLink="true">https://musprodev.hashnode.dev/notification-api-show-notifications-from-your-web-app</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[React]]></category><category><![CDATA[React Native]]></category><category><![CDATA[javascript framework]]></category><category><![CDATA[APIs]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Sun, 05 Sep 2021 21:57:41 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630879010177/zogoAwlks.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Notifications are vital if you want to drive traffic to your web applications.</p>
<p>Notifications can be shown even if the user is not active on your website/webapp.</p>
<p>Whether you are building an e-commerce website and want to show offers to your user or you are building a chatting application and want to show the notification about new messages.</p>
<p>Many top web applications like Slack, Facebook, WhatsApp and a lot more are using the same technology to show notifications.</p>
<p>Using Notifications API is lot more simpler than you might think.</p>
<h3 id="introduction">Introduction.</h3>
<p>The Notifications API allow developers to show notifications from their website or web application.</p>
<p>Notifications API is compatible with existing notifications system in your OS (Windows, Mac or Linux).</p>
<h3 id="how-to-use-notifications-api">How to use Notifications API 💭</h3>
<p>Notifications can be initialised using the class <code>Notification</code> which is available globally.</p>
<h3 id="asking-for-permission">Asking for permission ⬇️</h3>
<pre><code>// asking <span class="hljs-keyword">user</span> <span class="hljs-keyword">to</span> <span class="hljs-keyword">grant</span> the permission <span class="hljs-keyword">on</span> page <span class="hljs-keyword">load</span>
// <span class="hljs-keyword">to</span> <span class="hljs-keyword">show</span> notifications
<span class="hljs-keyword">window</span>.addEventListener(<span class="hljs-string">'load'</span>, () =&gt; {
  Notification.requestPermission();
// permission cannot be asked again <span class="hljs-keyword">if</span> the <span class="hljs-keyword">user</span> chose
// <span class="hljs-keyword">to</span> <span class="hljs-keyword">grant</span> <span class="hljs-keyword">or</span> deny the permission.
// once granted <span class="hljs-keyword">or</span> denied, <span class="hljs-keyword">then</span> <span class="hljs-keyword">user</span> have <span class="hljs-keyword">to</span> change the
// permission manually.
});
</code></pre><h3 id="checking-if-the-user-has-granted-the-permission">Checking if the user has granted the permission ⬇️</h3>
<pre><code><span class="hljs-selector-tag">console</span><span class="hljs-selector-class">.log</span>(<span class="hljs-selector-tag">Notification</span><span class="hljs-selector-class">.permission</span>);
</code></pre><p>Result of the above console can be:</p>
<p><code>default</code>: Permission is not asked yet, notifications will not be shown.</p>
<p><code>granted</code>: User has granted the permission to show notifications.</p>
<p><code>denied</code>: User has declined the permission.</p>
<p>Alternatively, you can also use Permission API to check for the permission. More about it <a target="_blank" href="https://dev.to/sidmirza4/permissions-api-why-should-you-start-using-it-2k4d">here</a>.</p>
<h3 id="showing-notifications">Showing notifications 🔔</h3>
<pre><code><span class="hljs-keyword">const</span> newMsgNotification = <span class="hljs-keyword">new</span> Notification(<span class="hljs-string">'A new message'</span>, {
  body: <span class="hljs-string">'You have got a new message, check it out!'</span>,
  icon: <span class="hljs-string">'https://images.unsplash.com/photo-1611605698335-8b1569810432?ixid=MnwxMjA3fDB8MHxzZWFyY2h8N3x8aWNvbnN8ZW58MHx8MHx8&amp;ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=500&amp;q=60'</span>,
});
</code></pre><p>Above code shows the notification in my ubuntu something like this 👇</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630878187975/_5TPUrrqm.png" alt="image.png" /></p>
<blockquote>
<p>And that is it, this is as much that you need to know to get started, continue to know more.</p>
</blockquote>
<p>In the above example you see <code>Notification</code> class accepts 2 <code>arguments</code>.</p>
<ol>
<li>Title of the notification.</li>
<li>Options object in which you can set settings for notifications.</li>
</ol>
<p>Interacting with the notifications:
Users can also interact with the notification (like <code>click</code> on the notification).</p>
<p><code>EventListener</code> can be added to notification instance.</p>
<pre><code><span class="hljs-comment">// navigate the user to you website when</span>
<span class="hljs-comment">// user click on a notification</span>


newMsgNotification.addEventListener(<span class="hljs-string">'click'</span>, <span class="hljs-function">(<span class="hljs-params">e</span>) =&gt;</span> {
  e.preventDefault();

<span class="hljs-built_in">window</span>.open(<span class="hljs-string">'http://yourwebappurl.com'</span>, <span class="hljs-string">'_blank'</span>);
});
</code></pre><p>In addition to <code>click</code> listener, notification can listen to 3 more events:</p>
<p><code>close</code>: Fired when the notification is closed.</p>
<p><code>error</code>: Fired when the notification could not be shown for some reason.</p>
<p><code>show</code>: Fired when the notification in displayed.</p>
<blockquote>
<p>That is it for this article guys, I hope you found it useful.</p>
<p>If you did please subscribe to my newsletter, leave a like and share the article.</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[From Zero To Web Developer]]></title><description><![CDATA[Choosing a text editor can be so frustrating sometimes, you should choose a text editor according to you needs and the way the software makes a your coding…]]></description><link>https://musprodev.hashnode.dev/from-zero-to-web-developer</link><guid isPermaLink="true">https://musprodev.hashnode.dev/from-zero-to-web-developer</guid><category><![CDATA[Web Development]]></category><category><![CDATA[Tutorial]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[webdev]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Mon, 30 Aug 2021 19:48:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630352833483/cOF-0-reC.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="1-choose-a-text-editor">1. CHOOSE A TEXT EDITOR</h2>
<p>Choosing a text editor can be so frustrating sometimes, you should choose a text editor according to you needs and the way the software makes a your coding easy.</p>
<p><b>Here I recommend 2 Editors</b></p>
<ul>
<li><p><a target="_blank" href="https://code.visualstudio.com/">VISUAL STUDIO CODE</a></p>
</li>
<li><p><a target="_blank" href="https://www.sublimetext.com/">SUBLIME TEXT</a></p>
</li>
</ul>
<h2 id="2-html">2. HTML</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630350813351/cmVrxtfu5.png" alt="image.png" /></p>
<p>The HyperText Markup Language, or HTML is the standard markup language for documents designed to be displayed in a web browser. It can be assisted by technologies such as Cascading Style Sheets and scripting languages such as JavaScript.</p>
<h2 id="3-css">3. CSS</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630351558655/pBwXcKDGe.png" alt="image.png" /></p>
<p>Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML.</p>
<h2 id="4-bootstrap">4. BOOTSTRAP</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630351259179/Ch1BWw2fi.png" alt="image.png" />
Bootstrap is a free and open-source CSS framework directed at responsive, mobile-first front-end web development. It contains CSS- and JavaScript-based design templates for typography, forms, buttons, navigation, and other interface component</p>
<h2 id="5-javascript">5. JAVASCRIPT</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630351727260/sbIUt4sji.png" alt="image.png" />
JavaScript is the world's most popular programming language. JavaScript is the programming language of the Web. JavaScript is easy to learn.</p>
<h2 id="6-build-projects">6. BUILD PROJECTS</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630352022132/6J4V4c7yE_.png" alt="image.png" /></p>
<p>The best way to learn web development is to find a project that will push you forward. Tony Mastrorio has a great article about getting out of “tutorial purgatory.” Everything he says in it is spot-on.</p>
<h2 id="7-command-line">7. COMMAND-LINE</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630352139563/iS4UKlI1h.png" alt="image.png" /></p>
<p>The command line is a text interface for your computer. It's a program that takes in commands, which it passes on to the computer's operating system to run. From the command line, you can navigate through files and folders on your computer, just as you would with Windows Explorer on Windows or Finder on Mac OS.</p>
<h2 id="8-git-and-github">8. GIT AND GITHUB</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630352225453/64TDHkVdM.png" alt="image.png" /></p>
<p>what's the difference? Simply put, </p>
<p><b>Git</b> is a version control system that lets you manage and keep track of your source code history. <b>GitHub</b> is a cloud-based hosting service that lets you manage Git repositories. If you have open-source projects that use Git, then GitHub is designed to help you better manage them.</p>
<h2 id="9-javascript-frameworks">9. JAVASCRIPT FRAMEWORKS</h2>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1630352465172/SmWVLFYVX.png" alt="image.png" /></p>
<p>JavaScript frameworks, instead, are collections of different JavaScript code libraries that are compiled together to make it easy for a developer to refer to and use the scripts. In simple words, frameworks (FM, F/M, FRWK, FWK) are pre-built groups of codes that are put together to make development easy and hassle-free.</p>
<blockquote>
<p>Do share if you find this article to be Helpful. And dont forget to subscribe to my news LETTER for future updates.</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[5 Css Hacks Every Developer Should Know]]></title><description><![CDATA[IDEA CREDIT => @Surreal.dev ** use this method carefully and test it beforehand on every screen size and resolution so that it doesn't break your site's…]]></description><link>https://musprodev.hashnode.dev/5-css-hacks-every-developer-should-know</link><guid isPermaLink="true">https://musprodev.hashnode.dev/5-css-hacks-every-developer-should-know</guid><category><![CDATA[CSS]]></category><category><![CDATA[CSS3]]></category><category><![CDATA[hack]]></category><category><![CDATA[tricks]]></category><category><![CDATA[CSS Frameworks]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Mon, 30 Aug 2021 18:46:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1630347852654/_nY2RYdYi.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>IDEA CREDIT =&gt; <a target="_blank" href="https://instagram.com/surreal.dev">@Surreal.dev</a></p>
<h2 id="1-fixing-an-elements-position">1. FIXING AN ELEMENT'S POSITION</h2>
<pre><code>/* suppose you want to fix your sidebar's position and size. .sidebar {

<span class="hljs-section">position: absolute;</span>

<span class="hljs-section">top: 15px;</span>

<span class="hljs-section">right: 15px;</span>

<span class="hljs-section">width: 300px;</span>

<span class="hljs-section">height: 150px;</span>

}
</code></pre><p>** use this method carefully and test it beforehand on every screen size and resolution so that it doesn't break your site's design.</p>
<h2 id="2-visited-link-styling">2. VISITED LINK STYLING</h2>
<p>Use CSS code to tweak how the links look before and after visitors have clicked on them.</p>
<pre><code><span class="hljs-attribute">a</span>:link {

<span class="hljs-attribute">color</span>: <span class="hljs-number">#ff0000</span>; <span class="hljs-selector-tag">the</span> <span class="hljs-selector-tag">unvisited</span> <span class="hljs-selector-tag">link</span> <span class="hljs-selector-tag">is</span> <span class="hljs-selector-tag">red</span> */

}

<span class="hljs-selector-tag">a</span><span class="hljs-selector-pseudo">:visited</span> {

<span class="hljs-attribute">color</span>: <span class="hljs-number">#ee82ee</span>; <span class="hljs-selector-tag">the</span> <span class="hljs-selector-tag">visited</span> <span class="hljs-selector-tag">link</span> <span class="hljs-selector-tag">turns</span> <span class="hljs-selector-tag">violet</span> */

}
</code></pre><h2 id="3-position-content-in-the-center">3. POSITION CONTENT IN THE CENTER</h2>
<p>Placing content in the middle of the screen might be tricky. However, you can use position: absolute to override the dynamic placement and always position the content in the center.</p>
<pre><code><span class="hljs-selector-tag">section</span> {

<span class="hljs-attribute">position</span>: absolute;

<span class="hljs-attribute">left</span>: <span class="hljs-number">50%</span>;

<span class="hljs-attribute">top</span>: <span class="hljs-number">50%</span>;

<span class="hljs-attribute">transform</span>: <span class="hljs-built_in">translate</span>(-<span class="hljs-number">50%</span>, -<span class="hljs-number">50%</span>); <span class="hljs-attribute">padding</span>: <span class="hljs-number">30px</span>;

}
</code></pre><h2 id="4-hovering-effect-delays">4. HOVERING EFFECT DELAYS</h2>
<p>The :hover selector is a CSS pseudo-class which allows you to create a hovering effect. However, you can further stylise this by adding a transition element to delay the hovering effect.</p>
<pre><code><span class="hljs-selector-class">.entry</span> <span class="hljs-selector-tag">h2</span>{

<span class="hljs-attribute">font-size</span>: <span class="hljs-number">48px</span>; <span class="hljs-attribute">color</span>: <span class="hljs-number">#000000</span>; <span class="hljs-attribute">font-weight</span>: <span class="hljs-number">750</span>;

}

<span class="hljs-comment">/* Next, add a delay to the hover effect */</span>

<span class="hljs-selector-class">.entry</span> <span class="hljs-selector-tag">h2</span><span class="hljs-selector-pseudo">:hover</span>{

<span class="hljs-attribute">color</span>: <span class="hljs-number">#f00</span>;

<span class="hljs-attribute">transition</span>: all <span class="hljs-number">0.5s</span> ease;

}
</code></pre><h2 id="5-initial-letter-stylizing">5. INITIAL LETTER STYLIZING</h2>
<p>Drop caps option is also written into the CSS language, so you can effortlessly use it and give your paragraphs a new look.</p>
<pre><code><span class="hljs-selector-tag">p</span><span class="hljs-selector-pseudo">:first-letter</span> { 

<span class="hljs-attribute">display</span>: block; 

<span class="hljs-attribute">float</span>: left;

<span class="hljs-attribute">margin</span>: <span class="hljs-number">5px</span>; 

<span class="hljs-attribute">color</span>: <span class="hljs-number">#000000</span>; 

<span class="hljs-attribute">font-size</span>: <span class="hljs-number">60px</span>;

}
</code></pre><blockquote>
<p>You can <b>SUBSCRIBE</b> to the my <b>NEWSLETTER</b> to receive updates in your mail</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Introduction To JavaScript]]></title><description><![CDATA[JavaScript, as you might know, is ubiquitous in today’s software development world. It is the foundation of frontend web development and is the key…]]></description><link>https://musprodev.hashnode.dev/introduction-to-javascript</link><guid isPermaLink="true">https://musprodev.hashnode.dev/introduction-to-javascript</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[javascript framework]]></category><category><![CDATA[javascript modules]]></category><category><![CDATA[Javascript library]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Thu, 26 Aug 2021 17:03:42 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1629997241883/cHNp1_vzP.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<blockquote>
<p>💬“In some ways, programming is like painting. You start with a blank canvas and certain basic raw materials. You use a combination of science, art, and craft to determine what to do with them.” (Andrew Hunt)</p>
</blockquote>
<h3 id="why-javascript">Why JavaScript?</h3>
<p>💬“In some ways, programming is like painting. You start with a blank canvas and certain basic raw materials. You use a combination of science, art, and craft to determine what to do with them.” (Andrew Hunt)</p>
<h3 id="why-javascript">Why JavaScript?</h3>
<p>JavaScript, as you might know, is ubiquitous in today’s software development world. It is the foundation of frontend web development and is the key ingredient in frameworks like ReactJS, Angular, and VueJS. It can also help create solid backends with platforms like Nodejs, runs desktop applications like Slack, Atom, and Spotify, and runs on mobile phones as Progressive Web Apps (PWAs).</p>
<p>In short, it is everywhere—and for good reasons. For starters, compared to other languages like C and Java, JavaScript is generally easier to learn. When we say ‘easier’, we mean in terms of how quickly you can go from being a JavaScript novice to someone who can actually make a living writing professional, high quality JavaScript code. So, in that sense, it’s more accessible than some other languages like C and Java.</p>
<p>JavaScript is also a fun and rewarding language, which is especially important when you’re just getting started in software development. The community support is very good, so if you get stuck, there’s a good chance that the problem and its solution already exist on the web.</p>
<h3 id="introduction">INTRODUCTION</h3>
<p>Now that we’ve gotten a bird’s-eye view of JavaScript, let’s get into the more technical detail. JavaScript was created to add ‘life to webpages’. Just like HTML and CSS, JavaScript is written in plain text files with a .js extension.</p>
<p>As previously mentioned, JavaScript can be used to accomplish many useful operations on the frontend, like validating forms, alerting users, storing temporary data, and performing calculations—to name just a few.</p>
<p><b>😎Pro tip:</b> Apart from the name itself, JavaScript has no relation to Java. Beginners often get confused between the two languages. Remember that Java is an entirely different language made for a different purpose (although you’ll still find it running on certain website backends).</p>
<p>Lastly, before we look at today’s itinerary, remember that JavaScript, just like HTML and CSS (but maybe even more so), is a vast language. We’ll only be learning parts of it that are relevant to us today, so we’ll list some good resources at the end if you’d like to learn more.</p>
<p>-------------------- ●●●--------------------</p>
<h2 id="1-javascript-basics">1. JavaScript basics</h2>
<p>JavaScript is a programming language, and like most programming languages, it has some basic constructs that we’ll look at. A program in JavaScript is like a sequence of steps. Similar to how we give directions to a stranger, a computer needs detailed instructions, defined as steps, to accomplish any simple or complex action.</p>
<p>Let’s begin by looking at some basics.</p>
<h3 id="writing-javascript">Writing Javascript</h3>
<p>We’ll create a new file for writing JavaScript called ‘script.js’ in the portfolio directory. Now open the index.html file, and just before the closing body tag (), insert this line.</p>
<pre><code><span class="hljs-tag">&lt;<span class="hljs-name">script</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"script.js"</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
</code></pre><p>That’s it. We have linked our script file in our HTML. Just to make sure it works, write the following code into your script.js file.</p>
<pre><code><span class="hljs-selector-tag">alert</span>(<span class="hljs-string">'hello world'</span>);
</code></pre><p>Save and refresh the page</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629410976099/vTBiK2ov5.png" alt="image.png" /></p>
<p>Notice the dialog box at the top? That’s your first line of JavaScript, the alert code, executing. Try changing the text and refreshing. You can do that in the CodePen below too!</p>
<p>If you followed along with the last section, you have correctly set up the script file. We’re ready to write some JavaScript! Let’s have a look at some important concepts.</p>
<h3 id="variables">Variables</h3>
<p>Variables are friendly names that hold data. Think of how you call a person by their name as opposed to ‘human’ or ‘one head, two eyes, one nose…’ and so on. Variables are simply human-friendly (and descriptive) names for pieces of data. Let’s consider an example.</p>
<pre><code><span class="hljs-built_in">let</span> greeting = <span class="hljs-string">'Hello world'</span>;
</code></pre><p>Here we’re defining a variable called ‘<b>greeting</b>’ and assigning it the value of ‘<b>Hello world</b>’. It almost reads like English–’let greeting be Hello world’–see? Now greeting holds the value ‘Hello world’ in it, and can be used instead of the literal text ‘Hello world’.</p>
<pre><code><span class="hljs-selector-tag">alert</span>(<span class="hljs-string">'hello world'</span>);
</code></pre><p>you could write:</p>
<pre><code><span class="hljs-built_in">let</span> greeting = <span class="hljs-string">'Hello World'</span>;
alert(greeting);
</code></pre><p>Refresh the page and the result should be the same. While it seems like we’re doing more to achieve the same result, in the real world, variables are immensely useful for storing data. Variables can also be used to store different types of data such as numbers, strings, and other variables..</p>
<pre><code><span class="hljs-built_in">let</span> age = 32;
<span class="hljs-built_in">let</span> pi = 3.142;
<span class="hljs-built_in">let</span> alphabet = <span class="hljs-string">'a'</span>;
</code></pre><p>Did you notice how we wrote ‘let’ before the actual variable name? That’s one way of declaring a variable in JavaScript. You can learn more in this <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Grammar_and_types#Declarations">Mozilla guide to declarations</a>.</p>
<p>Also note how each line ends with a semicolon (;). This isn’t strictly needed (except for some specific cases), but it’s best practice to use them, so we recommend you do so.</p>
<h3 id="arithmetic-operators">Arithmetic Operators</h3>
<p>JavaScript can also be used as a calculator. In fact, a lot of the code you’ll see in the wild will have basic calculations everywhere. It supports all the regular functions, called operators, like plus (+), minus (-), multiply (*), divide (/) and so on. You could do something like the following and it should say 5, just as you’d expect. Try running the CodePen below and you should see a popup in the current browser window.</p>
<pre><code><span class="hljs-attribute">alert</span>(<span class="hljs-number">2</span>+<span class="hljs-number">3</span>);
</code></pre><h3 id="comparison-operators">Comparison Operators</h3>
<p>Comparison operators compare two things together. In English and other languages, we often ask questions like ‘Is it warmer today than yesterday’ or ‘Are these two buildings of the same size?’. The answer to these questions is either a yes or a no, and they’re usually comparing two things (today vs yesterday, building 1 vs building 2 etc). In programming terms, it is either a ‘true’ or ‘false’.</p>
<p>We can ask questions like those in JavaScript too! In JavaScript, we have the following comparison operators:</p>
<pre><code><span class="hljs-keyword">Operator</span>      Question <span class="hljs-keyword">in</span> asks

===    Are the two things equal?*
!==    Are the two things unequal?  *
&gt;=    <span class="hljs-keyword">Is</span> the first thing greater 
than <span class="hljs-keyword">or</span> equal <span class="hljs-keyword">to</span> the second?
&lt;=    <span class="hljs-keyword">Is</span> the first thing less thanor equal <span class="hljs-keyword">to</span> the second?
&gt;    <span class="hljs-keyword">Is</span> the first thing greater than the second?
&lt;    <span class="hljs-keyword">Is</span> the first thing less than the second?
</code></pre><p>*There are less strict variants of these, namely == and !=, which enable you to compare two things that may not be of the same type.</p>
<p>“1” == 1 is true, but “1” === 1 is not true, as “1” is a string, while 1 is a number.</p>
<p>We recommend you stick to strict equal/not equal (=== and !==), and avoid the use of == and !=</p>
<h3 id="functions">Functions</h3>
<p>Functions are blocks of code to which we assign a name so that we can reuse them. Say adding two numbers is a common operation for our website. We can write the above code inside a function, as follows:</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">number1, number2</span>) </span>{ 
<span class="hljs-keyword">let</span> sum = number1 + number2; 
<span class="hljs-keyword">return</span> sum;
}
</code></pre><p>See how the function accepts two numbers (number1 and number2, formally called the parameters of the function), adds them, and ‘returns’ the result; in other words, sends the result back to you. Here we’ve defined how the ‘add’ function should behave, but we’re not using it. To use this code, we’ll need to ‘call’ it. Calling a function is simply writing its name and using parentheses to pass in the ‘arguments’ (actual parameters).</p>
<pre><code><span class="hljs-attribute">add</span>(<span class="hljs-number">2</span>, <span class="hljs-number">3</span>)
</code></pre><p>Let’s take another example. Consider a function that ‘alerts’ whatever is sent to it.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">alertMessage</span>(<span class="hljs-params">message</span>) </span>{
alert(message);
}
</code></pre><p>In this function, <b>alertMessage</b> is the function name, <b>message</b> is the parameter and we have no return value (notice the missing return statement).</p>
<p>When we call it as <b>alertMessage(‘Hello World’)</b>, the ‘Hello World’ part is the argument of the function. This is just the tip of the iceberg in the world of functions, but enough to get us moving.</p>
<p>Getting back to the add function, we’ll use it as follows:</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">add</span>(<span class="hljs-params">number1, number2</span>) </span>{
<span class="hljs-keyword">let</span> sum = number1 + number2;
<span class="hljs-keyword">return</span> sum;
}

<span class="hljs-keyword">let</span> num1 = <span class="hljs-number">2</span>;
<span class="hljs-keyword">let</span> num2 = <span class="hljs-number">3</span>;
<span class="hljs-keyword">let</span> sum = add(num1, num2);
alert(sum);
</code></pre><p>Did it run okay? If not, look into the console and see if you have any syntactical errors.</p>
<p>Repeating what we said about variables, this might again seem like more work to do exactly the same thing, and you’d be right in saying that. However, this will help us prepare for something more than just adding two numbers together.</p>
<h3 id="flow-control">Flow control</h3>
<p>Generally, a program in JavaScript will execute line by line. But there are instances when we wish to execute a statement based on some condition, or execute a group of statements multiple times. Such change in the order of execution of code is called flow control.</p>
<p>An example will make it clearer. Suppose you wish to show different messages to your users depending on whether they’re 18 and above or not. In plain English, your logic would be as follows:</p>
<p>If <b>age is less than 18</b>, display “You’re not an adult”, else, display “You’re an adult”</p>
<p>In JavaScript, you’d write the code as follows:</p>
<pre><code><span class="hljs-selector-tag">if</span>(age &lt; <span class="hljs-number">18</span>) { 
 <span class="hljs-selector-tag">alert</span>(<span class="hljs-string">"You’re not an adult"</span>);
} <span class="hljs-selector-tag">else</span> { 
  <span class="hljs-selector-tag">alert</span>(<span class="hljs-string">"You’re an adult"</span>);
}
</code></pre><p>Notice how similar the plain English version is to the JavaScript code. What we just wrote is an example of an if..else statement. Notice the age &lt; 18 part. That’s the condition. We’ve used the less than operator here from the Comparison Operators section above.</p>
<p>The general syntax of if..else is:</p>
<pre><code><span class="hljs-keyword">if</span>(condition) { 
  // code <span class="hljs-keyword">to</span> run <span class="hljs-keyword">if</span> condition <span class="hljs-keyword">is</span> <span class="hljs-keyword">true</span> 
} <span class="hljs-keyword">else</span> { 
  // code <span class="hljs-keyword">to</span> run <span class="hljs-keyword">if</span> condition <span class="hljs-keyword">is</span> <span class="hljs-keyword">false</span>
}
</code></pre><p>We’ll use if..else whenever we’ll need to make a decision in the code–for example, making sure our users have entered the right data.</p>
<h3 id="objects">Objects</h3>
<p>The last important concept needed for our website is the JavaScript object. Objects are simply containers for key-value pairs, similar to what you’d find in a dictionary. In a dictionary, a key is a word and a value is the meaning of the word. In a JavaScript object, a key is a name, and a value can be anything, even other objects. Let’s look at an example:</p>
<pre><code><span class="hljs-built_in">let</span> fullName = { 
  firstName: <span class="hljs-string">'John'</span>, 
  lastName: <span class="hljs-string">'Doe'</span>
}
</code></pre><p>In our example object, which is called ‘fullName’, firstName and lastName are keys, and ‘John’ and ‘Doe’ are the values.</p>
<p>We can access the firstName by using the dot (.) notation. The following will show the alert ‘John’.</p>
<pre><code><span class="hljs-built_in">let</span> fullName = { 
  firstName: <span class="hljs-string">'John'</span>, 
  lastName: <span class="hljs-string">'Doe'</span>
}

alert(fullName.firstName);
</code></pre><p>As mentioned, objects can have other objects and functions inside of them.</p>
<p>We can send an alert, in this case with:</p>
<pre><code><span class="hljs-keyword">let</span> personDetails = {
  <span class="hljs-attr">fullName</span>: {
    <span class="hljs-attr">firstName</span>: <span class="hljs-string">'John'</span>,
    <span class="hljs-attr">lastName</span>: <span class="hljs-string">'Doe'</span> 
  },
  <span class="hljs-attr">alertMessage</span>: <span class="hljs-function"><span class="hljs-keyword">function</span>(<span class="hljs-params">message</span>) </span>{
    alert(message);
  }
}


personDetails.alertMessage(<span class="hljs-string">'Hello World'</span>);
</code></pre><h2 id="2-selecting-html-elements">2. Selecting HTML elements</h2>
<p>The power of JavaScript on the web lies in its power to select and modify the HTML code. For example, we can write a function in JavaScript that gets called when we click the ‘submit’ button in our footer form.</p>
<p>To do that, let’s first select our submit button and attach a ‘click listener’ function to it. When we attach a click listener to an element, it will call that listener function when the button is clicked. To be able to select our button, we’ll give it an ID attribute with a unique ID in our HTML file.</p>
<pre><code>&lt;<span class="hljs-keyword">input</span> <span class="hljs-keyword">type</span>="submit" <span class="hljs-keyword">value</span>="Send Message" id="submit-button" /&gt;
</code></pre><p>Now that we have an ID to select, let’s move to our JavaScript file and use a JavaScript function, document.querySelector() to select our element. Just like we could select HTML elements by their names, class attributes or IDs in CSS, we can the same in JavaScript using this function.</p>
<p><b>document.querySelector</b> takes the selector as its parameter, and returns the HTML element that matched the selector, in the form of an Object (remember that Object are just containers for key-value pairs of data). We can then store this HTML element in a variable, and perform all sorts of operations on it.</p>
<pre><code>let submitButton =  
<span class="hljs-built_in">document</span>.<span class="hljs-built_in">querySelector</span>(<span class="hljs-string">'#submit-button'</span>);
</code></pre><p>Notice how the ID needs to be prefixed by the pound character (#), just like when you select IDs in CSS. If it were a class name you’d use (you guessed it) a period (.), like <b>.submit-button</b></p>
<p><b>Pro tip:</b> When in doubt, try console.log() to ‘log’–that is to display a certain message in the Chrome Developer Console–the variable in JavaScript. For example, after writing the previous line, try logging the submitButton variable with</p>
<pre><code> console.log(submitButton);
</code></pre><p>and check the output. If you see ‘undefined’ or ‘null’, it means something is incorrect.</p>
<p>In general, try tinkering with the developer tools. It takes time, but once you get the hang of it, figuring out what went wrong (‘debugging’) becomes easier.</p>
<h2 id="3-attaching-a-click-listener">3. Attaching a ‘click’ listener</h2>
<p>Now that we have the HTML element selected and stored in a JavaScript variable, let’s add a click listener function to it. A click listener, as the name suggests, listens or waits for a click. We attach click listeners to certain elements that are of our interest–form submit buttons–for example. When the said HTML element is clicked, the click listener function gets called.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">clickListener</span>(<span class="hljs-params"></span>) </span>{ 
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Button clicked'</span>); 
} 

submit.addEventListener(<span class="hljs-string">'click'</span>, clickListener);
</code></pre><p>Notice that the click listener function is just an ordinary function that we pass to the addEventListener() function (yes, passing functions to other functions as arguments is possible and very common in JavaScript!).</p>
<p>But before we try to run this, we’ll need to make some changes to the above code to make sure it runs properly.</p>
<p>You can also try running the CodePen snippet. Click the ‘Send Message’ button and then open the Developer Console in the same window as the one you’re reading this course in. You should see the text Button clicked in the console.</p>
<pre><code><span class="hljs-keyword">let</span> submitButton = 
<span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'#submit-button'</span>);

<span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">clickListener</span>(<span class="hljs-params">event</span>) </span>{
  event.preventDefault();
  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'Button clicked'</span>);
}


submitButton.addEventListener(<span class="hljs-string">'click'</span>, clickListener);
</code></pre><p>Essentially, we’re taking the event parameter supplied to our function, which contains the details of the click event (like what was clicked, button properties, etc), and preventing the form from refreshing the page with event.preventDefault()</p>
<p>Save and reload. Open the Developer Tools, Console tab and try clicking the button.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629654338775/oAtPHaSHg.png" alt="image.png" /></p>
<p>Hurray!! It works.</p>
<p>Our next step is to get the values entered into the form using JavaScript.</p>
<h2 id="4-getting-user-entered-values">4. Getting user entered values</h2>
<p>We have a form on our webpage, but we haven’t talked about how we’ll extract the data that a user might enter in our form. To make any form ‘work’, we generally get the data (that is, text in our case) inside of the form elements (inputs, textareas etc) into JavaScript variables and then send it to the server. Optionally, many developers like to do some validations (that is, checks) on the data before sending it to the server. An example validation could be checking the format of the email entered.</p>
<p>Remember the document.querySelector we used in the previous section? We used it to select HTML elements. Since form inputs are nothing but HTML elements, and the data that a user might enter in those inputs is stored inside of the HTML elements, we could use the same document.querySelector and select our HTML elements.</p>
<p>Then, we need to know a crucial piece of information. An HTML input’s value, or the data inside of it, can be accessed via the ‘value’ key. Remember Objects? The HTML input element object will have a ‘value’ key that holds the current text inside of the element.</p>
<p>Finally, we’ll console.log the values from the input and textarea and see what we’re getting in the emailText and messageText variables.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">clickListener</span>(<span class="hljs-params">event</span>) </span>{ 
  event.preventDefault();

  <span class="hljs-keyword">let</span> emailInput = 
<span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'#email'</span>); 
  <span class="hljs-keyword">let</span> messageInput = 
<span class="hljs-built_in">document</span>.querySelector(<span class="hljs-string">'#message'</span>);

  <span class="hljs-keyword">let</span> emailText = emailInput.value; 
  <span class="hljs-keyword">let</span> messageText = messageInput.value;

  <span class="hljs-built_in">console</span>.log(<span class="hljs-string">'email:'</span>, emailText, <span class="hljs-string">'message:'</span>, messageText);
</code></pre><p>Perfect! Did you see how the message just logs, flawlessly? Beautiful, we say. Instead of just printing the emailText and messageText, we’ve formatted it a bit using console.log('email:', emailText, …) which will print it nicely with the label email: printed as is.</p>
<p>It is possible that you might see some errors at this point. Just go back and make sure you type it exactly as it is. Play around and try different inputs. Did you notice any issues?</p>
<p>Pro tip: It is important to make mistakes. You should get used to seeing error messages and knowing what they mean. It might feel a bit cryptic in the beginning, but practice is the key. So whether you get it right straight away or after a bit of trying, there’s always something to be learned.</p>
<h2 id="5-javascript-validations">5. JavaScript validations</h2>
<p>If you played around a bit in the previous section, you’ll have noticed something weird. Although the input fields say email and message, you can pretty much enter anything into it and it would still accept and print it.</p>
<p>In fact, it even allows you to enter empty an empty email address and message. That’s not good. We’ll need to set some restrictions for what gets entered, especially the email field. For our purposes, checking to see if the text entered in the email field has an ‘@’ character will do. In the real world, you’ll want to do more stringent checks on the data.</p>
<p>For validating email, we need to write a validation function. Validation, as mentioned in the previous section, are checks. They could be checks to make sure the data is in the format we expect, or to filter any unwanted words from the text, or anything else. They serve as an easy way to let the users know about any errors in their data submissions.</p>
<p>In our email address validation example, our check for ‘@’ might catch the instance where our users forget to type ‘@’ or mistype their email addresses.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">emailValidate</span>(<span class="hljs-params">email</span>) </span>{ 
  <span class="hljs-keyword">if</span>(email.includes(<span class="hljs-string">'@'</span>)) { 
    <span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
  } <span class="hljs-keyword">else</span> { 
    <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  }
}
</code></pre><p>This function checks if the supplied text parameter email contains the ‘@’ character. It’s using something called a conditional (the ‘if’ and ‘else’ that you see). You can read it as, if yes, it returns true. Otherwise, it returns false. Let’s test it in our clickListener function by logging it to the console.</p>
<pre><code> console.log(emailValidate(<span class="hljs-string">'abc@xyz.cm'</span>));
</code></pre><p>Okay, it works! It isn’t perfect, but it does demonstrate how expressive JavaScript is. Now we can bring everything together inside our clickListener function and display the appropriate message.</p>
<p>if(emailValidate(emailText) !== true) {
  console.log('The email address must contain @'); 
  return false;
} 
console.log('Thanks for your message');</p>
<p>Try it and view the results in your browser’s Developer Tools console.</p>
<pre><code><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">emailValidate</span>(<span class="hljs-params">email</span>) </span>{
  <span class="hljs-keyword">if</span>(email.includes(<span class="hljs-string">'@'</span>)) {
<span class="hljs-keyword">return</span> <span class="hljs-literal">true</span>;
  }
  <span class="hljs-keyword">else</span> {
    <span class="hljs-keyword">return</span> <span class="hljs-literal">false</span>;
  }
}
</code></pre><p>Here, we’re first checking the email. If it fails, we log the error message and return false (which is one way of preventing further execution of a function, meaning that our last console.log will not be executed).</p>
<p>If the ‘if’ block are not executed (which means return false wasn’t encountered and the function is still running), we assume all went well and display a success message. Pretty sweet, huh?</p>
<p>Did you get it right? Great job! If not, just look carefully. You’ll find the bug. Remember, debugging is a critical developer skill!</p>
<blockquote>
<p>Thanks for getting to the end of this article</p>
</blockquote>
<h3 id="contact-me">CONTACT ME</h3>
<p>● <a target="_blank" href="https://t.me/musprodev">Telegram</a></p>
<p>● <a target="_blank" href="https://instagram.com/musprodev">Instagram</a></p>
<blockquote>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://buymeacoffee.com/musprodev">https://buymeacoffee.com/musprodev</a></div>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[What is a CDN? | How do CDNs work?]]></title><description><![CDATA[Explore how a CDN works under the hood to deliver fast, efficient and secure delivery of content to websites and Internet services. A content delivery…]]></description><link>https://musprodev.hashnode.dev/what-is-a-cdn-or-how-do-cdns-work</link><guid isPermaLink="true">https://musprodev.hashnode.dev/what-is-a-cdn-or-how-do-cdns-work</guid><category><![CDATA[CDN]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[Productivity]]></category><category><![CDATA[server]]></category><category><![CDATA[Cloud]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Tue, 17 Aug 2021 20:48:50 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1629233197678/K2CC1ZNH6.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Explore how a CDN works under the hood to deliver fast, efficient and secure delivery of content to websites and Internet services.</p>
<iframe width="345" height="auto" src="https://youtube.com/embed/841kyd_mfH0"></iframe>

<h2 id="what-is-cdn">What is CDN ?</h2>
<p>A content delivery network (CDN) refers to a geographically distributed group of servers which work together to provide fast delivery of Internet content.</p>
<p>A CDN allows for the quick transfer of assets needed for loading Internet content including HTML pages, javascript files, stylesheets, images, and videos. The popularity of CDN services continues to grow, and today the majority of web traffic is served through CDNs, including traffic from major sites like Facebook, Netflix, and Amazon.</p>
<p>A properly configured CDN may also help protect websites against some common malicious attacks, such as <a target="_blank" href="https://www.cloudflare.com/learning/ddos/what-is-a-ddos-attack/">Distributed Denial of Service (DDOS) attacks</a></p>
<h2 id="is-a-cdn-the-same-as-a-web-host">Is a CDN the same as a web host?</h2>
<p>While a CDN does not host content and can’t replace the need for proper web hosting, it does help cache content at the network edge, which improves website performance. Many websites struggle to have their performance needs met by traditional hosting services, which is why they opt for CDNs.</p>
<p>By utilizing caching to reduce hosting bandwidth, helping to prevent interruptions in service, and improving security, CDNs are a popular choice to relieve some of the major pain points that come with traditional web hosting.</p>
<h2 id="what-are-the-benefits-of-using-a-cdn">What are the benefits of using a CDN?</h2>
<p>Although the benefits of using a CDN vary depending on the size and needs of an Internet property, the primary benefits for most users can be broken down into 4 different components:</p>
<ul>
<li><p>Improving website load times - By distributing content closer to website visitors by using a nearby CDN server (among other optimizations), visitors experience faster page loading times. As visitors are more inclined to click away from a slow-loading site, a CDN can reduce bounce rates and increase the amount of time that people spend on the site. In other words, a faster a website means more visitors will stay and stick around longer.</p>
</li>
<li><p>Reducing bandwidth costs - Bandwidth consumption costs for website hosting is a primary expense for websites. Through caching and other optimizations, CDNs are able to reduce the amount of data an origin server must provide, thus reducing hosting costs for website owners.</p>
</li>
<li><p>Increasing content availability and redundancy - Large amounts of traffic or hardware failures can interrupt normal website function. Thanks to their distributed nature, a CDN can handle more traffic and withstand hardware failure better than many origin servers.</p>
</li>
<li><p>Improving website security - A CDN may improve security by providing DDoS mitigation, improvements to security certificates, and other optimizations.</p>
</li>
</ul>
<h2 id="how-does-a-cdn-work">How does a CDN work?</h2>
<p>At its core, a CDN is a network of servers linked together with the goal of delivering content as quickly, cheaply, reliably, and securely as possible. In order to improve speed and connectivity, a CDN will place servers at the exchange points between different networks.</p>
<p>These Internet exchange points (IXPs) are the primary locations where different Internet providers connect in order to provide each other access to traffic originating on their different networks. By having a connection to these high speed and highly interconnected locations, a CDN provider is able to reduce costs and transit times in high speed data delivery.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629231598535/p9iCZihZL.png" alt="image.png" /></p>
<p>Beyond placement of servers in IXPs, a CDN makes a number of optimizations on standard client/server data transfers. CDNs place Data Centers at strategic locations across the globe, enhance security, and are designed to survive various types of failures and Internet congestion.</p>
<h2 id="latency-how-does-a-cdn-improve-website-load-times">Latency - How does a CDN improve website load times?</h2>
<p>When it comes to websites loading content, users drop off quickly as a site slows down. CDN services can help to reduce load times in the following ways:</p>
<ul>
<li><p>The globally distributed nature of a CDN means reduce distance between users and website resources. Instead of having to connect to wherever a website’s origin server may live, a CDN lets users connect to a geographically closer data center. Less travel time means faster service.</p>
</li>
<li><p>Hardware and software optimizations such as efficient load balancing and solid-state hard drives can help data reach the user faster.</p>
</li>
<li><p>CDNs can reduce the amount of data that’s transferred by reducing file sizes using tactics such as minification and file compression. Smaller file sizes mean quicker load times</p>
</li>
<li><p>CDNs can also speed up sites which use TLS/SSL certificates by optimizing connection reuse and enabling TLS false start.</p>
</li>
</ul>
<blockquote>
<p><a target="_blank" href="https://www.cloudflare.com/learning/cdn/performance/">Explore all the ways a CDN helps websites load faster</a></p>
</blockquote>
<h2 id="reliability-and-redundancy-how-does-a-cdn-keep-a-website-always-online">Reliability and Redundancy - How does a CDN keep a website always online?</h2>
<p>Uptime is a critical component for anyone with an Internet property. Hardware failures and spikes in traffic, as a result of either malicious attacks or just a boost in popularity, have the potential to bring down a web server and prevent users from accessing a site or service. A well-rounded CDN has several features that will minimize downtime:</p>
<ul>
<li><p>Load balancing distributes network traffic evenly across several servers, making it easier to scale rapid boosts in traffic.</p>
</li>
<li><p>Intelligent failover provides uninterrupted service even if one or more of the CDN servers go offline due to hardware malfunction; the failover can redistribute the traffic to the other operational servers.</p>
</li>
<li><p>In the event that an entire data center is having technical issues, Anycast routing transfers the traffic to another available data center, ensuring that no users lose access to the website.</p>
</li>
</ul>
<blockquote>
<p><a target="_blank" href="https://www.cloudflare.com/learning/cdn/cdn-load-balance-reliability/">Learn more about how a CDN helps keep websites online</a></p>
</blockquote>
<h2 id="data-security-how-does-a-cdn-protect-data">Data Security - How does a CDN protect data?</h2>
<p>Information security is an integral part of a CDN. a CDN can keep a site secured with fresh TLS/SSL certificates which will ensure a high standard of authentication, encryption, and integrity. Investigate the security concerns surrounding CDNs, and explore what can be done to securely deliver content. <a target="_blank" href="https://www.cloudflare.com/learning/cdn/cdn-ssl-tls-security/">Learn about CDN SSL/TLS security</a></p>
<h2 id="bandwidth-expense-how-does-a-cdn-reduce-bandwidth-costs">Bandwidth Expense - How does a CDN reduce bandwidth costs?</h2>
<p>Every time an origin server responds to a request, bandwidth is consumed. See how a CDN, like the Cloudflare CDN, cuts down on origin requests and reduces bandwidth costs.</p>
<blockquote>
<p>Subscribe to my newsletter for more articles</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[A Study Plan To Cure JavaScript Fatigue]]></title><description><![CDATA[A study plan to cure javascript fatigue]]></description><link>https://musprodev.hashnode.dev/a-study-plan-to-cure-javascript-fatigue</link><guid isPermaLink="true">https://musprodev.hashnode.dev/a-study-plan-to-cure-javascript-fatigue</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[javascript framework]]></category><category><![CDATA[Javascript library]]></category><category><![CDATA[Redux]]></category><category><![CDATA[learning]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Mon, 16 Aug 2021 12:52:34 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1629115576621/yJG5k3YMx.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p> I’m going to give you a concrete, step-by-step study plan to conquering the JavaScript ecosystem.</p>
<h3 id="who-is-this-for">Who Is This For</h3>
<p>This study plan is for you if:</p>
<ul>
<li>You’re already familiar with basic programming concepts like variables and functions.</li>
<li>You might have already done back-end work with languages such as PHP and Python, and maybe used front-end libraries such as jQuery for a few simple hacks.</li>
<li>You now want to get into more serious front-end development but are drowning in frameworks and libraries before you’ve even started.</li>
</ul>
<h3 id="things-well-cover">Things We’ll Cover</h3>
<ul>
<li>What a modern JavaScript web app looks like</li>
<li>Why you can’t just use jQuery</li>
<li>Why React is the safest pick</li>
<li>Why you may not need to “learn JavaScript properly” first</li>
<li>How to learn ES6 syntax</li>
<li>Why and how to learn Redux</li>
<li>What GraphQL is and why it’s a big deal</li>
<li>Where to go next</li>
</ul>
<h3 id="resources-mentioned-here">Resources Mentioned Here</h3>
<p><b>Disclaimer:</b> this post will include a few affiliate links to courses by <a target="_blank" href="http://wesbos.com/">Wes Bos</a>, but the material is recommended because I genuinely think it’s good, and not just because of the affiliate scheme.
If you would rather find other resources, Mark Erikson maintains a great list of <a target="_blank" href="https://github.com/markerikson/react-redux-links">React</a>, <a target="_blank" href="https://github.com/markerikson/react-redux-links">ES6</a>, and <a target="_blank" href="https://github.com/markerikson/react-redux-links">Redux</a> links.</p>
<h2 id="javascript-vs-javascript">JavaScript vs JavaScript</h2>
<p>Before we start, we need to make sure we’re talking about the same thing. If you google “Learn JavaScript” or “JavaScript study plan”, you’ll find a ton of resources that teach you how to learn the JavaScript language.</p>
<p>But that’s actually the easy part. While you can definitely dig deep and learn the intricacies of the language, the truth is most web apps use relatively simple code. In other words, 80% of what you’ll ever need to write web apps is typically covered in the first few chapters of your typical JavaScript book.</p>
<p>No, the hard problem is mastering the JavaScript ecosystem, with its countless competing frameworks and libraries. The good news is, that’s exactly what this study plan focuses on.</p>
<h3 id="the-building-blocks-of-javascript-apps">The Building Blocks Of JavaScript Apps</h3>
<p>In order to understand why modern JavaScript apps seem so complex, you first have to understand how they work.</p>
<p>For starters, let’s look at a “traditional” web app circa 2008:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629116237212/ELRXH56Hf.png" alt="image.png" /></p>
<ol>
<li>The database sends data to your back-end (e.g. your PHP or Rails app).</li>
<li>The back-end reads that data and outputs HTML.</li>
<li>The HTML is sent to the browser, which displays it as the DOM (basically, a web page)</li>
</ol>
<p>Now a lot of these apps also sprinkled in some JavaScript code on the client to add interactivity, such as tabs and modal windows. But fundamentally, the browser was still receiving HTML and going from there.</p>
<p>Now compare this with a “modern” 2016 web app (also known as the “Single Page App”):</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629116319708/bvx-5sxeZ.png" alt="image.png" />
Notice the difference? Instead of sending HTML, the server now sends data, and the “data to HTML” conversion step happens on the client instead (which is why you’re also sending along the code that tells the client how to perform said conversion).</p>
<p>This has many implications. First, the good:</p>
<ul>
<li><p>For a given piece of content, sending only data is faster than sending entire HTML pages.</p>
</li>
<li><p>The client can swap in content instantly without having to ever refresh the browser window (thus the term “Single Page App”).</p>
</li>
</ul>
<p>The Bad:</p>
<ul>
<li><p>The initial load takes longer since the “data to HTML” codebase can grow quite large.</p>
</li>
<li><p>You now need a place to store and manage the data on the client too, in case you want to cache it or inspect it.</p>
</li>
</ul>
<p>And the ugly:</p>
<ul>
<li>Congratulations — you now have to deal with a client-side stack, which can get just as complex as your server-side stack.</li>
</ul>
<h2 id="the-client-server-spectrum">The Client-Server Spectrum</h2>
<p>So why go through all this trouble if there are so many downsides? Why not just stick to the good old PHP apps of old?</p>
<p>Well, imagine you’re building a calculator. If the user wants to know what 2 + 2 is, it doesn’t make sense to go all the way back to the server to perform the operation when the browser is perfectly capable of doing it.</p>
<p>On the other hand, if you’re building a purely static site such as a blog, it’s perfectly fine to generate the final HTML on the server and be done with it.</p>
<p>The truth is, most web apps fall somewhere in the middle of the spectrum. The problem is knowing where.</p>
<p>But the key thing is that the spectrum is not continuous: you can’t start with a pure server-side app and slowly move towards a pure client-side app. At some point (the Divide), you’ll be forced to stop and refactor everything, or else end up with a mess of unmaintainable spaghetti code.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629116550715/o5JDUrSvX.png" alt="image.png" />
This is why you shouldn’t “just use jQuery” for everything. You can think of jQuery like duct tape. It’s amazingly handy for small fixes around the house, but if you keep adding more and more things will start looking ugly.</p>
<p>On the other hand, modern JavaScript frameworks are more like 3D-printing a replacement piece: it takes more time, but the result is a lot cleaner and sturdier.</p>
<p>In other words, mastering the modern JavaScript stack is a bet that no matter where they start, most web apps will probably end up on the right side of the divide sooner or later. So yes, it’s more work, but better safe than sorry.</p>
<h2 id="week-0-javascript-basics">Week 0: JavaScript Basics</h2>
<p>Unless you’ve a pure back-end developer, you probably know some JavaScript. And even if you don’t, JavaScript’s C-like syntax will look somewhat familiar if you’re a PHP or Java developer.</p>
<p>But if JavaScript is a complete mystery to you, don’t despair. There are a lot of free resources out there that will quickly bring you up to speed. For example, a good place to start is <a target="_blank" href="https://www.codecademy.com/learn/javascript">Codecademy’s JavaScript lessons.</a></p>
<h2 id="week-1-start-with-react">Week 1: Start With React</h2>
<p>Now that you know basic JavaScript syntax, and that you understand why JavaScript apps can appear so complex, let’s talk specifics. Where should you <a target="_blank" href="https://facebook.github.io/react/">start</a>?</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629116733856/zFnalbw8y.png" alt="image.png" /></p>
<p>React is a UI library created and open-sourced by Facebook. In other words, it takes care of that “data to HTML” step (the View Layer).</p>
<p>Now don’t get me wrong: I’m not telling you to pick React because it’s the best library out there (because that’s highly subjective), but because it’s pretty good.</p>
<ul>
<li>React might not be the most popular library, but it’s pretty popular.</li>
<li>React might not be the most lightweight library, but it’s pretty lightweight.</li>
<li>React might not be the easiest to learn, but it’s pretty easy to learn.</li>
<li>React might not be the most elegant library, but it’s pretty elegant.</li>
</ul>
<p>In other words, React might not be the best choice in every situation, but I believe it’s the safest. And believe me, “just when you’re starting out” is not the right time to take risks with your technological choices.</p>
<p>React will also introduce you to some useful concepts like components, application state, and stateless functions that will prove useful no matter which framework or libraries you end up using during your career.</p>
<p>Finally, React has a large ecosystem of other packages and libraries that work well with it. And its sheer popularity means you’ll be able to find a lot of help on sites like Stack Overflow.</p>
<p>I personally recommend the <a target="_blank" href="https://reactforbeginners.com/friend/STATEOFJS">React for Beginners course</a> by Wes Bos. It’s how I learned React myself, and it’s just been completely overhauled with the latest React best practices.</p>
<h3 id="should-you-learn-javascript-properly-first">Should You “Learn JavaScript Properly” First?</h3>
<p>If you’re a very methodical learner, you might want to get a good grasp of the fundamentals of JavaScript before you do anything else.</p>
<p>But for others, this feels like learning to swim by studying human anatomy and fluid dynamics. Sure, they both play a huge role in swimming, but it’s more fun to just jump in the pool!</p>
<p>There’s no right or wrong answer here, it all depends on your learning style. The truth is, most basic React tutorials will probably use only a tiny subset of JavaScript anyway, so it’s perfectly fine to focus on only what you need now and leave the rest for later.</p>
<p>This also applies to the JavaScript ecosystem at large. Don’t worry too much about understanding the ins and outs of things like Webpack or Babel for now. In fact React recently came out with its own little command-line utility that lets you create apps with no build configuration whatsoever.</p>
<h2 id="week-2-your-first-react-project">Week 2: Your First React Project</h2>
<p>Let’s assume you’ve just completed a React course. If you’re like me, two things are probably true:</p>
<ul>
<li>You’ve already forgotten half of what you just learned.</li>
<li>You can’t wait to put the half you do remember in practice.</li>
</ul>
<p>I believe the best way to learn a framework or a language is to just use it. And personal projects are the perfect occasion to try out new technologies.</p>
<p>A personal project could be anything from a single page to a complex web app, but I feel like redesigning your own personal site can be a good middle ground. Plus, I know you’ve probably been putting it off for years!</p>
<p>Now I did say earlier that using single-page apps for static content was often overkill, but React actually has a secret weapon: Gatsby, a React static site generator that lets you “cheat” and get all the benefits of React without any of the downsides</p>
<p>Here’s why Gatsby is a great way to get started with React:</p>
<ul>
<li>A pre-configured Webpack, meaning you get all the benefits without any of the headaches.</li>
<li>Automatic routing based on your directory structure.</li>
<li>All HTML content is also generated server-side, so you get the best of both worlds.</li>
<li>Static content means no server and super-easy hosting on GitHub Pages.</li>
</ul>
<p>I used Gatsby for the <a target="_blank" href="http://stateofjs.com/">State Of JavaScript site</a>, and not having to worry about routing, build tool configuration, or server-side rendering saved me a ton of time.</p>
<h2 id="week-3-mastering-es6">Week 3: Mastering ES6</h2>
<p>In my own quest to learn React, I soon reached a point where I could get by copy-pasting code samples, but there was still a lot I didn’t understand.</p>
<p>Specifically, I was unfamiliar with all the new features introduced by ES6, such as:</p>
<ul>
<li>Arrow functions</li>
<li>Object destructuring</li>
<li>Classes</li>
<li>The spread operator</li>
</ul>
<p>If you’re in the same boat, it might be time to take a couple days and learn ES6 properly. If you enjoyed the React for Beginners course, you might want to check out Wes’ excellent <a target="_blank" href="https://es6.io/friend/stateofjs">ES6 for Everybody</a> videos.</p>
<p>Or if you prefer free resources, check out <a target="_blank" href="https://ponyfoo.com/books/practical-es6/chapters">Nicolas Bevacqua’s book</a>, <a target="_blank" href="https://ponyfoo.com/books/practical-es6/chapters">Practical ES6.</a></p>
<p>A good exercise for mastering ES6 is going through an older codebase (such as the one you just created in Week 2!) and converting your code to ES6's shorter, terser syntax whenever possible.</p>
<h2 id="week-4-taking-on-state-management">Week 4: Taking On State Management</h2>
<p>As this point you should be capable of building a simple React front-end backed by static content.</p>
<p>But real web apps are not static: they need to get their data from somewhere, generally a database of some kind.</p>
<p>Now you could just send data to your individual components, but that quickly gets messy. For example, what if two components need to display the same piece of data? Or need to talk to each other?</p>
<p>This is where State Management comes in. Instead of storing your state (in other words, your data) bit by bit in each component, you store it in a single global store that then dispatches it to your React components:</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629117310088/ugI_gj2TP.png" alt="image.png" /></p>
<p>In the React world, the most popular state management library is Redux. Redux not only helps centralize your data, but it also enforces some strict protocols for manipulating this data.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629117408363/yR-9kVMlM.png" alt="image.png" /></p>
<p>You can think of Redux as a bank: you can’t go to your local branch and manually modify your account total (“here, let me just add a couple extra zeroes!”). Instead, you fill out a deposit form, then give it to a bank teller authorized to perform the action.</p>
<p>Similarly, Redux also won’t let you modify your global state directly. Instead, you pass actions to reducers, special functions that perform the operation and return the new, updated state as a result.</p>
<p>The result of all this extra work is a highly standardized and maintainable data flow throughout your app, and access to tools such as the <a target="_blank" href="https://github.com/gaearon/redux-devtools">Redux Devtools</a> to help you visualize it:</p>
<p>Once again you can stay with our friend Wes and learn Redux with his <a target="_blank" href="https://learnredux.com/">Redux course</a>, which is actually completely free!</p>
<p>Or, you can check out Redux creator Dan Abramov’s <a target="_blank" href="https://egghead.io/courses/getting-started-with-redux">video series on egghead.io</a>, which is free as well.</p>
<h2 id="bonus-week-5-building-apis-with-graphql">Bonus Week 5: Building APIs With GraphQL</h2>
<p>So far we’ve pretty much only talked about the client, and that’s only half the equation. And even without going into the whole Node ecosystem, it’s important to address one key aspect of any web app: how data gets from the server to the client.</p>
<p>It won’t come as a surprise that this, too, is rapidly changing, with GraphQL (yet another Facebook open-source project) emerging as a serious alternative to the traditional REST APIs.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629117659590/6MCTqtK9N.png" alt="image.png" /></p>
<p>Whereas a REST API exposes multiple REST routes that each give you access to a predefined dataset (say, /api/posts, /api/comments, etc.), GraphQL exposes a single endpoint that lets the client query for the data it needs.</p>
<p>Think of it as making multiple trips to the butcher shop, bakery, and grocery store, versus giving someone a shopping list and sending them on their way to all three.</p>
<p>This new strategy becomes especially significant when you need to query multiple data sources. Just like with our shopping list example, you can now get data back from all these sources with a single request.</p>
<p>GraphQL has been picking up steam over the past year or so, with many projects (such Gatsby, which we used in Week 2) planning on adopting it.</p>
<p>GraphQL itself is just a protocol, but its best implementation right now is probably the Apollo library, which works well with Redux. There is still a lack of instructional material around GraphQL and Apollo, but hopefully the Apollo documentation can help you get started.</p>
<h2 id="beyond-react-and-co">Beyond React &amp; Co</h2>
<p>I recommended you start with the React ecosystem because it’s a safe pick, but it’s by no means the only valid front-end stack. If you want to keep exploring, here are two recommendations:</p>
<h2 id="vue">Vue</h2>
<p>Vue is a relatively new library but it’s growing at record speeds and has already been adopted by major companies, especially in China where it’s being used by the likes of Baidu and Alibaba (think Chinese Google and Chinese Amazon). And it’s also the official front-end layer of PHP framework Laravel.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629117764018/yxAF6Y9e7.png" alt="image.png" /></p>
<p>Compared to React, some of its key selling points are:</p>
<ul>
<li>Officially-maintained routing and state management libraries.</li>
<li>Focus on performance.</li>
<li>Lower learning curve thanks to using HTML-based templates.</li>
<li>Less boilerplate code.</li>
</ul>
<p>As it stands, the two main things that still give React an edge over Vue are the size of the React ecosystem, and React Native (more on this later). But I wouldn’t be surprised to see Vue catch up soon!</p>
<h2 id="elm">Elm</h2>
<p>If Vue is the more approachable option, Elm is the more cutting-edge one. Elm is not just a framework, but an entire new language that compiles down to JavaScript.</p>
<p>This brings multiple advantages, such as improved performance, enforced semantic versioning, and no runtime exceptions.</p>
<p>I haven’t tried Elm personally, but it’s been warmly recommended by friends and Elm users generally seem very happy with it (as shown by its 84% satisfaction rating in the State Of JavaScript survey).</p>
<h2 id="next-steps">Next Steps</h2>
<p>By now you should have a pretty good grasp of the entire React front-end stack, and hopefully be reasonably productive with it.</p>
<p>That doesn’t mean you’re done though! This is only the beginning of your journey through the JavaScript ecosystem. Some of the other topics you’ll eventually run into include:</p>
<ul>
<li>JavaScript on the server (Node, Express…)</li>
<li>JavaScript testing (Jest, Enzyme…)</li>
<li>Build tools (Webpack…)</li>
<li>Type systems (TypeScript, Flow…)</li>
<li>Dealing with CSS in your JavaScript apps (CSS Modules, Styled Components…)</li>
<li>JavaScript for mobile apps (React Native…)</li>
<li>JavaScript for desktop apps (Electron…)</li>
</ul>
<p>I can’t cover all this here but don’t despair! The first step is always the hardest, and guess what: you’ve just taken it by reading this study plan.</p>
<p>And now that you understand how the various pieces of the ecosystem fit together, it’s just a matter of lining up what you want to learn next and knocking down a new technology each month.</p>
<h2 id="keep-in-touch">Keep In Touch</h2>
<p>Did you find this study plan helpful? Which area of JavaScript would you like me to write about next? Leave a comment or <a target="_blank" href="https://t.me/musprodev">telegram me</a> to let me know!</p>
<p>And if you want to know next time I publish a post, you can also sign up to my newsletter.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://buymeacoffee.com">https://buymeacoffee.com</a></div>
]]></content:encoded></item><item><title><![CDATA[Coding Websites Where You Can Learn How to Code for Free]]></title><description><![CDATA[In this day and age, it seems like everyone is learning to code. Maybe you want to know how websites work, or you think back fondly on the old blogging…]]></description><link>https://musprodev.hashnode.dev/coding-websites-where-you-can-learn-how-to-code-for-free</link><guid isPermaLink="true">https://musprodev.hashnode.dev/coding-websites-where-you-can-learn-how-to-code-for-free</guid><category><![CDATA[coding]]></category><category><![CDATA[learning]]></category><category><![CDATA[learn coding]]></category><category><![CDATA[Learning Journey]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Mon, 16 Aug 2021 06:33:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1629093656972/xkwphrZ_z.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this day and age, it seems like everyone is learning to code. Maybe you want to know how websites work, or you think back fondly on the old blogging platforms where you could hack together some HTML to personalize them.</p>
<p>Or maybe you are curious to learn what all this coding craze is about so you can get started developing apps and websites yourself.</p>
<p>If that's the case, then this article can help you figure out where to start.</p>
<h2 id="why-and-how-should-you-teach-yourself-coding">Why – and How – Should You Teach Yourself Coding?</h2>
<p>Coding is a field that is accessible to everyone. And to get a tech job, you don't necessarily need a degree from an expensive university. As long as you are able to show that you are good at coding, you can get a job.</p>
<p>Tech is so accessible partly because of all the free resources you can use to teach yourself to code. But this can also be a challenge: how do you navigate through all these courses, articles, bootcamps, and discussion threads?</p>
<p>It's usually a good idea to choose one main resource from which to start learning. It can be a curriculum or an ordered list of topics, whatever works for you. Then follow that plan.</p>
<p>It's ok to make brief detours and use other materials that might help you out when you're stuck, but try to do that only if the resources you have are not enough.</p>
<p>When you finish a curriculum or a course, you may be tempted to start another one on the same topic right away. But instead of doing that, you should build projects with what you just learned to learn it better.</p>
<p>You will likely have enough basic knowledge to build simple projects, and in the process you'll figure out what you know and don't know.</p>
<p>To help you find some learning resources that are right for you, in this article I'll share various websites where you can learn to code for free.</p>
<p>I've used most these tools myself while learning to code, and I use some of them even now. And if I haven't personally used them, I made sure to choose resources that have really positive feedback.</p>
<h2 id="freecodecamporg">freeCodeCamp.org</h2>
<p>If you are here, you may have noticed that this is freeCodeCamp's publication. Here at freecodecamp.org/news there are thousands of articles on programming and related topics that you may find really useful along your learning path.</p>
<p>You can bookmark these articles to help you learn new topics or find different explanations for topics you are struggling with.</p>
<p>Also, the freeCodeCamp learning platform has a full-stack web development curriculum based on the MERN stack (Mongo, Express, React, NodeJS), and an expanding curriculum on Python and Data Science.</p>
<p>The freeCodeCamp forum is also a really friendly place to get help with the curriculum and programming help in general.</p>
<p>Finally, the FreeCodeCamp YouTube channel has thousands of hours of video tutorials on various programming topics. It has a much wider variety of topics than the curriculum, so if you are not interested in web devoplment, or want to look at other specific topics in more detail, definitely check the YouTube channel out.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.freecodecamp.org">https://www.freecodecamp.org</a></div>
<h2 id="khan-academykhanacademycom"><a target="_blank" href="khanacademy.com">Khan Academy</a></h2>
<p>Khan Academy offers courses in a lot of subjects, including introductory courses on programming and computer science.</p>
<p>It teaches JavaScript, HTML, CSS and SQL basics through interactive walkthroughs, with visual representations of the code changes. It's a great place to start if you're a total beginner.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.khanacademy.org/">https://www.khanacademy.org/</a></div>
<h2 id="the-odin-project">The Odin Project</h2>
<p>The Odin Project's full stack curriculum is free and supported by an open source community. It teaches you how to set up your own environment, and focuses on Ruby, Ruby on Rails, HTML, CSS, JavaScript, and NodeJS.</p>
<p>The curriculum contains dozens of assignments that'll help you build portfolio-worthy projects. And you can connect with the friendly community of beginners and experienced developers.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.theodinproject.com/">https://www.theodinproject.com/</a></div>
<h2 id="grasshopper">Grasshopper</h2>
<p>Grasshopper is a coding app for beginners. It is a phone app that uses fun quick lessons of increasing difficulty to teach you to write real JavaScript.</p>
<p>Grasshopper can be an ever present companion, always in your pocket, while you build your fundamentals. It can help get you ready for your next steps in learning web development.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://grasshopper.app/">https://grasshopper.app/</a></div>
<h2 id="mitopencourseware">MitOpenCourseware</h2>
<p>The MitOpenCourseware video courses section on Computer Science and Electrical Engineering offers a lot of video courses at the Graduate and Undergraduate level to improve your theoretical knowledge of computer science topics.</p>
<p>It covers areas like data structures, algorithms, artificial intelligence, and much more.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://ocw.mit.edu/courses/audio-video-courses/#electrical-engineering-and-computer-science">https://ocw.mit.edu/courses/audio-video-courses/#electrical-engineering-and-computer-science</a></div>
<h2 id="harvard-universitys-free-online-courses">Harvard University's Free Online Courses</h2>
<p>Harvard University's free online course catalogue has many interesting Computer Science courses on many subjects.</p>
<p>There are introductory courses to Computer Science and Programming using Scratch, an introductory course to Technology in general, and courses on Machine Learning, among other topics.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://online-learning.harvard.edu/catalog/free">https://online-learning.harvard.edu/catalog/free</a></div>
<h2 id="codeorg">Code.org</h2>
<p>Code.org has courses for all ages, but it's mostly directed toward young students (and teachers who want to teach coding to their students).</p>
<p>It offers various Hour of Code projects (projects that you can complete in one hour), and has a lot of material for self-learners, teachers, and students in a lot of different languages.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://code.org/">https://code.org/</a></div>
<h2 id="hackinscience">HackInScience</h2>
<p>HackInScience is an interactive Python exercise platform, where you can learn Python and strengthen your Python skills.</p>
<p>Each exercise has links to guides for the features of the language you need to apply in that exercise that you didn't need in the previous exercises – so it helps you build upon what you've learned.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://www.hackinscience.org/">https://www.hackinscience.org/</a></div>
<h2 id="github-guides">GitHub Guides</h2>
<p>GitHub Guides is the official collection of guides from GitHub that help you learn how to work with Git and GitHub.</p>
<p>The guides include detailed explanations, with images and gifs, of GitHub issues, GitHub Pages, how to fork projects, a Git Handbook, and more.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://guides.github.com/">https://guides.github.com/</a></div>
<h2 id="mdn-learn-web-development-and-tutorials">MDN Learn Web Development and Tutorials</h2>
<p>MDN Learn Web Development aims to bring its learners from absolute beginners to a level where they're comfortable with programming basics. Their aim is to help you get to a point where you're able to learn on your own from other sources.</p>
<p>In this area of the MDN website there is also a Front-end web developer learning pathway with material for hundreds of hours of learning.</p>
<div class="embed-wrapper"><div class="embed-loading"><div class="loadingRow"></div><div class="loadingRow"></div></div><a class="embed-card" href="https://developer.mozilla.org/en-US/docs/Learn">https://developer.mozilla.org/en-US/docs/Learn</a></div>
<h2 id="thank-you-for-reading">Thank you for reading!</h2>
<p>Now you have a collection of great beginner-friendly resources that'll help you start learning to code. Good luck!</p>
<blockquote>
<p>Don't forget to subscribe to my newsletter </p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[5 Front End Development Skills To Land Your First Job]]></title><description><![CDATA[Don’t get stuck or confused on the way to start your career When you’re about to start your career in IT Industry, you have so many options to starts with…]]></description><link>https://musprodev.hashnode.dev/5-front-end-development-skills-to-land-your-first-job</link><guid isPermaLink="true">https://musprodev.hashnode.dev/5-front-end-development-skills-to-land-your-first-job</guid><category><![CDATA[Frontend Development]]></category><category><![CDATA[frontend]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[coding]]></category><category><![CDATA[Learning Journey]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Mon, 16 Aug 2021 05:58:09 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1629091369826/Nnewu4cGl.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Don’t get stuck or confused on the way to start your career</p>
<p>When you’re about to start your career in IT Industry, you have so many options to starts with. There are so many programming languages, frameworks, and libraries like HTML, CSS, JavaScript, TypeScript, Java, Python, React, Angular, C#, C++, PHP, and so many others. Because of these so many options, you get confused to pick a path to starts with.</p>
<p>To be honest, if you have been confused and feel overwhelmed, you’re not alone. I have been there too. Now I realized that I had made some mistakes during my journey from fresher to senior software engineer. And I know that too that I’m not alone who made those mistakes. Because I don’t have much clarity as to where and how I can starts, I had spent a lot of time on unnecessary things.</p>
<p>One of the mistakes that most beginners make is that they waste so much time jumping from one thing to another and they don’t learn anything. So in this article, I’m gonna give you a clear and solid learning path to start with Front End Development so that you spend your time on things that matter the most.</p>
<p>●●●●●●●●●●●○●●●●●●●●●●</p>
<h2 id="1-foundation">1. Foundation</h2>
<p>First thing first. To become a front-end developer, you need to start with HTML, CSS, and JavaScript. These are actually the fundamental languages for front-end development. HTML is used to structure our web pages, CSS to make them beautiful, and JavaScript to program them.</p>
<p>Let’s understand this with an analogy. Think of a building as a web page. It has a skeleton or structure (HTML), it has pretty walls with paint and tiles (CSS) and it can have certain functionalities, e.g. when we press the elevator button, it comes to pick us up (JavaScript).
Now, let’s take another example. Just have a look at your medium profile page. The header looks something like this.</p>
<p>You want to develop a header that looks like it. So first we use HTML to build all the building blocks of this layout. Building blocks like user name, number of followers, lists menu, and about menu on the left side, and a search icon, a dropdown with profile image, a button to write a new story, and a medium icon to go to the medium’s home page on the right side. We use HTML to add these building blocks to our web page.</p>
<p>Then, we use CSS to give it some visual effects. For e.g, we make the user name a bit bigger and bold, change the color for the number of followers and other menus on the left side, and give the profile image a green border, changes text color and border color for the button, and justify the size of the medium icon.</p>
<p>And finally, we can use JavaScript to add functionality to our web page. Just like, if we click on the search icon, it can expand to some extent. We might use JavaScript for this.</p>
<p>So, every web page you see on the internet is built using these three languages; HTML, CSS, and JavaScript. So better you learn and understand these languages and their features, the better you will at front-end development.</p><hr /><p></p>
<h2 id="2-front-end-frameworks">2. Front End Frameworks</h2>
<p>Now, we understand the importance of fundamentals and what we learn to ace them. What’s next?
Well, building websites often include a bunch of repetitive tasks. And that’s where front-end frameworks and libraries come. A framework or library comes with a lot of code that we can reuse in our website. So, they help us to get the job done very faster. That’s why, nowadays a lot of companies use one of these popular frameworks like React, Angular, And Vue.</p>
<p>To be more accurate, React is not a framework but a library. The main difference between a framework and a library is that a framework forces our application into a structure. So all the applications build-up using a framework like Angular, end up having a similar structure. So as you move from one project to another, you will find a similar structure. On the other hand, Libraries don’t force our application into a structure. They just provide some code to reuse.</p>
<p>But settle all these things aside, all these tools serve the same purpose; they help us build applications faster. Now, you don’t need to learn all of those. As you move into different jobs, you might need to learn any one of those.
Out of all these, React is the most popular. It’s built by Facebook and used to build Facebook and Instagram. So I would say go for React as a starting point.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1629092785318/9werwnfpI.png" alt="image.png" /></p><hr /><p></p>
<h2 id="3-version-control-systems">3. Version Control Systems</h2>
<p>We use version control systems to track our code history and work more collaboratively with others. That’s why you will find it in every job description.
There are multiple version control systems available in the market, but git is the most popular one. So just focus on git, and don’t worry about other version control systems.</p><hr /><p></p>
<h2 id="4-css-preprocessors">4. CSS Preprocessors</h2>
<p>CSS is kind of an old language and it has its own limitations. If you write CSS for medium or large-size applications, sooner or later, your code starts looking messy and it becomes really hard to manage. So every time you want to change something, you end up breaking something else.</p>
<p>Now you will wonder why CSS hasn’t evolved. Well, it has and currently, it is at version 3. But every time there is a new feature in CSS, all the browsers need to support that feature. Which is, unfortunately, is a slow process. So this is where CSS Preprocessor comes in.</p>
<p>A CSS preprocessor is a program or tool that lets you generate CSS from a different language that is better and more capable than CSS. So instead of using plain CSS, we use another language that looks pretty similar to CSS. In fact, it's almost identical, but it has some extra features. Then we give our code to a CSS preprocessor that converts it into plain CSS which every browser understands. That’s the purpose of CSS preprocessors.
There are many CSS preprocessors available like SASS, LESS, and Stylus to name a few. 
But again, you don’t have to learn them all to get a front-end developer job. Because these all are similar tools that serve the same purpose. SASS is the most popular among them. So I would recommend going with SASS.</p><hr /><p></p>
<h2 id="5-superset-of-javascript">5. Superset of JavaScript</h2>
<p>Just like CSS, JavaScript is also a fairly old language. Although it’s getting updated from time to time, it still does have some limitations. So, a lot of front-end developers prefer more modern languages like TypeScript and CoffeeScript to write code. Then they give their code to a program called Transpiler which will translate and compile the modern code into old JavaScript code that all browsers can understand.</p>
<p>Once again, you don’t need to learn all of them. You just need to get started with any one of them. I would say, go with TypeScript, as this is the most popular and most widely used. As you move jobs, you might have to learn a different language. But you can learn those languages very easily because all of these languages are very similar as they are all built over JavaScript itself.</p>
<h2 id="learning-path">Learning Path</h2>
<p>As we have already know what we have to learn for being a front-end web developer. Now, let’s see the exact path and the time which every step might consume.</p>
<p>First, you have to learn HTML, CSS, and JavaScript. If you spend 3–5 hours learning and coding, you would have a reasonable understanding of fundamentals in 3 months. You’re not going to be an expert, but you will understand them well enough to make things.
Next, you have to learn a front-end framework or library like React.You would need 1–2 months to learn React.</p>
<p>After that, you have to learn a version control system like git. You would feel comfortable with git in 2 weeks.</p>
<p>These are the absolute essentials that you would find in almost every job description. Now, if you have some extra time, I would recommend learning SASS and TypeScript to stand out from the rest of the crowd and increase your job opportunities. SASS is pretty easy and you would need a week or two to learn it. TypeScript requires a bit more time it would need 2–4 weeks to learn the fundamentals of TypeScript.</p>
<p>So if you spend few hours studying and coding, you would be able to apply for junior front-end developer jobs after six months. Off-course, everyone is different. You might get there faster or you might take a bit longer, don’t let that discourage you. Don’t forget, you can achieve anything if you’re determined and passionate about it.
To learn these skills, you can go to the websites like <a target="_blank" href="www.udemy.com">Udemy</a> or <a target="_blank" href="pluralsight.com">Pluralsight.</a> They have a lot of learning content. Just check the preview and rating of the course and choose any one of them which you like.</p>
<h2 id="conclusion">Conclusion</h2>
<p>This is it for this article. I hope you have more clarity now about what it takes to be a front-end web developer. To read more articles like this, stay tuned!
Thanks for reading!</p>
<blockquote>
<p>Don't forget to subscribe to my newsletter for more articles</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Prompt in Javascript]]></title><description><![CDATA[window.prompt() instructs the browser to display a dialog with an optional message prompting the user to input some text, and to wait until the user either…]]></description><link>https://musprodev.hashnode.dev/prompt-in-javascript</link><guid isPermaLink="true">https://musprodev.hashnode.dev/prompt-in-javascript</guid><category><![CDATA[JavaScript]]></category><category><![CDATA[javascript framework]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[coding]]></category><category><![CDATA[#codenewbies]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Wed, 11 Aug 2021 17:43:44 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628702150744/vQgMTSeFF.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="windowprompt">Window.prompt()</h2>
<p><code>window.prompt()</code> instructs the browser to display a dialog with an optional message prompting the user to input some text, and to wait until the user either submits the text or cancels the dialog.</p>
<p>Under some conditions — for example, when the user switches tabs — the browser may not actually display a dialog, or may not wait for the user to submit text or to cancel the dialog.</p>
<h2 id="syntax">Syntax</h2>
<pre><code> <span class="hljs-attr">result</span> = window.prompt(message, default)<span class="hljs-comment">;</span>
</code></pre><h2 id="parameters">Parameters</h2>
<p><code>message</code> <code>Optional</code>
A string of text to display to the user. Can be omitted if there is nothing to show in the prompt window.</p>
<p><code>default</code> <code>Optional</code>
A string containing the default value displayed in the text input field. Note that in Internet Explorer 7 and 8, if you do not provide this parameter, the string "undefined" is the default value.</p>
<h2 id="return-value">Return Value</h2>
<p>A string containing the text entered by the user, or <code>null.</code></p>
<h2 id="example">Example</h2>
<pre><code>    let sign = prompt("What's your sign?");

    <span class="hljs-keyword">if</span> (sign.toLowerCase() == "scorpio") {
    alert("Wow! I'm a Scorpio too!");
   }

    // there are many ways <span class="hljs-keyword">to</span> use the prompt feature
     sign = <span class="hljs-keyword">window</span>.prompt(); // <span class="hljs-keyword">open</span> the blank prompt <span class="hljs-keyword">window</span>
     sign = prompt();       //  <span class="hljs-keyword">open</span> the blank prompt <span class="hljs-keyword">window</span>
     sign = <span class="hljs-keyword">window</span>.prompt(<span class="hljs-string">'Are you feeling lucky'</span>); // <span class="hljs-keyword">open</span> the <span class="hljs-keyword">window</span> <span class="hljs-keyword">with</span> <span class="hljs-type">Text</span> "Are you feeling lucky"
     sign = <span class="hljs-keyword">window</span>.prompt(<span class="hljs-string">'Are you feeling lucky'</span>, <span class="hljs-string">'sure'</span>); // <span class="hljs-keyword">open</span> the <span class="hljs-keyword">window</span> <span class="hljs-keyword">with</span> <span class="hljs-type">Text</span> "Are you feeling lucky" <span class="hljs-keyword">and</span> <span class="hljs-keyword">default</span> <span class="hljs-keyword">value</span> "sure"
</code></pre><p>When the user clicks the OK button, text entered in the input field is returned. If the user clicks OK without entering any text, an empty string is returned. If the user clicks the Cancel button, this function returns <code>null.</code></p>
<p>The above prompt appears as follows (in Chrome on OS X):button</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628702919531/ayDXdnzby.png" alt="image.png" /></p>
<h2 id="notes">Notes</h2>
<p>A prompt dialog contains a single-line textbox, a Cancel button, and an OK button, and returns the (possibly empty) text the user entered into that textbox.</p>
<p>The following text is shared between this article, DOM:window.confirm and DOM:window.alert Dialog boxes are modal windows; they prevent the user from accessing the rest of the program's interface until the dialog box is closed. For this reason, you should not overuse any function that creates a dialog box (or modal window).</p>
<p>Please note that result is a string. That means you should sometimes cast the value given by the user. For example, if their answer should be a Number, you should cast the value to Number.</p>
<pre><code>  <span class="hljs-keyword">const</span> aNumber = <span class="hljs-built_in">Number</span>(<span class="hljs-built_in">window</span>.prompt(<span class="hljs-string">"Type a number"</span>, <span class="hljs-string">""</span>));
</code></pre><blockquote>
<p>Subscribe to my newsletter</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Cyber Security]]></title><description><![CDATA[Cyber Security – Nowdays everything is available online, you can do shopping online, do banking online and much more, but everything has both positive and…]]></description><link>https://musprodev.hashnode.dev/cyber-security</link><guid isPermaLink="true">https://musprodev.hashnode.dev/cyber-security</guid><category><![CDATA[#cybersecurity]]></category><category><![CDATA[hacking]]></category><category><![CDATA[coding]]></category><category><![CDATA[Computer Science]]></category><category><![CDATA[Programming Tips]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Wed, 11 Aug 2021 06:12:01 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628661616865/gZpWlfyOv.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><b>Cyber Security</b> – Nowdays everything is available online, you can do shopping online, do banking online and much more, but everything has both positive and negative points. Digitalization makes our life better and easy, we do not need to go outside for anything. We can do our all work online, but there is also have some disadvantages of Digitalization, like someone can store your personal data, banking details, and so on.</p>
<h2 id="types-of-hackers">Types of Hackers</h2>
<p>There are mainly three types of Hackers available. First one is Black-Hat Hackers and the second one is White-Hat and the third one is Grey-Hat. The Black-Hat are those hackers who used their skills to do illegal work like stealing someone’s data, money, attacking on websites, etc. The White-Hat Hackers are those hackers who used their skills to protect systems/cyber word from malicious attacks or Hackers. The Grey-Hat Hackers is works in both manner, or you can say this is the mixture of both Black and White.</p>
<h2 id="what-is-cyber-security">What is Cyber Security ?</h2>
<p>You can relate this term with White-Hat Hackers because they provides security to cyber world. They protects system, server, websites, etc, from malicious attacks.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628662041404/D5HRgFeOd.png" alt="image.png" /></p>
<h2 id="career-opportunities">Career Opportunities</h2>
<p>Cyber Security is a growing carrier in India and in some other countries also. If you have interested in this field then this is very good idea. If you can make yourself perfect then you can also get job in Cyber Cell . Because Cyber Security is need of every organization nowdays. Lots of companies hire Experts at a high salary package in India and also in other countries for making his server secure.</p>
<blockquote>
<p>Subscribe to our newsletter</p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Basic Data Types in Python 3: Strings]]></title><description><![CDATA[There is a lot to learn on your Python journey when you are new to the programming language. Once you are comfortable writing and executing code, your…]]></description><link>https://musprodev.hashnode.dev/basic-data-types-in-python-3-strings</link><guid isPermaLink="true">https://musprodev.hashnode.dev/basic-data-types-in-python-3-strings</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[python projects]]></category><category><![CDATA[data structures]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Fri, 06 Aug 2021 20:24:00 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628281370969/sCyqcj4QE.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>There is a lot to learn on your Python journey when you are new to the programming language. Once you are comfortable writing and executing code, your first stop becomes understanding how to represent data in your code. No matter the language, there are a few basic data types you'll use all the time - strings, numbers, booleans, lists, and dictionaries.</p>
<p>Those data types, and how to use them in Python 3, are the topic of this blog post series. Today, we're starting with strings.</p>
<p>If you're learning Python, you might also want to <a target="_blank" href="https://www.twilio.com/quest/download">check out TwilioQuest 3</a>. You'll learn about basic data types and much more about Python programming.</p>
<p>Ready to learn how to use strings in Python 3? Let's get started!</p>
<h2 id="strings-in-python-3">Strings in Python 3</h2>
<p>One of the most common data types in any programming language is a string. A string represents a series of characters, which you would use to represent usernames, blog posts, tweets, or any text content in your code. You can create a string and assign it to a variable like this.</p>
<pre><code>    <span class="hljs-attr">my_name</span> = <span class="hljs-string">"Jonathan Joestar"</span>
</code></pre><h3 id="strings-are-immutable">Strings are "immutable"</h3>
<p>In Python, strings are considered immutable - once you create them, they can't be changed. You can, however, use a variety of methods to create new strings from existing strings. This type of work in programming is called string manipulation. Some web developers joke that at the end of the day, their job is just mashing strings together - and this isn't far from the truth!</p>
<p>Here are some common tasks you might undertake when using strings in your code.</p>
<h3 id="common-task-combining-strings-together">Common task - combining strings together</h3>
<p>Combining strings together - concatenating them - is a very common task. In Python 3, you can use the + operator for this purpose. You can use the + operator multiple times to concatenate multiple strings.</p>
<pre><code>    <span class="hljs-attr">first_name</span> = <span class="hljs-string">"Jonathan"</span>
    <span class="hljs-attr">last_name</span> = <span class="hljs-string">"Joestar"</span>

    <span class="hljs-attr">full_name</span> = first_name + <span class="hljs-string">" "</span> + last_name
</code></pre><h2 id="common-task-inserting-data-into-strings">Common task - inserting data into strings</h2>
<p>Another common task with strings is inserting data into a specific place within a string. In programming, we call this string interpolation. Python 3 provides a handy tool for doing this called "f" strings. The "f" in "f strings" stands for format - you can insert other data from your program into a string when you define it rather than doing complex string concatenation as demonstrated previously.</p>
<p>Here is an example of creating a formatted string - note the letter f is included just before the first double quote when defining the message variable. When you want to insert data from your program into the string, you can include it between two "curly braces" - the { and } characters.</p>
<pre><code>  first_name = <span class="hljs-string">"Jonathan"</span>
  last_name = <span class="hljs-string">"Joestar"</span>
  age = <span class="hljs-number">24</span>

  message = <span class="hljs-string">f"My name is <span class="hljs-subst">{first_name}</span> <span class="hljs-subst">{last_name}</span>, and I am <span class="hljs-subst">{age}</span> years old."</span>
  print(message)
</code></pre><h2 id="common-task-using-built-in-string-methods-to-manipulate-strings">Common task - using built-in string methods to manipulate strings</h2>
<p>String objects have a number of methods to perform common tasks, like changing the case of strings or trimming their content. Below, you'll find a few examples. In two of these examples, we are creating a string variable, and then assigning the same variable a new value, which is the result of calling a method on a string object.</p>
<p><b>Example 1</b>: Convert a string to all caps using the upper method.</p>
<pre><code>  example_string = <span class="hljs-string">"am I stoked enough yet?"</span>
  example_string = example_string.upper()
  <span class="hljs-keyword">print</span>(example_string) <span class="hljs-comment"># prints "AM I STOKED ENOUGH YET?"</span>
</code></pre><p><b>Example 2</b>: Replace all instances of the word kale with tacos.</p>
<pre><code>  example_string = <span class="hljs-string">"We're having kale for dinner! Yay kale!"</span>
  example_string = example_string.replace(<span class="hljs-string">"kale"</span>, <span class="hljs-string">"tacos"</span>)
  print(example_string) <span class="hljs-comment"># prints "We're having tacos for dinner! Yay tacos!"</span>
</code></pre><p><b>Example 3</b>: Split a comma-delimited string into a list of strings.</p>
<pre><code>  example_string = <span class="hljs-string">"Apples,Oranges,Pears"</span>
  groceries = example_string.<span class="hljs-keyword">split</span>(<span class="hljs-string">','</span>)

  <span class="hljs-comment"># Code below prints:</span>
  <span class="hljs-comment"># Apples</span>
  <span class="hljs-comment"># Oranges</span>
  <span class="hljs-comment"># Pears</span>
  <span class="hljs-keyword">for</span> item in groceries:
   <span class="hljs-keyword">print</span>(item)
</code></pre><p><a target="_blank" href="https://docs.python.org/3/library/stdtypes.html#string-methods">Check our more strings</a> can do in the Python 3 docs</p>
<h2 id="type-casting">Type casting</h2>
<p>Frequently, you will want to convert data from one type into another. In programming, we call this process type casting. There are a number of functions built in to Python which allow us to do these type conversions on basic data types.</p>
<p><b>Example 1</b>: Convert a number into a string using the str function.</p>
<pre><code> <span class="hljs-attr">example_number</span> = <span class="hljs-number">42</span>
 <span class="hljs-attr">converted</span> = str(example_number)
 <span class="hljs-attr">message</span> = <span class="hljs-string">"The meaning of life is "</span> + converted
</code></pre><p><b>Example 2</b>: Convert a string into a whole number (integer) using int.</p>
<pre><code>  <span class="hljs-attr">example_string</span> = <span class="hljs-string">"2"</span>
  <span class="hljs-attr">converted</span> = int(example_string)
  <span class="hljs-attr">message</span> = f<span class="hljs-string">"Two plus two equals { converted + 2 }"</span>
</code></pre><h3 id="wrapping-up">Wrapping up</h3>
<p>Strings of text are one of the most common pieces of data you will work with in programming. Hopefully, you've learned a bit about how to work with strings in Python 3! Stay tuned for more blog posts in this series to learn more about basic data types like strings, numbers, booleans, lists, and dictionaries.</p>
<p>Also, be sure to <a target="_blank" href="https://www.twilio.com/quest/download">download and play TwilioQuest 3</a> to learn even more about Python!</p>
]]></content:encoded></item><item><title><![CDATA[Python Loops]]></title><description><![CDATA[In Python Programming, Python Loops are used for iterating a sequence (which is either a list, a dictionary, a tuple, a set, or a string). With Loops in…]]></description><link>https://musprodev.hashnode.dev/python-loops</link><guid isPermaLink="true">https://musprodev.hashnode.dev/python-loops</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[Programming Blogs]]></category><category><![CDATA[coding]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Thu, 05 Aug 2021 20:25:09 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628193708778/kyLvsaUDW.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In Python Programming, Python Loops are used for iterating a sequence (which is either a list, a dictionary, a tuple, a set, or a string). With Loops in python, we can execute a set of statements, once for each time in a list, dictionary, tuple, set, etc.</p>
<p>In simple words, a loop means repeating a set of instructions for a given number of inputs. So in this tutorial, we will briefly understand all the loops in Python Programming Language with the help of examples which will help you the easiest way to understand.</p>
<h2 id="types-of-loops-in-python-programming-language">Types of Loops in Python Programming Language</h2>
<p>In Python Programming, there are 3 types of loops that handle looping requirements. All three types of loops are similar in their own way and they all provide similar functions. They are stated below:-</p>
<ol>
<li>For Loop</li>
<li>While Loop</li>
<li>Nested Loop</li>
</ol>
<p>We will understand all the loops statements one by one briefly.</p>
<h2 id="1-for-loop">1. For Loop</h2>
<p>The Loops which are used for Sequential traversal are known as For Loop. The syntax of For Loop in Python Programming language is similar to the syntax of all other languages. For loop has the easiest syntax and it is the most commonly used in Python Programming Language. Given below is the syntax of For Loop in Python:-</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628193865694/RaX-P0len.png" alt="image.png" /></p>
<h2 id="example-of-for-loop">Example of For Loop:-</h2>
<ol>
<li>Using range function</li>
</ol>
<p>We will understand the use of for loop using range function with the help of an example.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194195042/STJ10Xa9K.png" alt="image.png" /></p>
<p>From the above code, you can see that we had used for loop with range function and we know that our range function runs from 0 to n-1 terms. So it has printed from 0 to 4 instead of 0 to 5.</p>
<p>2 . Using for loop in a list</p>
<p>We will understand the use of for loop with the help of lists.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194301426/jFfmh8N9zb.png" alt="image.png" /></p>
<p>In the above code we had used list in for loop and we will get all the elements of the list as output in separate lines respectively.</p>
<p>3 . Using For Loop in String</p>
<p>We will understand the use of for loop with the help of a string.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194360640/CrHCLiFSn.png" alt="image.png" /></p>
<p>As it is visible from the above code, we can see that all the elements of the string are printed one by one in separate lines respectively.</p>
<h2 id="while-loop">While Loop</h2>
<p>The loop which can execute a given set of statements as long as the given condition is true is known as While Loop in Python Programming language. But when the condition is false then the line immediately after the loop in the program is executed. The syntax of While Loop is also simple but it provides a better way of looping as it is used in most of the cases where there are comparisons. Let's understand the syntax of While loop in Python Programming language:-</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194417773/79mS7Fx1y.png" alt="image.png" /></p>
<h2 id="example-of-while-loop">Example of While Loop:-</h2>
<ol>
<li>A general example of While Loop</li>
</ol>
<p>We will understand the use of the While loop with the help of a basic  or general example</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194482891/URfy0l73K.png" alt="image.png" /></p>
<p>The above-explained example is the general case of the while loop.</p>
<p>2 . Using While Loop with Break Statement</p>
<p>Let's understand the use of a While loop with a break statement with the help of an example.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194530609/fZBM_kNBE.png" alt="image.png" /></p>
<p>As you can see from the above code that we had used a break statement which stops the code after printing 2.</p>
<p>3 . Using While loop with Continue Statement</p>
<p>Let's understand the use of the While loop with the continue statement with the help of an example.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194618556/uADhyU69u.png" alt="image.png" /></p>
<p>We had used the continue statement in the above code and we can see that our code will execute and will run infinite times as it is in the loop.</p>
<h2 id="nested-loops">Nested Loops</h2>
<p>The function of nested loops is similar to the function of nested If- Else statements and in simple words, it means that loop inside a loop. We can use nested for loops and nested while loops. In simpler words, we can use both For Loop and While Loop together in a single program. There is no syntax in Nested Loops as they are comprised of both For loop and While loop.</p>
<ol>
<li>Nested For Loop</li>
</ol>
<p>We will understand the use of Nested For Loop with the help of an example</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194701848/ABNrxS7gV.png" alt="image.png" /></p>
<p>From the above code, we can see that we had used two for loops and we can easily see from the output that each f_name is printed with each l_name. We can also use nested For loops to print several different patterns.</p>
<p>2 . Nested While Loops</p>
<p>We will understand the use of Nested While Loop with the help of an example</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628194743775/dY8AEQt0e.png" alt="image.png" /></p>
<p>From the above code, it is clearly visible that we had used while loops which is a nested loop and it will perform the same functions which are similar to the functions of nested For loop, and will give us the output in the same way as nested for loop.</p>
<p>Thanks for Reading. Hope you liked it. Subscribe to our newsletter so that you will get notified of our new posts.</p>
<p>NOTE:- The awesome artwork used in this article was created by <a target="_blank" href="https://dribbble.com/tillaev">Farrúh Tillaev</a></p>
<blockquote>
<p>CREDIT FOR THIS GREAT ARTICLE =&gt; <a target="_blank" href="https://blog.codemadeeasy.in/author/khush">Khush Mehndiratta</a></p>
</blockquote>
<p>HAPPY LEARNING!!!</p>
<p><strong>DON'T FORGET TO FOLLOW AND SUBSCRIBE FOR MY NEWSLETTER TO RECEIVE MY FUTURE POSTS</strong></p>
]]></content:encoded></item><item><title><![CDATA[Python Files]]></title><description><![CDATA[File Handling is an important aspect of the Python Programming language as it is used in web applications. We can create files, read files, write in files…]]></description><link>https://musprodev.hashnode.dev/python-files</link><guid isPermaLink="true">https://musprodev.hashnode.dev/python-files</guid><category><![CDATA[Python]]></category><category><![CDATA[Python 3]]></category><category><![CDATA[python beginner]]></category><category><![CDATA[python projects]]></category><category><![CDATA[Programming Blogs]]></category><dc:creator><![CDATA[Blockchain Hashira]]></dc:creator><pubDate>Tue, 03 Aug 2021 21:30:49 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1628024580883/fdOyEpbGf.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>File Handling is an important aspect of the Python Programming language as it is used in web applications. We can create files, read files, write in files, can update files, and can also delete files.</p>
<p>A file can be handled in two ways i.e. Binary(b) and Text(t). A file in Python is also saved with the extension of .txt.</p>
<h2 id="open-function">Open() Function</h2>
<p>So the first function of file handling is open() and this function will return a file object. There is one important point that you also have to close a file once opened. A file is opened using f.open() and closed using f.close() . This open() function takes two parameters:-</p>
<ol>
<li><p>filename</p>
</li>
<li><p>mode</p>
</li>
</ol>
<p>There are a total of 4 members to open a file in python:-</p>
<ol>
<li><p>"r" = Read - Opens a file for reading.</p>
</li>
<li><p>"w" = Write - Opens a file for Writing.</p>
</li>
<li><p>"a" = Append - Opens a file for Appending.</p>
</li>
<li><p>"r+" = Read and Write - Opens a file for Reading and Writing.</p>
</li>
</ol>
<h3 id="the-syntax-for-opening-a-file">The syntax for opening a file:-</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025116480/bTyYcTafl.png" alt="image.png" /></p>
<h3 id="opening-a-file-in-reading-mode">Opening a file in reading mode:</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025187150/FG8CqE0zY.png" alt="image.png" /></p>
<p>The above-given syntax is for opening files in reading mode and also the file will be opened in text mode as a file is opened by default in the same mode.</p>
<h3 id="reading-a-file-on-a-server">Reading a file on a server</h3>
<p>Let's consider a file named file1.txt saved in the same folder as python</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025269071/2OM94KoTI.png" alt="image.png" /></p>
<p>To read the above file we will use open() to open the file and read() to read the file.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025305496/9tYorfAKO.png" alt="image.png" /></p>
<p>To read lines in python files we use a function known as readlines() but it will read only a single line.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025361561/K_dHpw3OP.png" alt="image.png" /></p>
<p>If you want to read more lines then you have to add more readline() functions. For eg- if you want to read 3 lines then you have to use the readline() function thrice.</p>
<h2 id="writing-in-a-file">Writing in a File</h2>
<p>"a" = will append at the end of the line</p>
<p>"w" = will overwrite the content</p>
<h3 id="append-the-content">Append the content</h3>
<p>Now we will take an example where we will append the file:-</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025440996/DQFHnTjP-.png" alt="image.png" /></p>
<p>As you can see that the data has been added at the end of file1.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025476055/4DU4me1i_.png" alt="image.png" /></p>
<p>Now the data from file1 has been removed and the date of file1 has been updated.</p>
<h2 id="delete-a-file">Delete a File</h2>
<p>In python, you can delete a file using the remove command. Now we will remove the file named file1.txt every python file is removed using import of os module.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025539072/fwDDf7VTM.png" alt="image.png" /></p>
<h2 id="python-directories">Python Directories</h2>
<p>Each file in python contains a directory. The os module in python helps in creating, removing, and changing directories.</p>
<p>Syntax of Python Directories:-</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025583888/qssECTBZy.png" alt="image.png" /></p>
<p>Now we will create a test directory in a current directory:-</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025623643/D93q9K4FR.png" alt="image.png" /></p>
<h3 id="chdir-method">chdir() method</h3>
<p>To change a current directory we use chdir() method. Generally, it takes an argument, which is the name of the directory which we want as our current directory.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025669986/8Meg5FRfO.png" alt="image.png" /></p>
<h3 id="rmdir-method">rmdir() method</h3>
<p>To delete a directory we use the rmdir() method which is passed as an argument in the method</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025709784/QhyrwEONE.png" alt="image.png" /></p>
<h2 id="exception-in-python">Exception in Python</h2>
<p>In the Python programming language, when a script encounters a situation which it cannot cope up with, then it raises an exception. An exception is a Python object which represents an error in the program. There are several exception methods in python:-</p>
<ol>
<li><p>Exception - Used for all exceptions</p>
</li>
<li><p>StopIteration - Occurs when the next() method does not point to any object</p>
</li>
<li><p>StandardError - Base class for all built-in exceptions</p>
</li>
<li><p>ZeroDivisionError - Raised when division or modulo by zero takes place for all numeric types.</p>
</li>
<li><p>FloatingPointError - Raised when any floating-point calculation fails</p>
</li>
<li><p>KeyError - Raised when a specific key is not found in the directory</p>
</li>
<li><p>SyntaxError - Raised when there is an error in syntax</p>
</li>
<li><p>IndentationError - Raised when indentation is not done properly</p>
</li>
<li><p>ValueError - Raised when arguments contain invalid values</p>
</li>
<li><p>RuntimeError - Raised when a generated error does not fall into any category.</p>
</li>
</ol>
<p>There are several more errors in Python.</p>
<h2 id="exception-handling">Exception Handling</h2>
<p>To handle exceptions in python we use try: except. If you found something suspicious in your code which may raise an exception then you can defend your program by placing the suspicious code in a try: block. After that add an except statement, followed by a block of code that will handle the problem easily.</p>
<p>The syntax for Try Except:-</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025880643/5jKA7DlWd.png" alt="image.png" /></p>
<h2 id="user-defined-exception">User-Defined Exception</h2>
<p>Python is a language that allows you to create your exceptions by deriving some classes from the built-in exceptions. Now we will create an exception using Runtime Error. This is very useful when we need to display more accurate information when an exception is caught.</p>
<p>In the try block, the user-defined exception is raised and after that, it is caught in the except block. The variable e is used to create an instance of the class Network error.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1628025921159/jK0MvAmzD.png" alt="image.png" /></p>
<p>I hope that you had easily understood the concept of files in python. You can visit my youtube channel for more help regarding this topic.</p>
<iframe width="100%" height="auto" src="https://www.youtube.com/embed/LfXq1ox3Aqk"></iframe>

<p>Thanks for reading. Hope you liked it. Many more to come in the future.</p>
<p>Note:- The amazing article used in this post is designed by <a target="_blank" href="https://dribbble.com/vic">Victor Korchuk</a></p>
<blockquote>
<p><a target="_blank" href="https://buymeacoffee.com/musprodev">Buy me a coffee</a></p>
</blockquote>
]]></content:encoded></item></channel></rss>