Posted (Updated ) in Linux

In this second post of my lazy man’s series, I’ll explain an easy way to batch rename files in any linux distribution with the rename command. For users of the sed tool, this will look very familiar. You’ll also need a bit of knowledge of regular expressions:

rename 's/_/ /g' *.mp3

The above example replaces every underscore with a space character in all mp3’s of the current directory. The command works as follows:

rename 's/<search_term>/<replacement_text>/g' <regex_filename_match>

Thanks to jazzmusik of the Ubuntu Forums for his little tutorial found here.

Read More »

Posted (Updated ) in Linux

Ubuntu 10.10 was the first release of Ubuntu not to have ‘Mark Packages by Task’ working in the Synaptic Package Manager. For those who don’t know, ‘Mark Packages by Task’ is a handy little menu option that allows you to install pre-configured groups of applications very quickly – such as the Samba file server, video and audio creation suites but more importantly to us: a LAMP stack.

To get this nifty tool back where it belongs, just install the tasksel package:

sudo apt-get install tasksel

It should now be where it belongs.

Happy installations.

Read More »

Posted (Updated ) in Linux

I’m a developer. That makes me lazy. Here is the code to recursively tar and untar files (with and without compression):

tar -cvf filename.tar target1 target2 #without compression
tar -cvzf filename.tar.gz target1 target2 #with compression (Just add z)

To untar, simply replace c with x:

tar -xvf filename.tar path #without compression
tar -xvzf filename.tar.gz path #with compression (Just add z)

Read More »

Posted (Updated ) in Linux

Update 2011-10-30: Added instructions for Ubuntu 11.04+

An issue has crept up in the latest version of Ubuntu (10.10 as of writing) whereby installing beta versions of Firefox causes the browser to become the default application for FTP addresses. This is a real annoying development that I’m sure alot of you have a beef with. There’s a very simple fix to change it back to trusty ol’ nautilus:

Open ~/.gconf/desktop/gnome/url-handlers/ftp/%gconf.xml and change the stringvalue link to/usr/bin/nautilus like so:

<?xml version="1.0"?>
<gconf>
	<entry name="needs_terminal" mtime="1287534317" type="bool" value="false"/>
 
	<entry name="enabled" mtime="1287534317" type="bool" value="true"/>
	<entry name="command" mtime="1287534317" type="string">
 
		<stringvalue>/usr/bin/nautilus</stringvalue>
	</entry>
</gconf>

In 11.04+, you’ll also need to open ~/.local/share/applications/mimeapps.list and under [Default Applications] add:

x-scheme-handler/ftp=nautilus.desktop

Courtesy of radu cotescu.

Read More »

Posted (Updated ) in PHP

I’ve been working with the Zend_Gdata tools lately to perform various Google Calendar operations. One thing I’ve noticed, though, is that there are no tutorials on how to cache the auth request between pages. Caching the authentication would result in one less expensive operation to an external server upon each new file request (The retrieving of a new, working Zend_Gdata_HTTPClient object). Figuring out how to accomplish this seemingly simple task proved a little more difficult than I’d have liked and ironically ended up being very simple 🙂

Read More »

Posted (Updated ) in Uncategorized

Over the last few days I’ve been working tirelessly on this site – moving it to a new home and adding a server-side syntax highlighter (wp-syntax) as well as various other behind-the-scenes improvements. The result should be a faster and load and better resulting experience while browsing.

That is all.

/PSA

Read More »

Posted (Updated ) in Database, PHP

Here’s my second Doctrine 1.2 driver for Kohana 3, this time for the Session class. I wrote this because I don’t particularly like the Kohana Database or ORM classes (that or I just don’t want to take the time to learn them!) and it’s released under a creative commons v3 licence So here it is. Enjoy!

Kohana 3 Doctrine Session Driver 1.02 See here for details

UPDATE 22 Oct 2010: Bugfix release – should actually work now 🙂
UPDATE 03 Jan 2011: Fixed rare bug in DB cleaning function.
UPDATE 21 Feb 2011: New module at a new home! See here for details

Read More »

Posted (Updated ) in PHP

I’ve recently started looking at the Google Calendar Data API for PHP for use in an upcoming project. It uses Zend Framework which has a pretty nice library complete with documentation here allowing for just about every operation I required…except deleting calendars (which is a bit strange, considering you’re able to create them with the API). This seems to be a limitation with version 1.0 of the API. Version 2 allows for deletion of calendars however there’s no documentation PHP implementation yet. After a long night of researching and hair pulling I’ve finally managed to come up with a working script provided.

EDIT – Now working with Zend Framework!

Read More »

Posted (Updated ) in Uncategorized

I installed firefox-4.0 (currently 4.0b8pre) on Ubuntu Maverick RC earlier today and all was going fine and dandy until I had to open a Google Docs spreadsheet. I’d receive a message stating:

The bad news is that Google Docs has just encountered an error.
The good news is that you've helped us find a bug, which we are now looking into.

We apologize for any inconvenience this has caused you.
In the meantime, if you'd like updates on this and other issues, try visiting the Google Docs Help Forum.

Sorry, and thanks for your help!
- The Google Docs Team

I checked documents and they seemed to be fine. It turns out this is an issue with Google not recognising FF4’s user agent string. The easiest way to solve this issue is to type about:config into the address bar and set

general.useragent.compatMode.firefox

to true.

Read More »

Posted (Updated ) in PHP

A very quick post for any of you poor souls suffering the dreaded ‘Discovery Failed’ message in Zend_OpenID_Consumer when trying to connect to Google – see this comment on Stack Overflow for the solution you’re looking for. Hopefully this’ll save you some time hunting around on the web for it.

Read More »