Posts
Ranged Switch Case C++
· β˜• 2 min read · πŸ€– Naresh Mehta

Ranges in C++ Switch Case block

Today, we will do something really stupid! Yes, I am talking about the ranged switch case support that is available in C++. In all the commercial/hobby source code that I have seen, implemented and used, rarely have I come across the ranged switch case use. Most of the code when in need of ranges inside a switch case start using multiple case cascading or (the more niche programmers) resorting to nested if..else blocks!
So much so that when I told one of my co-workers that we can use ranges in C++ switch case, he started laughing (hysterically if I may add). Taken aback, I wanted to see if I have learned stuff wrong. So here it is, just to brush up your basic cpp knowledge and fall in love with it again! Below is the code in ideone ready for you to take for a spin.


Simple Downloader!
· β˜• 2 min read · πŸ€– Naresh Mehta

I come across this very nice siteΒ http://www.dwarkadheeshvastu.com/Β which has a collection of excellent MP3s (Devotional Music). I congratulate the maintainer of that site for the excellent collection of texts/mp3s in multiple languages. So the site is more or less static with mp3s arranged inside folders starting from 000.mp3 to the <lastsection>.mp3. And you want to download them all.

Layman way is to keep right clicking on each link and do save as. But we are lazy programmers. We will just give our job to the computer to increment the URL and download the file for us. This can very simply be done in a bash script. Below is a snippet. I will not go into explaining all the details, just that the script takes in 3 parameters (start of the count, end of count and the absolute URL of the folder). Run the script and get all the mp3s that you need. One can extend the script to pass in the kind of file we are interested in (like mp3, pdf, etc.). But that is left as a user exercise. The folder path can be got by looking at the HTML code (in case you are wondering how I got it).


Forgot your EXCEL Password?
· β˜• 2 min read · πŸ€– Naresh Mehta

Okay. It is a bit sneaky and I will not explain everything but if by any chance you are using Excel and are password protecting the sheets and if you forget what your password was, β€œYou are dead… ;)”. NOT REALLY! Use the following VBA script to recover the password. No need to download any softwares. Just press Alt+F11, put in the code and run it. It will soon pop up a box with the actual password which you can use to unlock.


SSHFS on Linux & Windows
· β˜• 2 min read · πŸ€– Naresh Mehta

SSHFS does come into play when connecting to a remote client and/or working on a remote server. I am pretty sure most of you are aware of how to do this. But if not, the below can help a lot with your development using your favorite tools. The problem is that on the remote servers is either not having root access, or updated and latest software and/or most of our new age tools might not work as expected (eg: try to run atom on it or sublimeText). Also using NX is pain… You can of course run Linux or X-Server on windows and get native X-forwarding but losing the SSH session will invalidate your window and you might have data loss. Worst of all, such X-sessions are not restored (on windows).


Angular2: Beyond the β€œTodo” list!
· β˜• 6 min read · πŸ€– Naresh Mehta

Angular2 is the latest buzz word in web programming and frankly speaking, I am in love with it. It seems to be the β€œDocker” for web! Well I am also in love with β€œDocker” and the good part is that both Angular2 and Docker do not mind me loving them at the same time ;). Jokes apart, I particularly like Angular2 because of the component concept and its inherent support for TypeScript (TS). Components truly allow for creation of re-usable web components since they also encapsulate the β€œview” aspect. Hence no more grappling / switching between a model/view/controller. Everything is inside a component. You use the component and you get an automatic binding with the needed controller and view. This takes re-usability to the next level. Also for someone like me whose background is systems programming, components can be seen as class object exposing certain methods/properties (i.e. basic encapsulation). Components also allows for extension (i.e. inheritance) and can be tested individually, so once confirmed working, they are always working without any external dependency. That said, there are quite a few tutorials out there which creates a basic ToDo app with Angular2 and yes, it is pretty cool. But when you try to make something useful out of what has been learned from the ToDo App, the details bog us down. In any case, #FreeCodeCamp (#FCC) project on Pomodoro Clock was my trigger to use Angular2. I have the project hosted on Plunker (Pomodoro Clock) which uses Angular2, TS and Semantic-UI. I am also a big fan of Jade so have used it a little bit in the index.html but using it inside a component template seems to be a bit awkward. Though we can do so, I have used normal HTML since the components are broken down and are quite simple. Pomodoro clock is basically a countdown timer which alternates between a session time and break time and increases productivity (Google it if you want to know more).


