display: inline-block; A lesser known css property that works!

No more trouble getting the vertical alignments correct. display: inline-block allows you to set a width and height on your elements without forcing a break; you get an inline element which you can set width and height on, just like you can on a block element. Simply set a fixed width on your labels and watch the input fields line up nicely. Details and code examples inside!

Working with image meta data in Exif and IPTC headers from PHP

Most people know that when you take a picture a digital camera it writes the image to a file, but quite a few people do not know that there’s usually a lot more data being written to this image file. The extra data being written is meta data (data about data), and it may contain lots of data about the camera and surroundings when the picture was taken. This data is usually written in Exif headers. Addtionally you can add your own data in IPTC headers. Here’s how to work with the two formats in PHP.

New google charts wrapper in PHP

I’ve been doing a freelance project for a while for one of the biggest media corporations in Norway. Without going into details it involves tying together a lot of data and make it available on a map. I’m building the back-end for this thing, and it needs to support charts and diagrams.

Norwegian political party uses welding scientist as global warming expert

FRP is one of the biggest political parties in Norway. This weekend they’re holding a conference about the ongoing global warming debate and whether or not humans are to blame. For expert witness, they got hold of a Swedish scientist, but they seemingly forgot to mention that welding was his field of interest.

Callback-functions explained

Very many programming and scripting languages today allows you to use callback functions, both built-in functions and user defined functions. This is all good and dandy, but unfortunately very many programmers don’t know what a callback function is or does, and definately not how to use one. In this article I will try to explain and show how to use callbacks. The language used in this article is PHP because it’s easy to understand and work with, but the theory can be applied to any language supporting callback functions.

Session security in PHP, and how to improve it.

When you first start out with PHP, you soon realize that you need a way to save small chunks of data like client input across pages. There are two fairly simple ways of doing this in PHP. Sessions are useful for storing this data for shorter periods of time i.e per browser session while cookies are used to store the data more permanently. While cookies are saved on the client’s computer, sessions are stored on the server, giving the client a unique string which identifies their session. Hence sessions are arguably better for storing sensitive data, as there’s no way for anyone to tamper with it, unlike cookies which are just text files stored on the client computer. This is at least what many programmers tend to think today. Unfortunately, things are rarely this easy. This post is not going explain the vulnerabilities of sessions in great detail, but this great blog post explains the most common exploitations.