zzamboni.org
Ideally Blue

zzamboni.org
Ideally Blue

These are the things I have written about

tips

See all posts on posterous with this tag ยป
Jan 25 / 9:54am

Changing "message:" protocol handler from Sparrow back to Mail.app

After using Sparrow for a while, I have decided to switch back to Mail.app. However, even after setting my default email client to Mail.app, all my message: links (for example, from messages dragged from Mail.app into Things) were opening in Sparrow.

After some experimentation, I figured out what happened: I switched the default email client from Sparrow to Mail using Mail's preference panel:

Pastedgraphic-1

Apparently this switches the application for the mailto: protocol, but not for message:, nor for .eml files. The solution was to use Sparrow's preference panel to set it again as the default email client, and then disable it. Then Sparrow correctly sets all the protocol handlers back to their default values.

Pastedgraphic-2
Filed under  //  macosx   mail   sparrow   tips  
Dec 15 / 12:07am

Fix journal in an HFS+ file system

Yesterday my external Western Digital disk (which I use for Time Machine, among other things) stopped mounting automatically when I plug it in. This may *cough*definitely*cough*have something to do with me unmounting it forcefully while it was doing a backup, since I was in a hurry.

Disk Utility reported everything was OK with the disk, but it still failed to mount. Upon poking a bit deeper, I found these messages in the logs:

12/14/11 11:49:00.000 PM kernel: jnl: disk2s2: open: journal magic is bad (0x0 != 0x4a4e4c78)
12/14/11 11:49:00.000 PM kernel: hfs: late jnl init: failed to open/create the journal (retval 0).
12/14/11 11:49:00.000 PM kernel: hfs_mounthfsplus: hfs_late_journal_init returned (0)
12/14/11 11:49:00.000 PM kernel: hfs_mounthfsplus: encountered errorr (22)
12/14/11 11:49:00.000 PM kernel: hfs_mountfs: encountered failure 22 
12/14/11 11:49:00.000 PM kernel: hfs_mount: hfs_mountfs returned 22

Aha! Journal error. A bit of Google searching led me to this page, where one comment gave me the key:

root# mkdir /tmp/disk && mount_hfs -j /dev/disk2s2 /tmp/disk
root# diskutil disableJournal /tmp/disk
An error occurred journaling the file system: The underlying task reported failure on exit (-69860)
root# diskutil enableJournal /tmp/disk
Journaling was already enabled for volume Casa on disk2s2
root# diskutil unmount /tmp/disk
Volume Casa on disk2s2 unmounted

Despite the error in the "disableJournal" command, after this sequence the Finder was able to mount the disk, and things seem to be working fine. The trick in the first command is the -j option, since it allows the disk to be mounted (without journaling), so that the disableJournal/enableJournal commands can be issued.
Filed under  //  diskutil   hfs   macosx   tips  
Jan 20 / 12:24am

How to fix "texexpand error: More than one input file specified" in latex2html

There's a bug that causes problems when running latex2html on files which have spaces in the path. The workaround is to either move things to folders with no spaces, or add appropriate symbolic links.

This error had me stumped in trying to process a latex file with latex2html:

texexpand: Error: More than one input file specified.
texexpand failed: No such file or directory

The fix is simple - make sure the path of the current directory does not have any spaces.

Filed under  //  latex2html   tips  
Jan 19 / 3:28pm

Installing latex2html under Win7 with cygwin

I got latex2html to install on the latest cygwin, however to get the configure to pass I had to alter the configure to recognize cygwin as a UNIX.

Using this patch I was able to properly configure and install latex2html under cygwin in Windows 7.

Filed under  //  cygwin   latex   latex2html   tips   windows  
Jan 19 / 12:33pm

LogParser, Event Logs, and Vista - Neil Carpenter's Blog - Site Home - TechNet Blogs

The only workaround to this is to convert the logfile to the new evtx format prior to parsing it.  You can do this in the event log viewer GUI by doing a Save As... but I find it easier to do this at the command prompt:

wevtutil epl application.evt application.evtx /lf:true

I'm trying to process Windows Event Viewer files (.evt) from some servers on my Win7 machine, which kept me giving a "log file is corrupt" error message. The trick is to convert it to the newer .evtx format before processing. Thankfully this can also be easily done using a command-line utility.

Filed under  //  eventviewer   logparser   tips   windows  
Dec 23 / 12:14pm

Setting up a global hotkey to add tasks to Outlook

One thing I missed since I moved from a Mac (using The Hit List for GTD) to Outlook (using Jello Dashboard for GTD) was the availability of a global hot key that I could use to bring up a text entry box which I could use to quickly add things into my electronic Inbox, for later processing.

I have found a way to achieve this, and here is the setup I am using now:

