How to customize a WordPress plugin and upgrade

Sometimes you want to make minor changes to WordPress plugins that no body except your self would want. Then comes the issue of upgrading to new versions of the plugin. git-svn is the perfect tool for this. It has all the cool features of the distributed SCM git and ability to pull from subversion (and push to it as well). Here is how I do it:

  1. Clone the trunk
    git svn clone http://svn.wp-plugins.org/web-invoice/trunk/
    
  2. Make your changes
  3. Commit changes locally
    git commit -a
    
  4. Pull new changes (e.g. new release). Git is very good at merging, you will not have conflicts unless you edit exact same lines in the local version. Still a manual merge shouldn’t be too complicated
    git svn rebase
    

In the example I have taken the svn trunk of Web Invoice WordPress plugin. Hope you find this information useful next time you hack a WordPress plugin.

Hacking drupal: Add search by node creation date and the author

Some of the users using one of my Drupal sites were asking for search by author and creation date. The site had 3000+ nodes and the user’s request seemed reasonable enough. I first started with googling for a Drupal module or a patch that would add the functionality, but none were found.

So when ahead and hacked the node module. I sucessfully managed to add search by author and node creation date to advanced search block. If you are in searching for a patch like I did you can find it at http://drupal.org/node/233476, I’m keeping my fingers crossed to see whether it would make it to the Drupal trunk :).

Adding social bookmarking links to blogger

I recently wanted to add social bookmarking links to all of my blog posts. As you might notice my blog is hosted on blogger, only way I could do that is by editing the template. I thought I would share how to get about editing the template such that you add social bookmarking links which will automatically add the post permalink and the title if possible.

To edit the template, Sign into your blogger.com account and goto Template -> Edit HTML and then select Expand Widget Templates. Search for <data:post.body/>, just after <data:post.body/><div style="clear: both;"> <!-- clear for photos floats --> insert the following code.

<!-- Start of social bookmarks -->
<div class='service-links'>
<div class='service-label'>Bookmark this post with: </div>
<ul class='links'>
<li class='service_links_digg'>
<a class='service_links_digg' expr:href='"http://digg.com/submit?phase=2&amp;url=" + data:post.url + "&amp;title=" + data:post.title' rel='nofollow' title='Digg this post on digg.com.'>
<img alt='Digg' src='http://www.mohanjith.net/images/service_links/digg.png'/>
</a>
</li>
<li class='service_links_stumbleupon'>
<a class='service_links_stumbleupon' expr:href='"http://www.stumbleupon.com/submit?url=" + data:post.url + "&amp;title=" + data:post.title' rel='nofollow' title='Bookmark this post on StumbleUpon.'>
<img alt='StumbleUpon' src='http://www.mohanjith.net/images/service_links/stumbleupon.png'/>
</a>
</li>
<li class='service_links_delicious'>
<a class='service_links_delicious' expr:href='"http://del.icio.us/post?url=" + data:post.url + "&amp;title=" + data:post.title' rel='nofollow' title='Bookmark this post on del.icio.us.'>
<img alt='Delicious' src='http://www.mohanjith.net/images/service_links/delicious.png'/>
</a>
</li>
<li class='service_links_reddit'>
<a class='service_links_reddit' expr:href='"http://reddit.com/submit?url=" + data:post.url + "&amp;title=" + data:post.title' rel='nofollow' title='Submit this post on reddit.com.'>
<img alt='Reddit' src='http://www.mohanjith.net/images/service_links/reddit.png'/>
</a>
</li>
<li class='service_links_newsvine'>
<a class='service_links_newsvine' expr:href='"http://www.newsvine.com/_tools/seed&amp;save?u=" + data:post.url + "&amp;h=" + data:post.title' rel='nofollow' title='Submit this post on newsvine.com.'>
<img alt='Newsvine' src='http://www.mohanjith.net/images/service_links/newsvine.png'/>
</a>
</li>
<li class='service_links_facebook'>
<a class='service_links_facebook' expr:href='"http://www.facebook.com/sharer.php?u=" + data:post.url + "&amp;t=" + data:post.title' rel='nofollow' title='Share on Facebook.'>
<img alt='Facebook' src='http://www.mohanjith.net/images/service_links/facebook.png'/>
</a>
</li>
<li class='service_links_google'>
<a class='service_links_google' expr:href='"http://www.google.com/bookmarks/mark?op=add&amp;bkmk=" + data:post.url + "&amp;title=" + data:post.title' rel='nofollow' title='Bookmark this post on Google.'>
<img alt='Google' src='http://www.mohanjith.net/images/service_links/google.png'/>
</a>
</li>
<li class='service_links_yahoo'>
<a class='service_links_yahoo' expr:href='"http://myweb2.search.yahoo.com/myresults/bookmarklet?u=" + data:post.url + "&amp;t=" + data:post.title' rel='nofollow' title='Bookmark this post on Yahoo.'>
<img alt='Yahoo' src='http://www.mohanjith.net/images/service_links/yahoo.png'/>
</a>
</li>
<li class='last service_links_technorati'>
<a class='service_links_technorati' expr:href='"http://technorati.com/cosmos/search.html?url="+data:post.url' rel='nofollow' title='Search Technorati for links to this post.'>
<img alt='Technorati' src='http://www.mohanjith.net/images/service_links/technorati.png'/>
</a>
</li>
</ul>
</div>
<!-- End of social bookmarks -->[/sourcecode]
Add the following code before <code>]]></b:skin></code>.
[sourcecode language='css']/** Service links style **/
.service-links {
padding-top: 3px;
}
.service-links ul.links {
margin:0pt; padding:0pt;
}
.service-links ul.links li {
display:inline;
list-style-type:none;
padding: 0pt 0px;
background: none;
}
.service-links ul.links li img {
border: none;
padding: 3px;
}
.service-links ul.links li a {
border: none;
text-decoration: none;
}


Then save the template. Adding social bookmarking links and submitting your posts to social bookmarking networks would improve the visibility of your blog and help drive traffic to your blog.

Colossus is back to crack Nazi codes

WW2 cipher breaking machine Colossus will be exhibited at new National Museum of Computing, Bletchley Park. If you are in UK, you better not miss this chance to see early days of hacking.

After 6,000 volunteered man days of diligent work Colossus now sits in the original location of Colossus No. 9 in Block H at Bletchley Park. The public can see demonstrations of how Colossus cracked a real intercepted Lorenz message.

The museum will complement Bletchley Park Trust’s story of code breaking up to the Colossus and allow visitors to follow the development of computing from the ultra-secret pioneering efforts of that time, through the mainframes of the 1960s and 1970s, and the rise of personal computing in the 1980s.

Other planned exhibits in the National Museum of Computing include:

  • working Air Traffic Control station previously installed at West Drayton;
  • the bringing back to life of an ICL 2900 – one of the workhorse mainframe.

Source: http://www.ccht.co.uk/