<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Neha Nakrani </title>
    <description>The latest articles on DEV Community by Neha Nakrani  (@nehanakrani).</description>
    <link>https://dev.to/nehanakrani</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F244349%2Fc399845f-272a-4388-b9c1-7233f43589a7.png</url>
      <title>DEV Community: Neha Nakrani </title>
      <link>https://dev.to/nehanakrani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nehanakrani"/>
    <language>en</language>
    <item>
      <title>Things are similar in Programmers and Guitarist</title>
      <dc:creator>Neha Nakrani </dc:creator>
      <pubDate>Sun, 26 Apr 2020 16:12:15 +0000</pubDate>
      <link>https://dev.to/nehanakrani/things-are-similar-in-programmers-and-guitarist-e96</link>
      <guid>https://dev.to/nehanakrani/things-are-similar-in-programmers-and-guitarist-e96</guid>
      <description>&lt;p&gt;Here I want to share my own experience with so many common things that I do wonder if there’s some kind of relationship between being a guitarist and being a programmer. For informed opinions, let’s turn to programmers who are actually guitarists.&lt;/p&gt;

&lt;p&gt;When I was in 10th std, I wanted to learn guitar. That actually attracted by my school's music rooms. Wherever I saw a guitar band and their guitar player seemed seriously cool. The music they performed was so good. And I thought it would be so cool to become the lead guitarist of an awesome band. After that, I convened my parents and finally bought a guitar ...But I have zero musical ability.&lt;br&gt;
And after some years of the same happened to me when I was in an engineering college doing an internship like how easy it is to become a programmer and how cool stuff to do in programming I realized that doing many of the really good programmers.&lt;/p&gt;

&lt;p&gt;But the same observation is expressed in many different places. like My fingers move a lot faster on guitar if I’m doing some kind of shred solo style work than they ever would on a keyboard. But they are the same fingers. Just totally different jobs but things that are similar. That most things about music often don’t intersect that much with code, in that music is about feelings and emotions, and software is about facts and dataflows. But there are at least a few things that are similar:&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Smart practicing for your “soul”&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;one thing you can learn the guitar by watching other people play or by listening too. Your fingers, hands, and arms have a lot to learn for even the simplest songs: fingering chords, picking strings, strumming, and learning basic form. Without practice, you could never learn or get better at playing the guitar and really no way around putting in the hours to get good at what you do. like while repeating the shift between two chords hundreds of times with taking comfort with the F chord really how that tough for everyone initially. On the other hand, if you practice 5-7 days a week for an hour or two at a time, you're going to improve rapidly. If you do that practice session at the same time and in the same setting every day, you'll do even better because your body and mind will trigger the familiar environment and switch right into practice mode. &lt;/p&gt;

&lt;p&gt;The same is true of programming, yet most programmers suffer from what is the language to choose and start that career with a paid job. and after choosing the language with programming facing initially tough to Write code with hard in few days to understand the coding structure after The practice involves dedicating time to learning new aspects of programming or working on those skills that are lagging. You can get the same benefit from consistency with your programming practice. Do it in the same place with the same programming environment and you'll get right into the groove every time. Try practicing every day at the same time to make it a routine.&lt;/p&gt;

&lt;p&gt;Obviously guitarist and software engineers both come from a place of initial interest plus a whole lot of &lt;strong&gt;practice…! practice…! Practice….!!!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The printed lyrics of chord notes require interpretation and execution. Like the written line of code, there is often much more than meets the eye. Making songs using different chords and software is simultaneously collaborative and individualistic undertakings.to achieve different sounds. So many combinations of chords and streaming patterns often deal with an array of technologies to get their music, performed, and/or produced.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Stay determined &amp;amp;&amp;amp; Daily practicing &amp;amp;&amp;amp; Get better&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;if you learn to play a couple of songs and then only practice those songs over and over. It may feel comfortable to be able to play some songs well, but you have to get out of your comfort zone and learn to play new stuff. It's frustrating to practice hard pieces that you haven't memorized yet. One thing I started noticing after months of guitar practice was that I would improve without realizing it. After learning a new song, I would attempt to play along with the recording, trying my best to keep up, but failing completely. I would practice the song for days or weeks, feeling like I wasn't making any progress. Then I would try playing along with the recording again and surprisingly, find that I was playing too fast.. But you won't get better by only practicing what you know.&lt;/p&gt;

