If you’re dead set on finding a way to do a recursive delete with Windows’ standard command line FTP client you’re in the wrong place. Actually, the whole internet is the wrong place for you. Why? It’s simply impossible to find a way to do recursive deleting of directories in ftp.exe on the Internet. Well, I’ve searched high and low and couldn’t find it that is. If you can, I’d love to hear from you.

What I did find however is a way to achieve the same thing with a simple different FTP client.

At my job someone was looking for a way to delete all contents from a certain directory. This directory contains files and more directories (which in turn can contain more files and even more directories). This is easy if you’re working in a graphical FTP client like FileZilla but in our case it had to be done with a script. This meant we needed to work from the command line. Windows’ standard FTP client simply didn’t work. As long as a directory is not empty, it can’t be deleted. There are probably complicated scripts that can be written to do what we want but we’re no guru’s and we couldn’t find them by means of Google.

After a lot of searching we finally found our answer. I knew that the linux based FTP client LFTP does what we want with a built in command. All I had to was find a way to run it in Windows. Finally Google was my friend again. It didn’t take too long for me to find a windows version of LFTP. It’s in a ZIP file and it can be downloaded from here.

When running the included install.bat, Windows complained a little but that didn´t stop the program from working. I did need to specify the full path to the exe (for instance C:\Windows\lftp.exe) in order to run it. Now you could write a script like this:

debug 10
open ftp.blah.org
user <user> <pass>
rm -r <directory>

And after saving the script you can start LFTP like so:

C:\Windows\lftp.exe -f <script_file>

I assume you’ll understand that you’ll need to replace all text that is enclosed <like this> with their corresponding values (so replace <user> with the username to connect with and <pass> with the user’s password)?

For more info on using LFTP try the documentation or this page (with scripting examples).

Please let me know in the comments if you’ve found other ways to achieve the same thing (perhaps with Windows’ standard FTP client?). Hope this helps!

