Simple script for dumping a MySQL database

As file system backups might fail to backup open files, it’s good practice to close any open files before running the backup.

Closing a MySQL database file means you will have to stop the MySQL server itself, causing causing a database outage while the backup is running. But fortunately there’s a smarter way to backup you database – simple dump the entire database to a file (which is automatically closed when the dump is completed), and have your file system backup software backup the dump file instead.
Continue reading


Setting up Sublime Text as a node.js development environment

Image courtesy of  tiramisustudio at FreeDigitalPhotos.net

Image courtesy of tiramisustudio at FreeDigitalPhotos.net

Sublime Text makes a great IDE for node.js development. First, install the node.js software and get your initial project up and running. Various tutorials on the web should get you going. When it’s time to run your app, configure the Sublime Text build system to build it and run it. To avoid having to start and stop your Node server manually, make use of the tool Nodemon – this tool will build and run your app automatically when you edit the source code.
Continue reading


How to view the contents of your WordPress database

Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net _

Image courtesy of David Castillo Dominici / FreeDigitalPhotos.net

My site is running WordPress, which store data in a mysql database. As part of my backup procedure, I backup the database as well as the WordPress files.
For fun I thought I’d inspect the actual contents of the database, and in case others wish to do the same here’s how to go about it.
Continue reading


Hvorfor du må ha ulik passord på mailen din enn andre steder

Image courtesy of digitalart/ FreeDigitalPhotos.net

Image courtesy of digitalart/ FreeDigitalPhotos.net

Det er mange som bruker samme passordet sitt mange steder på nettet, meg selv inkludert. Har opp gjennom årene registrert meg utallige steder, men har ikke laget unikt passord for hvert sted. Men passordet til mailen er unikt, og brukes ingen andre steder. Hvorfor?
Continue reading


Er det verdt risikoen å betale moms på utenlandske varer?

I august var min kone Marianne og jeg i Sverige på ferie, og på vei hjem kjøpte Marianne et el-piano som hun skulle ha med tilbake til Norge. Lovlydige som vi er var vi innom tollen for å
få betalt norsk moms og få tilbake svensk moms på varen.

Dette var første gang vi har kjøpt dyre varer i utlandet som trengs å fortolles, vi var ikke forberedt på at vi måtte betale norsk moms der og da, og sende krav til butikken om å få tilbakebetalt den svenske momsen. Vi hadde ikke satt oss inn i dette på forhånd, og trodde i grunn man kunne gjøre opp alt der og da. Men det var det ikke.
Continue reading


Kjøp, salg og utnytting av ung arbeidskraft

For noen dager siden så jeg deler av et svensk program som tok for seg hvordan arbeidstakere utnytter unge arbeidstakere ved å utsette dem for urimelig mye press, og å bryte arbeidsmiljøloven på ulike måter. Flere av de som ble intervjuet fortalte om hvordan de ble presset til å utføre mange arbeidsoppgaver på fritiden, og om urimelige krav til effektivitet. Dersom de stod opp mot ledelsen var en typisk motreaksjon at de fikk sparken (på ulovlig vis).

Continue reading


Setting up dual monitors in Xubuntu 11.04 on Fujitsu P7120

I recently installed Xubunut 11.04 on an old notebook laptop, and wanted to run a dual monitor setup using an external monitor.

The laptop ships with Intel Graphics Media Accelerator 900, and I’m using this display controller:

1
2
kenneho@laptop:~$ lspci |grep Display
00:02.1 Display controller: Intel Corporation Mobile 915GM/GMS/910GML Express Graphics Controller (rev 04)

My external monitor is running with a 1280×1024 resolution, and are placed on the left hand side of the laptop.

Continue reading


Using swatch to throttle script log messages

At work we have a few scripts that we would like to monitor, and define a few messages that should trigger an SMS to be sent to the person on call.

As most of these scripts log to syslog, and we have a our linux servers set up to forward syslog messages to a central log host, we going to monitor the central syslog for important messages originated by the scripts. In order to avoid message storms, however, we need a way of throttling duplicate messages. On our central log host we’re running swatch for real time analyzis of the incoming syslog messages.

Continue reading


Simple script for testing regular expressions in Perl

At work the other day I was creating regular expressions (regexps) in perl for use with swatch. Instead of testing the regexps by entering them into the swatch config file, restart swatch, and use the “logger” command to trigger swatch to take action, I thought I’d simplify it by creating a small script. Since swatch is written i perl, I created a tiny script in perl so that there wouldn’t be any regexps mismatch between how the script interprets regexps and how swatch interprets them.

Continue reading