<?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: Pradipta Sarma</title>
    <description>The latest articles on DEV Community by Pradipta Sarma (@pradipta).</description>
    <link>https://dev.to/pradipta</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%2F303057%2F25f0ce1b-74e8-4a56-af39-398337853d2a.jpg</url>
      <title>DEV Community: Pradipta Sarma</title>
      <link>https://dev.to/pradipta</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pradipta"/>
    <language>en</language>
    <item>
      <title>Launch Sublime from the Command Line</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Fri, 17 Sep 2021 14:21:52 +0000</pubDate>
      <link>https://dev.to/pradipta/launch-sublime-from-the-command-line-317c</link>
      <guid>https://dev.to/pradipta/launch-sublime-from-the-command-line-317c</guid>
      <description>&lt;p&gt;Sublime is a powerful source code editor. It is also used a lot to clip notes and stuff, thanks to it being very light weight.&lt;br&gt;
As a developer, if you aren't using Sublime yet, I highly recommend you do.&lt;/p&gt;

&lt;p&gt;Sublime Text comes with a CLI out of the box. For version 3 or 4, check in the directory &lt;code&gt;/Applications/Sublime\ Text.app/Contents/SharedSupport/bin&lt;/code&gt;. There should be an executable named &lt;code&gt;subl&lt;/code&gt;.&lt;br&gt;
On that directory, try running &lt;code&gt;./subl&lt;/code&gt; on a the terminal, it should launch Sublime Text for you. Btw, I hope you're using iTerm 2 with ZSH and not the Terminal that comes with Mac, if you're on Mac. If not, check out &lt;a href="//../terminal-setup-on-mac/"&gt;this blog&lt;/a&gt;.&lt;br&gt;
Now to move to this directory and then executing this command every time is not of a big help, we create a shortcut for us.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$PATH&lt;/code&gt; is an env variable that lists all the directories that the OS should look for, for an executable.&lt;br&gt;
Run &lt;code&gt;echo $PATH&lt;/code&gt; to check your env value. Pick any directory from there, for instance, I picked &lt;code&gt;/usr/local/bin&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;You now need to create a link from this directory to the executable. You can do that by running:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/sublime&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This creates a &lt;a href="https://linuxize.com/post/how-to-create-symbolic-links-in-linux-using-the-ln-command/"&gt;symbolic link&lt;/a&gt; between two files. For my case, the &lt;code&gt;/usr/local/bin/sublime&lt;/code&gt; actually points to &lt;code&gt;/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;With this link being created, you can execute/run &lt;code&gt;sublime&lt;/code&gt; from anywhere using the Terminal app and it will launch Sublime for you.&lt;/p&gt;

&lt;p&gt;Now you can launch sublime from anywhere executing &lt;code&gt;sublime&lt;/code&gt;, as well as open a particular file by mentioning the file name as well. Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;touch test
&lt;/span&gt;sublime &lt;span class="nb"&gt;test&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above commands would create a file named &lt;code&gt;test&lt;/code&gt; and would open it in Sublime Test.&lt;/p&gt;

&lt;p&gt;Sublime CLI also comes in with a lot of other stuff, check &lt;code&gt;sublime --help&lt;/code&gt; for more.&lt;/p&gt;

&lt;p&gt;PS: a lot of sites mention the link command as: &lt;code&gt;ln -s "&amp;lt;the directory&amp;gt;" &amp;lt;target directory&amp;gt;&lt;/code&gt;, however, for me, avoiding the quotes worked, and not the other way around.&lt;/p&gt;

</description>
      <category>sublime</category>
      <category>terminal</category>
      <category>linux</category>
      <category>macos</category>
    </item>
    <item>
      <title>Save time remembering SSH hosts</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Mon, 09 Aug 2021 05:02:55 +0000</pubDate>
      <link>https://dev.to/pradipta/save-time-remembering-ssh-hosts-5fdp</link>
      <guid>https://dev.to/pradipta/save-time-remembering-ssh-hosts-5fdp</guid>
      <description>&lt;p&gt;As part of my work I regularly have to SSH into various hosts to perform some actions or to debug issues.&lt;br&gt;
Every time I do it, I head to our internal cloud dashboard to figure out the IP address of the host that I need to SSH into. There are a few hosts for particular services that I SSH into very frequently, almost on a daily basis.&lt;/p&gt;

&lt;p&gt;It is not possible to remember IP addresses, which look like 10.12.13.14.&lt;/p&gt;

&lt;p&gt;Assigning a name is easier. I now have created aliases for my most frequently used hosts.&lt;/p&gt;

&lt;p&gt;On the &lt;code&gt;~/.zshrc&lt;/code&gt; file, I added:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;alias ssh-service-env-zone="ssh ipaddress"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The next time I wish to SSH into &lt;code&gt;ipaddress&lt;/code&gt;, I can just do a &lt;code&gt;ssh-service-env-zone&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This gets even better with &lt;code&gt;Auto Suggestions and Syntax Highlighting&lt;/code&gt;. For details check out this &lt;a href="https://pradipta.github.io/terminal-setup-on-mac/"&gt;blog&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ssh</category>
      <category>zsh</category>
      <category>terminal</category>
      <category>linux</category>
    </item>
    <item>
      <title>Manage Multiple Git Accounts on a Computer</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Tue, 08 Jun 2021 17:21:53 +0000</pubDate>
      <link>https://dev.to/pradipta/manage-multiple-git-accounts-on-a-computer-h0m</link>
      <guid>https://dev.to/pradipta/manage-multiple-git-accounts-on-a-computer-h0m</guid>
      <description>&lt;p&gt;Want to use a Git account for work and one for personal projects? Here's how.&lt;/p&gt;

&lt;p&gt;I recently started working for a company that uses GitHub Enterprise for their Git solution. I set my work laptop and it's terminal to use that GitHub account and git credentials to manage git on my computer.&lt;br&gt;
I also wanted to work on my personal projects which I have maintained on my GitHub account. The process to maintain multiple Git accounts on a single machine was straightforward but I wasn't aware of the how-tos.&lt;/p&gt;

&lt;p&gt;I looked up upon it a little and got it to work. If you're looking for the same, follow the steps:&lt;/p&gt;

&lt;p&gt;&lt;em&gt;(The commands and directories are according to a Mac computer. Things might change on a Linux or a Windows, but the job to be done remains the same, please look uiip for the right commands in that case.)&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;1. Generate separate SSH Keys for both (or more?) accounts&lt;/h3&gt;

&lt;p&gt;head to your &lt;code&gt;.ssh&lt;/code&gt; directory and generate sets of SSH keys for both the accounts. This can be ignored for the accounts which already have a pair generated. This was true for my case as I had already set up my work account.&lt;br&gt;
To generate a pair of ssg keys, run &lt;code&gt;ssh-keygen -t rsa&lt;/code&gt;&lt;br&gt;
Follow the instructions that ask for a file location, name, etc. For the name, I prefer setting something like &lt;code&gt;id_rsa_work&lt;/code&gt; and &lt;code&gt;id_rsa_personal&lt;/code&gt; as it is easier to identify (in case I need to someday).&lt;/p&gt;

&lt;h3&gt;2. Manage ssh config file&lt;/h3&gt;

&lt;p&gt;There should be a file named &lt;code&gt;config&lt;/code&gt; in the &lt;code&gt;.ssh&lt;/code&gt; folder. If not, we need to create one by running &lt;code&gt;touch config&lt;/code&gt;.&lt;br&gt;
Edit the config and add the following lines into it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#work account
Host github&amp;lt;-identifier&amp;gt;.com
   HostName &amp;lt;enterprice github host&amp;gt;
   User git
   IdentityFile ~/.ssh/id_rsa_work
   IdentitiesOnly yes

#personal account
Host github&amp;lt;-identifier&amp;gt;.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa_personal
   IdentitiesOnly yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Example config:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#pradipta-sarma account
Host github.com
   HostName xyz.github.com
   User git
   IdentityFile ~/.ssh/id_rsa_work
   IdentitiesOnly yes

#pradipta account
Host github-personal.com
   HostName github.com
   User git
   IdentityFile ~/.ssh/id_rsa_personal
   IdentitiesOnly yes
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And save the file.&lt;/p&gt;

&lt;h3&gt;3. Register the SSH keys on the respective GitHub accounts&lt;/h3&gt;

&lt;p&gt;This step is to let GitHub identify our machine and authorize it, to avoid typing in the id and password everytime.&lt;br&gt;
Follow the steps &lt;a href="https://docs.github.com/en/github/authenticating-to-github/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account"&gt;here&lt;/a&gt; to add the keys to the respective accounts.&lt;/p&gt;

&lt;p&gt;To avoid using the work account on a clone for a personal repo, you can change a clone from:&lt;br&gt;
&lt;code&gt;git clone git@github.com:user/repo.git&lt;/code&gt; to &lt;code&gt;git clone git@github-personal.com:user/repo.git&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With this, you're good to go. Let me know if there's an issue or if I have missed something.&lt;/p&gt;