&lt;p&gt;The same concept should be applied to programming. Seek out good, clean source code to read and learn from. There is a wealth of open-source code out there, and you likely have a favorite program that you can get the source for. Read through it and try to understand how the programmers structured the code. What design patterns do they use? What is their coding style? How do they use the language to accomplish their goals? Good source code contains a wealth of knowledge for you to explore. Programming has potential problem areas, too. What parts of the language or libraries you're using are difficult to understand? What features are hard to remember or use effectively? What areas of programming do you avoid because you haven't put in the time to learn them? These are the areas where you should be pushing yourself.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be patient, don’t rush and don’t give up&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Fundamental Exercises Matter&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The guitar chords are full of patterns, too. Most chords are created from only a few basic finger formations that are slid up or down the frets or back and forth to different sets of strings. Sequences of chords tend to follow patterns, and combining them with different strumming patterns creates all kinds of rich, rhythmic sounds. Arpeggios are chords that are played by quickly picking the strings in a pattern instead of strumming. All of these different patterns and sequences, once learned, can be strung together to create very complex sounding music while still being relatively easy to remember.&lt;/p&gt;

&lt;p&gt;Programming is quite similar to basic code blocks being built up to create massively complex systems. Without the patterns and sequences that we have developed in programming, code would be a garbled mess, and we couldn't possibly hope to create the software systems we have today.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conflicts happen, but don’t lose yourself in the process&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Self-Expression&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Many programmers, often to the dismay of corporate managers, try to express themselves through code the same as Music and programming are both forms of creation and self-expression. When starting out, guitarists get nervous about performing and sharing their recordings. Beginner programmers have the same kind of stage fright before posting their code on GitHub. And demo there features to the client. yes, ..This is a fact and When practicing, you learn to identify your own weak spots, which requires being honest with yourself and dealing positively with criticism. It builds self-esteem and confidence. You also learn what it is like to “be in the zone”. Perfectionism is a characteristic that commonly forms, but I think it is a simply acute attention to detail.&lt;/p&gt;

&lt;p&gt;“Software development is similar to Guitarists in that a good coder is constantly looking to improve their code. Both are things you can start very young, but spend your while life improving. There is no limit to what you can accomplish as people are constantly pushing the boundaries of what we thought was possible both creatively and technically. &lt;/p&gt;

&lt;p&gt;Both teach you lessons in starting small and progressing incrementally. The cumulative knowledge becomes apparent over time. As you reflect on your progress, you will encourage and motivate yourself based on the noticeable progress you have made. Both require large amounts of deliberate practice and are not an innate talent. This is true for just about everything in life though.&lt;/p&gt;

&lt;p&gt;The reward for all that hard work for both software engineers and Guitarists is often a personal sense of success more so than a public one. When you finally master some tricky software technique, or when you finally master some tricky guitar tune technique like circular breathing, the world doesn’t really stand up and applaud. But you know you’re awesome.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;stay determined and you’ll get a reward&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Make hard pieces to look easy&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;The best programmers can do the same thing with their instruments. They have spent so much time learning their tools that they know their text editors, their programming languages, and their environments inside out some ways It is amazing to watch a great guitar player. They make even the most complicated pieces look effortless. They have played for so long and practiced with such dedication that their instrument seems like an extension of themselves. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do it in different ways or tried to replicate them in different ways… It was exciting!&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Honoring with people&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Whether it’s music or software, it’s hard to get in so many hours honing your craft without having some sort of deep enjoyment for the work, and so you’ll see practitioners of both doing a lot without actually being paid for it. In software we call it Open Source meetups and conference, and in music it’s a Jam Session.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Be in the zone &amp;amp;&amp;amp; The Zone feels good.&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When you get into The Zone, it's as if the world melts away and the only thing left is you, your instrument, and the music. Time stands still. Your fingers dance across the strings. The notes resonate with your soul. These are the moments that are the most satisfying. At first it doesn't happen often, but the better you get, the more time you spend in The Zone. Programming is much the same.&lt;/p&gt;

