Showing page 7 of 38.


 

Quick vim tip: Copying matching lines to the end of file

I recently had the need to cleanup a long diff file and move certain lines to the end of the file for further analysis. The diff file that I got was something like the following, only much longer (produced using diff -qr xxx yyy).

Files xxx/abc1 and yyy/abc1 differ
Only in xxx: cde1
Files xxx/abc3 and yyy/abc3 differ
Files xxx/abc4 and yyy/abc4 differ
Only in xxx: cde2
Only in xxx: cde5
Files xxx/abc5 and yyy/abc5 differ
Only in xxx: cde3

I didn’t care as much about the “Only…” lines, but the files that differed needed more attention. To accomplish this I wanted to get this file in the following format.

Only in xxx: cde1
Only in xxx: cde2
Only in xxx: cde5
Only in xxx: cde3
Files xxx/abc1 and yyy/abc1 differ
Files xxx/abc3 and yyy/abc3 differ
Files xxx/abc4 and yyy/abc4 differ
Files xxx/abc5 and yyy/abc5 differ

I could go in and copy and paste all the lines that matched, but that would be a lot of manual work. So, I looked around for a minute and came up with the following command.

:%g/^Files/m$

Vim is awesome!

Read more

Play Button iTunes Patch updated

My original patch possibly worked only with OS X 10.6.5. Last night I figured out a better way to apply the patch without relying on a pre-supplied diff. What this means is that starting with version 0.7 the patch should work with pretty much all versions.

If you are interested, check it out on the project page.

Read more

New Patch: Play Button iTunes Patch

I just published a new patch for OS X, below is a description of the patch. Check it out.

This is a patch for removing the default OS X behavior of always starting iTunes when the play button on the keyboard is pressed. This feature can be useful for a lot of users, but it can also be annoying if you are using VLC or other similar programs that support the media keys.

The Patch script will patch the Remote Control Daemon to prevent it from starting iTunes whenever you press the play button on the keyboard or an external remote control. This will only prevent iTunes from starting, all other functions (like play/pause while iTunes is running) will continue to work as before.

Lastly, this program will backup the original file in case if you would like to restore the original functionality.

For more information please visit the Play Button iTunes Patch page.

Read more

New Songbird Extension: Delete from Disk

One thing I have missed in OS X is a powerful media player like MediaMonkey. iTunes gets a good part of the job done, but doesn’t have everything that I need. Plus, I hate the fact that it doesn’t display the ratings that I have on the files from my Windows machine. So, I have been exploring my options and one possibility is Songbird. It it better, but still lacks in some places (once again, ratings). I am still playing around with Songbird because, compared to iTunes, it is a lot easier to create add-ins for Songbird.

The first thing that I noticed missing from Songbird was the ability to delete songs that are not “managed” by Songbird. This is pretty much how iTunes behaves as well. I did not like this because I like control. If I added a file to a playlist then I would also like to have the ability to delete it from both the playlist and the file system.

So, instead of using the prescribed “1-start rating” to denote deletions I decided to explore Songbird extension development. I am glad to report that I was able to figure out the framework and actually just published an extension in the official repository to do just that: Delete from Disk. If you are a Songbird user looking for this functionality then you don’t need to look any further. Browse to the extensions page in Songbird and search for Delete from Disk.

This is the new menu entry that the extension adds.

Now let’s figure out what we can do about the ratings…! I also wish that someone will fix the Apple media key support extension.

Read more

code 400, message Bad request version

Lately I have noticed that I kept getting a 400 bad request when doing django development (i.e. using runserver) and browsing through Google Chrome. It was only Chrome that was behaving this way because Firefox would browse without generating any of these errors on the server side.

1
2
3
4
[09/Nov/2010 00:31:53] "GET /acq/ HTTP/1.1" 200 1393
[09/Nov/2010 00:31:53] code 400, message Bad request syntax ('\x16\x03\x00...')
?????????...." 400 -???8 .....?????
[09/Nov/2010 00:33:39] "GET /acq/ HTTP/1.1" 200 1393

I finally took a few minutes to debug. After clearing the cache and browsing data as suggested by many sites and having no luck I started disabling all of the extensions that I had installed. Guess what? The error disappeared.

This issue was being caused by the Secure Sites extension which lets you use secure versions of the site if one is available. In order to figure out whether a secure version is available it does an extra request, and it is this extra request that was causing the problem.

What’s the solution? I went into the options for this extension and added localhost to “Assumed no secure version exists” and the error disappeared.

Read more

Wake on LAN for webOS updated

I just published an updated version of the Wake on LAN (WoL) client for webOS (Palm Pre and Pixi). The latest version supports specifying a custom hostname and port, which means that now you can send WoL packages from to a remote network.

Main screen of the updated version, note the host name and port under the MAC address. Screenshot of the new fields. Preware screen showing the updates.

James Knowles (please see the about screen for contact info) contributed the initial UI changes for specifying a hostname. I added some more information and added the ability to specify a custom port (which required a service update).

To get these changes please update to/install the latest version of the service and UI using Preware.

Read more

Now I know!

...that the monitors at the Chicago O’Hare airport are running Adobe Flash! :)

Someone right clicked on the screen, and now I know that the monitors are running Adobe Flash A close up of the menu

Read more

Low level hotkeys in MediaMonkey

MediaMonkey Logo

MediaMonkey (MM) is my music player of choice on Windows. I have a few global hotkeys setup (for instance WIN+ALT+B for next track), but after an upgrade a few months ago (probably starting with 3.0) I noticed that my shortcuts started sending the shortcut keys to the active applications. So, for instance, while in Outlook if I press WIN+ALT+B, MM will go to the next track, but in addition Outlook will switch views because ALT+B is a shortcut in Outlook.

After a quick post online I found the solution that I was looking for. Basically, I had to edit the MediaMonkey.ini and add “PreferLLKeysHook=1” to the “[options]” section. MediaMonkey.ini will be located in different places based on the operating system, you can find the details in this knowledge base article. Add “PreferLLKeysHook=1” to the “[options]” section in there and restart MM. From there on the shortcut keys will only be interpreted by MM and will not be forwarded to the active application.

Read more