Press "Enter" to skip to content

Posts published in May 2012

Disable Cache in jQuery

I usually run into this problem when dealing with good ol’ Internet Explorer (..any version of IE actually). The problem is that IE tries to be smart and not tell you the new output of a file it fetches more than one time with the same filename, instead it shows…

Where is Technology heading, perhaps we should focus more on Software?

I often wonder to myself where the technology industry is heading as I see new things come out almost daily. You look around and something you just bought is all of a sudden outdated. This can be quite irritating for the techno-geeks out there that always want the latest release…

How to break out of an iframe

So someone’s trying to make their site better by opening a page on your site inside of their site using an iframe? They’re doing something like this: [code lang=”html”] [/code] Well how about you stop that from happening by pasting the following line in your website’s header! [code lang=”html”] [/code]…

Edit hosts file on Windows 7

The hosts file is used to manually alter the hostname or IP address in place of it being served by a Nameserver, also known as via DNS. The hosts file is located here: [code lang=”bash”] C:\windows\system32\drivers\etc\ [/code] Or an easiler way to get to it incase of whatever is like…

Virgin Media blocks torrent sites!

Virgin Media have done it again! They have gone and started a “downloaders war”, I’m sure of it. Basically what happened is that Virgin Media are claiming that they have had an order from the Courts to prevent access to a whole bunch of sites which lead to illegal downloading…

How to Comment out a line in a Crontab on Linux

Firstly let’s just note that crontabs are read in the following way: [code lang=”bash”] * * * * * command to be executed – – – – – | | | | | | | | | +—– day of week (0 – 6) (Sunday=0) | | | +——- month…

DateTime conversion function using PHP

It’s really very simple to convert times in different timezones using the following function. [code lang=”php”] function dateTimeConversion($datetime, $timezone=”Europe/London”) { $date = new DateTime($datetime, new DateTimeZone(“UTC”)); $date->setTimezone($timezone); return $date->format(“Y-m-d H:i:s”); } [/code] As you can see, it takes 2 arguments, $datetime which is a time string and a $timezone which…

Convert seconds to days, hours, minutes, seconds in PHP

With the following function you can easily convert an integer containing seconds to a nice days, hours, minutes, seconds string or array. [code lang=”php”] function secondsToTime($seconds, $return_type=”string”) { // extract days $days = floor($seconds / 3600 / 24); // extract hours $hours = floor($seconds / 3600) – $days*24; // extract…