&lt;p&gt;A more obvious similarity is also the fact that both are rewarding and enjoyable as long as your strings don’t break and as long as your compiler doesn’t complain.&lt;/p&gt;

&lt;p&gt;I’ve learned through playing guitar and coding that sometimes you need to convince yourself that it’s worth sticking with the hard things because they will pay off in the end. Now I’m a software engineer as well as a guitarist not at a good player but I couldn’t be happier. Well, I guess I could be a rockstar, but you can’t have it all…or can you?&lt;/p&gt;

&lt;p&gt;Let me know in the comments below how you deal with listening to music-related to anything while do programming. I am curious about your experience!&lt;/p&gt;

&lt;p&gt;Happy reading !!&lt;/p&gt;

</description>
      <category>guitarist</category>
      <category>programmers</category>
      <category>coding</category>
      <category>music</category>
    </item>
    <item>
      <title>Setting up MQTT with Ruby on Rails</title>
      <dc:creator>Neha Nakrani </dc:creator>
      <pubDate>Sun, 22 Mar 2020 11:59:24 +0000</pubDate>
      <link>https://dev.to/nehanakrani/setting-up-mqtt-with-ruby-on-rails-3dbi</link>
      <guid>https://dev.to/nehanakrani/setting-up-mqtt-with-ruby-on-rails-3dbi</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;Introduction to MQTT&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;MQTT&lt;/strong&gt; is a Client-Server publish, subscribe messaging transport protocol. It is lightweight, open, simple, and designed to be easy to implement. These qualities make it ideal for use in many spots, including constrained environments such as for communication in Machine to Machine (M2M) and Internet of Things (IoT) world of connected devices, and for mobile applications where bandwidth and battery power are at a premium.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why the adoption of MQTT ?&lt;/strong&gt;&lt;br&gt;
Well, as opposed to HTTP it is an extremely light-weight protocol. HTTP is stateless and thus a new connection needs to be established for every request (communication overhead). MQTT is based on data streams that stay connected once they are established (minimal overhead). This makes MQTT faster for sending data very frequently as is common for IoT use cases.&lt;/p&gt;

&lt;p&gt;A protocol for collecting device data and communicating it to servers.&lt;br&gt;
In addition, it is very easy to have multiple applications consume different sets of data. Each application can simply subscribe to the data points they need. As simple as that…&lt;/p&gt;

&lt;p&gt;But, that’s enough introduction. Let’s take a look at how to set up such a process to connect and how you get your data there.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;MQTT Basic Concepts:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Publishers&lt;/strong&gt;- publish messages to the broker.&lt;br&gt;
&lt;strong&gt;Subscribers&lt;/strong&gt;- subscribe to a particular topic with the broker.&lt;br&gt;
&lt;strong&gt;Broker&lt;/strong&gt;- ensures correct routing of messages published to it by the publishers, to the correct subscriber(s).&lt;br&gt;
&lt;strong&gt;Topics&lt;/strong&gt;- can be thought of as naming specific sets of data. It’s generally a plain string, usually corresponds to a legit word in English for ease of use. A publisher would essentially publish data on one of the topics. Similarly, a subscriber can subscribe to a particular topic. The job of the broker is to route messages based on the topic.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;How to set up an MQTT broker with rails:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;You may get the latest stable version from Rubygems:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="n"&gt;install&lt;/span&gt; &lt;span class="n"&gt;mqtt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Alternatively, to use a development snapshot from GitHub using Bundler:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;gem&lt;/span&gt; &lt;span class="s1"&gt;'mqtt'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:git&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s1"&gt;'https://github.com/njh/ruby-mqtt.git'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;1. Connecting to server&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;A new client connection can be created by passing either an MQTT URI, a host and port or by passing a hash of attributes.&lt;/p&gt;

