Mechanical keyboards

Between work and personal projects, programmers tend to type 8 or more hours a day and it helps to have a keyboard you can type on comfortably. Something that wont kill your fingers or your hands over time. Mechanical keyboards fill this need. They have taken the gaming world by a storm and a lot of the hard core programmers I know don’t like using anything else. Now that more and more companies have started to offer mechanical keyboards as part of their lineup, it is really easy to get your hands on one.

For those who don’t know what mechanical keyboards are, you can read about them here: I got interested in them because my Dell keyboard (the one that comes free when you buy a PC) was starting to feel like I had to fight it to type anything. This made me start looking for an alternative. The first mechanical keyboard I tried was a DAS keyboard and now I don’t ever want to use a rubber dome keyboard ever again (except Kinesis freestyle 2).

Mechanical keyboards are a treat to type on and come in many shapes and sizes. If your fingers hurt when you type on a regular keyboard I highly recommend that you get a mechanical one. You don’t have to press the keys all the way to the bottom for the computer to know you pressed a key. This means your fingers face less resistance when typing. You will, however, have to practice not bottoming-out the keys (pressing the keys all the way to the bottom).

If this has made interested in mechanical keyboards and you want to get one. Here are some I recommend looking into:

  • Filco Ninja or Majestouch 2 keyboards. Filco is, hands down, the best keyboard maker. Their keyboards are not backlit and don’t have macro support but their build quality is the best. Amazon is the only reseller that sells these in USA.
  • Ducky Shine. Ducky is more of the higher end mechanical keyboards and they have the best backlit keyboards.
  • DAS keyboard. DAS has been making keyboards for quite some time now and I love their design. Their keyboards, like Filco, are also not backlit
  • Ergodox. This is an open source keyboard you will have to make yourself but it is very ergonomic and you get the satisfaction of having made your own keyboard.
  • Fully mechanical keyboards by Corsair. Corsair has some very original designs for their keyboards. Their keyboards have no bezel making it really easy to clean them. Starting from K70, they are backlit.

Corsair k60 OSX issues

I got a Corsair K60 a few months ago and fell in love with it. It is a mechanical keyboard (my first mechanical keyboard) with Cherry MX red switches. There is, however, one problem with it. The caps lock LED is always on and the LEDs for num lock and scroll lock are always off.

This affects all models of Corsair keyboards as far as I know. Why they don’t just add support for Macs? I don’t know. It can’t hurt. It is just another HID device.

The keyboard will toggle caps lock when you press it but it won’t change the state of the LED. So, like any sensible person I set out to fix the damn LEDs. And, let me tell you it was not an easy task (considering I have not programmed a single line in objective C before this or written any hardware drivers in any language).

After spending the whole weekend on it, I was able to write a program that will listen for key strokes from k60. Now, I have to figure out how to toggle the LED when caps lock is pressed and I will be able to have a normal functioning keyboard.


Technology is a means to an end and not the end itself

Last Friday, the CEO of the company I work for said something interesting: “Technology is not the end. It is a means to an end.” He, then, elaborated that by saying that we are making applications to make people’s lives easier. The code doesn’t have to be perfect. If it works for 90-95% of the cases, it is fine. We can go back to it later and refine it.

This caused an internal debate within me. I have always been (and still am) an advocate of beautiful code but I have (occasionally) let myself get slowed by trying to make code more beautiful (and better organized). What I should have done is made something work then refactored it afterwards. This way, I don’t delay a release and I get time to make things better later.

Obviously, this assumes I will get time later on to make the code better organized or more understandable. Depending on the industry you are working in, you may not have the time to make things better or refactor the code. So how does one deal with this? You have to strike a balance (which may not be easy at times) between trying to make everything 100% perfect and finishing the project on time.

I don’t want anyone to think that it is okay to write sloppy code and use this reason an excuse. I have had to deal with the aftermath of such code way too many times. Let me tell you, it is not pleasant (although sometimes it can be interesting). It is, however, important that we don’t get bogged down by writing that perfect piece of code that we lose sight of what is most important – getting the application in the hands of the end-users who will have feedback of their own.

