Change of address

November 7, 2009

From now on anyone wishing to follow my antics, rants and ramblings should direct their browser to http://barbedwirebytecodebaconburger.com since I will no longer be updating the blog here at WordPress.com.

That’s http://barbedwirebytecodebaconburger.com people! Learn it, live it, love it!

END OF LINE


Calling all European citizens and users of the internet!

September 27, 2009

Go here immediately and sign the petition. The petition has to be presented tomorrow so hurry up!!!


Move along, nothing to read in this entry

August 7, 2009

Just testing an android app.




Migrating an old MS Access database to MySQL [UPDATED]

August 3, 2009

I’m in the process of migrating an old website I made almost 8 years ago from it’s current unbearable platform of Windows, ASP and MS Access to some sort of *nix, PHP and MySQL. Tonight I decided to combat that MS Access database and transform it into a real database. To help me accomplish this I used the excellent tools provided by the mdbtools project.

First I had to export the schema of the database to a format readable by MySQL:

mdb-schema -S mydb.mdb mysql > mydb.sql

This creates an SQL-file containing the schema in plain readable SQL. Very nice.

Next I had to export the actual data from the tables in the MS Access database, like this:

TABLES=`mdb-tables mydb.mdb`
for T in $TABLES; do
mdb-export -I -R';\n' mydb.mdb $T >> mydb.sql
done

The first line stores the names of all the tables in the variable TABLES. Then I simply loop through all of them and execute the mdb-export command on all of them, writing the output to the end of the schema-file.

In case I need to do this again in the future I put it all together in a script like this:

#!/bin/bash
DBFILE=$1
OUTFILE=$2

#Check for correct number of arguments
if [ ! $# -eq 2 ]; then
echo "Usage: access2mysql.sh DBFILE OUTPUTFILE"
echo "Example: access2mysql.sh msaccess.mdb mysql.sql"
exit 1
fi
#Check that DBFILE really exists
if [ ! -f $DBFILE ]; then
echo "$DBFILE does not exist."
exit 1
fi

#All is good, here we go!

#Create schema
mdb-schema -S $DBFILE mysql > $OUTFILE

#Export table data
TABLES=`mdb-tables $DBFILE`
for T in $TABLES; do
mdb-export -I -R';\n' $DBFILE $T >> $OUTFILE
done
#Clean up some Windows-character stuff
dos2unix $OUTFILE
exit 0

Now all I have to do is create a MySQL-database and write my newly created SQL-script into it and I’m good to go!

UPDATE:
Before I could get the SQL-script to work I had to fire off a couple of sed-statements to fix the fact that I had used some illegal words as names for some of the table-columns, “type” and “condition” to be specific. No biggie though. Also, mdb-schema didn’t add “AUTO_INCREMENT” to the fields that were auto incrementing in the MS Access database so I had to do that manually.


The classics meet the modern times

July 19, 2009

I finally started transferring my vinyl collection to FLAC (concentrating mainly on 7″ EPs and Mini-LPs). It’s gonna be a looong time before I’m finished though.

Thus far I’m basically transferring the music into Audacity via USB and then manually chopping the capture into songs. I know there’s probably a better and faster way to do it, but I’ve just started and I’m sure the proper tools will reveal themselves to me soon enough once I start looking for them😉 Meanwhile, here’s a picture of a classic piece of vinyl in the process of going digital:

The music of 1989 meets the tech of 2009

The music of 1989 meets the tech of 2009


I’m in your internets, sniffing your packets

July 15, 2009
Rocking Wireshark on my EeePC on the train to Stockholm

Rocking Wireshark on my EeePC on the train to Stockholm


It’s not that I hate GUIs, I just like CLIs

July 7, 2009

I’m a big fan of the command line. I find that using it is many times a lot faster and more efficient than going the “clicky-clicky”-route via a GUI. Also I often find graphical user interfaces highly restrictive. A GUI is only as good as the designers ability to predict every possible thing that a user would need to do with it and because of this there is no such thing as a perfect GUI.

This is especially true with GUIs that are in reality just a pretty face on top of a console application, which is many times the case. Take for example a graphical front-end to a webserver-application like the Apache Web Server. To cover all bases this GUI would have to make it possible to do and configure exactly every part and function of this complex piece of software with the same precision as you can when you manually edit the configuration-files in your text-editor of choice. I just don’t see how that would be possible without making the GUI a cluttered and hard to use mess, which totally defeats the purpose of using a GUI to begin with. And what if you stumble upon a situation where the GUI lacks the needed knobs and switches needed to configure the underlying application to behave in a particular way? Well, then you’d have to drop down under the hood and go command line wouldn’t you? Now wouldn’t you have been better off being there the entire time then? You might even have picked up something about the application that you didn’t know before just from mucking about closer to it’s innards, which is always a good thing.

Another thing that I really like about CLI-apps is that you can combine them with each other piping input and output all over the place to create new functionality. This simply isn’t possible with a GUI-app because it lives in it’s own little world inside a window full of buttons, sliders, whistles and bells and almost always impossible to get to play nice with other apps unless it was specifically built for this to begin with. A CLI-app that accepts and supplies communication from stdin and stdout has no such limits and at the command line they all come together with incredible power that can never be mimicked by any GUI on earth, no matter how shiny it is.

There are also computing environments where I believe that GUIs have no place at all. One such environment is on a server machine. Why suck up resources from the server by forcing it to power a graphical environment with windows, button and such? It’s a waste of precious computing power and darn right stupid if you ask me. Naturally, by saying this I am also saying that no incarnation of the Windows OS has any place on a server, which is completely deliberate😉

However, don’t get me wrong, GUIs definitely have their place in the world of computers. Not every user is a power user that needs to control every single byte of data and naturally there are apps that would be simply unbearable or at least highly impractical as CLI-apps. Web browsers for example are no fun in a command line environment and playing media like movies or flash animations is simply not possible. For the menial day to day computing tasks such as browsing the intertubes, handling e-mail and thousands of other things a graphical environment is preferred over a command line based one. But sooner or later I always find myself back at the prompt writing commands with twelve arguments and piping here and there, simply because for me it makes sense. I feel in control and not at the mercy of whoever designed some jumble of buttons and windows believing that his vision is what I and every other user wants and needs.

For my love of the command prompt I’ve even been called a GUI-hater (as a joke though) but that’s not true. I don’t hate GUIs, I just really like CLIs.

END OF RANT


Follow

Get every new post delivered to your Inbox.