Oaths in Islam – Part 2

Since I posted an article on “Oaths in Islam”, I have gotten quite a few questions from readers (most of which I have not published) asking me to clarify if an oath they took is valid or something else related to oaths they took. I figured I would write another article providing examples to help such people out.

First I’d like to state that I am not a scholar, or even a formal student of sacred knowledge. I just happen to like learning and get my knowledge from reading various books, articles and listening to lectures. I had written the original article as a reminder for me after having read articles about oaths on sunnipath.com (now qibla.com) and other sources. Here is the original article, I am talking about: http://moazzam-khan.com/blog/oaths-in-islam/ if you are curious.

My friend/whoever took an oath that they will do something bad to themselves if I don’t do what they want.

If your friend, or anyone else takes an oath to not eat (or harm themselves) until you do something, that is between them. You are not responsible for their oaths. If they break those oaths, they will have to pay kaffarah for it. It doesn’t affect you. No one can force you to do something by taking an oath. Allah will not hold you accountable for an oath someone else took.

I swore that I will not let my son/daughter do something (like play soccer), but I want to let them play it. What should I do?

Firstly, try not to take oaths you can’t keep. Secondly, if you break your oath, you will have to pay the kaffarah. If you don’t break that oath, then you son/daughter will not get to play soccer (or whatever you forbade them from) .

3D Printing

The future is here – with 3D printing. If anyone has seen Star Trek, they will know about the synthesizer used in the show to make (synthesize) anything from coffee to costumes to anything else. This is how I felt when I first got my 3D printer and started making (printing) things with it.

You can pretty much design and print anything. It is, however, not as fast as the ones on the show (or the movies). They take a while to print somethhing but they are precise and will make almost anything you want/need. I have printed a holder for dry-erase markers and cleaning spray (which turned out to be better than anything I have ever bought for it), green latern rings for the kids, toy cars and many other things. It is also not as expensive as I thought it would be. To be fair, there are printers out there that cost upwards of $10,000 but they are not meant for a hobby-ist.

I got my printer for (I am not kidding) $250 on a sale. It’s regular price is $300 (Monoprice maker select v2).The plastic it uses to print stuff cost me $14.00 and will print things that cost a lot more than that.I printed a car phone ring holder. Each ring holder in the store costs $20. I printed it for less than a dollar.

I will try and post pictures of things I have printed in another post and my experiences with my printer and 3D printing in general.

Why Golang/Go is so awesome

I have been working with Go for quite some time now and know more about it. My initial thoughts about it were accurate, I think with some variations. Go really can do almost everything.

It can be run like any interpreted language for development and compiled for production

This is something I love about Go a lot. You can run any Go code by just typing:

And, you can compile your whole app into a binary, copy that binary to a production server and just run it. No dependencies needed. If you have assets that your app reads (like images, etc) , they can be compiled into the binary as well! This gives a whole new meaning to portability (at least for me).

It supports parallelism and concurrency

With Go routines, you can run multiple things at the same time (assuming you have a multi-core CPU). Go takes care of splitting your routines into multiple-threads and all the house-keeping chores that come along with it. It is, by far, the best multi-threaded language I have come across.

Many developers think Node supports parallelism but it doesn’t. Node is a great language for its asynchronous model but it executes only 1 thread at a time. Most scripting languages that I know of (Ruby, Python, etc) have this issue. They have a global interpreter lock, which makes sure only one thread executes at a time. So, they are concurrent but do not support parallelism (running multiple things at the same time).

Since, web servers spawns multiple processes for processing multiple HTTP requests, you don’t generally notice the bottleneck.

It has a unit testing framework in its standard library

It’s the first language, I’ve seen doing this. No need to install external libraries. The testing framework (in a package called “testing”) is very performant. It also lets you run benchmark tests and example code for generating documentation.

It has support for GUIs apps

There are a bunch of libraries in Go that will let you write native applications for Windows, Mac, etc. Go has bindings for GTK, QML, etc. Some Go libraries will even let you write hybrid apps (for desktop applications – will talk about mobile later).The content in these native UIs can be done using HTML/CSS. I tried this for a proof-of-concept app that generates configuration for a proprietary ETL tool at my work and it is so easy to do! The library I used was : https://github.com/murlokswarm/app

It has support for writing web services and web applications

Go, with it’s standard library has a templating engine built-in. And, it is very performant. No need to worry about which library to use for templating, etc. You can, with a few lines of code, create a web service!

There are quite a few features that make Go a great language to work with. I hope it proliferates the IT market so much that more companies ask for Go as a main requirement for jobs (and not just a nice-to-have).

Golang: Restart web server on file change

A great feature of scripting languages like PHP, Python and Ruby is that you don’t need to re-compile the app or restart a web server every time you change something. With Go, you need to restart the web server for your changes to take affect. This can be a pretty daunting task.

We can, however, have this feature in Go as well (with some extra code). We just need to write a file watcher that will restart the web server on any file changes. Below is working code (from a project I am building) that does exactly this. You can modify it to suit your needs or just put it in your project as is.

Golang: Get the function caller’s name


Consider this code:

In the function foo, we want to get the name of the function (and preferably file name and number ) that called it.


We can get this information by traversing the stack trace (which Go’s “runtime” package has handy functions for:

Golang: Connect to Postgres and selecting data from a table

You will need to get the Postgres driver first. In the terminal type:

Connecting to Postgres

Selecting data from a table

After connecting to the database, you can do the following:

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. It supports polymorphism only through interfaces (and not through inheritance). 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: