Jun
24
SugarSync Client update
Hi all,
Good News - my SugarSync client is now in alpha - with the ability to download and upload files and folders based on last modified times.
I will provide some initial source code once I have tidied it up a bit and done some more extensive testing.

posted by
Mark Willis
Sep
18
Sorting MySQL Result by field
After my post about sorting multidimensional array's by an array of values I've now found a better way of keeping a mysql result set in order by using the ORDER BY FIELD() function. For example:
SELECT id,name FROM tbl_name ORDER BY FIELD(id,3,4,2,6,8,1) DESC
Will return the results in the correct order or using ASC instead of DESC will return results in reverse order.
The folks over at MySQL have thought of everything

posted by
Mark Willis
Aug
16
ip2long vs INET_ATON
Whilst I was making the IP range function for my crawler catcher, I stumbled upon the problem of signed and unsigned integers for ip address (ip2long, INET_ATON) and back again (long2ip, INET_NTOA) using PHP and MySQL respectively. This caused me a problem when I used ip2long to sort ip addresses by order, and received negative numbers (-16843010) this gave me some funny results when using php's sort() function. I was getting 1 IP out of a range appearing 3/4 numbers out of place.
Upon futher inspection I found out that php uses signed integers (positive and negative numbers). This messes with the array sort functon. After I changed to unsigned integers, my ip ranges worked perfectly.
MySQL also won't produce an IP from a negative integer, and just returns false:
I've provided some demonstrations, and a php function to produce an unsigned long from an IP address.
Read the rest of this entry »

posted by
Mark Willis