Linux
VirtualBox Guest Additions woes
Jan 18th
Sigh… I wish that computers would just work all the time!
Today i booted my machine, launched my snazzy Linux virtual machine, proceeded to start my XAMPP stack and mount my shared folder so that my Linux VM can communicate with my host OS (sigh) Windows… This works 99.9% of the time, but to my horror:
/sbin/mount.vboxsf: mounting failed with the error: No such device
FUCK! What now? So i google and google, but nothing works…
I’m now bashing my head in frustration against my desk, spilling my coffee and rubbing my blood-red forehead, but that didn’t help either… I try mount VBoxGuestAdditions via VirtualBox, nothing. Nothing, nothing, nothing! NOTHING!
By now i’m getting so irritated that i’m drinking coffee after coffee and smoking vociferously… and then…. -cue lightbulb- if you can’t take the horse to the water (mount VBoxGuestAdditions in Linux), pick the fucker up and dump him in there (download the fucking thing from Linux and run it from Linux). So, i dig around looking for the URL, eventually find it, mount the ISO file (help instructions on mounting an ISO file in Linux here), run the installation script, reboot and IT WORKS!! …and the children lived happily ever after.![]()
PHP Process Viewer for Unix
Oct 4th
While working on a project lately, i needed a script that would allow me to find certain processes with PHP and inspect their running times, etc. After struggling for a little bit, i came up with the following script that can output a plain view, JSON or XML of the running processes whose names match a regular expression passed to the script. The script can also kill all processes that match the search term.
This script is by no means complete, but i thought i’d share it with my readers ![]()
Save it as process_viewer and run it from the command line.
Please keep in mind that this script is still in a very rough form and should not be used on enterprise products; it’s merely a bit of buggering around for fun
Click here to download the script.
Usage:
process_viewer [search_regex] [mode] -o [format]
- search_regex – search term to find running processes (defaults to .+)
- mode – script mode (defaults to view)
- view | kill
- -o – flag to indicate that the script must output in a specified format
- format – output format (defaults to plain)
- plain | json | xml
Sample usage:
XAMPP 1.7.2 Released
Aug 20th
It’s finally here! The new version of the XAMPP stack has been released…
This new version includes PHP 5.3.0, Apache 2.2.12, MySQL 5.1.37 & phpMyAdmin 3.2.0.1 (amongst a myriad of other features). You can check out the new stack here. I wouldn’t recommend upgrading if you are using AMFPHP or CodeIgniter as the new version of PHP (5.3.0) will mess up quite a few things – i learnt the hard way.
I upgraded from 1.7.1 to the new version on my Linux Mint virtual server that i run within my Vista installation (damn you Adobe! Just release your software on Linux already!) and i came across an error in one of my AMFPHP installations on a project that i’m working on at the moment:
(mx.rpc::Fault)#0
errorID = 0
faultCode = “Client.Error.DeliveryInDoubt”
faultDetail = “Channel disconnected before an acknolwedgement was received”
faultString = “Channel disconnected”
message = “faultCode:Client.Error.DeliveryInDoubt faultString:’Channel disconnected’ faultDetail:’Channel disconnected before an acknolwedgement was received’”
name = “Error”
rootCause = (null)
I think that AMFPHP is still the simplest and easiest way to use Flex remoting with PHP (i recently wrote an article for FFDMag on this topic – look out for it in the September edition). However, it doesn’t have the greatest error handling mechanism ever…
Using Charles Proxy, i managed to find the real root of the error, and it appears that there is some sort of discrepancy with the dates/timezones in Gateway.php in the core of AMFPHP.
To resolve this issue, open the Gateway.php file in the core/amf/app folder in your AMFPHP installation and go to line 213. You need to tell PHP which timezone you’re in, and you can paste the following code:
date_default_timezone_set("Africa/Johannesburg");
above this line:
$dateStr = date("D, j M Y ") . date("H:i:s", strtotime("-2 days"));
I reside in Johannesburg, South Africa so that timezone will apply to me, but if you live anywhere else, you’ll have to find the pertinent timezone to use.
Union Platform – Part I (Installation)
Jul 8th
We’ve all heard about Colin Moock at some point in our Flash/Flex development career. Colin has authored a great many ActionScript books throughout the years and as a consequence has helped thousands – including myself – to learn ActionScript. Now Colin has hit the community with something incredible… the Union Platform.
Here is the official definition of the Union Platform from http://www.unionplatform.com: “Union is a development platform for creating multiuser applications. It includes the Union Server, a multiuser communications server, and Reactor, a framework for creating Adobe Flash client applications.”
Essentially what this means is… you can now build realtime chat applications, MMORPG games, and anything else that could use a little realtime flavour
Installation
In this part of the series on the Union Platform i will be showing you how to install the Union server on your *nix machines and Window$ machines. Let’s leave the hideous beast (Window$) for last, and begin with a real operating system that is actually a pleasure to work with, and doesn’t make you praise whichever god you worship that your legs can’t bend backwards at the knees to kick yourself in the balls for ever getting roped into that shitty OS.
I’ll be Linux Mint for my *nix installation explanation, and this will work on Macs too in much the same way.
The Union Platform Server is a Java application that will run on your server and listen on port 9100 and 9101 for traffic. Be sure to check that your firewall doesn’t block this port before you begin…
First things first, head over to the downloads page on the Union site and download the GZipped tarball to your desktop.
Next, unzip the tarball’s contents (tar -xf union_1.0.0_alpha2.tar.gz). This will create a folder called union on your desktop. Now, move either the folder in its entireity or the contents to a folder somewhere on your machine.
Perfect. So now we have all the files we need. Make sure that you have Java installed and working correctly on your machine or otherwise this will not work. You will need to make sure that this folder had execute permissions, so issue the command chmod 775 * to give all the files the necessary permissions.
Usage
Once this is done, we’re done! To start the Union Platform Server issue this command: ./startserver.sh from inside the folder you unzipped. You will now see your terminal bombarded with debug messages notifying you of Union’s successful start.
Window$ users please note: the instructions above are pretty much the same for Window$; merely extract the files to your machine and run the batch file startserver.bat.
Administration Panel
Colin Moock and crew have been generous enough to provide us with a Flex administration panel for the server, and you can find it here. Download the SWF, and open it in your browser. You will be met with a login screen like this:
NOTE: If you look in the union.xml configuration file, you will find the password that is used by the server. By default it is password. Also note that the administration panel runs on port 9110.
Once you have logged in, you will see a screen like this:
Pretty bloody cool if you ask me!
Join me in the next part of this series when i will be demonstrating how to build a simple realtime chat application!
Which Linux distro best suits you?
Mar 13th
I stumbled upon a very interesting test today that asks you a series of questions and then offers you advice as to which linux distros would suit you, and why.
Go to http://www.zegeniestudios.net/ldc/index.php to take the test.
Here are my results:
Using SWFTools on Linux
Jan 27th
SWFTools is a fantastic library of SWF manipulation utilities. It contains the following packages:
- PDF2SWF A PDF to SWF Converter. Generates one frame per page. Enables you to have fully formatted text, including tables, formulas etc. inside your Flash Movie. It’s based on the xpdf PDF parser from Derek B. Noonburg.
- SWFCombine A tool for inserting SWFs into Wrapper SWFs. (Templates) E.g. for including the pdf2swf SWFs in some sort of Browsing-SWF.
- SWFStrings Scans SWFs for text data.
- SWFDump Prints out various informations about SWFs.
- JPEG2SWF Takes one or more JPEG pictures and generates a SWF slideshow.
- PNG2SWF Like JPEG2SWF, only for PNGs.
- GIF2SWF Converts GIFs to SWF. Also able to handle animated gifs.
- WAV2SWF Converts WAV audio files to SWFs, using the L.A.M.E. MP3 encoder library.
- AVI2SWF Converts AVI animation files to SWF. It supports Flash MX H.263 compression. Some examples can be found at examples.html.
- Font2SWF Converts font files (TTF, Type1) to SWF.
- SWFBBox Allows to readjust SWF bounding boxes.
- SWFC A tool for creating SWF files from simple script files.
- SWFExtract Allows to extract Movieclips, Sounds, Images etc. from SWF files.
- RFXSWF Library A fully featured library which can be used for standalone SWF generation. Includes support for Bitmaps, Buttons, Shapes, Text, Fonts, Sound etc. It also has support for ActionScript using the Ming ActionCompiler.
You can download the tarball from their site (http://www.swftools.org) or using the Synaptic Package Manager on your Linux distro. The installation is fairly straightforward, so i’ll just skip to using the package.
All the exercise files i will be using in this post are available here.
The tools i will be highlighting are:
- PDF2SWF
- SWFDump
PDF2SWF
This is probably the most useful tool in the entire package. As the name implies, it will convert the inputted PDF and convert it into a SWF. Refer to the PDF2SWF.pdf and PDF2SWF.swf files in the exercise files.
You can find the manual for PDF2SWF here.
Usage: pdf2swf [options] input-file.pdf -o output-file.swf
Useful arguments:
- -P – Decrypt the SWF with a password
- -p – Pages to convert
- -T – Set the Flash Player version
SWFDump
This is a very neat tool! It can tell you a whole lot about your SWF, such as the width, height, fonts, and it can even generate (X)HTML code for you for embedding your SWF.
The documentation for this tool can be found here.
This is a very interesting package for all of the experimenting Flash/Flex developers working on or with Linux. The package is available for a plethora of operating systems though, but it’s always cooler on Linux
![]()









