You are here

(mdb to) csv to MySQL

Quick and dirty PHP script to turn a CSV file into a table in a MySQL database. Used for a Drupal project, so I ran it with drush php-script. Couldn't find anything better online. Feel free to use it.

If I need it again some time I will probably make it a bit nicer (I might also make it nicer if you ask me nicely and/or pay me to do it).

In the project I'm using it, I first converted an .mdb file to .csv with mdbtools.

<

pre>
<?php

$handle = fopen("/tmp/test.csv", "r");
$headers = fgetcsv($handle);

Rewrite Rules (not) - Lowercase URLs, but only for some specific paths

This took me enough time to get right to post a little blog post about it:

        RewriteEngine on
        RewriteMap lc int:tolower
        RewriteCond %{REQUEST_URI} (shared|Shared|download|Download)/[A-Z]
        RewriteRule (.*) ${lc:$1} [R=301,L]

Note that this doesn't work in .htaccess - you have to put it higher up in the Apache configuration.

Recursively create lowercase symlinks to filenames with uppercase letters - in Python

I'm working on a project to convert a big ASP website into Drupal. On Windows OSes there is not really a distinction between upper and lower case characters in filenames. At first I thought to just leave the capitals, but on web pages links were sometimes with capitals and sometimes lowercase. So I added some stuff to the Apache configuration, usually inside the VirtualHost directive (this does not work in .htaccess):

<

pre>
RewriteEngine on
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]

Support for Dutch sites in Drupal Service Links

For my little project site about swimming pool construction I decided I needed some way to spread links better over Dutch sites. So I hacked around a little bit in Drupal's Service Links module and I just uploaded some files to support nujij en eKudos. I want to add some more Dutch sites, but there ain't that many it seems.

Ads are back - this time FLOSS only though!

This month I found out about the free software advertising network. I took the opportunity of moving my blog to Drupal to add ads for ethical computing, approved by the Free Software Foundation: "The Free Software Community now has an ethical alternative to ad networks that promote proprietary software".

Damn, I'm even tempted to click on these ads myself!

Moving my blog from WordPress to Drupal

WordPress is a great blogging platform. I've been using it for a couple of years now for my blog. However, with some small exceptions I haven't really dived deeper into it. Since most of my professional time (and a lot of my hobby time) goes into Drupal I started looking into moving my blog to Drupal. I've also been thinking about how I want to publish more about the work I've been doing.

memcache doesn't necessarily speed up your Drupal sites

Sites that show up quickly on a user's screen tend to keep the user's attention for longer and also rank better in Google. So when listening to the excellent Lullabot Podcast 80: Top 40 Drupal Modules Revisited I was caught by Drupal experts stating that Memcache would even speed up your site if it's not a high traffic site. It could off-load the database. I decided to give it a try on a relatively low traffic site of one of my clients.

Hitchwiki everywhere

"Aard Dictionary is a multiplatform dictionary and offline Wikipedia reader. It runs on desktop computers, notebooks and netbooks with Windows, Linux and Mac OS X as well as Nokia Internet Tablets (N800 and N810) and anywhere Python, PyGTK and ICU are available.

Wanted: Wireless Researcher for project in Dharamsala, India

In 2005 I spent some time ICT volunteering for Geekcorp Mali.  And in 2001 I traveled in India and had a great time in the North.  Now, a ICT volunteer is actually needed in Dharamsala.  Contact me if you have the skills, time and you feel like an amazing experience:
AirJaldi, a nonprofit dedicated to harnessing the capabilities of the internet for the benefit of rural communities in developing countries, is looking for a highly-motivated and experienced person to take a central role in carrying out an innovative research project aimed at de

More to follow: wikis without nofollow

I've come to realize that it's silly that most wikis are using nofollow by default. In fact, it seems that the majority of the most visited websites are not contributing to a healthy way for spreading pagerank. Twitter, Facebook, Flickr, Youtube, Wikipedia and Delicious are all adding rel="pleasefollow" to links added by their users.

Underscores to dashes in MediaWiki (not yet)

It's clear that dashes (-) are better than underscores (_) for search engine optimization. So people have looked for ways to make MediaWiki use -. Wikihow is one of the few MediaWiki sites that behaves this way, but unfortunately even they don't seem to be running an extension for this. I tried my luck at changing the MediaWiki core (Title.php) but I'll leave this for now.

Back in A'dam

My unlimited MetroCard was still valid for a day and a half so I left it to the poor soul who was robbed from all of his belongings in Lower Manhattan - he was also staying at my host's place in Williamsburg. I had a good flight to Dublin, where I had a very pleasant stay with Dublin's superhost. The guy has been hosting more than 1000 people. Now I'm back in Amsterdam, and it feels good to be among friends. It was just a bit annoying to find out that a "1 zone" tram ride in Amsterdam costs 2,60 euro these days. I boycotted that and walked instead - with about 25 kg of extra weight.

Out of New York and into Groundcrew

I'm in Northampton MA right now, at Joe Edelman's place. It's nice to be out of the City. It's even nicer to see Joe excited about Groundcrew. The guy who worked on the user interfaces for Blogger and Twitter is doing the design and there are some cool opportunities. It also looks like the project has taken a clear direction on one side - while leaving open the community side for later. The main problem is the cost of text messages, which should have been free by now.

Logos for wikis

I'd like to see some logos for the following wikis: Healthywiki, Visawiki and Wikifurniture. Let me know if you think you can make something nice, or even better, you can directly upload it to the wiki. And yeah, anything is better than nothing at all.

Silly with rsnapshot

A bit silly. I tried setting up rsnapshot to make snapshots of the entire filesystem on my server. This apparently led to a fatal exception in the Linux kernel, probably when rsyncing /dev and especially /proc. It took a bit of time before it was fixed, but everything is working fine again. I'll make sure to first try silly things such as backup / localhost on my laptop.

fail2ban and sshd on non-standard port

Sometimes wifi connections only allow connections to a limited range of ports. In Israel connections to ports over 1024 were seriously throttled. So I put the SSH server of one machine on port 22. When going through /var/log/auth last week I found many bots trying to enter with standard names. So I installed fail2ban, today I'm checking and everything is working fine. For your own safety you can set up IP addresses that can always come through. Merely putting sshd on a non-standard port seems to be a more adequate way to keep bots out.

Pages