Posts Tagged ‘php’


Keyboard layouts


These days, my job finds me writing a lot of PHP code for a business-oriented web portal. This implies quite a few dollar signs, along with parenthesis and quotes. To make my life a little bit easier, realizing the number of times I’m forced to hold shift while typing one of these symbols, I decided to create a keyboard layout that doesn’t requiring shift-holding for the majority of activities.

Unshifted register


Shifted register


The at-sign and double-quote have been swapped so that I don’t have to hold shift for double-quote (which I type very often) but I do have to hold it for at-sign (which doesn’t come up so often).

Some international layouts employ a similar philosophy (see: Slovak layout), requiring the top row to be shifted in order to type a number. While it could get annoying having to hold shift to enter digits all the time, I have two other options for numeric entry. My first option is to engage caps-lock and use the top row as numerals. My second option is to use the numeric keypad.

Caps-lock register


The caps-lock register only applies when SHIFT is not held down. With additional work I could probably split the register in two so that SHIFT+CAPS-LOCK is distinct from the normal shifted register, but for now this will suffice. Notice – among other things – the angle-brackets replacing the square brackets. Clearly, this mode is also useful for entering HTML without shift gymnastics.

But what about muscle memory of all those crazy passwords? Simple: change back to standard layout. This new layout acts as sort of a caps-lock for the symbols I have to type when writing code, and will save my shift keys from grave peril.


Sweet home West Virginia


Having been entrusted with yet another infrastructure deployment project, I purchased a SuperMicro barebones system from Newegg along with a Xeon X3220 processor, 8 GB of RAM, and two WD 320 GB SATA-II hard disks. Installing Arch Linux was (as always) a walk in the park, but care had to be taken to set up the RAID properly. The latest version of Arch allows the admin to set up the array, and then write the output of mdadm to mdadm.conf, and doesn’t require kernel parameters– mdadm.conf is loaded immediately during initrd so that no kernel parameters are needed to reload the array.

I was very pleased when the server came online in WV without needing operator assistance. I attribute this to carefully configuring the rc.conf to have the correct IP settings and making sure iptables allowed only SSH access into the machine. Arch Linux isn’t difficult to configure in regard to TCP/IP settings, but it does require some know-how. It isn’t obvious from looking at rc.conf that the gateway settings need to be provided in terms that the route command can directly understand. I referred to my previous work to make sure I had it down cold.

Now that it’s online, I’m spending time tuning and tweaking the system for optimal performance. I realized that some of the code I had written before was very suboptimal, mainly because every page referred to a gigantic >1000 line monstrosity of a PHP class that contained everything needed for the entire management site. I decided to peel layers away from it piece by piece, and I’ve now ended up with several smaller files that are dynamically loaded when they are needed. The common functions live in their own file, and each database table gets its own file to handle validation and presentation. The average load time has dropped significantly as a result.