A blog where Moazzam … rambles
-
Golang: Make HTTP requests
A simple GET request can be made like this: package main import ( “net/http” “ioutil” ) func main() { // Make a get request rs, err := http.Get(“https://google.com”) // Process response if err != nil { panic(err) // More idiomatic way would be to print the error and die unless it’s a serious error }…
-
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: import “fmt” type Car interface { func Drive() } type Lamborgini struct { // Implement the Car interface func Drive() { fmt.Println(“Driving”) } } func driveACar(car Car) { car.Drive()…
-
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…
-
Go: Declaring and using objects
Go (or Golang) doesn’t have the concept of classes. The class equivalent in Go loos like this: // Make a Car class equivalent type Car struct { // object properties go here doors int } // Get the number of doors func (car *Car) Doors() int { return car.doors } // Set the number of…
-
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…
-
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. Run the following commands on your terminal to clone Ben Blazak’s firmware code from github and create a custom layout for…
-
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…
-
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…
-
Is Zephir worth learning?
Not so short answer: If you want to learn something that makes you more marketable, then no. It is better to learn C++ instead. If you just want to play with it, maybe write an extension or two for your project, then Zephir is fun language to learn. I checked for jobs dice.com and other…
-
A second look at Zephir
Ever since I found out about Zephir, I have been very curious about it. I mean compiled PHP code. How awesome is that? Also, Zephir code doesn’t have to be compiled into a PHP extension. You can just convert it to binary and run it normally like any other PHP code. Why spend a lot…
Got any book recommendations?