&lt;p&gt;Originally posted &lt;a href="https://pradipta.github.io/multiple-git-accounts/"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
    </item>
    <item>
      <title>Mongock, Mongo and Java</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Sun, 29 Nov 2020 16:55:51 +0000</pubDate>
      <link>https://dev.to/pradipta/mongock-mongo-and-java-4jj9</link>
      <guid>https://dev.to/pradipta/mongock-mongo-and-java-4jj9</guid>
      <description>&lt;p&gt;Originally posted on my &lt;a href="//pradipta.github.io/mongock-java-mongodb/"&gt;blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Database Migration tools are essential with applications where you need to migrate data into a database, change a schema, update a record/document across all environments and where it is tedious to do it manually (&lt;em&gt;almost always?&lt;/em&gt;). These can also help you with keeping a track of the changes made, just like version control.&lt;/p&gt;

&lt;p&gt;With Java there are various libraries you can use for the purpose. There's &lt;a href="https://www.liquibase.org/"&gt;Liquibase&lt;/a&gt;, &lt;a href="https://flywaydb.org/"&gt;Flyway&lt;/a&gt;, &lt;a href="https://github.com/cloudyrock/mongock"&gt;Mongock&lt;/a&gt; and maybe more.&lt;/p&gt;

&lt;p&gt;When using MongoDB as the database for the application, I found that Mongock would be the best to go for.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/mongobee/mongobee"&gt;Mongobee&lt;/a&gt; seems to be outdated and not being maintained anymore.&lt;/p&gt;

