Archive for July, 2008

Shift+Delete clipboard shortcut nuisance

Problem:

At times when I’m coding a lot, especially when moving multiple lines at once and doing a bit of code rearranging, the content of the clipboard gets lost (for instance the very part I was trying to cut and paste elsewhere).

Solution:

It took me some time to reproduce it. Now I know I was just careless – when selecting the lines to be erased (most of the time whitespaces) by “Shift-Arrowing”, once in a while I forget to depress the Shift button soon enough. Then deleting the lines gets combined with the old alternative Windows shortcut for cutting content into the clipboard (Shift+Delete). This way the yet to be pasted lines get replaced by their whitespace counterparts – and that’s the impression of losing clipboard contents. Knowing that, I can avoid it by being more careful, but I don’t like it. Unfortunately, having searched for a way to disable the old-style shortcuts, I still can’t find a once forever fix. I thought about writing a tiny override intercepting this kind of messages, but for the time being I’m still waiting for someone to come up with a more elegant fix. And hey, it’s not that painful either way.

Gengo and Simple Tags compatibility issue

Problem:

Installing Simple Tags (1.5.7) on WordPress with Gengo (2.5.3) results in a classic localization problem:

Fatal error: Call to a member function on a non-object in [...]/wp-includes/classes.php on line 38

Solution:

Open [...]/wp-content/plugins/simple-tags/2.5/simple-tags.client.php and find in SimpleTags() function:

// Localization
$locale = get_locale();
if ( !empty( $locale ) ) {
   $mofile = str_replace('/2.5', '', $this->info['install_dir'])
      .'/languages/simpletags-'.$locale.'.mo';
   load_textdomain('simpletags', $mofile);
}

Remove this part and place it in a separate function (just before add_action(’plugins_loaded’, ’st_init’);) like this:

function locale_init() {
   global $simple_tags;
 
   // Localization
   $locale = get_locale();
   if ( !empty( $locale ) ) {
      $mofile = str_replace('/2.5', '', $simple_tags->info['install_dir']).
         '/languages/simpletags-'.$locale.'.mo';
      load_textdomain('simpletags', $mofile);
   }
}

After add_action(’plugins_loaded’, ’st_init’); add this line:

add_action('init', 'locale_init');

This way the localization part gets postponed till Gengo establishes all the needed stuff. Use at your own risk – not thoroughly tested yet.

WinMerge – a nice update solution

Updating heavily modified installations of phpBB, WordPress etc. can always be a pain. That’s why most of the time I postpone it till the guilt of running a more than year old version becomes too fierce to resist.

Once in a while, however, the moment finally comes when I have to do this unpleasant task. This time my installations were so customized, that trying to merge all the changes without a decent versioning tool was almost impossible. I didn’t want to set up a fully blown SVN server, so I looked for some decent Windows diff tool, which could also handle recursive directory comparisons.

Having tested some of the open-source tools available, I must admit I really liked WinMerge.

What’s so nice about it?

  • allows visual differencing and merging
  • handles directories without a hassle
  • quite decently laid-out
  • sufficiently good editor for quick fixes
  • provides a nice visual on the structure of differences (the vertical pane on the left)
  • plus some other nice features (and hey, it’s GPL)

WinMerge

Latest version can be obtained from: http://winmerge.org/