Monday, December 27, 2010
Quick workaround for broken handling of Play/Pause key in Winamp
In the Intellitype settings (Control Panel -> Keyboard -> Key Settings), change the Play/Pause key to a macro that sends some other keystrokes, e.g., Ctrl+Shift+* (Intellitype makes the Alt-key hard to record, so I leave it out). Then, in Winamp's settings, enable global hotkeys and change the Playback: Play/Pause hotkey to the same value.
Saturday, October 9, 2010
Perl one-liner, bumping a version string
perl -lpe 's/([^a-z])$/$1a/ || substr($_, -1) =~ tr/a-z/b-za/'
Friday, October 1, 2010
Wednesday, February 24, 2010
Wordpress Fail
1) Create a new post
2) In the visual editor, start a line with a few spaces followed by some text
3) Click 'Preview', or click to the HTML tab then back to the Visual tab.
You'll notice your leading spaces have disappeared. Ok, fine, just convert them to  's in the HTML editor. Now, switch back to the visual editor. Ahh, leading spaces at last. Let's just switch back to the HTML editor for one last tweak. And... the leading spaces are gone again. Welp.
I found one attempt to fix this - unfortunately it's just a bandaid and only works inside shorttags for a specific wordpress plugin.
Tuesday, January 23, 2007
Embedding iTunes album art into MP3s
iTunes makes it really easy to download album art for an entire music library in one fell swoop (select-all, Advanced->Get Album Artwork). It's a little trickier to embed the artwork into the MP3s themselves (for use with other players like WinAmp). I found a perl script at Teridon's iTunes Scripts called itunes_insert_artwork that does a nice job.
While trying it out, I noticed that a lot of the jpegs from iTunes were ridiculously large. Some were over 800K, for a 600x600 image. Not quite sure why - resaving them even at 100% quality resulted in much smaller files. So, I tweaked the script to send the images through ImageMagick first. (At quality 85, those 800K images get down to 200K.)
You'll need to have ImageMagick and PerlMagick installed. If you plan on installing ImageMagick/PerlMagick for ActivePerl, note that, currently, you'll need the older 5.8.x version to get it to work.
Download the scriptSaturday, November 25, 2006
KeyFix4000: Improve your MS Natural Keyboard 4000
First, it is conspicuously missing a Windows key on the right side. Second, there is no way to remap the back and forward buttons to act as mouse buttons. After googling in futility for a solution, I decided to whip one up myself. (After all, this was nothing a little keyboard hooking couldn't solve.)
The result? KeyFix4000.
The mouse button mapping is pretty straight-forward - it just translates a click on the back/forward button to a click on the left/right mouse button.
The Windows key issue was a little tricky - how do you fix a key that doesn't exist? Well, the Apps key is pretty much where the Windows key should be, and I realized I could overload it. Now, when pressed by itself, it functions as the Apps key, and when pressed in combination with another key, it works as the Windows key. This dual usage works surprisingly well.
Download executable
C++ source code at GitHub
Sunday, November 12, 2006
Fun compiler bugs
void bar() {}
namespace foo
{
using ::bar;
}
using namespace foo;
// namespace {}
int main(int argc, char * argv[])
{
bar();
return 0;
}
In VC6, the preceding block of code produces
error C2668: 'bar' : ambiguous call to overloaded function
and the error goes away when you uncomment "namespace {}". Yikes.