&lt;p&gt;Here some ways to connect sever:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="c1"&gt;#using MQTT URI&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;MQTT&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"mqtt://servername.example.com"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;#using server name with passing host and port&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;MQTT&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="ss"&gt;:host&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"servernamer.example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;:port&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt; &lt;span class="o"&gt;...&lt;/span&gt; &lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;#Enabled SSL connection &lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;MQTT&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="ss"&gt;:host&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;"servernamer.example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;:port&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;8080&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="ss"&gt;:ssl&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="kp"&gt;true&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;#NOTE: if you have set up everything for using MQTT with AWS, let’s use those credentials we downloaded from the generated certificate to connect to AWS IoT.&lt;/span&gt;

&lt;span class="c1"&gt;#using client certificate-based authentication when passing below attributes&lt;/span&gt;

&lt;span class="n"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;MQTT&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="no"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="ss"&gt;host: &lt;/span&gt;&lt;span class="s2"&gt;"myserver.example.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;# Your AWS  IoT host&lt;/span&gt;
        &lt;span class="ss"&gt;port: &lt;/span&gt;&lt;span class="mi"&gt;8883&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;ssl: &lt;/span&gt;&lt;span class="kp"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="ss"&gt;cert_file:  &lt;/span&gt;&lt;span class="c1"&gt;#path_to('client.pem')&lt;/span&gt;
        &lt;span class="ss"&gt;key_file: &lt;/span&gt;&lt;span class="c1"&gt;#path_to('client.key')&lt;/span&gt;
        &lt;span class="ss"&gt;ca_file:  &lt;/span&gt;&lt;span class="c1"&gt;#path_to('root-ca.pem')”&lt;/span&gt;
    &lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;2. Publishing&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;After connecting the client we can publish the payload to the topic with just one command as below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;topic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"mqtt/test"&lt;/span&gt;

&lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;test: &lt;/span&gt;&lt;span class="s2"&gt;"This test message."&lt;/span&gt;&lt;span class="p"&gt;}.&lt;/span&gt;&lt;span class="nf"&gt;to_json&lt;/span&gt;

&lt;span class="c1"&gt;# Publish to the topic&lt;/span&gt;
&lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;publish&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;retain&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kp"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;qos&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;3. Subscribing&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;You can send a subscription request to the MQTT server using the subscribe method. &lt;br&gt;
To subscribe to a topic just use the “subscribe” method with the topic as the argument. Separate the topics by comma(,) to subscribe to multiple topics.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"topic1"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"topic1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"topic2"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;subscribe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"test/#"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;4. Receiving Messages:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;To receive a message, use the get method. This method will block until a message is available. The topic is the name of the topic the message was sent to. The message is a string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;

&lt;span class="c1"&gt;# To receive a message from a topic:&lt;/span&gt;
  &lt;span class="n"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
     &lt;span class="c1"&gt;# Block is executed for every message received&lt;/span&gt;
  &lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you have successfully implemented an MQTT client with performed publish-subscribe to received data.&lt;/p&gt;

&lt;p&gt;I hope you found it as easy as I did to make this work.&lt;/p&gt;

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

</description>
      <category>mqtt</category>
      <category>ruby</category>
      <category>rails</category>
    </item>
    <item>
      <title>Easy way to setting Ruby Version Manager (RVM) on projects</title>
      <dc:creator>Neha Nakrani </dc:creator>
      <pubDate>Tue, 10 Mar 2020 09:09:16 +0000</pubDate>
      <link>https://dev.to/nehanakrani/easy-way-to-setting-ruby-version-manager-rvm-on-projects-34e4</link>
      <guid>https://dev.to/nehanakrani/easy-way-to-setting-ruby-version-manager-rvm-on-projects-34e4</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;Ruby on Rails with RVM&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;RVM is &lt;strong&gt;Ruby Version Manager&lt;/strong&gt;. It's a command-line tool that allows you to easily install, manage and work with different Ruby environments. With RVM, you can easily install different versions of Ruby and easily switch between them.&lt;/p&gt;

