<?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" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Dario Djuric on Medium]]></title>
        <description><![CDATA[Stories by Dario Djuric on Medium]]></description>
        <link>https://medium.com/@dario-djuric?source=rss-c157d738212d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*lUVeKu48iflfsfdYMhH9fg.png</url>
            <title>Stories by Dario Djuric on Medium</title>
            <link>https://medium.com/@dario-djuric?source=rss-c157d738212d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 20:01:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dario-djuric/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Run Groovy Within Uber JAR Using Maven]]></title>
            <link>https://medium.com/javarevisited/run-groovy-within-uber-jar-using-maven-646e9864b0a4?source=rss-c157d738212d------2</link>
            <guid isPermaLink="false">https://medium.com/p/646e9864b0a4</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[maven]]></category>
            <category><![CDATA[groovy]]></category>
            <dc:creator><![CDATA[Dario Djuric]]></dc:creator>
            <pubDate>Fri, 16 Apr 2021 13:54:39 GMT</pubDate>
            <atom:updated>2021-04-16T13:54:39.626Z</atom:updated>
            <content:encoded><![CDATA[<h4>Creating an executable JAR having a mix of Groovy and Java code</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uXCu0yhUqUO_j6mu" /><figcaption>Photo by <a href="https://unsplash.com/@vidarnm?utm_source=medium&amp;utm_medium=referral">Vidar Nordli-Mathisen</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Running Groovy scripts from command-line is relatively simple: the only prerequisite is having the Groovy binary installed and then you can use to run any Groovy script. Even dependency management is easy — just annotate your external classes with @Grape and <a href="http://docs.groovy-lang.org/latest/html/documentation/grape.html">Groovy’s Grape</a> mechanism will do the complete dependency retrieval process for you.</p><p>Sometimes, though, things are more complex and you might have a mix of Java and Groovy code, some external dependencies, perhaps even resource files. In such cases, the above approach will not work, and you might need to resort to using a so-called “uber JAR” to make your deployment easier, by building a single executable file that contains everything you need in a single package.</p><h3>Uber JARs</h3><p>An uber JAR is a common term for a slightly upgraded JAR that contains not just your code, but all dependencies that your code depends on, all packaged in a single JAR file. This is a really convenient way of packaging your application where you can easily deploy and run using only a couple of commands.</p><p>For example, once you copy your uber JAR file to a target location, running your application can be quite easy:</p><pre>java -jar uber.jar</pre><p>That’s simple enough, isn’t it?</p><p>Some frameworks such as <a href="https://medium.com/javarevisited/top-10-courses-to-learn-spring-boot-in-2020-best-of-lot-6ffce88a1b6e">Spring Boot</a> give you uber JARs with little effort. However, if you have a plain old Java application, things aren’t so trivial anymore.</p><p>This guide will show you how you can create uber JARs when you have a project with several dependencies. And to make things slightly more complicated, let’s assume that a Groovy file instead of a Java file contains your main method.</p><h3>Compiling Groovy Code</h3><p>Maven, by default, will compile only Java code stored under src/main/java. Typically, though, you will not have any Groovy code there. You’ll store your <a href="https://javarevisited.blogspot.com/2017/08/top-5-books-to-learn-groovy-for-java.html">Groovy </a>in src/main/groovy.</p><p>To compile Groovy code, the first step is to add Groovy dependency, then instruct <a href="https://medium.com/javarevisited/6-best-maven-courses-for-beginners-in-2020-23ea3cba89">Maven </a>where to find Groovy classes so it can compile them. You’ll also need to include the Groovy compiler plugin:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e798efa42efaf719b31f791c2d43e625/href">https://medium.com/media/e798efa42efaf719b31f791c2d43e625/href</a></iframe><p>Now, let’s create a Groovy file with the main method. For simplicity, we’ll store it directly in the root package:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/36fab40427a1b0e27a53d4399dea1dd3/href">https://medium.com/media/36fab40427a1b0e27a53d4399dea1dd3/href</a></iframe><h3>Assembling JAR File</h3><p>For creating the actual JAR file, we will use the <a href="http://maven.apache.org/plugins/maven-assembly-plugin/">Maven Assembly Plugin</a>. With just a few configuration settings, this plugin allows you to create uber JARs that include not just your Java/Groovy code, but all dependencies your code depends on (and their dependencies as well — the complete tree).</p><p>After adding the Maven Assembly Plugin, the POM file will look like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa1894b9b93e587fb1706ec35f608ec9/href">https://medium.com/media/fa1894b9b93e587fb1706ec35f608ec9/href</a></iframe><p>There are two things to note here. First of all, the main class is referenced in the mainClass element:</p><pre>&lt;mainClass&gt;Main&lt;/mainClass&gt;</pre><p>If the Main class were to belong to a package, then you would need to prefix it with the package name. For example: a.b.c.Main</p><p>The second interesting element is the finalName element. This element specifies the name of the assembled JAR. In our case, the <a href="https://javarevisited.blogspot.com/2017/06/how-to-get-jar-files-of-jackson-libary-for-JSON.html">JAR </a>will be named uber.jar.</p><h3>Packaging and Running</h3><p>That’s it. Now, before running your JAR, you’ll need to create it by running mvn package and the JAR will be created during the Maven package phase. Once you have the JAR, you may deploy it to your target environment and running it using the Java binary and its -jar flag:</p><pre>java -jar uber.jar</pre><p>Thanks for reading! I hope you found the guide useful. Maven Assembly Plugin is just one of the plugins that allow you to create executable JARs. One other popular one is the <a href="https://maven.apache.org/plugins/maven-shade-plugin/">Maven Shade Plugin</a>. Both plugins are nice, although their configuration differs quite a bit. It’s up to you to decide which one is more suitable for your use case.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=646e9864b0a4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/javarevisited/run-groovy-within-uber-jar-using-maven-646e9864b0a4">Run Groovy Within Uber JAR Using Maven</a> was originally published in <a href="https://medium.com/javarevisited">Javarevisited</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Execute Raw PostgreSQL Queries in NestJS]]></title>
            <link>https://javascript.plainenglish.io/how-to-execute-raw-postgresql-queries-in-nestjs-1967a0cb950b?source=rss-c157d738212d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1967a0cb950b</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[nestjs]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[sql]]></category>
            <dc:creator><![CDATA[Dario Djuric]]></dc:creator>
            <pubDate>Sun, 21 Mar 2021 09:22:27 GMT</pubDate>
            <atom:updated>2021-03-21T09:22:27.235Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*a2T_Y_CuW1aXi9M9" /><figcaption>Photo by <a href="https://unsplash.com/@casparrubin?utm_source=medium&amp;utm_medium=referral">Caspar Camille Rubin</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>The <a href="https://docs.nestjs.com/techniques/database">official NestJS documentation</a> has many examples showing how to use an ORM framework such as <a href="https://typeorm.io/">TypeORM</a> to integrate with a database. However, what if you don’t want to use an ORM, but would rather execute raw queries on the database without the overhead of an ORM?</p><p>This tutorial will give you an example of how this could be done. In this tutorial, we will write a module that will responsible for executing SQL queries on a PostgreSQL database.</p><h3>Required Dependencies</h3><p>For this to work, we’ll need to install a library that will allow us to interface with a PostgreSQL database. <a href="https://node-postgres.com/">node-postgres</a> is the de facto standard library for this, so let’s install it:</p><pre>npm install pg</pre><p>Since NestJS uses TypeScript, we can also install the TypeScript definitions for node-postgres:</p><pre>npm install @types/pg --save-dev</pre><h3>Configuration File</h3><p>Database configuration is usually stored in an outside configuration file, and you will often have different files for different environments. For the purpose of this tutorial, we’ll store our database settings in a simple .env file:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7c2b21bc7cbc62c123a249665b85ed6/href">https://medium.com/media/e7c2b21bc7cbc62c123a249665b85ed6/href</a></iframe><p>Reading this file shouldn’t be a problem if we use NestJS’s built-in ConfigModule. We’ll import this module in our AppModule and make it global:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3be25ed95221249fb70748f99e943d58/href">https://medium.com/media/3be25ed95221249fb70748f99e943d58/href</a></iframe><p><a href="https://docs.nestjs.com/modules#global-modules">Making modules global</a> is not common unless you really plan to use them in most of your application modules. Reading configuration is a common task, so it makes sense to make ConfigModule global. This way, we don’t have to import it explicitly in every application module. The other configuration property, envFilePath , is the path to our .env file.</p><p>With ConfigModule configured and imported, we can now use ConfigService throughout the application to retrieve values from our configuration file. For example, configService.get(&#39;POSTGRES_USER&#39;) will return my-user in our case.</p><h3>Database Module</h3><p>Now, let’s create a dedicated module that will be a container for our database integration functionality.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5736a85f35d89adf3df8400514dc6f68/href">https://medium.com/media/5736a85f35d89adf3df8400514dc6f68/href</a></iframe><p>The purpose of this module is to connect to the database and expose a service for executing queries on the database.</p><p>The recommended way of connecting to the database from a NestJS application is through <a href="https://node-postgres.com/features/pooling">database pools</a>. A database pool is simply a node-postgres object that is responsible for managing connections to the PostgreSQL database.</p><p>Since we will be injecting this pool into our database service, we can create it using a <a href="https://docs.nestjs.com/fundamentals/custom-providers#factory-providers-usefactory">factory provider</a>. Factory providers allow us to use dependency injection to inject other providers, such as the ConfigService .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ad1382c8615c20aa295b3666f65fdab/href">https://medium.com/media/7ad1382c8615c20aa295b3666f65fdab/href</a></iframe><p>In the above snippet, we defined our provider in the module’s providers array, named it DATABASE_POOL, and told NestJS to inject an instance of ConfigService to our factory so we can initialize the pool object with the configuration from our .env file.</p><p>Now let’s create a database service that will be used to execute queries. The executeQuery method is blank for now, and we are injecting our pool object named DATABASE_POOL to the service. We also created an instance of the <a href="https://docs.nestjs.com/techniques/logger#using-the-logger-for-application-logging">NestJS logger</a> so we can log database queries as they happen.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fc7bf337a5e8fc62756fe0000492bd5b/href">https://medium.com/media/fc7bf337a5e8fc62756fe0000492bd5b/href</a></iframe><p>Now we need to export this DatabaseService from our DatabaseModule so other application modules can use it:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9bd4a81f3deff1f5e44339ad4002dae/href">https://medium.com/media/e9bd4a81f3deff1f5e44339ad4002dae/href</a></iframe><p>We can now finish the executeQuerymethod which will invoke pool.query() to execute queries on the database:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0a0f40315d7f8fe6b3cca41c521d7c47/href">https://medium.com/media/0a0f40315d7f8fe6b3cca41c521d7c47/href</a></iframe><p>The method is simple: it accepts query text, optional parameters, and returns the result rowset.</p><h3>Finally: Clean Up</h3><p>The database pool we initialized in our DatabaseModule will not make any connections until the first query is executed. When this happens, a new connection client is created and is kept in the pool while the pool is alive. If the application is shut down, this pool is shut down abruptly without any clean-up.</p><p>To fix this, we can use the NestJS lifecycle hooks and react to termination signal. Listening to termination signals <a href="https://docs.nestjs.com/fundamentals/lifecycle-events#application-shutdown">does consume a bit more resources</a>, so this is an optional feature in NestJS. It can be enabled using the enableShutdownHooks() method of the application instance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7e4a9eae1e7b19a72c9b7abeb5732b8a/href">https://medium.com/media/7e4a9eae1e7b19a72c9b7abeb5732b8a/href</a></iframe><p>With shutdown hooks enabled, we can write the actual shutdown hook in our DatabaseModule .</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/145baf01a83b361e3c7351a11d774c61/href">https://medium.com/media/145baf01a83b361e3c7351a11d774c61/href</a></iframe><p>We use a <a href="https://docs.nestjs.com/fundamentals/module-ref">module reference</a> to retrieve the instance of our pool object from the module context, then call its end() method to disconnect all active clients. Since this method returns a promise, NestJS will wait in the shutdown sequence until the promise is resolved or rejected.</p><h3>Wrapping Up</h3><p>Thanks for reading. I hope you found this tutorial useful. Directly interfacing with the database may not be so common use case in NestJS, but sometimes it can be useful when you want more control of the queries executed. If you run into any issues, please let me know in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1967a0cb950b" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/how-to-execute-raw-postgresql-queries-in-nestjs-1967a0cb950b">How to Execute Raw PostgreSQL Queries in NestJS</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Applications for Better Productivity]]></title>
            <link>https://dario-djuric.medium.com/applications-for-better-productivity-917d676c2d0b?source=rss-c157d738212d------2</link>
            <guid isPermaLink="false">https://medium.com/p/917d676c2d0b</guid>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[windows]]></category>
            <category><![CDATA[tips-and-tricks]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[productivity]]></category>
            <dc:creator><![CDATA[Dario Djuric]]></dc:creator>
            <pubDate>Fri, 25 Dec 2020 16:31:00 GMT</pubDate>
            <atom:updated>2021-04-10T08:54:02.970Z</atom:updated>
            <content:encoded><![CDATA[<h4>A collection of useful applications for getting stuff done faster</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6_H4-KCiPNP2RfNw" /><figcaption>Photo by <a href="https://unsplash.com/@zfett?utm_source=medium&amp;utm_medium=referral">Zachary Fetters</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I’m a productivity freak. I’m always on the lookout for new and better tools that will allow me to do more in less time. Whether or not I am successful is a different story.</p><p>Over the years, I have found many applications and techniques that have significantly improved my productivity. In this article, I would like to share them with you. Being a Windows user myself, many apps listed here are Windows-only, though some are cross-platform. Don’t get discouraged if you are a Mac or Linux user. Each tip in this article is presented as a concept and is in no way meant to be an advertisement for a specific app or platform. Besides, using a site such as <a href="http://alternativeto.net/">AlternativeTo</a>, you can easily find pretty decent alternatives to all apps suggested here.</p><p>Let’s start with the number one productivity tip: use a to-do list.</p><h3>Use a To-Do List</h3><p>Most people have some sort of to-do list: whether it’s a collection of post-it notes on their fridge, a simple text file, or an app on their cell phone or computer. It’s a natural way of keeping track of work that needs to be done.</p><p>I will not go into specifics or recommendations on how to maintain a to-do list. I do want to mention some requirements that I had for a to-do app that helped me be faster and more productive. Perhaps this will also give you some idea of what to look for in a to-do app.</p><p>One such requirement is that it needs to be a cross-platform app. I have many gadgets: a mobile phone, work laptop, iPad, and desktop PC at home. Whichever device I use, I would like to be able to access my to-do list quickly.</p><p>The second requirement is to be able to add tasks quickly. I don’t want to perform a dozen clicks just to add a task. Often I am on a go, perhaps even in a midst of a conversation, and I want to be able to quickly note a task so I don’t forget it.</p><p>The third requirement is that the app has natural language parsing with built-in reminders, a feature that is quite rare in to-do apps. Why is that important? Again, when adding tasks, I want to be able to specify quickly if I want to be reminded of that task at some point. Let’s say that I want to remind myself to bring a book to work tomorrow. I would write something along the lines of:</p><pre>Bring book tomorrow 8:15</pre><p>The app should be to recognize that I specified a reminder time and remind me tomorrow 8:15 of that task. I also want to be able to specify recurring tasks in a similar fashion:</p><pre>Pay my bills 1st monthly 10:00</pre><p>(to remind me to pay my bills on the 1st of every month at 10:00)</p><p>The fourth requirement is easy editing of tasks. Again, I don’t want to waste too many clicks just to edit the task title. Ideally, I should be able just to click the task and automatically go to edit mode.</p><p>The fifth and final requirement is being able to categorize and prioritize my tasks. This is a feature that is pretty standard on most to-do apps so this requirement is a no-brainer. Nevertheless, some to-do apps do implement it better than others.</p><p>For a long time, I used <a href="https://www.wunderlist.com/">Wunderlist</a> as my primary to-do app, until it was acquired by Microsoft, stripped it down and changed it to <a href="https://to-do.microsoft.com/">Microsoft ToDo</a>. Microsoft ToDo is decent, but unfortunately, some of the functionalities from Wunderlist are still missing. A better replacement for me was <a href="https://ticktick.com/">TickTick</a>, which I have been using for the last couple of years.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*49Lh5zr7wyFYbvXzDF1mYA.gif" /><figcaption>Pressing Ctrl+Shift+N in Windows opens a small TickTick dialog allowing quick entry of tasks. Note how it highlights the date part.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SsyPSAPCk7rw5GTm4yav0Q.png" /><figcaption>This task is then visible in the list</figcaption></figure><h3>Unify Your Calendars</h3><p>Calendars are a great way to organize your time. Many people have some sort of work calendar where they can find scheduled meetings among other things.</p><p>I like to keep my work calendar separate from my personal calendar. For example, at work, we use <a href="https://support.microsoft.com/en-us/outlook">Outlook calendar</a>, while my personal calendar is on <a href="https://www.google.com/calendar">Google Calendar</a>. Google Calendar also allows having a <a href="https://support.google.com/families/answer/7157782?co=GENIE.Platform%3DDesktop&amp;hl=en">family calendar</a> that you can share with your spouse, kids, etc.</p><p>Managing so many calendars can be troublesome, so it’s useful to have an app that integrates all calendars into one. I use <a href="https://www.onecalendar.nl/">OneCalendar</a> on Windows, although there are many other options to choose from. For example, <a href="https://minetime.ai/">MineTime</a> is a relatively new app that also works cross-platform.</p><h3>Use Keyboard Instead of a Mouse</h3><p>Perhaps you’ll notice one pattern throughout the tips in this article. I try to utilize my keyboard as much as possible. Why is that important for productivity?</p><p>Grabbing the mouse, finding the pointer, pointing it to click takes a couple of seconds on average, assuming that whatever you are trying to find is on the screen already (and not hidden away somewhere). Although these two seconds seem negligible, it’s still two seconds wasted when you could be using the keyboard instead to fire up a shortcut and get where you need to be faster.</p><h3>Learn to Touch-Type</h3><p>Closely related to the previous tip is the practice of touch typing. Before I learned to touch-type, I can’t really say I used my keyboard in an optimal way. I wasn’t using all of my fingers and I also had to look at the keyboard occasionally. My average speed was around 60–70 WPM, which might seem decent, but considering that I had been typing for nearly two decades I wouldn’t consider it very good for my standards.</p><p>A couple of years ago I learned to touch type and this was one of the smartest decisions I’ve made. Now I type around 90 WPS on average and this speed is growing steadily. If I had learned touch typing earlier in my life, I would probably be at 150 WPS now.</p><p>Learning to touch type one thing that will definitely help you in your career if you work with computers, and most of us do. There are many services out there that can help you practice. The one I used (and still use) myself is <a href="https://www.keybr.com/">Keybr.com</a>. It’s a great service that generates typing lessons matching your skills. It tracks your progress, detecting which letters you need practice with, and lets you practice words containing those letters.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eaTI4GCiY1hEkWakoAzOGA.png" /><figcaption>My statistics on Keybr.com. Average typing speed has been growing steadily, while number of errors has been declining.</figcaption></figure><h3>Use Text Expansion</h3><p>The previous tip will help you type faster, but why type something when an app can do it for you? Enter the world of text expanders, a collection of apps that listen to keywords or shortcuts and react by inserting predefined text snippets, saving you time on typing e-mails, documents, etc.</p><p>One shortcut that I use most often is the one for inserting my e-mail. For example, typing “:emal” will trigger my text expander and replace “:emal” with my e-mail, which is a great time-saver for me as I normally have to type my e-mail quite often. I use at least a dozen similar shortcuts.</p><p>Text expanders have become increasingly popular in the past several years and there are many of them available for all platforms. On Windows, I used to use <a href="https://www.autohotkey.com/">AutoHotkey</a>, but recently I switched to <a href="https://espanso.org/">Espanso</a> which is cross-platform.</p><p>AutoHotkey is more than a text expander, though. It is an automatization tool, helping me to automate certain actions in Windows. I still use it for that purpose, but more on that in the next tip:</p><h3>Automatize Tedious Tasks</h3><p>Sometimes we have certain actions that we perform often but are tedious and repetitive. For example, let’s say that you have an app that requires you to perform the same sequence of steps or clicks to perform a task. Using a tool like <a href="https://www.autohotkey.com/">AutoHotkey</a>, everything can be automated in Windows — it just depends on how far you want to go.</p><p>One common automation that I use is setting volume in Windows. I wanted to have a shortcut that I can use on any device, whether it be a laptop or PC. I wrote three different shortcuts using AutoHotkey: for volume up, volume down, and mute.</p><pre>^!u::<br>SendInput {Volume_Mute}<br>return<br>^!Up::<br>SendInput {Volume_Up 3}<br>return<br>^!Down::<br>SendInput {Volume_Down 3}<br>return</pre><p>One other automation that I use is GUI automation. For example, I use Cisco AnyConnect to connect to my work VPN. Every time I open the app, I need to click the Connect button to open the login dialog. This can become tedious, so why not automate it?</p><pre>Run, C:\Program Files (x86)\Cisco\Cisco AnyConnect Secure Mobility Client\vpnui.exe<br>WinWaitActive, Cisco AnyConnect Secure Mobility Client<br>SetControlDelay -1<br>ControlClick, Button1, Cisco AnyConnect Secure Mobility Client</pre><p>Now, instead of clicking through the app I simply run the above AutoHotkey script and I will get to the login dialog much faster.</p><h3>Store Your Passwords in a Password Manager</h3><p>Don’t even think about using the previous tips to automate entering a password somewhere. Passwords are sensitive information and you should always securely save your passwords. Never store them in a text file or a post-it note.</p><p>Fortunately, there are many good apps for that. One classic app that I still use today is <a href="https://keepass.info/">KeePass</a>. <a href="https://1password.com/">1Password</a> and <a href="https://www.lastpass.com/">LastPass</a> are also popular and very user friendly, but they are paid services (although LastPass does have a limited free plan).</p><h3>Save Articles for Reading Later</h3><p>While doing my regular morning round-up of news sites and blogs, I often find something interesting to read that I don’t have much time for at that moment. While I could bookmark it for a later time, it’s much easier to use a service like <a href="http://getpocket.com/">Pocket</a>.</p><p>Pocket is made for saving articles for reading at a later time. However, it does much more than that. It has a smart scanner that goes through the saved page and strips it down to basic text without any unnecessary ads or images. This works surprisingly well, although on some rare occasions it does strip down too much. In those cases, you can simply choose to view the normal version of the page.</p><p>Pocket has a mobile version aside from web and desktop version, so you can read your saved articles anytime, anywhere.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T-1M7SNdYvcMRjN-W2R6Jw.png" /><figcaption>There is always something in my Pocket, although I do manage to clean my list every once in a while. I have a habit of reading at least a couple of articles before going to bed.</figcaption></figure><h3>Use Alternative File Explorer</h3><p>Windows Explorer is perfectly good enough for most people. Myself, I just don’t feel productive using it. As I noted earlier, I try to utilize my keyboard as much as possible, so I’m missing the ability to set keyboard shortcuts to favorite folders. I also want the ability to use tabs to quickly switch between multiple folders I work on.</p><p>Fortunately, there are plenty of options to choose from. Call me old, but I am a fan of <a href="https://www.speedproject.com/sc">SpeedCommander</a>, which uses a classic two-pane window that <a href="https://en.wikipedia.org/wiki/Norton_Commander">Norton Commander</a> popularized in the 90s.</p><p>SpeedCommander has good support for FTP and SFTP, which is a bonus since I don’t have to use an additional tool for that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ltu0l5wMdqXVTy5O1Q1bag.png" /><figcaption>SpeedCommander uses a proven two-pane interface.</figcaption></figure><h3>Use an Application Launcher</h3><p><a href="https://keypirinha.com/">Keypirinha</a> has to be one of the nicest tools I’ve discovered over the last few years. A tool so small, yet so performant and useful. This tool belongs to the class of so-called “application launchers”. Application launchers, generally speaking, allow you to find and launch your applications faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*8H7q263JQpyLH6WdYm41SA.png" /></figure><p>Keypiranha works by running in the background and waiting until you trigger a special shortcut that opens the application. By default, this is Ctrl+Win+K, although this can be changed to any shortcut. I use Alt+Space. Once the application is opened, it allows you to search for a task that you want to execute. A “task” can be another application, a browser bookmark, or anything else searchable by <a href="https://keypirinha.com/shipped-packages.html">its plugins</a>. You can even use it as a calculator, or currency converter.</p><p>For example, let’s say you wanted to quickly open Google Chrome. Instead of using your mouse to click on the start menu, finding Google Chrome shortcut, and clicking it, you could just press Alt+Space and type “chr”. Keypiranha searches all of the installed applications and provides those that contain the string “chr”. It will also search for other files that contain the same string, and those will likely show in the list of available tasks.</p><p>Provided that Google Chrome is the first on the list, you can just press Enter and this will launch Chrome. If initially, Chrome happens to be further down the list, then you just use the arrow keys to select it. The next time you type “chr”, it will appear further up the list. This means that Keypiranha “learns” how you use your searches and eventually you won’t need to use arrow keys for your common searches anymore.</p><p>Nowadays, I cannot imagine working without Keypiranha. I use it to launch applications, documents, bookmarks, and much more. I hardly use Windows Start Menu anymore.</p><h3>Find a Note-Taking Tool</h3><p>A proper note-taking tool is essential for any productivity enthusiast. With so many note-taking tools out there, it can be sometimes difficult to find a perfect one that will suit your needs. In fact, <a href="https://www.youtube.com/watch?v=wpcVQeF07G4">as Ali Abdaal notes</a>, a perfect note-taking tool for you might even depend on your personality.</p><p>Even I have migrated from one tool to another a few times. I started with <a href="https://simplenote.com/">SimpleNote</a>, but later I migrated to <a href="https://www.onenote.com/">OneNote</a>, looking to use some more powerful features such as pasting pictures into notes. Eventually, after having weird sync issues and also wanting to be able to format text using <a href="https://www.markdowntutorial.com/">Markdown</a>-like syntax, I went to <a href="https://www.notion.so/">Notion</a> which I still use today.</p><p>In any case, I recommend that you try several note-taking apps before settling down on one. <a href="https://alternativeto.net/">AlternativeTo</a> is a good place to start.</p><h3>Disable Most Notifications</h3><p>This itself is not a tool but a general guideline that I try to abide by. Nowadays, it’s getting more and more difficult to find deep focus at work. Ad-hoc meetings, e-mails, messages are all appearing in a random fashion and distracting you from the work that you need to do. While it’s almost impossible to completely isolate from everything, it’s a good idea to at least try to organize your time and try to find continuous periods where you can focus and work on whatever task you have at the moment.</p><p>Techniques such as the <a href="https://en.wikipedia.org/wiki/Pomodoro_Technique">Pomodoro technique</a> can help. Many have used this technique successfully to organize their time. However, even in those timeslots of 25ish minutes when you should be working, your apps try to fight for your time, popping up from everywhere with notifications. You probably don’t need to react to most of these notifications, so why not disable them altogether? Instead of reacting to every notification, why not have dedicated timeslots in your day to check and respond to notifications?</p><p>Of course, this is not always an option. Perhaps you use Slack or Teams at work and colleagues need to get ahold of you quickly. Not every company is organized like Basecamp where <a href="https://medium.com/@dfeldman/basecamp-communication-principles-revisited-b63239905b49">most communication is asynchronous</a>.</p><p>There is a compromise. Slack and other similar instant messaging tools give you the possibility to tweak notifications so they are easier to manage. For example, the default notification in Slack is a popup that appears in a corner of your screen for every received message. At the same time, it also changes the system tray icon, indicating that there are unread messages. Why have both? The latter mechanism is perfectly fine and non-intrusive. The messaging popup can easily distract you from your work, not to mention it’s not always convenient to have private messages popping up while you have someone else looking at your screen.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/78/1*JheCN7IlUk5A2qlVvK3d6A.png" /><figcaption>Windows system tray, from left to right: Slack, Teams, Telegram. Each having indication for unread messages.</figcaption></figure><p>To summarize, my suggestion is to disable all notifications that are not important. You will have peace of mind. As for other more important notifications, at least make them less intrusive.</p><h3>Sync Your Important Files</h3><p>If you don’t have anything against storing your private files in the cloud, my final tip would be to use one of the many cloud sync services such as <a href="http://www.dropbox.com/">Dropbox</a>, <a href="http://onedrive.live.com/">OneDrive</a>, <a href="http://drive.google.com/">Google Drive</a>, or <a href="http://www.pcloud.com/">pCloud</a>. This is useful for several reasons.</p><p>First of all, it gives you a great option for syncing files between various devices, from laptop/desktop to mobile. In one moment you are working on a document on your laptop, in another you are on the go, viewing the same document on your mobile phone. The sync itself is quite fast and you won’t even notice it’s happening.</p><p>Secondly, by keeping your important files in the cloud, you also have a safe backup in case any of your devices go haywire.</p><p>Finally, having a cloud sync service also allows you to sync and backup your application settings easily. Some applications already have support for this out of the box, while others can be tricked with a bit of effort. But that’s a topic for another article.</p><p>I hope you found at least some above tips useful. Do you have some productivity tips of your own? Let me know in the comments below.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=917d676c2d0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Retrieving Raw Files via GitLab API]]></title>
            <link>https://dario-djuric.medium.com/retrieving-raw-files-via-gitlab-api-2b86ac1183b0?source=rss-c157d738212d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2b86ac1183b0</guid>
            <category><![CDATA[gitlab-api]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[checkstyle]]></category>
            <dc:creator><![CDATA[Dario Djuric]]></dc:creator>
            <pubDate>Wed, 27 Mar 2019 16:32:19 GMT</pubDate>
            <atom:updated>2021-05-12T15:29:19.384Z</atom:updated>
            <content:encoded><![CDATA[<p>In my company, we use Checkstyle to enforce our internal Java conventions. The Checkstyle configuration file used to be hosted on <a href="https://github.com/VersoAltima">our public GitHub repository</a>, but since we use self-hosted GitLab internally, we figured it made sense to host it there. However, we couldn’t find an easy way to retrieve raw files having the following requirements in mind:</p><ul><li>The file should be retrievable through a single GET request so we can use the URL in <a href="https://maven.apache.org/plugins/maven-checkstyle-plugin/">Maven’s Checkstyle Plugin</a></li><li>The URL should be pretty — without cryptic IDs so it can be clearly visible which GitLab the configuration file is hosted on, what is the file’s location within the project, and which tag/branch/commit we are referring</li></ul><p>The <a href="https://docs.gitlab.com/ce/api/">GitLab API</a> does give some hints, however we had to do quite a bit of digging to pinpoint a proper format of the URL.</p><p>The first step is to create a Personal Access Token that will be used to authenticate to the API. Since we use Jenkins, we normally create a dedicated Jenkins user that is added to most projects, and this user is also used for accessing the Checkstyle configuration. We created a token under this user, as shown in the below screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*phYgD4-x7v3jKOztcOGRKA.png" /><figcaption>Creating Personal Access Tokens in GitLab</figcaption></figure><p>Make sure to write down the token, as there is no way to retrieve it later. You can only revoke it when and if needed.</p><p>Once you have the token, you can form the URL as follows:</p><p><em>https://[GITLAB_URL]/api/v4/projects/[PROJECT_NAME_OR_ID]/repository/files/[FILE_PATH]/raw?ref=[TAG_OR_BRANCH_OR_COMMIT]&amp;private_token=[PRIVATE_ACCESS_TOKEN]</em></p><p>Note that the file path must be <a href="https://www.urlencoder.org/">URL encoded</a>, meaning that you will use config%2fcheckstyle.xml if your file is stored in the repository as config/checkstyle.xml, for example. The same applies for project name if you will use it instead of the ID; you must URL encode it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b86ac1183b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Retrieving Worklogs Using Jira Tempo REST API]]></title>
            <link>https://dario-djuric.medium.com/retrieving-worklogs-using-jira-tempo-rest-api-f7a0c77c4832?source=rss-c157d738212d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f7a0c77c4832</guid>
            <category><![CDATA[jira]]></category>
            <category><![CDATA[rest-api]]></category>
            <category><![CDATA[tempo]]></category>
            <dc:creator><![CDATA[Dario Djuric]]></dc:creator>
            <pubDate>Tue, 02 Jan 2018 12:30:50 GMT</pubDate>
            <atom:updated>2021-04-12T15:46:40.822Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve had quite a bit of trial and error while trying to retrieve all worklogs made by a specific user in a given period using Jira’s Tempo plugin REST API. The <a href="https://tempoplugin.jira.com/wiki/spaces/JTS/pages/76906719/Tempo+REST+APIs">official documentation</a> is not up to date and is in some parts misleading (at least at the time of writing this). However, I’ve managed to get what I wanted by issuing a GET request to the following path:</p><p><strong>/rest/tempo-timesheets/1/tempo-worklogs?jql=worklogAuthor%20%3D%20currentUser()&amp;period=21&amp;periodView=DATES&amp;paginate=false</strong></p><p>This gives a list of worklogs for the past 21 days for currently logged in user. The query consists of several parts:</p><ul><li>The jql parameter is used to filter out Jira issues to which the user has contributed to.</li><li>periodView is set to DATES, meaning that it will return the last N days where N is given by period parameter.</li><li>paginate is set to false, otherwise the result will be limited by 50 worklogs (default).</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f7a0c77c4832" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Connecting to GCP Compute Instance via SecureCRT on Windows]]></title>
            <link>https://medium.com/google-cloud/connecting-to-gcp-compute-instance-via-securecrt-on-windows-b1b5a6f0ec11?source=rss-c157d738212d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1b5a6f0ec11</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[securecrt]]></category>
            <category><![CDATA[ssh]]></category>
            <dc:creator><![CDATA[Dario Djuric]]></dc:creator>
            <pubDate>Mon, 13 Nov 2017 08:45:23 GMT</pubDate>
            <atom:updated>2021-04-12T15:47:34.388Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’ve ever wanted to connect to your Google Cloud Provider compute instance via SecureCRT or some other tool of your choice, this is one of the ways to do it, assuming that your machine has an external IP set up.</p><p>The first thing you’ll need is your own SSH key, which consists of a unique private SSH key file and a matching public SSH key file. I’ve already generated one using Git Bash since I have Git installed locally.</p><pre><strong>$ ssh-keygen -t rsa -C &quot;</strong><a href="/service/mailto:your_email@youremail.com"><strong>your_email@youremail.com</strong></a><strong>&quot;</strong><br>Generating public/private rsa key pair.<br>Enter file in which to save the key (/c/Users/you/.ssh/id_rsa): [Press Enter]<br>Enter passphrase (empty for no passphrase): [Type a passphrase]<br>Enter same passphrase again: [Type passphrase again]</pre><p>The SSH public key should then be available in c:\Users\[your username]\.ssh\id_rsa.pub. The public key will be in the format:</p><pre>&lt;protocol&gt; &lt;key-blob&gt; &lt;your_email@youremail.com&gt;</pre><p>Now, go to your GCP console, find your instance, and click Edit. Go to SSH Keys, click Add. If you paste the content of id_rsa.pub, then GCP will try to resolve the SSH username from <em>your_email@yourmail.com</em> (<em>your_email</em>) which may not correspond to the username you are using in your instance.</p><p>In such cases, it would be better to specify username explicitly and paste the following into SSH box:</p><pre>&lt;protocol&gt; &lt;key-blob&gt; google-ssh {&quot;userName&quot;:&quot;&lt;<a href="/service/mailto:username@example.com">username@example.com</a>&gt;&quot;,&quot;expireOn&quot;:&quot;&lt;date&gt;&quot;}</pre><p>Comparing to the content of id_rsa.pub, the only difference is that you are replacing your e-mail with:</p><pre>google-ssh {&quot;userName&quot;:&quot;&lt;<a href="/service/mailto:username@example.com">username</a>&gt;&quot;,&quot;expireOn&quot;:&quot;&lt;date&gt;&quot;}</pre><p>&lt;date&gt; can be something like 2020-01-01. &lt;username&gt; is your username in your compute instance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1b5a6f0ec11" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/connecting-to-gcp-compute-instance-via-securecrt-on-windows-b1b5a6f0ec11">Connecting to GCP Compute Instance via SecureCRT on Windows</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>