Saturday, September 29, 2012

Tabs in Finder (Mac OS X filesystem explorer)

You can use the TotalFinder extension to beef up the Finder program in OS X (including add tabs!)

As of writing, there's a 14 day trial (which I've used for longer than 14 days without issue so far), and program cost is $18.

Sunday, August 19, 2012

Disable animations when switching desktops in Lion

As mentioned here, TotalSpaces lets you disable the animation for switching between spaces (look on the Transitions tab). Yay!

Tuesday, July 3, 2012

Automatically sync Windows time with Internet at boot

If you want Windows to sync with its Internet time servers at boot (e.g. your CMOS battery died and you're too lazy to replace it), put the following into a batch file and put it in the All Users Start Up folder:

fix-time.bat:
net start w32time 
w32tm /resync /force


Put it in the All Users startup folder:
1) Right click on Start Menu -> All Programs -> Start Up and choose Explore All Users
2) Copy fix-time.bat into that folder

Friday, March 23, 2012

Controlling MPD via hotkeys in OS X

You can use Spark to set global hotkeys in OS X. Then, to control mpd with mpc, create AppleScript hotkeys with the following commands, and bind them to the desired key combination:

  • do shell script "/opt/local/bin/mpc prev"

  • do shell script "/opt/local/bin/mpc toggle"

  • do shell script "/opt/local/bin/mpc next"

Saturday, January 21, 2012

Profiling node.js on linux

According to "Understanding V8" by Vyacheslav Egorov, you profile node applications like this:

% node --prof parser.js
806 ms
711.4267990074442 bytes/ms
% deps/v8/tools/mac-tick-processor

[GC]:
ticks total nonlib name
576 79.0%

However, I couldn't get the linux-tick-processor (in the same folder) to work:

% ~/Documents/node/deps/v8/tools/linux-tick-processor v8.log
d8 shell not found in .
To build, execute 'scons d8' from the V8 directory

I ran scons as instructed, but the command still wouldn't work. What I finally realized is that I need to run the command from the v8 folder:

% pwd
/home/iggames/Documents/node/deps/v8
% tools/linux-tick-processor ~/code/nodetest/v8.log


Lame, but it works.

Thursday, October 6, 2011

More robust verification

Fragile: relying on certain behavior between action and response, and using this to know when to validate the response

Better: make no assumptions about the behavior. Instead, continuously check for a valid response for a reasonable amount of time.

e.g.:

Fragile:
- perform action
- wait for loading ui (if the devs change or remove loading ui, this will break)
- validate response

Better:
- perform action
- check for valid response
- wait a second or two
- check again...for 5-10 seconds

The second is only invalidated if the response changes (less likely). The former is invalidated if the loading UI changes (apparently, any time the PM/devs get bored).

Wednesday, October 5, 2011

TimeStamp100nSec is DateTime FileTime

The TimeStamp100nSec value of CounterSamples is in the same format you get from DateTime.ToFileTime() (or maybe DateTime.ToFileTimeUtc() in some situations, not sure).

This was not made clear to me in any documentation I could find, but some example code half-way down this page spells it out.

To go from TimeStamp100nSec to a DateTime object, use DateTime.FromFileTime(timestamp100nsec).