Showing posts with label structure. Show all posts
Showing posts with label structure. Show all posts

Saturday, October 03, 2009

New challenge

About a year ago I started something that, a few days ago, came to a conclusion - but to be fair, it's more a milestone than a conclusion.
In August of last year (2008), I applied for a job at Ghent University. In the months that followed I went through the selection process, and after some hurdles I got selected. In April of this year (2009), I started on my new job. And now, six months later, my trial period is over. After a very good evaluation, I was appointed to the job, starting October 1st.
It took me over a year to get so far, but now I've reached what I was aiming for since then. But of course, this is just the start of it all. I have the rest of my life's working career ahead of me at Ghent University. And I'm still getting started, with a lot of plans to accomplish, projects to start, task being assigned, ... I'll know what to do the next few years.

But now that I've reached some stability on the work front, I might think of a new challenge, some new projects to start, or some overall reorganisation of the goals and priorities in my life. I've been thinking of a few, some silly or ridiculous, others infeasible (at least on my own), or down right impossible ways to pass time:


  • Find a way of solving any Rubik's cube in maximum 21 steps. The current proof says maximum 22 steps are needed.

  • Write a socio-philosophical essay addressing some effects of globalism : economy, environment, politics, communication, pluralism, culture, migration.

  • Now that, Gianfranco Gentile, a researcher of Ghent University has discovered that dark matter is needed to explain certain behavior in galaxies, it might be time to create a theory combining classic, relativistic and quantum mechanics together with dark matter.

  • Work on something revolutionary to save energy, use available energy more efficiently, not only by technology, but also by a change of mentality.

  • Build a render farm.

  • Start beatboxing.

  • Research methods of efficiently stacking solids, and by extension, deformable solids (f.e. a sealed bag containing a liquid).


But some are more realistic so I'll focus on those :

  • Learn to solve a Rubik's Cube. This is trivial, but I would like to find it by myself.

  • Pick up playing the piano again.

  • Read more, by which I mean : books, literature.


Or I could just try to look for goals in my work, find a girlfriend, buy a house, get married, start a family and raise some children.

Wednesday, March 11, 2009

Rename multiple tables in MySQL database

Having to rename multiple tables with a similar pattern (prefix, suffix, ...) by replacing the recurring pattern, isn't an easy task, because there is no simple function or statement for doing it, not as far as I know.
Renaming tables like 'table_1234' and 'table_3456' to 'new_table_1234' and 'new_table_3456', is pretty straightforward in SQL:


RENAME TABLE `database`.`table_1234`
TO `database`.`new_table_1234`;
RENAME TABLE `database`.`table_3456`
TO `database`.`new_table_3456`;

or in one SQL statement :

RENAME TABLE
`database`.`table_1234` TO `database`.`new_table_1234`,
`database`.`table_3456` TO `database`.`new_table_3456`;

But when renaming a lot of tables, this method becomes tedious and time consuming.

This PHP script automates the renaming of multiple tables in a MySQL database. It lists all tables in a MySQL database, which contain a defined string pattern. The script creates and executes a series of SQL statements, which rename the table by replacing the search pattern in the original table name with another pattern in the new table name.

This script can easily be modified to rename multiple databases, or when stripping the original pattern (f.e. a prefix) and adding a new pattern (f.e. a suffix) is needed.

<?php
$db_server = "localhost"; // hostname MySQL server
$db_username = "username"; // username MySQL server
$db_password = "password"; // password MySQL server
$db_name = "database"; // database name

$pattern = "pattern_"; // search string
$new_pattern = "new_pattern_"; // replacement string,
// can be empty

// login to MySQL server
$link = mysql_connect( $db_server, $db_username, $db_password);

if (!$link)
{
die('Could not connect: ' . mysql_error());
}

// list all tables in the database containing the search pattern
$sql = "SHOW TABLES FROM `" . $db_name . "`";
$sql .= " LIKE '%" . $pattern . "%'";

$result = mysql_query ( $sql, $link );
if (!$result)
{
die("Invalid query: " . mysql_error( $link ));
}

$renamed = 0;
$failed = 0;

while ( $row = mysql_fetch_array ($result) )
{
// rename every table by replacing the search pattern
// with a new pattern
$table_name = $row[0];
$new_table_name = str_replace ( $pattern, $new_pattern, $table_name);

$sql = "RENAME TABLE `" . $db_name . "`.`" . $table_name . "`";
$sql .= " TO `" . $db_name . "`.`" . $new_table_name . "`";

$result_rename = mysql_query ( $sql, $link );
if ($result_rename)
{
echo "Table `" . $table_name . "` renamed to :`";
echo $new_table_name . "`.\n";
$renamed++;
}
else
{
// notify when the renaming failed and show reason why
echo "Renaming of table `" . $table_name . "` has failed: ";
echo mysql_error( $link ) . "\n";
$failed++;
}
}

echo $renamed . " tables were renamed, " . $failed . " failed.\n";

// close connection to MySQL server
mysql_close( $link );
?>

Syntax Highlighting in Blogger

I've added some Javascript to the template of my blog to get Syntax Highlighting working. This means source code is formatted so it is easier to read. If it works allright, you should see an example of some highlighted php-code below. (The source code is not formatted/coloured when reading this post through an RSS-feed.)


<?php
/* Sample php code
This code doesn't do anything at all.
It just contains some php elements that should be formatted
and coloured.
*/

$some_variable = "some_string";

// Some comment
$result = some_function( $some_variable );

if (!$result)
{
die("It doesn't work!");
}

$some_array = new array();

$some_array[0] = $result;
?>

Saturday, February 07, 2009

Green Plug Universal Power Adaptor

How many electronic devices do you have? A laptop, cell phone, MP3 player, external hard disc, GPS, ...
And each of them has its own adaptor, which can only be used with a specific device and isn't compatible with your other devices.
So you end up with several different adapters powering your devices, which results in a lot of cables that can get entangled, and which take up a lot of power plugs.
And if an adapter breaks, you have to buy a spare one from the original manufacturer, which costs a lot.

Wouldn't it be nice if there was a universal adapter for all your electronic devices?
You would only have to take one adaptor with you, to charge your cell phone, MP3 player and laptop. If a friend or colleague forgot to take her or his adapter, he or she could easily use yours, even if he or she uses a laptop of a different brand.

Actually, there is an initiative to standardize power adaptors :
Green Plug Universal Power Adaptor.


GreenPlug Universal Adapter

Friday, November 21, 2008

Social Web

Social networking websites are becoming more and more popular, and it's number is growing. Some websites provide a unique service, while other websites seem to be more of the same.
Some of your friends join one website while others join another, and both of them are requesting to join them on their website of choice.

After a while you have an account with several of those websites, and you start to notice you are providing the same information over and over again, on every of those websites : personal details, interests, schools you attended, employers you worked for.
And you have to (re)connect to your friends on every of those websites.
Not to mention when something changes, for instance when you change jobs, you have to change it on every website and hope you don't forget any of them.

Wouldn't it be convenient if all of the information you provide on those websites, can be shared between those websites? If you want to change something, you can do it in one place and all other social networking websites where you have an account adopt these changes automatically? If you add a friend on one website, and that friend has an account on another website where you have an account too, that this friend is added there as well?

I'm not the only one asking the same questions. And it seems some effort is put into creating a Social Web, where this kind of (personal) data can be shared between (social networking) websites in a open, easy and secure way.
These are a few of the initiatives :

A recent presentation (June 2008) was held with an overview of these efforts and what the future will bring. Unfortunately, these efforts, for now, are quite theoretical and about creating standards based upon existing web standards. Several protocols are proposed (FOAF, XFN, hCard, GRDDL, RDF, OpenID, OAuth, REST, ...) to be used in this new standards.

No real usable application is available at the moment, not as far as I know, but the big players (MySpace, Facebook, Google, Twitter, Netlog, ...) are backing some of these initiatives.

Friday, August 15, 2008

Dreamjob

Changing jobs is always some sort of a gamble. Will I like it? Is it as described in the vacancy? Is it as I expected it to be?
Therefor, it is important to know what you want and expect of a job.

Taking my current and past job experiences in account, this is what my ideal job would look like :

  • It should have something to do with technology or IT. I enjoy creating new things, so some programming, engineering or research should be envolved.
  • I have to believe in what I'm doing or what I'm being part of. The long-term project or product should be something I can support and be commited to. Maybe some sort of Open Source project, or cutting edge technology.
  • Considering my health, it is important I get enough sleep. Although I always enjoyed doing project work which involved long, irregular hours and traveling abroad, it's better for me if I can have less demanding hours.
  • I don't mind forensing, to a certain extent, but I'd like to live near where I work. Working in the same city where I live, is therefor preferrable. For a dreamjob, I would even consider relocating, even if it means going abroad.
  • The working atmosphere should be nice. Getting along with my colleagues is important as I'm around them for a major part of the day, and maybe even for a large part of my working life.

