Skip to content

Category: Computers & Internet

Javascript time formatting function

While working on a web application, I found myself with the need for a Javascript function that would format dates to a consistent state. Several different functions exist out on the internet to perform this task, but none were exactly what I was looking for. Most of them did a fairly decent job of taking a time like ‘6:45′ and plugging the am or pm onto the end. Some even allowed military time so ’20:30’ would convert to ‘8:30 pm’. What I really needed was one that could format a time entered in a normal fashion, but also format if I enter a time like ‘0645’ or ‘2315’. So, I wrote my own.

Benchmarking PHP: Inserting text with include(), require(), or get_file_contents()

Often times in PHP you find yourself needing to insert text. Most sites do this by using a database backend, but you also have the option to include data from a text file. Three methods are available for this; require, include, and file_get_contents. Which is fastest, which is best? When should you use one over the other?

StatTraq and WordPress Permalinks

For this and my other blog, I use WordPress with permalinks turned on. I installed an add-in called StatTraq to keep track of statistics. But, the stats page never showed which pages were being shown. It just showed that ‘Multiple Posts’ were being displayed. Honestly, I just assumed this was the way StatTraq was supposed to work until I just happened to get hit by a comment spammer.

TinyP2P – “The World’s Smallest P2P Application”

Ed Felten and Alex Halderman released the smallest fully functional P2P application. TinyP2P is a 15 (yes 15) line Python program.

The authors claim that they are not intending to facilitate copyright infringement, but are trying to show how easy it is to set up a P2P application. TinyP2P was written to show how easy it is to write a functional P2P application, and how pointless it would be to “ban” their creation.

For more information, see the TinyP2P home page.