sort

Bogo Sort In PHP

23rd June 2018

I came across this sorting algorithm the other day called 'bogo sort'. This is a sort of joke sorting algorithm that is highly ineffective at actually sorting arrays. The name comes from the word 'bogus'.

Here is how it works.

Find The Size Of Files And Directories In Linux With The du Command

29th June 2012

The du (or 'disk usage') command is a Linux command that can print a list of the files within a directory including their sizes and even summarize this information. It is useful if you want to see how large a group of files is and provides more information about directories than the ls command does.

Force Sorting Of VARCHAR Data In MySQL

18th September 2008

If you find that you are having trouble sorting data in a VARCHAR column in a MySQL database then you can try the following trick.

Lets say that you had the values 1,200,30,4000 and 5 and that you inserted them into the database in that order. When the following query is run on this data:

Randomise JavaScript Array

4th July 2008

Randomising a JavaScript array can be done in one or two ways. The easy way is to create a function that returns a random number and then use the sort() function of the Array object to sort the array by a random value.