Go Lang

Checking JPEG image dimension from partial headers

The goal was to read image dimensions from an image file. Pretty easy task with standard “ image ” library and DecodeConfig. The tricky part was – the file wasn’t completed – I had only the beginning of the file. I tried to decode headers by myself. I didn’t find an exact recipe in GO and found many people looking for correct answers in many languages.

Using Google Cloud storage with AWS libraries in GO LANG

Using Google Cloud storage with AWS libraries in GO LANG

Google Cloud storage  it’s Google answer to [Amazon S3][1] service. As long one of them is very popular 😉 Second wasn’t so successful amongst developers due to quite complex processes around service. Amazon is super simple, and developer friendly – Google… well not so easy. So the questions – why you may consider using GS instead of well documented, and super easy S3. Not many people realise but Google Cloud Storage is actually cheaper . The other reason to use Google Storage is having different provider as a backup solution. Anyway – let’s show how easy is to use GS with existing S3 libraries.

How update Go library

How update Go library

Installation of go library is pretty simple: go get github.com/garyburd/redigo/redis

From time to time, you want to get fresh version of it. If you run that command again it will NOT update the library – because it’s already there. To update it you need to use the -u switch:

go get -u github.com/garyburd/redigo/redis

MongoDB vs MySQL using golang

MongoDB vs MySQL using golang

I’m the guy who like to test. Benchmark is my… middle name. You can find dozens articles about speed one or other solution. I mean MongoDB and MySQL . I tried MongoDB couple times, and each time I wasn’t  moved by it speed. Got project coming in, when I have to deal with large amount of concurrent connection. It’s not very big, but bigger then casual MySQL load.

So… how did I test – very dump way. Got 2 tables, one around 11k records, second one close to 200k record. Not much. Fields were indexed in both MySQL and MongoDB. And then i run benchmarks. First one had string fields, second one numeric.