Monthly Archives: April 2008

Xml Sitemaps pligg module v0.9

This one is a quick release just like the previous one that fixes just one thing.

All previous versions had this problem that the urls were not urlencoded so those urls that contained special characters like those with an accent or diacritics were invalid and of course google would show an error on those sitemaps.

Version 0.9 makes escapes those urls so now those of you with such special characters in the urls can finally enjoy this module.

It seems like the modules is getting closer to version 1.0 . If you have any suggestion about some feature you would like in 1.0 or you found some other bug that needs fixed, don't hesitate to let me know about it.

download v 0.9 from the module's page

Xml Sitemaps pligg module v0.8

It seems my last version of the Xml Sitemaps module for pligg didn't really fixed the date format problem with the generated sitemaps.

Back when this module was created google had less strict rules about the date format in the lastmod section. My module generated a date and time string with this format YYYY-mm-ddTHH:MM:SS and it was ok but now it's only valid if it also contains the timezone offset in this format +/-HH:MM or if the string doesn't contain the time anymore.

So here is another update on this module that also contains the timezone offset so the sitemap is considered valid by google.

Download here

wordpress 2.5.1

I have just upgraded to wordpress 2.5.1. My upgrade routine worked well without any problem.

The new release seems to bring a few bug fixes to  some annoying issues and a security fix as well as some performance enhancements.

Unfortunately the automatic plugin updater still fails at times and doesn't save the ftp password and the media uploader still renames .tar.gz files in a stupid way.

vim arrows in MacOSX

I know vim gurus would criticize me for using arrows in vim's insert mode but it's really hard to give them up.

I have this problem when I connect from my linux box to a MacOSX or FreeBSD box over ssh. I find it one of the most annoying things when using vim. When you are in insert mode and hit one of the arrows to move around, instead of the expected action vim will just print A, B, C or D on a new line. This makes vim practically useless.

So either you are very careful and always exit the insert mode before you move or fix the keys.

I think it's hard to always remember to get out of insert mode and it's one extra operation you have to do that I find useless not to mention you will probably have to enter insert again a few seconds after that.

So here's the fix for the arrow keys.  Edit vimrc either the global vimrc ( I'm using vim from macports so my vimrc is /opt/local/share/vim/vimrc ) or ~/.vimrc like this:

$ vim ~/.vimrc
set t_ku= (now type Ctrl-V and press cursor up)
set t_kd= (now type Ctrl-V and press cursor down)
set t_kr= (now type Ctrl-V and press cursor right)
set t_kl= (now type Ctrl-V and press cursor left)

This solution was stolen from vim tips wiki. I posted it here to avoid looking for it again if I need it. It's the second time I am hit by this problem and every time I had to search through a few pages with solutions that didn't work for me

xml sitemap for pligg v0.7

This is a quick fix for a bug introduced in a previous version because I tried to make it compatible with php4 date().

This bug may have made your sitemap invalid because the lastmod date contained the timezone between the date and time.

This version also brings a new feature that could be useful for larger sites.

The cache