There’s a conference on blogging going on today in Amsterdam, called Blog08. Everybody using the right hash tag (#blog08) on Twitter and tagging their pictures with blog08 on Flickr but I couldn’t find a Twitterfountain for the event anywhere! So I figured I’d do one, check it out!.

I recently helped my mother with switching over to Gmail. She has always used the webmail service from our webhost with an e-mail adress at amazoneadvies.nl (she runs a dutch PR consultancy) but the webmail service had been buggy lately. Setting up Gmail to receive e-mail from another account with POP3 access is easy but I was getting worried when I noticed the mail that she had put in folders wasn’t coming through. When I went googling for a clue I found the Gmail answer to this problem:

You’re only receiving mail from the inbox of your other account and not from any folders. Each webmail provider determines which messages to make available for POP download and sends a list of the messages to Gmail. Since Gmail can’t retrieve any messages that aren’t on the list, we suggest contacting your other provider to learn about alternatives.

I didn’t really feel like doing it this way, it meant waiting for our hosting provider to respond and everything. Plus I wasn’t convinced that Gmail would automatically label the messages with the folder name. So I had to come up with another solution.

Gmail allows you to access your e-mail through IMAP which means that you can access your mail with a standard desktop e-mail client like Mozilla Thunderbird. Every change you make in Thunderbird (such as deleting a message) will reflect in your Gmail as well (in contrast to making changes with POP3 access). Our hosting company provides IMAP access as well. What I did was the following:

I turned on IMAP access in Gmail and configured Thunderbird so I could access my mother Gmail (read all about it). Then I created another account in Thunderbird to access her mailbox at our hosting provider (the one the still held some mail in folders). After doing this I could easily create folders for Gmail in Thunderbird (Gmail converts them to labels automatically) that match the folders at our hosting provider. After that I could simply drag and drop all the mail from the hosting provider to Gmail (hold [CTRL] while dragging and dropping to copy instead of move).  Voila!

This way all the e-mail that was archived in folders at our hosting provider now appears under matching labels in Gmail.

I’ve started my internship at a big school that recently implemented Google Analytics (GA). When we looked at their data we saw that many pageviews simply came from employees visiting gateway pages to internal services. Also, because we don’t have a comprehensive intranet right now many employees and students look for information at the public website. We needed a way to remove all internal traffic from our GA data.

This turned out to be easy. Google Analytics offers this feature right out of the box. On the Analytics Settings page for your account simply navigate to the filter manager and choose the ‘Exclude all traffic from an IP Address’ filter. The fill out your IP range. Some regular expression magic is needed here but there’s plenty of documentation about that to be found. A good tip is to create a new profile for the same website and apply the filter to this new profile so that you never loose any data: you’ll still have your original profile without filters.

Now that we had this sorted out we figured it might be kind of cool to also have a profile that only displays data about internal traffic. Google Analytics doesn’t offer this feature out of the box. Luckily there’s a workaround. Create a new profile for the same website again (add website profile -> add profile for an existing domain), and create a new filter. Make this a custom filter and choose Include as the filter method. Then choose Visitor IP address as the filter field and enter the same IP range you used for the exclude filter as the filter pattern. Now apply this filter to the right profile and you’re all set: you now have a filter that will only show traffic from a certain range op IP adresses. Hope this helped!

I hate using PHPMyAdmin to adminstrate MySQL databases. It looks ugly, it’s unintuitive and simply not user friendly. And still it was still the tool I used to do this very task. I thought there was no good alternative. SQL Buddy seems to offer just that. A nicer way of administrating your MySQL databases.

SQL Buddy is AJAX enabled and refreshes only the portion of the page that needs it. This alone makes for some reduced loading times. However it does play nice with bookmarks and the back button (in the same way that GMail does). When browsing your data you can resize the table columns and sort the data on the fly. One other thing I really like is that it allows you to hardcode your MySQL password in the config file. This shouldn’t be used in a production environment ofcourse, but it’s pretty nice when you’re on your local testing machine. It also doesn’t log out after 15 minutes of inactivity like PHPMyAdmin does.

I’m sure there are some features that PHPMyAdmin has and SQL Buddy doesn’t. But still, it can’t hurt to try it out and you can always run the two side by side ofcourse!

I’ve been using Netbeans for web development with PHP for some time now and just keep on finding neat tricks. Most of the times I use TemplatePower for templating in my PHP applications. Your template files have to have the extension .tpl to work with TemplatePower. I had a problem with this because Netbeans didn’t recognize the files as html files (which they effectively are). There’s an easy way to fix this however, which works like this:

Go to Tools -> Options and click on ‘Miscellanous’. Now open the type called ‘File associations’. Click new, enter the extension for which you want to assign a file type and hit ‘Ok’. Now choose the associated File Type (MIME) that you want to go with this file extension. Done! You can do this for any file extension you want.

Since about a week or so I’ve been running Ubuntu and Windows Vista in dual boot. I’ve had Windows Vista for a longer time already and after trying Ubuntu from the LiveCD I decided it was time to install it for real. When doing this stuff you really need to plan how you’re going to use your available hard disk space. What I wanted to achieve was to be able to access all my personal files from both Ubuntu as well as Vista. By personal files I mean the files that are stored in Documents, Music, Videos, Pictures, etcetera. Both Vista and Ubuntu have these folders built in.

I decided to create a FAT32 partition to hold these personal folders. I knew I could then change the location of the personal folders in Vista to this FAT32 partition and create symbolic links to these folders in Ubuntu. This way it looks like you’re just browsing your Documents folder while you’re actually on the Documents folder on the FAT32 partition. This all seemed to work out great. I had my personal folders in my ‘/home’ folder on Ubuntu and in Vista I could reach them via Username -> Documents.

But ofcourse things can never be as easy as they seem. After doing this I didn’t have write access to some of my personal folders in Ubuntu. The folders that were linked to personal folder in Vista were read only, all the other folders on the FAT32 partition adhered to rules I had set in /etc/fstab. I participated in a couple of forum threads about this, but nobody ever seemed to be able to provide a solution. I still don’t really know what’s causing this problem but I have found a way to fix it. The answer is really quite simple but it’s not something you’d expect.

We’ll start off by linking Vista’s personal folders to the ones on the data partition. You can do this by right clicking on of the personal folders, going to the tab that says ‘Location’ and change the location listed there. In my case I’m pointing my Documents folder to ‘E:\Walter\Documenten’ as you can see in the following image:

There are also folders that Vista doesn’t have natively while I do want them in my Personal folder. In my case for instance that’s a ‘Webs’ folder. It’s the one where all my web development projects are in. To have it show up in your personal folder you can just make a new shortcut to it. You can even pick a nice icons for it. See below:

Here’s what my data partition looks like in Vista after changing the location of my personal folders to it. The folders actually get the same icons:

If I reboot into Ubuntu now and go to my data partition (I’m assuming you already mounted your FAT32 partition correctly) I’m seeing something really odd. The folders that have been linked to from my personal folders in Vista are locked. The non Vista native folders like the ‘Webs’ folders aren’t. See the two images below:

If we type the ‘ls -al’ command in the terminal for the folder that you mounted your data partition to (in my case it’s located at ‘/data’) we can see what the locks mean:

The folders appear to be read only. This wasn’t the case before we did our thing in Vista. As a matter of fact it’s not supposed to be possible since FAT32 partitions don’t support file and folder permissions and so should be mounted according the rules you set in ‘/etc/fstab’. We’ll fix this strange behaviour later. First we’ll set up symbolic links to these folders from our ‘/home’ folder. To be able to do that we’ll first delete Ubuntu’s native personal folders that have similar names. In my case I needed to delete ‘Pictures’, ‘Documents’, ‘Videos’ and ‘Downloads’. See the two images below for a before and after shot of my ‘/home’ folder (/home/waltervos in my case).

Now we’ll set up the symbolic links. First off open up a terminal as root: press ALT + F2 and type ‘gksu gnome-terminal’. You’ll  be prompted to enter your password. The syntax for symbolic links that we’ll  be using is ‘ln -s [TARGET] [LINK FOLDER]‘. In my case, to make a link to my ‘Downloads’ folder I had to enter the following: ‘ln -s /data/Video /home/waltervos/’. This creates a link to ‘/data/Video’ in the ‘/home/waltervos’ folder with the same name as the target folder. See the image below for all the commands I used:

This made my ‘/home’ folder look like so:

Unfortunately the file permissions remain the same. We still can’t write to some of the folders. To fix this strange bug (feature?), all you really need to do is chmod the misbehaving folders in their original location like so (execute these in a terminal as root as we did when creating symbolic links earlier):

chmod 0775 -R /data/Documents
chmod 0775 -R /data/Pictures
chmod 0775 -R /data/Video
chmod 0775 -R /data/Music

Do this for every misbehaving folder and the problem is solved. Once again, what’s strange about this is that FAT32 partitions aren’t supposed to support file and folder permissions. The above commands aren’t supposed to work! See the image below for a before and after shot:

If we reboot into Vista now we’ll see that some things have changed. We lost the icons on the personal folders that Vista and Ubuntu have in common now, and there is a double Documents folder now. You can delete the one that’s empty.

This is what you’ll end up with. Your personal folders are now accessible under Ubuntu and Vista in their default location. Unfortunately you have lost the pretty icons in Vista because of this and I haven’t found a way to do something about that yet. It’s really not that big of a deal I think.

Please do post your thoughts on this article in the comments. Do you know why this is happening? Did this walkthrough help you out?

I’m sure that there are a couple of commands you use on a regular basis when working in Ubuntu. I for instance often open the file browser by pressing ALT+F2 and entering ‘gksu nautilus’ which opens the file browser as root. The same goes for the ‘gksu gnome-terminal’ command. Entering commands with ALT+F2 is cool and all but when the commands start to leave a lot of room for typo’s it can be annoying.

I knew that I could make bash scripts in Linux to execute certain commands so I figured I’d simply make some bash scripts for these commands. The way to do that is like so:

Press ALT+F2 and enter ‘gksu gedit /usr/local/bin/sunau’. This opens the text editor with new file called ’sunau’ in the location /usr/local/bin. We’ll make a script in this file that opens the file browser as root. Enter the following into the empty file:

#!/bin/bash
gksu nautilus

Now save the script and close the editor. The only thing left now is to make the script executable. Press ALT+F2 again and enter ’sudo chmod +x /usr/local/bin/sunau’. After this you can call your script by pressing ALT+F2 and entering ’sunau’. This will start the file browser as root. By changing the contents of the file you can execute all kinds of commands with bash scripts.

Today I was looking for a how to format a disk in FAT32 in Windows Vista and came across this simple tip. You can simply open the run command and type the following there:

format [drive letter]: /FS:FAT32

So if the drive you want to format is drive E: you simply type in format E: /FS:FAT32. This will open a new window where you’ll be asked to confirm the operation. After that all you need to do is wait a little.

If you don’t have a lot of time to wait you can also add the /q command to do a quick format.

I’m releasing my new Wordpress plugin called EasyGals today. I made this plugin because it can be such a hassle making nice thumbnail galleries for your posts. With EasyGals the gallery is automatically generated based on the images that are attached to the post.Read more about EasyGals and how to use it here .