Ramblings of a Coder's Mind

Got Tech? Will Hack.

Use Spotify internationally (again)

If you don’t mind using Spotify in a browser, you can use Hola Better Internet.

Admittedly, it’s not as cool as using the Spotify client on desktop but it’s certainly a lot simpler (and quicker) than managing proxy settings yourself ;)

ExpandRegion on Sublime Text

Once you get used to the JetBrains suite of IDEs pressing Cmd/Ctrl+W for expanding selection becomes second nature. This leads to closing tabs on most applications such as text editors which is of little consequence since you can train yourself to use a different short cut.

My favourite text editor (Sublime Text) does not have this feature built in but it seems I’m not the only one who misses the expand region feature. Go grab your copy of ExpandRegion by Aron Woost from GitHub with full instructions on how to install on Windows, Linux and Mac.

Developers beware of OS X Yosemite

It’s been a bit over 24 hours of using OS X Yosemite and I’m liking all the UI sugar it’s added. So far, my regular applications work fine after the upgrade but the IDEA based IDE set (IntelliJ, WebStorm, PyCharm, RubyMine etc.) seem to have a problem which has been also reported by IDEA.

Tread lightly. You have been warned!

Desktoppr Downloader v1.0

I recently found Desktoppr, a service which has an insane number of curated wallpapers. What’s even better is that they come with an easy to consume API.

To fulfil my insatiable need for good high resolution wallpapers, I wrote a script to go through the thousands of pages of images they have, find the ones that are “right for my desktop” and download them. I define “right for my desktop” as being at least the same resolution as mine and if higher then the same aspect ratio. If your’s is the same, feel free to use this script

Read on →

Twitter Images Not Loading

I recently moved to Pune and of course to a new ISP (Tata Telecommunications in Pune). For strange reasons, images on Twitter wouldn’t load. Also, certain other websites weren’t visible. Simple enough fix was to ensure I wasn’t using Tata’s DNS’ but Google’s.

If you have a 2 level setup (Devices -> WiFi Router -> DSL Modem) like I have here which is something even I’m new too, you should probably need it the DNS on one of the routers (logically would be preferred to be on the DSL Modem). Safe side, do it on both :p

Google DNS

Read on →

ThoughtWorks Welcome Video

I usually don’t post much about work but this is something I’ve never done before and would like to remember for a long time. I joined ThoughtWorks early August 2014 and by the end of it 8 of us had joined the Pune office in the month. We got together to create a video to introduce ourselves to the ThoughtWorkers in Pune (not that there weren’t mails floated with our pictures, a jazzy 3-4 line intro and tons of talking to people around the office). I’m not sure if anything of the sort has been done in the Pune office but we certainly got a nice response to the video.

Read on →

Project Euler #79: Passcode Derrivation (using Lambdas)

I’ve been solving Project Euler for years and I avoid posting solutions online as far as possible but this problem is old enough that it shouldn’t be a problem. Plus, the problem statement interests me enough to write a functional solution using the new Java 8 Lambdas that I’ve been experimenting over the past few months.

Before I begin, I’d like to acknowledge Alex Michael for providing the base solution with a pretty nice explanation of how to crack the problem. You should read through his post before you continue.

My solution provides a Java port of this solution using Lambdas. Here are the steps to the solution

Read on →

Set Java Home to a specific version on Mac

Installing Oracle’s version of Java on your machine does (for most machines I’ve encountered) add a Java Home system variable. Rarely however it doesn’t work on some machines. Such folks are recommended to add the path themselves.

On a Mac, you can do this by using the following

export JAVA_HOME=$(/usr/libexec/java_home)

This information is littered across the internet and isn’t hard to find at all. However, this specific machine, when upgraded from Java 1.7 to Java 1.8 kept insisting it’s home is Java 1.7. The Java Home script at /usr/libexec on the mac should take care of this

Read on →

Java 8: Generic Method Returns with Lambdas and Strategy Design Pattern implementation

With the introduction of Functional Programming in Java 8 new possibilities have opened up. One use case I recently encountered was that of processing JSONs to return data inside them. Let us, for the sake of argument, say the data in an element could be one of the following:

  • An Integer e.g. 1
  • A String e.g. The quick brown fox jumps over the lazy dog
  • A JsonObject representing a Java Object e.g. {"payload":[{"lastName\":\"AB","firstName":"Karun","email":"test[at]email.com"}
  • A JsonArray containing Integers e.g. [1, 2, 3]
  • A JsonArray containing Strings e.g. ["String 1", "String 2"]
  • A JsonArray containing JsonObjects representing Java Objects e.g. [{"lastName":"AB","firstName":"Karun","email":"test[at]email.com"},{"lastName":"FooBar","firstName":"Kung","email":"kung[at]foobar.com"}]

If you want such a wide variety of data parsed and handled (relatively) safely (i.e. with compile time type safety where possible), here is what you do.

Read on →

Karun AB, that's me!

It’s been almost a year now since I bought the domain http://karun.me and a few months back I decided to put in some of my free time to put something up there. The domain, being named what it is, makes sense to house things about who this mythical Karun is and what he does. Seems he mostly does code for random organizations and at times is allowed to talk a bit about it :P So that’s what the website tells you! He also seems to take some photographs so the website helps show that off as well.

So, anyone who’s

Read on →