&lt;p&gt;Let’s get started with the first step. I can’t stress enough how valuable RVM is to the development of Ruby and Rails. &lt;br&gt;
RVM allows you to create as many Ruby sandboxes as you need for development or projects or whatever. You can separate versions of Ruby as well as sets of gems called “&lt;strong&gt;GEMSETS&lt;/strong&gt;”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gemset gives you the privilege of creating a set of gems specific to your particular rails application.&lt;/strong&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;1. Steps for Creating a new Gemset:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Assuming that you are already on your project directory with on your machine in installed ruby versions that you want.&lt;/p&gt;

&lt;p&gt;Step 1: rvm gemset create [name of gemset]&lt;br&gt;
Step 2: rvm --rvmrc [ruby version here]@[name of gemset]&lt;br&gt;
   Note: You can check your current ruby version by running "ruby -v" from your console.&lt;br&gt;
Step 3: Refresh your directory. &lt;br&gt;
  You can simply do this by checking out of your directory and going back to that directory again.&lt;br&gt;
Step 4: RVM will ask you a simple Yes, No, View, Cancel question. Press Y for yes.&lt;br&gt;
Step 5: You're done! Run bundle install.&lt;/p&gt;
&lt;h4&gt;
  
  
  &lt;strong&gt;2. Particular gemset Use:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;As you may have more that one gemsets installed on your machine, you might need to use an explicit version of the gemset for your particular application. You can use specific gemset using the subsequent command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;rvm&lt;/span&gt; &lt;span class="n"&gt;use&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ruby&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;gemset&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you may want to set one of the gemset as the default gemset. You can do this by using the subsequent command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;rvm&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="n"&gt;default&lt;/span&gt; &lt;span class="n"&gt;use&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ruby&lt;/span&gt; &lt;span class="n"&gt;version&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;@&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;gemset&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;In-Built Gemsets list:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;When you install particular Ruby using RVM then it comes with 2 gemsets. default and global. You can list the gemsets that are available for current ruby version selected using the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;rvm&lt;/span&gt; &lt;span class="n"&gt;gemset&lt;/span&gt; &lt;span class="n"&gt;list&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  &lt;strong&gt;3. Delete a Gemset:&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;you may want to delete particular gemset using the subsequent command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="n"&gt;rvm&lt;/span&gt; &lt;span class="n"&gt;gemset&lt;/span&gt; &lt;span class="n"&gt;delete&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;gemset&lt;/span&gt; &lt;span class="nb"&gt;name&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you for reading!🤗&lt;/p&gt;

</description>
      <category>ruby</category>
      <category>rails</category>
      <category>rvm</category>
    </item>
    <item>
      <title>FCM push notification with ruby on rails</title>
      <dc:creator>Neha Nakrani </dc:creator>
      <pubDate>Wed, 09 Oct 2019 18:19:25 +0000</pubDate>
      <link>https://dev.to/nehanakrani/fcm-push-notification-with-ruby-on-rails-2189</link>
      <guid>https://dev.to/nehanakrani/fcm-push-notification-with-ruby-on-rails-2189</guid>
      <description>&lt;p&gt;&lt;strong&gt;FCM&lt;/strong&gt; is one of the best-known ways to notify the client iOS, Android, or web/JavaScript via push notification as it is free and backed by Google.&lt;/p&gt;

&lt;p&gt;Push notification is a very popular communication channel to notify users about important events in the application 🔔.&lt;/p&gt;

&lt;p&gt;This is about how to enable push notification send to app using Google's Firebase Cloud Messaging.&lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;Setup FCM&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Go to the &lt;a href="https://console.firebase.google.com/" rel="noopener noreferrer"&gt;Firebase Console&lt;/a&gt; page and click on Add new project.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If you don't have an existing Firebase project, click Add project and enter either an existing Google Cloud Platform project name or a new project name.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get a server key from settings.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;FCM with Ruby on Rails&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt; 1. Install &lt;a href="https://rubygems.org/gems/fcm/versions/0.0.1" rel="noopener noreferrer"&gt;fcm gem&lt;/a&gt; and just  gem 'fcm' include in your Gemfile.&lt;/p&gt;