Get Started With Docker!
· β˜• 4 min read · πŸ€– Naresh Mehta

Docker is amazing! It is a gift to mankind. Next best thing after sliced bread! Lets start using it yeah. OK, lets say you want to get started with docker quickly and install a host of services on your local machine that enables you to get your big-data analytics SW into a real-time visualization. Don’t go about searching the net on how to install different servers. Instead, use Docker (I bet you knew this was coming)!


Install Linux on a Fresh Machine using LVM!
· β˜• 3 min read · πŸ€– Naresh Mehta

Okay, I know, the title says it all right? And there are hundreds and thousands of tutorials out there that allows you to do this right? Show me one tutorial which tells you what different partitions are needed when you are doing fresh install of Linux especially whose installers do not support LVM/LVM2 installations. Lets take an example of Manjaro, the latest talk of the town. The graphical installers do not have an option to support LVM. Even if you do manual partitioning, it does want to install anything over LVM and it wants the root and swap partitions. Besides, it will forget that we also need a smaller boot partition to install GRUB/SYSLINUX right? Well, atleast it did that to me and either I am too stupid to understand it or I didn’t read the instructions properly. In any case, I headed over to the CLI installer which thankfully had an option to use LVM (which was misguiding) since it wanted to do partitions manually and did not provide any guidance as to what partitions should be created. Instead it more felt like an GUI menu for creating reminding the steps namely partitioning, creating physical volumes (PVs) and creating volume groups (VGs).


Metrics & task boards in Scrum/Agile!
· β˜• 2 min read · πŸ€– Naresh Mehta

My thoughts on why and how metrics/measurements of ongoing tasks should be done.

I will start with the practice. The problems we are trying to tackle is:

  1. How to make our team believe in their own estimations?
  2. What is our cycle time?
  3. How do we project the probability of fulfilling the sprint goals?
  4. How do we track the state of the task?
  5. How do we ensure continuous development of processes?

For the last 3 questions, I suggest referring to the self-explaining Cumulative Flow Diagrams (http://www.slideshare.net/yyeret/explaining-cumulative-flow-diagrams-cfd). Martin Alaimo writes on measuring sprint progress in the Scrumalliance community blogs (https://www.scrumalliance.org/community/articles/2011/may/measuring-sprint-progress). Essential Scrum: A practical guide to the Most Popular Agile Process by Kenneth S. Rubin (p.357-359) defines how task metrics can be visualized (though in a table formation) (https://books.google.se/books?id=3vGEcOfCkdwC&pg=PA357&lpg=PA357&dq=visualize+tasks+in+scrum+boards&source=bl&ots=-BBbkkfr_l&sig=KqO_9xWDIEM3hVqe-9QSi0IQKQQ&hl=en&sa=X&ved=0ahUKEwjZk9ztxurKAhWFs3IKHYioBLE4FBDoAQg9MAU#v=onepage&q=visualize%20tasks%20in%20scrum%20boards&f=false). An electronic task board showing the progress (https://www.targetprocess.com/content/uploads/2013/11/lists-sketch-for-Targetprocess-3.png). A detailed article by MSFT on Task board (of course tailored towards VS Team edition usage but has lots of details) (https://msdn.microsoft.com/en-us/library/vs/alm/work/scrum/task-board). Another article (https://blog.taiga.io/q-id-like-to-measure-the-sprint-progress-through-closed-tasks.html) very good on why sprint progress should be monitored regularly and not at the end of the sprint.