I noticed that on a site with over 20000 links it may take a lot of time to generate the sitemap index and sitemap files and will put some significant load on the server if google, yahoo or ask will try to access the sitemap every few minutes or hours ( depending on your site's posting/pinging frequency ), so I thought it would be nice to have some kind of cache.

The module will save generated sitemap index and sitemaps in pligg's cache directory ( this means it needs to be writable by the user running the webserver ) and if the cache has not expired yet the module will serve the sitemaps from the cache instead of trying to regenerate every time.

You can set the expire time ( TTL ) and the module will regenerate the sitemap if TTL seconds have passed since the last time it was modified.

You don't need to set any cron job to generate the sitemap files. It will only generate the sitemap if someone/something(google,yahoo,ask) tries to access it.

Another modification related to the caching system is that the site will only ping services if the cache has expired so make sure you set your cache's TTL accordingly.


To upgrade to this version just download and unzip in your module's directory and then to pligg admin -> module management , disable and uninstall the module and then reinstall it so that you can see the new options ( "Use Cache" and "Cache TTL")

Download from module's own page

MacOSX: Automount external drives at boot

After spending about an hour trying to figure out why I can't mount disks from /etc/fstab in MacOSX 10.4 I finally figured it out.

MacOSX 10.4 ( and maybe lower ) doesn't use fstab anymore. Well not just fstab. The stupidest thing about this is that fstab is referenced in every man page related to mount but nowhere it says it does NOT work anymore. I guess apple didn't want to invest in updating the man pages, no one is reading them anyway, everyone is using the gui tool, etc...

MacOSX holds all this information about mounts, users, groups, passwords, services, protocols, hosts and other stuff ( that uses to be in plain text files on Unix ) in it's NetInfo database. The good news is that you can import the information from the Unix standard format plain text files into the NetInfo database and you have an easy way to do this over the command line.

To mount one or more external disks at boot you will simply import the fstab entries just by piping them to the niload command:

echo "echo "/dev/disk1s10 none hfs rw,auto"  > /etc/fstab  	
cat /etc/fstab | niload -m fstab /   	# load fstab in netinfo

At the next boot /dev/disk1s10 will be mounted to /Volumes/disk1s10's label.
The weird thing about this is that you can't just remove /etc/fstab after you import in NetInfo. If you do this will not work anymore. If you just put the info in fstab but not inport it with niload it will not work. You need to both have a valid /etc/fstab and import it in order for this to work.

xml sitemap for pligg update v0.6

Update: There is be a new version of this module. Click here to get it.

Last year I have released a pligg module that creates XML sitemaps for better SEO. The module was tested and working on pligg 0.9.7. Since that time pligg was updated two times and is now at 0.9.9.

In pligg 0.9.8 they removed the clear_cache function that the my module's install code was using to clear the configuration cache. Because of this it was impossible to install the module.

The quick fix was just to edit xml_sitemaps_install.php and remove a line (#5) that called clear_cache() and then you could install it without any problems. This workaround was already known and discussed in the comments
Someone in the pligg community released a new version of this module that is basically just my module with that clear_cache function call removed and another 1 bug that was also discussed in the comments and was easy to fix. They bumped the version number to 0.5 which in my opinion was really not necessary since it was such a small fix.
They have also added a .htaccess file to the archive, again not necessary since my initial post already had the details ( .htaccess code ) about how to set it up and the module was also showing that in the configuration section.
One other thing I didn't like about their release was that they didn't make the module available for download without having to register on their forum.

So here I release a new version ( 0.6 ) of this module with more bugs fixed and now the module will have a page of it's own so that it will be easier to track new versions .

What changed:

  • use safe category names
  • generate links according to URLMethod configuration
  • modified use of date() function to work on php4

This module was tested on pligg 0.9.9.

Go to xml sitemap pligg module page for download

change hostname on MacOSX

here's a quick tip about how you can change the hostname on your MacOSX and keep it changed after a reboot:


Of course you have to type that as root.

It seems there is also possible to set in it /etc/hostconfig but that file on it's own will not work. You have to load it in netinfo somehow but I don't know how to do that.

I think I like the /etc/hostconfig approach more then the scutil (even if it has to be loaded in netinfo ) because it's somehow closer to how most unix/linux systems do it.
Anyone knows how this can be done ?

Permissions on HFS+ volumes

This post will show you how to enable or disable permissions on a HFS+ volume and also how to check if a volume had the permissions enabled or not.

By default when you create a HFS+ filesystem it will have the permissions/owners disabled. I'm using a macmini for backing up files from a linux system and if I want the backup to be fully consistent with the source I need filesystem permissions.

Another problem is that using rsync between a permission based and a non permission based filesystem is useless because all files will always be out of sync.

Check permissions

  1. vsdbutil -c /Volumes/YourVolume

it will "Permissions on '/Volumes/YourVolume' are enabled ( or disabled ) of just "No entry found for '/Volumes/YourVolume'" which means the permissions are disabled.

Enable Permissions

  1. vsdbutil -a /Volumes/YourVolume

Disable Permissions

Since permissions are disabled by default I don't see many wanting to disable permissions but here's how you can do it anyway:

  1. vsdbutil -d /Volumes/YourVolume

I guess this is really useful only when you want to distribute a dmg image which currently has permissions enabled.
Distributing images with permissions enabled doesn't make much sense because the user that will open the image may have a different id then the user id that owns the files in the image so he may not be able to access the files inside the image.

How to create a dmg image

In a previous post I showed you how to mount a .dmg image from the command line.

Have you ever wondered how you can create such an image? Continue reading if you want to know.

Let's assume you want to create an image with a size of 10Mb that is formatted with a case sensitive HFS+ filesystem, with a Volume name Test stored in a file with the name Test.dmg.
Here is the command line you have to type in the shell:

  1. span style="color: #ff0000;">"Case-sensitive HFS+"

If you want to put files on it you have to attach it first:


Or you could just add -attach to the list of parameters of the hdiutil command and it will also attach it after it creates it:

  1. span style="color: #ff0000;">"Case-sensitive HFS+"

Now you can copy your files to /Volumes/Test and when you're done you can detach the image in case you want to transfer/copy/move it:


If you want a quick way to create an image from the contents of a folder you can use something like this:

  1. hdiutil create -fs "Case-sensitive HFS+"

With that you can also specify a format for the image like compressed or read-only images.
Note that in this case I have not used that -size specifier anymore because the image will be as large as the contents of the source folder.

hdutil create --help for more details about image formats encryption and other goodies 🙂