The first component is this PowerShell script written by Lee Holmes, which takes as arguments the title of the task to add, and adds it to Outlook. I saved it as Documents/Add-OutlookTask.ps1 in my home directory.

The second component is the ever-useful and amazing AutoHotkey. I added the following lines to my Documents/AutoHotKey.ahk file:

This snippet assigns Win-space to open an input box, and uses whatever is typed in it as the task title to the Add-OutlookTask script. The task will be placed without any categories in the task list, so it appears automatically the next time I open my Jello Dashboard inbox. Here it is in action:

Addtask

I find this extremely useful, since I can press Win-space to add new tasks from any application, without having to switch to Outlook first. At some point I would like to explore the idea of making it smarter, like the quick-add keys in Things or THL for the Mac. This would include, for example, using some information from the currently-active application to prefill the task information. Examples would include using the subject line if an Outlook email is selected or the title of the current web page if a browser is open. Also nice would be to include any selected text automatically in the notes for the task, and maybe a link to the original item.

 

 

Filed under  //  autohotkey   gtd   outlook   productivity   tips   windows  
Dec 20 / 5:46pm

GTD tip: clean up physical clutter using ziploc bags

If you are like me, you carry in your backpack, bag or briefcase all sorts of physical stuff, other than documents, papers or magazines. You know the type: phone chargers, USB cables, power adapters, network cables, USB sticks and other small gadgets or accessories. Over time these things accumulate and it becomes harder and harder to find them and to keep them organized.

I have been using a low-tech tool for organizing these things: ziploc bags. I now carry two large ziploc bags in my backpack, labeled "frequent use" and "infrequent use". The first one has the things that I would most likely need to use every time I sit down to work: my iPhone USB cable, my laptop power adapter, etc. The other one includes all other things that I need every once in a while so I want to have them handy, but I don't need them every day. This includes a USB cable for my camera, a two-to-three prong adapter for when I find myself in old buildings that don't have grounded outlets, a couple of USB sticks, etc.

I find that this simple tip helps me keep the physical clutter under control, and makes it easy to review things periodically to check if I still need everything I'm carrying around.

Filed under  //  gtd   tips  
Sep 28 / 9:39am

Making cygwin, Windows and emacs understand the same symlinks

Today I ran into the problem that symlinks created under cygwin using "ln -s" are not understood by Windows, and of course Windows shortcuts are seen by cygwin as regular files. Happily, this is a (semi-)solved problem. For reference, this is what needs to be done:

  1. Add "winsymlinks" to your CYGWIN environment variable. For example, in my .bashrc I have the following:

    export CYGWIN="nodosfilewarning winsymlinks"

    This makes cygwin create symlinks differently, in a form that is understood both by it and by Windows.
    This is the main step, and the only one if you just need access from the shell and from the Windows explorer. However, emacs still sees those symlinks as regular .lnk files. To fix this, follow the next step.

  2. Install the w32-symlinks.el package, and add the following to your .emacs file:

    (require 'w32-symlinks)

  3. Run M-x customize-option and enter w32-symlinks-handle-shortcuts as the variable to customize. Turn it on, save it for future sessions, and you are all set. The new symlinks should be properly understood by the cygwin shell, Windows explorer, and emacs. Of course, you will have to re-create any symlinks or shortcuts that you created prior to setting the winsymlinks option, for them to be created in the new format.

    Update: so this doesn't quite work on my system. I am using Emacs 23.1, and apparently w32-symlinks does not work properly in this version. If you have an older version (I hear Emacs 21 works well), then this might work for you. 

Filed under  //  annoyances   cygwin   howto   symlink   tips   windows  
Aug 27 / 12:28am

Hierarchical copying with cfengine3

I recently posted a snippet to perform hierarchical copying in cfengine3. As I was attempting to integrate this mechanism into my copy of cfengine's COPBL, I realized that no additional functions or body components are needed. Thanks to cfengine3's list expansion, all you need to do is include in the existing copy promise the list containing the desired list of suffixes to try. For example:

Becomes:

While this looks at first sight even longer than the original (and of course, in this case you could just specify ${sys.flavour} directly in the copy_from statement), it is much more flexible. Instead of defining different sections for each class that you want to handle (e.g. suse_9, redhat_5, etc.), the same code is able to copy the corresponding binary directory for any operating system, you just have to put the corresponding bin.* directory in your repository.

Furthermore, without modifying the code, you can provide different binaries for specific hosts, for different domains, or for any other classification you want to impose. Just modify the @suffixes variable, ordering them from the most specific to the most general one:

You can do this without any additional functions, just adding ${suffixes} in the appropriate place in the copy arguments. The advantage of using a different function as in my previous post (or even better, modifying your existing copy function), is that you can add hierarchical copying without having to modify all copy promises in your policy.

Filed under  //  cfengine   hierarchicalcopy   tips