Earn more by learning Go!

According to this article a friend forwarded to me, software developers who learn Go, Python or Scala (along with tech like Apache Spark) have found it easier to find jobs with better salaries. Learning Scala caused the highest boost and in the second place was Go.

Learning python is a bit subjective in terms of getting a raise. It depends on what you are doing and which field you are in. So the increase in income with Python isn’t as consistent as it is with the other 2 languages.

Here is the article in detail: http://www.infoworld.com/article/3071623/salary/want-to-boost-your-salary-learn-scala-golang-or-python.html

Golang: Testing HTTP requests

Unit testing HTTP calls to external services is pretty easy in Go. Let’s say we have some code that makes HTTP requests like so:

We can test if the request is made and we get the response we want by mocking the external service. Below is the code:

Golang: Make HTTP requests

A simple GET request can be made like this:

POST request:

If more control is needed, like specifying headers, cookies, etc:

Golang: Polymorphism

Polymorphism is a bit different in Go. A function’s parameters must accept an interface. If it accepts a concrete type, then you will not be able to pass anything other than what you are asking for. To help you understand better, here is an example:

However, Polymorphism doesn’t work when driveACar(lammborgini) would not work if Car was a struct and not an interface. Here is an example:

Don’t waste time

A friend of mine sent me an interesting quote by Imam Ghazali which puts things in perspective.

Your time should not be without any structure, such that you occupy yourself arbitrarily with whatever comes along.
Rather, you must take account of yourself and order your worship during the day and the night, assigning to each period of time an activity that must not be neglected nor replaced by another activity.
By this ordering of time, the blessing in time will show itself. A person who leaves himself without a plan as animals do, not knowing what he is to do at any given moment, will spend most of his time fruitlessly.
Your time is your life, and your life is your capital: by it you make your trade, and by it you will reach the eternal bounties in the proximity of Allah.
Every single breath of yours is a priceless jewel, because it is irreplaceable; once it is gone, there is no return for it.
So do not be like fools who rejoice each day as their wealth increases while their lives decrease. What good is there in wealth that increases while one’s lifespan decreases?
Do not rejoice except in an increase of knowledge or an increase of good works.
Truly they are your two friends who will accompany you in your grave, when your spouse, your wealth, your children, and your friends will remain behind.
— Imam al-Ghazali

Go: Declaring and using objects

Go (or Golang) doesn’t have the concept of classes. The class equivalent in Go loos like this:

The above declaration can now be used as an object like so:

First impressions of Go

I have been in search for a language I can use for web programming, writing computationally intensive and general scripting among other things. The language that came close to fitting all of these things was Racket, a dialect of Chicken Lisp. It can even do geometry drawings. However, there were issues with it so I ended up concluding it wasn’t that language in was in search of.

I started learning Go some time ago and, at first, found its syntax backwards. Declaring types after variable names was hard to get used to. And, the syntax for writing “classes” is even more weird. However, when I found out that Go supported concurrency (and parallelism) natively, I was intrigued. On a side note: default Python and Ruby interpreters do not support parallelism. PHP has some support through pthreads but using it could mean you not being able to use other extensions.

If you want to have a true parallel app in Ruby or Python you have to get the interpreter that runs on JVM. So, you Ruby code is run by the Ruby interpreter which is running on JVM. Ruby and Python support concurrency but their threads run one at a time. So, no parallelism.

Once you get past the syntax weirdness, Go is actually a pretty cool language. It makes it easy to write concurrent apps. They call them “go routines”. From what I have learned, go routines are cheaper to create and maintain than normal threads and the way Go is designed, it is very easy to communicate between threads (using channels). And, all of this makes sense since one of the goals of Go was to make multi-threaded network applications.

