Monthly archives: May, 2013

Create your own MySQL query profiler in PHP

Do you know how many times your PHP scripts are calling the database or how long time the queries take to execute? Maybe it’s time to create your own query profiler? It’s simpler than you might think. There are several ways of doing it but we’ll look into one example here based upon a previous

Fingerprint IP hosts to discover address conflicts

Once upon a time, the network tool ping used to be a good tool to check if a computer was up and running or if an IP address was available or not. Today, a lot of computers have the ping response service turned off due to security reasons since many Denial-of-service attacks use the ICMP

How to automatically recover from an MySQL SERVER HAS GONE AWAY error

The error message is very self explaining – the program lost connection to the server. The reason for this error is quite often simply that the script took longer time to execute than the time-out settings in the connection. In PHP there is a simple command to check if the database connection still is open:

Do you know how crash-prone your PHP script is?

It’s easy to spot errors when they happen on your developer machine. But how do you deal with error happening on the live server? Or even more important – how do you discover errors happening to your customers? In PHP you have to possibility to register a function that will be called every time your

Restart Windows from the Command line

It’s not always that you have the option of restarting Windows from the start menu. When you connect with Remote Desktop connection all you’re presented with is an Log off, Disconnect and Lock option. But you can still restart the computer by using the command prompt. Just type shutdown /r to send a restart signal

Security in MVC4

Traditional security in web applications has focused on securing a file or folder through web.config. The problem with this security model is that a path is unreliable when using routing. Two different routes can lead to the same function and thus both routes need to be secured. This opens up for security holes. When looking

%d bloggers like this: