Thursday, May 21, 2009

Show Desktop Command on Mac OS X

I'm relatively new to Mac OS X and have been struggling to find out how to quickly "Show the Desktop" to see all the icons I have in there.

I have been used to clicking that little "Show Desktop" icon on the bottom left of the screen in Windows and was looking for an equivalent on my Mac.

Fortunately, there is! But it's not an icon that you would click but some keyboard shortcuts you need to type. For me pressing fn F10 did the trick.



You can find more Expose tips on this page.

Wednesday, May 20, 2009

P25,000 Pay Sought for Teachers, Nurses

This is something I hope gets approved quickly. For reasons that are quite obvious....
MANILA, Philippines - At least three congressmen are proposing that public school teachers and government nurses be entitled to a monthly salary of at least P25,000.

Taken from philstar.com.

Monday, May 11, 2009

PHP writeUTF implementation

We currently have an application in Groovy/Grails/Java that we're slowly porting to PHP (for more affordable hosting costs).

We encountered a problem when we needed to convert one of our routines for writing out a binary file. We were using Java's DataOutputStream.writeUTF(String) method and had a hard time trying to write binary data in PHP.

After much research on the web, we found a method in PHP called pack(). Below is our PHP implementation of Java's DOS.writeUTF(String).

[sourcecode language='php']
public static function writeUTF($string) {
$utfString = utf8_encode($string);
$length = strlen($utfString);
print(pack("n", $length));
print($utfString);
flush();
}
[/sourcecode]

We don't claim this to be the exact equivalent of the method, but it gets the job done and the receiving end of the file was able to parse the binary file properly with the new PHP implementation with no modifications to the client code.

Please checkout the pack() documentation for more details.

vi Page Up/Page down for Mac OS X

In case you're wondering how to move up or down in "vi" from Mac OS X terminal:

Then CTRL-B and CTRL-F should do the trick.

Got this from the Mac forums at macworld.com.