PHP Uncategorized

Testing multiple browsers with Selenium2 in PHPUnit

You used to be able to run test on multiple browsers with PHPUnit Selenium test class by specifying a $browsers property. You can still do the same with PHPUnit’s Selenium 2 class made for web driver. Here is how you do it:

class SomeTest extends PHPUnit_Extensions_Selenium2TestCase
	 * Variable to specify which browsers to run the tests on
	 * @var array
	public static $browsers = [
		['browserName' => 'firefox'],
		['browserName' => 'chrome']	

	public funciton __construct()
	public function setUp()

	 * This is just a test that will open a website in chrome and firefox
	public function testOpenSite()

OSX Mavericks upgrade and PhpStorm problems

I upgraded my work laptop’s OS to Mavericks (finally). Started the upgrade yesterday when going home and when I went back to work today, PhpStorm stopped working. I got no errors, no warnings, nothing. It didn’t even give me an indication stating that it was trying to open PhpStorm.

So, like any sensible person I tried opening it through the command line and that’s when I got this error:

LSOpenURLsWithRole() failed with error -10658 for the file /Applications/

So, I tried to run the executable for PhpStorm directly like so:


It told me Java runtime is missing and it is requesting that it be installed. After that, if you cycle through the windows you should see an alert asking you if you want to install Java 6. Hit yes, and you should be good to go.

If you don’t see the alert, restart your machine and you will see it as soon as you login. Or, you can also just go to sun’s website and install it.


Is OSX the best Linux

Someone I know mentioned in passing that OSX is the best Linux out there and I have been thinking about it ever since.

A lot of developers I know get MacBooks to work on (and not Linux desktops or laptops) for multiple reasons. The business has a point of support they can pester if anything goes wrong with the machine or its software. And, the laptop can be used by people who are not very knowledgeable about how their operating system is doing the things it is supposed to do – like designers. I didn’t know this but most really good designers use Apple machines.

Linux operating systems (for the most part) demand you know what you are doing. It is not for meant for the people who don’t want to know how their operating system is doing what it is supposed to. Ubuntu, however, has done a great job of trying to make it user-friendly. They, now, have an App Store like application which you can use to install games, applications, etc and buy them. I haven’t played much with it but it looks promising.

I had tried installing a Linux (don’t remember if it was Fedora, Ubuntu or something else) on a laptop and that was a nightmare. I could not get the wireless adapter to work. I had to scour the internet for days before I found a solution to my problem. While it was a tad annoying to have to go through all that trouble to just get a wireless adapter to work, it was interesting to see how things worked. However, that will not fly in an environment where I just want to get things done.

It is (in general) easier and more pleasant to work on a Mac than it is to work on (let’s say) Ubuntu. I am not saying it is always the operating system’s fault. The applications written for Linux are sometimes sub-par for a regular user. My experience with Dota 2 on Linux is a great example of this. It was un-playable on Linux and I had no problems with it on OSX. Valve has since updated the code and made the Linux experience more pleasant but it is still not as good as Windows or OSX.

I love Linux. If you have an old machine you can bring it back to life by installing a minimalistic flavor of Linux and get it working again. Servers built on Linux are so stable that it’s not even funny. One of my employers had both Windows and Linux servers. The system administration team would always complain that Windows servers crashed almost every week while Linux servers didn’t need to be touched at all. I love the fact that there is so many free applications available on Linux that are better than commercial applications available for the same. Penetration testing tools are a great example of this.

So, it depends on the context. For regular use OSX is definitely better but for servers and hardcore bad-assary of installing an OS on a small board in a motor-cycle because it has such a low footprint and then using that as a mobile cam just because you can. Nothing beats a regular Linux OS (Slackware anyone?).


Dota 2 on Linux (again)

So, I had to reboot my computer and it booted into my Linux partition. I thought I would give Dota 2 another try. Maybe there is something I can do to improve the performance and I came across this forum in which a Valve developer said they made performance improvements to Dota 2. So, like any sensible sane man, I opened Steam, updated Dota 2 and played a practice match with bots.

I was pleasantly surprised when I noticed the game was really smooth. Not as good as Windows but still playable. The update happened in July 2013 so if anyone else has had issues with Dota 2 on Linux, I would recommend you try it out again and see if has improved for you too.

People at also have tips on how to get better performance from Dota 2 on Linux. Worth checking out.


My experience with Dota 2 on Linux

I love Linux. I love developing on it and the powerful command line that Linux has is really great. When I heard that Dota 2 had been released for Linux I was excited. I didn’t have to be on Windows just so I could play games.

I installed 2 days ago and installed Steam and Dota 2 on it. The screen that comes up when you start Dota 2 (where you hit the “Play” button to look for a match) ported over really nicely. I didn’t see any problems in it except that when you changed your video settings, it gets so messed up that you have to restart the game. I would have been okay if that was the only problem Dota 2 had.

The game was almost unplayable. My unit would move a second after I click his destination. A lag that long is unacceptable when playing a competitive game against other people. The movements were most of the times choppy – not just mine but other players as well. I thought maybe it’s my refresh rate but it wasn’t.

I can play Dota 2 on the same hardware on Windows 8 and it runs very smoothly without any issues. When I switch over to Linux, it’s a nightmare to play. Even with the lowest video settings I could not get it to run smoothly. I was very saddened by this experience because I was looking forward to switching over to Linux for most of my computing needs (if not all).

I updated my drivers, made sure hardware rendering was on and tried to do anything else I could do to improve performance but no dice :(. I have a dual boot setup so it’s not that bad. I can switch over to Windows when I am not programming. So, if you are also thinking of doing what I did , I advise against it. I don’t think Dota 2’s Linux client is there yet. Hopefully they will make it better in the near future.


A second look at MariaDB

After my last post on MariaDB, I installed it and played around with it. It really is a project that was forked from MySQL some time ago since MySQL is increasingly becoming closed source. There is another fork of MySQL called Drizzle, which claims that they have made the database faster by removing chunks from the code that were not relevant to web related queries.

The reason I was very excited about MariaDB is that it claims to be a hybrid of RDBMS and noSQL philosophies. However, their stable version (5.5 as of this post) lacks proper support for noSQL queries. It supports noSQL through something people at MariaDB call “dynamic columns”. The dynamic columns work as intended if you use numeric keys for your column names. However, if you use alphabetical keys, you can have just one column. If you try to add multiple keys, it will error out. If you try to add more keys using an update statement, it will replace the key you had before.

All hope is not lost, though. They do have a version (10.0.1 as of this post) which worked properly in my tests but it is in alpha stage and it will be some time before it becomes stable. If you are not looking for a noSQL solution the latest stable version is still great. It has percona’s proprietary engine (Xtradb) which is a better implementation of InnoDB, a better MyISAM engine, etc.


MariaDB – A better replacement for MySQL?

A friend of mine mentioned that Suse and another Linux distribution were going to switch from MySQL to MariaDB. So I got curious and looked at it. According to their website, it is a drop-in replacement for MySQL. You can uninstall MySQL, install MariaDB and things will just work. No need to change any code.

The thing that impressed me about MariaDB is that they have XtraDB engine (among other engines not available in MySQL) which is supposed to be a better implementation of InnoDB. Percona offers it for MySQL if you buy their services. So, I was glad to see that it is being packaged with MariaDB. For those of you who want to try out document based databases like MongoDB, CouchBase, etc. MariaDB supports document based database engines too. So you can have an relational database and an document/object database in one server.

I found out about MariaDB not that long ago. So, I have yet to explore all the things it can and cannot do. But, if all of these features make you curious, you can head over to their website ( to learn more.