Monday, August 04, 2008

Retraining batteries

I've bought an Apple iPod (4G) three years ago (December 2004) and I've noticed its battery life decreasing over the years.

A few months ago (March 2008) I started on a new job, for which I spend about 2-3 hours per day commuting by train, during which I listen to music on my iPod.
When I first started, I could use my iPod for 2 days (approx. 5 hours of listening), without recharging the battery. But over the past months, the battery life increased. Last week I managed to use my iPod for 4 consecutive days (approx. 10 hours of listening), without recharging. It seems that battery memory can be 'retrained'.

Wednesday, July 16, 2008

Todo list

This post is a work in progress, listing things I would like to do in the near and more distant future.
Some may be completed soon, while others will take a long time or may never be completed.
While some items are in preparation of another item on the list, others have no set goal or defined purpose, yet. Thus, the items on this list are in no particular order :

  • Learning new programming languages and improving my knowledge of the ones I'm already familiar with :
  • Linux :

    • Finish the CLFS project for my old 486

    • Upgrade to a new version of LFS on my server

    • Get my encrypted external hard drive working in linux and windows

    • Learn more about the linux kernel and maybe participate in its development or that of another Open Source project

  • Continue work on some small PHP-projects

  • Think about the feasibility of the semantic web, Turing tests, universal machines and time travel.

  • (Re)paint my bathroom

  • Find a new hobby

  • Get a girlfriend

Wednesday, February 20, 2008

Selection test #2 : trip to VUB

I went, I told them what I know and I got a job!

This morning I went to Brussels, for the second time this week, for a job interview and written selection test, this time at VUB. The job I applied for is very similar to what I do now, i.e. system administration of linux servers.

The written test, in the morning, went well, explaining some linux and digital library terms and answering some sysadmin related questions. In the afternoon, I had an interview, with more questions about linux, libraries, me and my motivation. And although I was quite nervous, it went well.

On the way home, I got a call, telling me I was ranked first and congratulating me with my appointment as sysadmin.

I didn't expect to hear from them so soon. I thought it would take at least a day or two, before they would let me know the outcome of their deliberation. But it didn't take that long, so I'm very excited getting that job.

I have some thinking to do and arrange a few things, soon, as they would like me to start in March already.

Sunday, February 17, 2008

Selection test #1.1

Yesterday, I had to wake up early. 6:30 is early enough during the week, but on a Saturday it's even more unpleasant. The reason I had to get up this early, was because I had to be in Brussels at 9 o'clock to participate in a selection test for a new job.

Despite the early time, I managed to get out of bed, take a shower and eat some breakfast. Then I headed for the train station. Because I left a little early I managed to get a train earlier, giving me more time to get a connection at Gent-Sint-Pieters, on my way to Brussels South

The building where I was expected to take the test is near Brussels South, so I just had to cross the street to get there. Being a bit early, I had to wait in the hall, watching the other contestants arrive. At 8:50 we were let in, good thing I planned to take a train arriving at 8:30, because the next one arrived at 8:54 at the station, leaving me only minutes to locate the building, getting there and finding the entrance.

Before taking the test we got an introduction about the company, the kind of work we would have to do, once employed, and an overview of the selection procedure, which was about to start a few minutes later with a written selection test.

The written test was multiple choice, with 40 questions, divide in 3 categories. To discourage guessing answers, every wrong answer was penalized with 1/3 of a point. For every good answer one was awarded one point. In the end one had to score 10/20 to get to next round, which is an oral test.
The three categories were mechanics, electricity (common knowledge) and electricity ( power or signal ). It went rather well, considering that it has been some years now since I graduated and some of my knowledge of these topics is rather dusty. And I didn't have time to review everything before the test.
I managed to solve 28 of 40 questions, of which I'm quite certain.
So now it's waiting for the results. The oral test is planned in two weeks, which leaves me some time to review some more of my previous courses. If you catch me with a book on electrical motors, you'll know why.

BTW: Thanks to Tine, for letting me borrow a non-programmable calculator for this test.

Friday, February 15, 2008

Preparing for a new job