&lt;p&gt; 2. Get the registration token or devices token from the devices where App &lt;br&gt;
    installed. There can be multiple devices registered for an app.&lt;/p&gt;

&lt;p&gt; 3. Call and setup your the fcm_call_notification function when you send &lt;br&gt;
    the notification.&lt;br&gt;
&lt;br&gt;
 &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight ruby"&gt;&lt;code&gt;&lt;span class="nb"&gt;require&lt;/span&gt; &lt;span class="s1"&gt;'fcm'&lt;/span&gt;
&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;fcm_push_notification&lt;/span&gt;
    &lt;span class="n"&gt;fcm_client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;FCM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;FCM_SEVER_KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;# set your FCM_SERVER_KEY&lt;/span&gt;
    &lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;priority: &lt;/span&gt;&lt;span class="s1"&gt;'high'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="ss"&gt;data: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="ss"&gt;message: &lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="ss"&gt;icon: &lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="ss"&gt;notification: &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; 
                &lt;span class="ss"&gt;body: &lt;/span&gt;&lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="ss"&gt;sound: &lt;/span&gt;&lt;span class="s1"&gt;'default'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="ss"&gt;icon: &lt;/span&gt;&lt;span class="n"&gt;image&lt;/span&gt;
                &lt;span class="p"&gt;}&lt;/span&gt;
              &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;registration_ids&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"registration_id1"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"registration_id2"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="no"&gt;Array&lt;/span&gt; &lt;span class="n"&gt;of&lt;/span&gt; &lt;span class="n"&gt;registration&lt;/span&gt; &lt;span class="n"&gt;ids&lt;/span&gt; &lt;span class="n"&gt;up&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
    &lt;span class="c1"&gt;# A registration ID looks something like: “dAlDYuaPXes:APA91bFEipxfcckxglzRo8N1SmQHqC6g8SWFATWBN9orkwgvTM57kmlFOUYZAmZKb4XGGOOL9wqeYsZHvG7GEgAopVfVupk_gQ2X5Q4Dmf0Cn77nAT6AEJ5jiAQJgJ_LTpC1s64wYBvC”&lt;/span&gt;
    &lt;span class="n"&gt;registration_ids&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;each_slice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;registration_id&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt;
        &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;fcm_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;send&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;registration_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="nb"&gt;puts&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;
    &lt;span class="k"&gt;end&lt;/span&gt;
&lt;span class="k"&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Set options according to your requirement with fcm_push_notification function will notify the client apps with the image also.&lt;/p&gt;

&lt;p&gt;Now, your notification should be ready for appearing.&lt;/p&gt;

&lt;p&gt;Thank you for reading!🤗&lt;/p&gt;

&lt;p&gt;This blog was originally published on Medium 📝&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag__link"&gt;
  &lt;a href="https://medium.com/@nehanakrani004/fcm-push-notification-with-ruby-on-rails-64097685ce66" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmiro.medium.com%2Fv2%2Fresize%3Afill%3A88%3A88%2F1%2AomMAT59Mb77faccvk4kGBQ.jpeg" alt="Neha Nakrani"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://medium.com/@nehanakrani004/fcm-push-notification-with-ruby-on-rails-64097685ce66" class="ltag__link__link" rel="noopener noreferrer"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;FCM push notification with ruby on rails | Medium&lt;/h2&gt;
      &lt;h3&gt;Neha Nakrani ・ &lt;time&gt;Feb 18, 2021&lt;/time&gt; ・ 
      &lt;div class="ltag__link__servicename"&gt;
        &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fassets.dev.to%2Fassets%2Fmedium-f709f79cf29704f9f4c2a83f950b2964e95007a3e311b77f686915c71574fef2.svg" alt="Medium Logo"&gt;
        Medium
      &lt;/div&gt;
    &lt;/h3&gt;
&lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>fcm</category>
      <category>ruby</category>
      <category>rails</category>
      <category>firebasepushnotification</category>
    </item>
  </channel>
</rss>