&lt;p&gt;To use the same with a Java, you would need the following dependencies (in addition to the Mongo Java Driver/Spring Mongo data that you'd use to set up the application anyways):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://mvnrepository.com/artifact/com.github.cloudyrock.mongock/mongock-bom"&gt;Mongock BOM&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mvnrepository.com/artifact/com.github.cloudyrock.mongock/mongock"&gt;Mongock runner&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mvnrepository.com/artifact/com.github.cloudyrock.mongock/mongock-spring-v5"&gt;Mongock driver&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mvnrepository.com/artifact/org.mongodb/mongodb-driver-sync"&gt;MongoDB driver sync&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Make sure not to import Mongock Core along with the above dependencies, as it will lead you into having multiple versions of a library in your classpath. Read more on this &lt;a href="https://github.com/cloudyrock/mongock/issues/274"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On importing the above, all you need to do is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Annote the Application Class with &lt;code&gt;@EnableMongock&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Specify the package(s) where you'd localte your &lt;code&gt;Changelog&lt;/code&gt; classes on your &lt;code&gt;application.yml&lt;/code&gt; or &lt;code&gt;application.properties&lt;/code&gt; under &lt;code&gt;mongock.change-logs-scan-package&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With this, the application should be ready to be run, without an issue. If you face any, leave a comment or visit the &lt;a href="https://github.com/cloudyrock/mongock/issues"&gt;issues&lt;/a&gt; section on Github, and you'd most likely find a solution for it.&lt;/p&gt;

&lt;p&gt;To add a changelog, create a &lt;code&gt;changelog&lt;/code&gt; class in the package mentioned in the properties file. Annotate the class with &lt;code&gt;@Changelog(order = "001...")&lt;/code&gt;. The order defines the order in which the changelog classes will be executed in case there are multiple. The class should now contain the &lt;code&gt;changesets&lt;/code&gt;. The changesets are nothing but Java methods. You can create collections, insert a document, or do whatever you'd want to that you can do via a Java method. The method would run at the Startup and the changes (if any) would get executed (if not already).&lt;/p&gt;

&lt;p&gt;Example class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@ChangeLog(order = "001")
public class Changelog {
    @ChangeSet(order = "001", id="001", author = "pradipta")
    public void dummyChangeSet() {
        System.out.println("Dummy changeset");
    }

    @ChangeSet(order = "002", id="create collection", author = "pradipta")
    public void createCollection(MongoDatabase db) {
        MongoCollection&amp;lt;Document&amp;gt; mycollection = db.getCollection("dummycollection");
        Document doc = new Document("k1", "v1").append("k2", "v2");
        mycollection.insertOne(doc);
    }

    @ChangeSet(order = "003", id = "insert document", author = "pradipta")
    public void insertDocument(MongockTemplate mongockTemplate) {
        User user = new User("Name", "Email", "Phone");
        //User is an entity with a collection already defined
        mongockTemplate.save(user);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is also another method where you write the builder yourself and not annotate the application with &lt;code&gt;@EnableMongock&lt;/code&gt;. You'd want to do it if you want to have a control over the beans and configure things. Read the &lt;a href="https://www.mongock.io/quick-start"&gt;documentation&lt;/a&gt; for more info.&lt;/p&gt;

&lt;p&gt;With these, you can be sure to have the changes being executed onto the DB on a successful deployment to any environment.&lt;/p&gt;

&lt;p&gt;Happy coding.&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>java</category>
      <category>database</category>
      <category>springboot</category>
    </item>
    <item>
      <title>A Problem with JJWT With Java 11 (9+)</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Fri, 13 Nov 2020 17:10:20 +0000</pubDate>
      <link>https://dev.to/pradipta/a-problem-with-jjwt-with-java-11-9-2cm4</link>
      <guid>https://dev.to/pradipta/a-problem-with-jjwt-with-java-11-9-2cm4</guid>
      <description>&lt;p&gt;Originally posted on my &lt;a href="https://pradipta.github.io/jaxb-with-java-11/"&gt;blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was implementing Spring Security for a service I am working on for work. The project is based on Java 11 and the Spring Boot Framework.&lt;br&gt;
Usign the JWT token, I was supposed to extract user details and roles. The JWT is signed using a secret key with has been stored in properties encoded in base 64.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nc"&gt;Jwts&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;parser&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;setSigningKey&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;appProperties&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getAuth&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;getTokenSecret&lt;/span&gt;&lt;span class="o"&gt;()).&lt;/span&gt;&lt;span class="na"&gt;parseClaimsJws&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;authToken&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code is used to validate the JWT's authenticity.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;setSigningKey(...)&lt;/code&gt; method looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;JwtParser&lt;/span&gt; &lt;span class="nf"&gt;setSigningKey&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;base64EncodedKeyBytes&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;Assert&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;hasText&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base64EncodedKeyBytes&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"signing key cannot be null or empty."&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;keyBytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TextCodec&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;BASE64&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;decode&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;base64EncodedKeyBytes&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method throws an error when it tries to decode the encoded key.&lt;br&gt;
Logs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;java.lang.ClassNotFoundException: javax.xml.bind.DatatypeConverter
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606) ~[na:na]
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168) ~[na:na]
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
    at io.jsonwebtoken.impl.Base64Codec.decode(Base64Codec.java:26) ~[jjwt-0.5.jar:0.5]
    at io.jsonwebtoken.impl.DefaultJwtParser.setSigningKey(DefaultJwtParser.java:71) ~[jjwt-0.5.jar:0.5]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, the same Library was being used on other projects I/my team had worked on written in Java 8. There, the decode method calls an api from &lt;code&gt;jaxb&lt;/code&gt;, but I obserrved that on the Java 11 project, it wasn't the case. Even with exact same version of &lt;code&gt;jjwt&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The problem lies with JJWT with Java 11 (or any after Java 8).&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;jaxb&lt;/code&gt; APIs are considered to be Java EE APIs. The API is completely removed from the Java 11 SDK. With the introduction of modules since Java 9, the &lt;code&gt;java.se&lt;/code&gt; module is available on the default classpath, and it doesn't include Java EE APIs.&lt;/p&gt;

&lt;p&gt;To fix the same, you can pass &lt;code&gt;--add-modules java.xml.bind&lt;/code&gt; as a command line argument.&lt;br&gt;
A better fix is to add the &lt;code&gt;jaxb&lt;/code&gt; API as a Maven/Gradle dependancy.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Runtime, com.sun.xml.bind module --&amp;gt;
&amp;lt;dependency&amp;gt;
    &amp;lt;groupId&amp;gt;org.glassfish.jaxb&amp;lt;/groupId&amp;gt;
    &amp;lt;artifactId&amp;gt;jaxb-runtime&amp;lt;/artifactId&amp;gt;
    &amp;lt;version&amp;gt;{version}&amp;lt;/version&amp;gt;
&amp;lt;/dependency&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;compile group: 'javax.xml.bind', name: 'jaxb-api', version: '{version}'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes &lt;code&gt;jaxb&lt;/code&gt; APIs available in the classpath and the above problem gets fixed.&lt;/p&gt;


&lt;p&gt;Sources:&lt;br&gt;&lt;br&gt;
&lt;/p&gt;
&lt;li&gt;&lt;a href="https://stackoverflow.com/questions/43574426/java-how-to-resolve-java-lang-noclassdeffounderror-javax-xml-bind-jaxbexceptio"&gt;Link 1 | StackOverflow&lt;/a&gt;&lt;/li&gt;
&lt;br&gt;&lt;br&gt;
&lt;li&gt;&lt;a href="https://www.programmersought.com/article/57492225148/"&gt;Link 2 | ProgrammerSought Blog&lt;/a&gt;&lt;/li&gt;
&lt;br&gt;&lt;br&gt;
&lt;li&gt;&lt;a href="https://github.com/jwtk/jjwt/issues/317"&gt;Link 3 | GitHub&lt;/a&gt;&lt;/li&gt;

</description>
      <category>java</category>
      <category>spring</category>
      <category>jwt</category>
      <category>todayilearned</category>
    </item>
    <item>
      <title>Manage Multiple JDK Versions on Your Computer</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Thu, 12 Nov 2020 17:49:22 +0000</pubDate>
      <link>https://dev.to/pradipta/manage-multiple-jdk-versions-on-your-computer-12ld</link>
      <guid>https://dev.to/pradipta/manage-multiple-jdk-versions-on-your-computer-12ld</guid>
      <description>&lt;p&gt;Originally published on my &lt;a href="https://pradipta.github.io/multiple-java-versions/"&gt;blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Java now released a new version every 6 months, the latest as on the date of this post is the &lt;a href="https://openjdk.java.net/projects/jdk/15/"&gt;JDK 15&lt;/a&gt;, while the LTS are released at longer intervals.&lt;/p&gt;

&lt;p&gt;You might be using a version of Java for work or your personal use, and may need to use another version of it for a different project. Or, if you're one who would want to try out the newest version as soon as it comes out and also have the stable version installed, this can help. Although, you can pick up a JAR from anytime in the past 25 years, and most likely it will run on the newest version of Java, it is good to have an LTS (or whatever your main version of need is) installed for your actual projects.&lt;/p&gt;

&lt;p&gt;To change a version of Java, you need to change the &lt;code&gt;JAVA_HOME&lt;/code&gt; environment variable. And it's a pain to do it every time.&lt;/p&gt;

&lt;p&gt;I have two projects that I work on almost everyday. One runs on Java 8 while the other is on Java 11. Here's what I did to be able to switch between them when needed.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export JAVA8_HOME=$(/usr/libexec/java_home -v1.8)
export JAVA11_HOME=$(/usr/libexec/java_home -v11)

alias java8='export JAVA_HOME=$JAVA8_HOME'
alias java11='export JAVA_HOME=$JAVA11_HOME'

# To use Java 8
java8

# To use Java 11
java11
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After doing so, I now have two aliases &lt;code&gt;java8&lt;/code&gt; and &lt;code&gt;java11&lt;/code&gt;, calling which, sets my &lt;code&gt;JAVA_HOME&lt;/code&gt; to either &lt;code&gt;JAVA8_HOME&lt;/code&gt; or &lt;code&gt;JAVA11_HOME&lt;/code&gt;. Adding a new one is as easy as exporting a new home and creating an alias for it.&lt;/p&gt;

&lt;p&gt;In case you're using zsh, you can write these into your &lt;code&gt;.zshrc&lt;/code&gt; file using &lt;code&gt;echo&lt;/code&gt; or pasting them into the file manually and doing a &lt;code&gt;source ~/.zshrc&lt;/code&gt;. An awesome tutorial to set up ZSH is up &lt;a href="https://pradipta.github.io/terminal-setup-on-mac/"&gt;here&lt;/a&gt; or &lt;a href="https://dev.to/pradipta/terminal-setup-on-macos-48l9"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is another way of doing this using &lt;code&gt;jenv&lt;/code&gt;. A post on that will be here soon.&lt;/p&gt;

</description>
      <category>java</category>
      <category>openjdk</category>
      <category>jdk</category>
    </item>
    <item>
      <title>Day 1 with the Github CLI 1.0</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Tue, 29 Sep 2020 18:30:41 +0000</pubDate>
      <link>https://dev.to/pradipta/day-1-with-the-github-cli-1-0-2imn</link>
      <guid>https://dev.to/pradipta/day-1-with-the-github-cli-1-0-2imn</guid>
      <description>&lt;p&gt;Originally posted on my &lt;a href="https://pradipta.github.io/day-1-with-the-github-cli"&gt;blog&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;GitHub finally launch their CLI, versioned 1.0 after 7 months of having it in Beta. Done with &lt;code&gt;Cmd+Tab&lt;/code&gt; / &lt;code&gt;Ctrl+tab&lt;/code&gt; to move to the browser. Do it all at one place.&lt;/p&gt;

&lt;p&gt;You can install the GitHub CLI on you laptop and can perform entire GitHub's workflow right from the terminal, starting from creating an issue, reviewing a PR, to merging a PR.&lt;/p&gt;

&lt;p&gt;You can create aliases against any commands.&lt;br&gt;
You can also use GitHub APIs to trigger Actions.&lt;/p&gt;

&lt;p&gt;Visit this &lt;a href="https://cli.github.com/"&gt;link&lt;/a&gt; for the official documentation.&lt;/p&gt;

&lt;p&gt;To install Github CLI, open the terminal and run:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;brew install gh&lt;/code&gt; [Mac]&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo apt-add-repository https://cli.github.com/packages &amp;amp;&amp;amp; sudo apt update &amp;amp;&amp;amp; sudo apt install gh&lt;/code&gt; [Linux]&lt;/p&gt;

&lt;p&gt;&lt;code&gt;scoop bucket add github-gh https://github.com/cli/scoop-gh.git&lt;/code&gt; [Windows]&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gvUzk53W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z1wq21q0yo7evpyq4zif.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gvUzk53W--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/z1wq21q0yo7evpyq4zif.png" alt="brew install gh"&gt;&lt;/a&gt;&lt;/p&gt;

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

&lt;p&gt;After the installation, we need to authenticate the CLI with our GitHub Account. For that, run &lt;code&gt;gh auth login&lt;/code&gt; and proceed with the instructions that follow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--g4Szft86--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eop95e9ycn3qw8lpmun9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--g4Szft86--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/eop95e9ycn3qw8lpmun9.png" alt="gh auth login"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On a successful login, we now can perform all the workflows of GitHub, for which, previously, we had to open the browser, right from the terminal.&lt;/p&gt;

&lt;p&gt;Let's look at some of them.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;gh repo clone &amp;lt;repo name&amp;gt;&lt;/code&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fFbMr9pU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9fwa2iojsylsx41fop1y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fFbMr9pU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/9fwa2iojsylsx41fop1y.png" alt="gh repo clone"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;gh repo view&lt;/code&gt; would show us the Readme for the repo, if any.&lt;/p&gt;

&lt;p&gt;We can create an issue on a repo using &lt;code&gt;gh issue create&lt;/code&gt; and entering the details that it asks for.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--O6N0DMIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qu01e78m7m6jdv6lsahp.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--O6N0DMIz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/qu01e78m7m6jdv6lsahp.png" alt="gh issue create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I created a new branch and made some changes, commited them and pushed it to the branch. To raise a PR, I previously had to go to GitHub.com on my browser and raise it from there. No more. All you need is: &lt;code&gt;gh pr create&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--GL4Az64o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l3qneg20bxti073oyfn9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--GL4Az64o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/l3qneg20bxti073oyfn9.png" alt="gh pr create"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can also perform PR reviews from the CLI. I haven't tried out reviewing a big PR on it to put my thoughts about it. But yes, we can. We can approve, leave comments, or request for changes right from the CLI.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NVxEHpv_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oivdbcalve17u5o22ha6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NVxEHpv_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/oivdbcalve17u5o22ha6.png" alt="gh pr approve"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Also, have it merged.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NT2DzD85--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/c9thjrls6142q4mwe1p6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NT2DzD85--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/c9thjrls6142q4mwe1p6.png" alt="gh pr merge"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is just an overview, there are a whole lot of commands we need to play around and try out.&lt;/p&gt;

&lt;p&gt;One of the best things: to create a new repo, we donot need to do a &lt;code&gt;git init&lt;/code&gt;, Create Repo on GitHub.com, and &lt;code&gt;git remote add origin ...&lt;/code&gt;. It is just a command on the CLI.&lt;/p&gt;

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

</description>
      <category>github</category>
      <category>git</category>
      <category>opensource</category>
      <category>news</category>
    </item>
    <item>
      <title>Build a Slackbot using Hubot</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Sun, 14 Jun 2020 17:05:53 +0000</pubDate>
      <link>https://dev.to/pradipta/build-a-slackbot-using-hubot-oo7</link>
      <guid>https://dev.to/pradipta/build-a-slackbot-using-hubot-oo7</guid>
      <description>&lt;p&gt;Originally posted on my &lt;a href="https://pradipta.github.io/build-a-salckbot-using-hubot/"&gt;blog&lt;/a&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--aVjBkkw2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2xo1mwm54mttok9z1iof.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--aVjBkkw2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/2xo1mwm54mttok9z1iof.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;"Hubot is your friendly robot sidekick."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hubot is open source, it is written in Coffee Script on NodeJS by Github. It can automate a lot of stuff and bring up fun in around the office, and improve efficiency in some tasks.&lt;/p&gt;

&lt;p&gt;Hubot comes along with a few built-in scripts and is pretty fun to use in itself. It can be used on your command line, or can be integrated to other services, like Slack. You can even write your own script or an NPM module and import it into your Hubot project. The script can be written in CoffeeScript, or JS.&lt;/p&gt;

&lt;p&gt;To get started with Hubot, you must have NodeJS and NPM installed.&lt;/p&gt;

&lt;p&gt;To generate your hubot run npm install -g yo generator-hubot&lt;/p&gt;

&lt;p&gt;Now think of a name for your Hubot and create a directory. I named mine &lt;code&gt;Alfred&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ mkdir alfred
$ cd alfred
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here you can now generate your Hubot by running &lt;code&gt;yo hubot&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;You can now run the hubot by running &lt;code&gt;./bin/hubot&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To get a list of all supported commands by Alfred, run alfred help. Since it already comes with some scripts and modules installed, you can play around with it.&lt;/p&gt;

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

&lt;p&gt;Although these are fun, they are not of actual help. We can write our own scripts that can do what we want them to do. We can automate stuff, make it talk to third party apis, deploy services, set reminders and what not! You can also persist data into its own Redis service (called Hubot Brain) or connect it to an external database service.&lt;/p&gt;

&lt;p&gt;There are other open source Hubot scripts. Search for them on the NPM registry for &lt;code&gt;hubot-scripts &amp;lt;your-search-term&amp;gt;&lt;/code&gt;. Once you find one you can install it and put it up on &lt;code&gt;external-scripts.json&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To write your own script:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You must place the CoffeeScript or the JS in the &lt;code&gt;scripts&lt;/code&gt; directory&lt;/li&gt;
&lt;li&gt;You must have to export the function from the script&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Let's create a custom script which gives you the idea of how to actually write one. Move to the scripts directory, and create a &lt;code&gt;.coffee&lt;/code&gt; or or a &lt;code&gt;.js&lt;/code&gt; file. I named mine &lt;code&gt;alfred.coffee&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cd scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The first thing you need to do is add this section in the script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Description:
#   Alfred Hubot
#
# Dependencies:
#   None
#
# Configuration:
#   None
#
# Commands:
#   hubot hello
#
# Author:
#   pradipta.sarma
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is where Hubot can index your command into its list of all commands, which shows up on hitting &lt;code&gt;alfred help&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;To export the function off the script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = (robot) -&amp;gt;
    #Your code here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To respond to messages, we write the respond code as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;models.respond /hello/i, (res) -&amp;gt;
    res.reply("Hey, what's up?")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This code will make the bot listen to his name followed by the Regex pattern &lt;code&gt;/hello/i&lt;/code&gt;, and should reply with &lt;code&gt;“Hey, what’s up?”&lt;/code&gt;&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;res&lt;/code&gt; is the object that contains the message details, sender name, channel (if on Slack) etc. You can look around and find some useful information in there. To customise the message you can change the code to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = (robot) -&amp;gt;
    robot.respond /hello/i, (res) -&amp;gt;
        res.reply("Hey "+res.envelope.user.name+", what's up?")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On trying &lt;code&gt;alfred hello&lt;/code&gt; now, the response would &lt;code&gt;Hey Shell, what's up?&lt;/code&gt;. Since it is running it on Shell. This name would be replaced by a user's username if the bot had been running on Slack.&lt;/p&gt;

&lt;p&gt;To add more functionalities to your bot, this is all you need to know. You can add more .respond code with a suitable regex so that it gets triggered and the code following it executes. You can make HTTP calls, run a workflow, send an email, trigger a deployment, or whatever you want to automate with it.&lt;/p&gt;

&lt;p&gt;Slack comes with the option of integrating a Hubot out of the box. Go to .slack.com/apps and search for Hubot. Enter a name for the bot and other details that Slack asks for and once done, Slack will provide you with a Token. We need this token when we want to run the bot on Slack.&lt;/p&gt;

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

&lt;p&gt;To run the bot on Slack, make sure your computer has an internet connection (if running locally), or you're running on a cloud server. Run command:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;HUBOT_SLACK_TOKEN=YOUR_SLACK_TOKEN ./bin/hubot --adapter slack&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;It should now be up an running on Slack. Add the bot to a channel and send &lt;code&gt;alfred ping&lt;/code&gt;. It should respond with &lt;code&gt;PONG&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;In my previous organization there was Winky, a friendly bot which helped developers reserve dev and staging environments so that nobody has a conflict, nobody else deploys while somebody is testing a feature, but instead get the details of whoever is using an instance so that he/she can get in touch and maybe merge the changes and deploy together.&lt;/p&gt;

&lt;p&gt;I wanted to build something similar for my current organisation and that’s when I started off with Alfred and learned how to build a Hubot, integrate it with Slack and have it running on a server. I drew the idea from Winky, and Alfred here does almost the same thing. Thanks to &lt;a href="https://github.com/captn3m0"&gt;Nemo&lt;/a&gt; from Razorpay.&lt;/p&gt;

&lt;p&gt;Checkout this &lt;a href="https://github.com/pradipta/alfred"&gt;repository&lt;/a&gt; for the code to the bot built for our workspace.&lt;/p&gt;

&lt;p&gt;Good luck. Build a few bots. Happy coding.&lt;/p&gt;

</description>
      <category>slack</category>
      <category>javascript</category>
      <category>node</category>
      <category>hubot</category>
    </item>
    <item>
      <title>Terminal Setup on macOS</title>
      <dc:creator>Pradipta Sarma</dc:creator>
      <pubDate>Mon, 18 May 2020 03:59:27 +0000</pubDate>
      <link>https://dev.to/pradipta/terminal-setup-on-macos-48l9</link>
      <guid>https://dev.to/pradipta/terminal-setup-on-macos-48l9</guid>
      <description>&lt;p&gt;Originally posted on my &lt;a href="https://pradipta.github.io/terminal-setup-on-mac/"&gt;blog&lt;/a&gt;&lt;br&gt;
This is what the default terminal looks like on a Mac:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--fHtYdl8o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/pradipta/pradipta.github.io/raw/master/posts/zsh/images/terminal.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fHtYdl8o--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/pradipta/pradipta.github.io/raw/master/posts/zsh/images/terminal.png" alt="Terminal on a Mac"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this sucks. It looks bad, it is hard to read, and differentiate. And there are no fancy colors.&lt;/p&gt;

&lt;p&gt;To boost it up and level up the terminal game we’re going to use use the following:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;iTerm2
ZSH
Oh My ZSH
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Steps:&lt;/p&gt;

&lt;p&gt;Install Homebrew. For that, run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You may need to install Command Line tool for X-Code before that.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcode-select --install
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Download and install iTerm2 from here or run:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew cask install iterm2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Install ZSH and oh-my-zsh&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install zsh
sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;To run zsh shell, run:&lt;/p&gt;

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

&lt;/div&gt;

&lt;p&gt;We’re also going set up Auto Suggestions and Syntax Highlighting to make the experience friendlier and easier to use. To do that we need to edit the .zshrc file (located at &lt;code&gt;~/.zshrc&lt;/code&gt;). This is where most of our configuration is going to take place.&lt;/p&gt;

&lt;p&gt;Install zsh-autosuggestions and zsh-syntax-highlighting:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install zsh-syntax-highlighting
brew install zsh-autosuggestions
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;You can set your ZSH theme by putting in this line into your &lt;code&gt;.zshrc&lt;/code&gt; file. Make sure you import the &lt;code&gt;.zshrc&lt;/code&gt; after any change for it to reflect.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ZSH_THEME=robbyrussell
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;At this point your terminal/iTerm2 should look something like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PImdczRj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/pradipta/pradipta.github.io/raw/master/posts/zsh/images/zsh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PImdczRj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/pradipta/pradipta.github.io/raw/master/posts/zsh/images/zsh.png" alt="iTerm2 with ZSH"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is much better. Notice the short git commands that I’ve used? Well, those are configurable too. Follow this &lt;a href="https://github.com/pradipta/Terminal-Setup-for-Mac"&gt;repository&lt;/a&gt; for the complete guide and .zshrc file with all the configurations, aliases and functions.&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

&lt;p&gt;Originally posted on &lt;a href="https://pradipta.github.io/posts/zsh/"&gt;https://pradipta.github.io/posts/zsh/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Find all my blogs at &lt;a href="https://pradipta.github.io/"&gt;OmniaCode&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