I mentioned earlier that I decided to stop studying and start working again.
Last month I've been looking for job opportunities, sending applications and preparing for interviews and selection tests.
Tomorrow and next Wednesday I'm invited for selection tests. The test I'm taking tomorrow is for a technical job, which is in line with my bachelor diploma in electromechanics.
The test and interview on Wednesday is for a systems administration job (IT), managing computers and servers running Linux. It's a bit like the job I currently have at Ghent University.
I also made an appointment with my previous employer, to talk about a job offer.

Today I decided to quit my current job by the beginning of the Easter Holidays and start working on a new job, somewhere near 1st of April. I'm hopeful to find a suitable job by then.

So the next few weeks, I will be doing interviews, waiting for reactions, finding a successor for my current job at the university and finish some small projects.

Tuesday, November 13, 2007

Growing a crystal #1

Today, the professor handed out small bags with a white powder to me and my fellow students. As I mentioned before, I have to grow a crystal from a powder, for the professor's class. And today the powder arrived so I can start growing my crystal.

I went to the supermarket to get demineralised water. I can't use tap water, as this contains to much calcium and other substances that could affect the growing of the crystal.
Back home I mixed some powder with the water and stirred until the powder was completed dissolved. The liquid is clear again.
Then I added some more powder and mixed again, but this time not all of the powder is dissolved. That's normal as I calculated how much powder could be dissolved in the water at room temperature. By adding some more of the powder, the solution becomes saturated, thus it cannot dissolve more of the powder.

By heating the water a bit, the water can dissolved more of the powder. I put the beaker in the microwave for about 40 seconds and stirred again. Now all the powder, even the excess powder, is dissolved, resulting in a clear liquid.

When the water cools down to room temperature, the liquid remains clear, thus the solution contains more powder than it previously contained before heating. This means the solution is oversaturated. That is what is needed to start growing a crystal.

First I need a seed crystal, so I put a thin copper wire in the oversaturated liquid, in order to let a seed crystal grow on the wire.

Now I have to wait for the liquid to cool down further and let the seed crystal(s) grow. I'll check back in a few hours before I go to sleep, but I expect to see something when I wake up in the morning.

(I would post some pictures of the process, but I don't have a (digital) camera, so you'll have to believe what I'm describing)

Thursday, September 27, 2007

Physics : handywork

In the exercises class of my Crystallography course, an assignment was given :

Craft a cube and bring it to class next week. It can be made of any material. You will need it to help you with the exercises.

So I cut a cube out of some insulation foam. But I'm not completely pleased with the result.
First I thought of making a cube from cardboard, by drawing some squares, cutting them from the cardboard and folding them together. But I figured this cardboard cube would be crushed when transported in my backpack, so I needed some structure that's not hollow.
Insulation foam is very light and relativily easy to sculpt, so I chose this material and started creating my cube, by measuring, cutting and sculpting. The end result looks like a cube, but not all sides are completely square. But it will do for the exercises.

This course starts to become some sort of handywork class, as in a few weeks we will be instructed to grow a crystal at home, starting from a beaker containing a dissolved substance. It's all very exciting. :-)

Saturday, September 22, 2007

Archiving

Next monday, a new academic year starts. This means : new courses and new lectures.
So it is time to archive some of my previous courses and make room for the new ones.

As it happened to be, there was still studying material of my first year Eastern Studies somewhere on a shelve. Because I won't need it anymore, I switched to physics and astronomy two years ago, I put it together in two small piles, made a list of the courses in each pile and bound them together with a string. The piles are now stored with the other archived studying material in another room.

With the old material out of the way, the courses of last year, which where on my desk, now take the free spot on the shelve, as I might want to look something up during the next two semesters.
The available space on my desk will soon be taken by the new studying material for next semester.

Thursday, September 06, 2007

Search your feeds in Google Reader

A long awaited search function is added to Google Reader.

Now you can search newsfeeds you previously read. If you know you read a newsitem about something, but can't remember on which feed it appeared, just search for it in Google Reader and the post will turn up.

Sunday, August 26, 2007

Ironkey : secure USB key

Ironkey as a robust, secure and tamperproof USB key, that stores your data with hardware encryption, remembers your passwords, contains a portable version of Firefox and can be run over by a car or get wet without loosing your data or stop functioning.
It even protects your data from being stolen : when someone fails 10 times to supply the correct unlocking password or when someone tampers with the housing to get access to the electronics inside, the USB key starts self destructing.
Don't expect a Mission Impossible style self destruction with a voice counting down and a lot of smoke. The self destruction sequence is hardware based and erases the flashmemory, which renders the USB-key unusable afterwards, so watch out when you forget your password or mistype it a few times.

With the Ironkey, you can carry all your personal information completely secured. All your passwords are stored on the key, so you don't have to remember them and you have them with you all the time. This enables you to use different strong passwords for all the websites you use, which is much more secure than using the same simple password for every site you ever visit.
Because there is an imbedded version of Firefox running on the key, you can use it on computers that don't have Firefox installed and you don't leave sensitive information like cookies, stored passwords and surfing history on that computer.

Unfortunately, the USB-key only works with Windows XP and Vista. But the site announces they are working on a version that works on Linux and Mac too.

The basic version has a storage capacity of 1GB, but 2 GB and 4 GB versions are also available. At this moment the shop on their website doens't ship the USB-key outside the USA, but maybe it will be available with other retailers.

Sunday, August 19, 2007

My programming personality type : DHSB

You're a Doer.
You are very quick at getting tasks done. You believe the outcome is the most important part of a task and the faster you can reach that outcome the better. After all, time is money.


You like coding at a High level.

The world is made up of objects and components, you should create your programs in the same way.


You work best in a Solo situation.

The best way to program is by yourself. There's no communication problems, you know every part of the code allowing you to write the best programs possible.


You are a liBeral programmer.

Programming is a complex task and you should use white space and comments as freely as possible to help simplify the task. We're not writing on paper anymore so we can take up as much room as we need.


I came along this programmer personality test on the blog of Jan, an old classmate.

Saturday, August 18, 2007

Google Gears


Some time ago (31st of May 2007), Google Gears was launched. Yet another new project, next to all the other applications Google has launched already.
But this one is different. It's not a stand-alone application, like Gmail or Google Analytics, but a framework that makes it possible to store a website or a web application offline, so you can still visit this website or use this web application while you are not connected to internet.

To show what the framework does, a new feature was implemented for Google Reader, an online news feed (RSS/Atom) reader, that makes it possible to read newsfeeds while offline. This feature uses the Google Gears framework.

I've used it for a while now, and I must say that it works well. When I'm traveling by train for example, I switch to offline mode in Google Reader, before I leave home.
When going to offline mode, Google Reader downloads 2000 messages and stores them locally. On the train, I open Google Reader in my browser and start reading the news messages, just like I would when connected to the internet.
When I get back home and switch back to online mode, Google Reader synchronises with the online version. All messages I read offline, are marked as read and the starred or shared messages are set.

I'm wondering which Google applications will be next to have an offline mode, using the Google Gears technology. An offline version of Google Calendar would be nice. ;-)

Thursday, August 16, 2007

Two-way MySQL replication

MySQL database server has a master-slave replication feature, which makes it possible to have a complete copy of a master database on a slave server. When the master server should fail, you have a copy available immediately, so you don't loose data and you can switch your applications to the slave-server while bringing back up the master server, so the downtime is small too.

A drawback of this master-slave replication is that it is a one-way backup. The slave server is a complete copy of the master server : all changes that are done on the master server are applied to the slave server, keeping them identical.
But because it is one-way replication, changes to the slave database server aren't applied to the master server.

I just came along an article explaining how to set up two-way replication : both servers are master and slave at the same time. So it doesn't matter on which server the database is changed, the change will be applied to the other server, which always results in two identical databases.

I'm thinking of using this setup to synchronise the database of my server at home with the database running on my laptop. This way I will have a remote backup of my database server on my laptop, in case something happens to my database server at home.
But also, all changes that I make to the database on my laptop while not at home, will be synchronised with my database server, when I get home.

This good HOWTO on setting up (one-way) master-slave replication, also provides a simple, but working, script to make a daily backup of a MySQL database server.

Friday, July 27, 2007

Saving energy searching with Black Google

When displaying a screen with a white background a monitor consumes more energy than showing a black background. That's true at least for (older) CRT type of computer monitors. A study points out that a CRT monitor uses 75 Watts displaying a white background, but only consumes 59 Watts when showing an all black background.
This is not true for LCD type of monitors, as the background lighting is always on, even if some or all parts of the screen are black. But LCD monitors are far more energy efficient than CRT-monitors.

Using a site like Blackle, a version of popular Google search engine with a black background, could globaly save 750 Megawatts per year.