Tech Thought

Tech tips, hints, and general musings. PHP, Perl, Mysql, Javascript, AJAX, JSON, Linux, Mac OSX

Entries for May, 2008

How-To: Convert Epoch to Normal Time

If you want to covert from epoch (number of seconds since 1970) to a more human readable format, you can use this simple perl script: #!/usr/bin/perl $time = localtime($ARGV[0]); print “$time\n”; Save it as epoch.sh and make it executable, then simply issue the following command from the command line: $> ./epoch.sh 1211926097 Wed May 28 [...]

Leave a Comment

How-To: Setup Mysql Replication – A simple guide

The following is a simple guide to help you setup Mysql replication – a fantastic way to ensure you have an up-to-date backup of your production databases. This guide only describes a single master-slave relationship, however you can use mysql in various modes which include additional slaves as required.

Comments (1)

Inside Google’s Search Quality Team

Udi Manber, the VP of Engineering in Google’s Search Quality team has a very interesting post about the Search Quality Team (the guys responsible for the ranking of results in Google searches). I’ve often wondered how google ranks results, and whilst they don’t tell you specifically, the post offers an interesting insight into the inner [...]

Leave a Comment

How-To: Read an RSS Feed with PHP

An easy way to read an RSS feed with PHP is to use the MagpieRSS library. This provides a simple API to read an RSS feed, and elegantly deal with the issues of timeouts and caching. It’s as simple as: require(‘rss_fetch.inc’); $rss = fetch_rss($url); echo “Site: “, $rss->channel['title'], “<br> “; foreach ($rss->items as $item ) [...]

Leave a Comment

WSP Wins 2008 DuPont Innovation Award for Sustainable Services

On Friday the 16th of May, WSP was awarded the 2008 DuPont Innovation Award for Sustainable Services.  The team was recognised for driving sustainable outcomes through innovative online solutions.  More information is available on the WSP Online Solutions website and news article. Examples of these solutions include: EIATRACK – the standard in environmental regulatory tracking [...]

Comments (1)

How-To: Determine Real hostname in php

If you need to know the real host name of your server using php, use the following command: <? echo gethostbyaddr (gethostbyname ($_SERVER["SERVER_NAME"])); ?> This will return the server’s hostname, not the address that the script is being accessed by. Very useful if you have a script that needs to run on multiple servers.

Leave a Comment

Removing ._ files on Linux

If you have zipped up a directory from a Mac OSX machine and unzipped it on a linux box, chances are you have heaps of hidden files that look like ._myfile and ._mydirectory – these are files that OSX uses to keep track of additional information about your files. To remove these, do the following [...]

Comments (3)

MiniFrontpage Joomla Extension – Thumbnails not working

We’re started using Joomla as our CMS for a new website we’ve been developing. One of the key functions we wanted was the ability to display article ‘snippets’ on the front page including a thumbnail image from the article. The MiniFrontpage Joomla extension provides exactly this functionality – so we installed it. Everything was working [...]

Comments (2)

CSV to SQL Converter – Now supports UPDATE statements

I’ve modified my CSV to SQL conversion tool (csv2sql.com) so that it now can produce both INSERT and UPDATE SQL statements from your CSV file.  Previously the tool only created INSERT statements, so you could easily insert all your CSV data into your database table.   However this is rather limited – what if you want to [...]

Comments (1)

How-To: Export RSS feeds from Mac Mail

To export all your RSS feeds from Mac Mail as a list, open up terminal and enter the following on a single line: IFS=$’\n’;for i in $(find ~/Library/Mail/RSS/ -name “Info.plist”);do grep “<string>http://” $i | sed “s/.*\(http[^<]*\).*/\1/”;done Thanks to macosxhints.com for this one!

Comments (1)

How To: SSH Port Forwarding on Mac OSX

As long as you have SSH access, you can still access ports on a remote server which are blocked via a firewall.  You simply need to use a function of the SSH protocol called Port Forwarding (or Tunneling).   This process allows you to open a port on your local machine, which is forwarded via SSH [...]

Comments (2)

How-To: Determine CPU Speed on Linux

I’ve been trying to work out how fast a server that I maintain is (in Mhz).  The simplest way to do this is to follow these instructions: Enter the following command: dmidecode | grep “Current Speed” | head -n 1 And you should receive output like this: Current Speed: 3400 MHz

Comments (2)

How-To: Fix “command not in docroot” suexec apache error

If you’re in the process of setting up a new server, and you want users to have the ability to execute scripts in their home directory: http://myserver.com/~myname You will often run into problems with suexec. suexec is an apache security construct to stop users from executing scripts outside of a known path. I was recieving [...]

Comments (1)

How-To Fix Perl Error: Can’t locate object method “new” via package “LWP::Protocol::https::Socket”

I came across the following error while trying to connect to an LDAP server over HTTPS using the Perl module SOAP::Lite: Can’t locate object method “new” via package “LWP::Protocol::https::Socket” The way to fix this problem is to install the Crypt::SSLeay module from CPAN. Hope that helps someone!

Comments (2)

How-To: Update all system packages with yum

This might sound like a really really simple thing to do, but it actually took me a little while to work out how to do this. To list all the available packages available for update, use the command: yum list available To update all packages on your system to the latest version, use the command: [...]

Leave a Comment

iPhone in Australia in Late June, Not Fixed to a Provider

Applesource has reported that the iPhone will be on its way to Australia in Late June – and that the model will be the next generation iphone! I say bring it on!  Have a look at the complete story here at applesource.com.au.

Leave a Comment