Those used to dynamic languages might find it a bit difficult to work with Go in the beginning as it is strongly typed. I was, however, able to adjust pretty easily (then again I have done C++, Java and C# in the past). Your mileage may vary but I highly recommend trying it out. You might like it.

Programming Macros for Ergodox

The default configuration tool on Input Club or Massdrop don’t allow for macro programming. So you will have to get your hands dirty and mess with the firmware code a little. It’s not hard.

  1. Run the following commands on your terminal to clone Ben Blazak’s firmware code from github and create a custom layout for yourself

  2. Open keyboard/ergodox/options.mk and add qwerty–custom to the KEYBOARD_LAYOUTS and change the KEYBOARD_LAYOUT to qwerty–custom. The keyboard layout will look something like this :

  3. Edit keyboard/ergodox/layout/fragments/macros.part.h and create a function for your macro. As an example, we will do a macro that prints b4.

  4. Now that the macro is ready, it can be placed in the layout. Put m_b4 for whichever key you want the macro to trigger. Edit firmware/keyboard/ergodox/layouts/qwerty–custom.c and put your macro in it.

  5. In the terminal, run make It will create firmware.hex
    Upload the file to Ergodox and your macro will be ready for use.

You can look up the hex codes for keys here: http://www.usb.org/developers/hidpage/Hut1_12v2.pdf

What should I learn?

This is a question I get asked a lot. Mostly by those who are just starting off their career as programmers/developers, but often times also by veterans of IT field.

Recently, I found myself asking that question when I came to the realization that PHP, as a language was not as much in demand as it once was. Not that I didn’t know this before but it became more apparent when I moved away from New York. With hundreds of companies and their office, it was never hard for me to find a job with great pay. Now, not so much.

With new technologies emerging faster than a New York minute how do you keep yourself relevant and keep moving up that corporate/salary ladder? A big part of that is knowing which technologies are in demand and being able to predict if they will stay in demand long enough for you to never run out of work.

After some experimentation (and a lot of help from God), these are the things that helped me realize where the market is going and what I need to learn next.

  1. Search the job sites
    Check out various job listing sites (monster.com, dice.com, etc) and search for jobs of all the technologies you are interested in and take a note of how many jobs are available and what their salaries are.

    If you are planning to move soon, then perform this search for the city you are going to move to (or thinking of moving to).

  2. Talk to recruiters
    The first time I heard big data was increasing in demand is when a recruiter mentioned it to me. She also told me PHP was becoming more of a niche skill than a mainstream skill. So, I decided to learn Ruby. I have always been fascinated by the meta-programming capabilities of Ruby.

    However, I came across an article published by Stack Overflow which showed Ruby was even less (much less) popular than PHP. I haven’t stopped learning it though. It’s a fun language and I want to explore it more.

  3. Go to startup meetups and see which technology stack is being used

    A few years ago, Python was the popular kid on the block. All the cool kids (new startups) were using it. If you told someone, your new project was not in Python or Node, you were looked down upon (I wish I was exaggerating).

    The only reason I found this out was because I noticed that at networking events, most new companies were using Python and Mongo.

  4. Other Thoughts

    These three things help you get a general idea of what you should learn next. However, there other things you should take into consideration. What is the most important thing you want your employer or your job to have? If you like working 9-5 then find out what big companies are asking for. If you like the startup culture, then find out what they want.

    Sometimes, you don’t know what you want until you have gone through a few jobs. When I started by career as a developer, my first few jobs were great. I was part of planning process for projects and it opened my mind to all the possibilities. I enjoyed that a lot. I felt intellectually challenged and learned a great deal.

    Later on, one of the jobs I got was at a firm where my manager expected his team to be robots. On top of that he micro-managed everything. I hated it. I didn’t like being micro-managed. Some people prefer it. Some developers are okay with vague requirements, some get paralyzed by them. In an ideal world we would have clear cut business requirements, but depending on where you work, that is often not the case. You need to figure out what you want and then narrow down your search based on that criteria.

    Currently the popular technologies seem to be: NodeJS, AngularJS, React, Big Data (data analysis, machine learning, etc). I think the reason for this is that quite a few new companies are being founded and investors (as well as business owners) need to know if the business plan will work and how to make it work. Javascript is is supported outside the browser, (applications like Mirth let you write code in JS for custom rules) which has added to its popularity.

    Java will always be in demand in the financial sector. You can never go wrong with learning C/C++. As long as computers are in use, C/C++ will be in demand.

    I hope this helps others are out who confused about their next step. Please feel free to contact me, if you have anything else that might be helpful. Below are some useful links:

    http://stackoverflow.com/research/developer-survey-2016 (a great resource)
    http://monster.com
    http://dice.com
    http://glassdoor.com
    http://indeed.com
    http://careers.stackoverflow.com

Clean your oil painting brushes the non-toxic way

Oxyclean stain remover is your friend. Wipe your brushes with a paper tower, then spray some Oxyclean into the bristles, leave it for a few seconds and wash them. You may need to use more than once on a brush but it will clean the brush and leave no color stains ( at least not as much as Gamsol + soap and water ).

I have heard some artists like to use baby oil to clean their brushes and they say you need a lot of it. I haven’t tried this method

Another cleaner that works great is Fast Orange hand cleaner. It is a bit thick and has pumice in it so I don’t use it for brushes as much. You have to make sure you get all the pumice out after you are done cleaning. Also I have had to use quite a bit of it on brushes.

Fast Orange cleaner is amazing for your hands. It will clean them better than regular soap and water. Also, you can use it as a facial or body scrub.

Notice how new brushes need to be broken in before painting. The bristles are stuck together and you need to brush them lightly on you hand to get them to part. You can get that with milk. After cleaning the brushes, take a few drops of milk and shape the brush. Next time you reach for it to paint, it will feel like you are painting with a new brush.