PHP (RSS)

Topics related to PHP

Blog moved to WordPress and new domain...

I've moved my blog to my own domain and onto a WordPress engine, CS + SPAM was driving me nuts!

Catchup posts: Oh yes, I've been in Japan for a couple of months, first 2 weeks of photos are uploaded on Flickr, I still havent had a chance to upload the thousands after.

Whats more, I've actually written some information about me so you can finally find out my sad sad way of life. See About Thushan Fernando.

UBUNTU: 7.10 Gutsy Gibbon is finally out!

Thats right, the final countdown comes to an end and Gutsy's ISO's are now able to be downloaded from the Ubuntu servers. Mirror's should start propogating it soonishly! *HOWEVER* I would strongly suggest you try the Ubuntu 7.10 (Desktop AMD-64) Torrent (Desktop x86 or Server x86 / Server x64 ) instead, faster download and less choking on the server.

I've been busting to install it on the Dell M1330 XPS ever since I got it and now finally the moment has come. Oh, i'm so happy.

UPDATE:
Mirror's for those down-under.

LINUX: Switched to Ubuntu, well not completely...

Yes thats right, I've finally took the plunge and gone hardcore with Linux! My first encounter was with Red Hat 6 in 2000 (I got free install CDs from somewhere) while I thought the installer was good i didnt like RH itself or what Linux was back then. But 6 years later taking a fresh-no-preconcieved-thoughts-look at Ubuntu (and Fedora Core) I feel the difference.

So much so that my now-ancient Inspiron 8600 I bought back around this time in 2004 is now running Ubuntu 6.06 which was previously booting Windows 2003 (for work purposes). Another workhorse (Inspiron 6400) is still running Windows Server 2003. I'm finding more and more that I tend not to use the Windows dual-boot on the 8600 (unless its at uni - Wireless/VPN etc) and instead happy enough with Ubuntu + WINE if i really need to run anything. Main desktops are still happy chugging along to Windows XP Pro and probably wont change.

So time to start blogging about Ubuntu and my adventures...

First of all why Ubuntu? Why not Fedora or another distro like - ewww - Lindows?

I've found the neat packaging system useful and the fact that its based off Debian (which i've used for a while as a "toybox" in the past) I'm used to the feel. Ubuntu's like the "hot new distro" (not new!) this year (like Gentoo was a year or so ago). Currently i'm using GNOME (didnt like KDE) and just got XGL running natively on a desktop box yesterday (not that hard at all following this guide!)

First things first, after the lovely installer handles all the hard work partitioning, installing and maybe fixing GRUB to dual boot the first thing you should do is to go ahead and have a good look through the Ubuntu Guide for Dapper. Heres a rough outline of what I did (dont forget I'm still a Linux-n00b) with my 8 or so installs (keep in mind that all the machines/notebook are powered by ATI cards) so far:
  • UPDATE UPDATE UPDATE!
    Greatest thing I enjoy about Ubuntu (and debian) is the updating, its so seamless! Goto System > Administration > Update Manager and download all the updates you need for your box!
  • Get Easy Ubuntu
    Previously I went through and manually installed most of the apps that this beauty will automate for you. Installs (taken from Ubuntu Forms post):
    • Add extra repositories for installing a lot of additional software.
    • Install multimedia codecs for reading all videos, musics and DVDs.
    • Activate the "audio preview" feature in Nautilus.
    • Install the most needed Firefox plugins: Flash, Java, Real, videos. Adds Microsoft fonts, GNOME's Firefox buttons, officials Firefox icons.
    • Install archiving support for RAR and ACE.
    • Install the most used peer-to-peer softwares: aMule (a clone of eMule) and Azureus (for Bittorent).
    • Install the Skype voice-over-IP software.
    • MSN: Install AMSN cvs with webcam support.
    • Num lock: Active the num lock at system startup.
    • Replace the GNOME foot logo with Ubuntu's logo.
    • Install the NVIDIA or ATI driver for 3D support.
    This alone will get you the basic necessities you'll need.

    I cant recall if hte ATI driver installed is the Messa one or the ATI one, but make sure if your running an ATI card you use the latest ATI release (v8.27.10 as of writing) by running 'fglrxinfo' at terminal:
    thushan@NOTEBOOK04:~$ fglrxinfo
    display: :0.0  screen: 0
    OpenGL vendor string: ATI Technologies Inc.
    OpenGL renderer string: MOBILITY RADEON 9600 Generic
    OpenGL version string: 2.0.5946 (8.27.10)
    thushan@NOTEBOOK04:~$
    
    Check its using the accelerated version of the driver by running:
    thushan@NOTEBOOK04:~$ glxinfo | grep -i direct
    direct rendering: Yes
    
  • Make sure your using DMA where possible!
    Edit hdparam.conf:
    # sudo gedit /etc/hdparm.conf
    
    Make sure you enable DMA, this is whats in mine:
    /dev/hda {
            io32_support = 1
            dma = on
    }
    /dev/hdc {
            io32_support = 1
            dma = on
    }
    
  • Get a copy of SwiftFox
    Dapper comes with Firefox by default (and its the default browser installed) but you'd want to try SwiftFox, an optimised (and always recent) builds of Firefox for Linux (much like Moox was for Windows - no longer maintained!) aimed for several CPUss, theres also a neat Installer script to set it up for you! I always add these extensions
  • Get Build-Essentials and manuals
    sudo apt-get install build-essential manpages-dev
  • Get WINE
    WINE has matured so much since I last touched it.
    sudo apt-get install wine msttcorefonts
    
  • Get Skype
    I'm a VoIP junkie...
    sudo apt-get install skype
  • Install some cool apps from 'Add/Remove'
    There's an abundant amount of apps in the Add/Remove list (tick 'Show unsupported applications' & optionally 'Show Commerical APplications' to see stuff like Adobe Acrobat viewer etc and go nuts! I've got too many apps to list but some small selection of handy tools:
    • AbiWord
      OpenOffice is tweakable (Tools -> Options -> Memory, Steps=40 | Graphics Cache: 128Mb | Memory Per Object: 1Mb) but i prefer AbiWord
    • Acrobat Reader
      Theres lots of alternatives but I went with Adobe's v7.x (I use ePDFViewer too)
    • Alacarte Menu Editor
      Cool tool to add/remove/change stuff in the menus in GNOME
    • Configuration Editor
      Configuration Editor
    • Ethereal
      Best network traffic analysis tool around!
    • GAIM
      Probably like all companies, at vividas we use alot of IM to talk/spam you-tube videos etc..
    • gDesklets
      Applets on your desktop
    • GKreIIM
      Monitors your system
    • Klipper
      Clipboard history tool!
    • PuTTY
      Its small, its fast and its so damm cool!
    • Text Editor
      I seem to like this one
    • VLC Player
      Its either totem or VLC, VLC has more options
    • Wireless Assistant
      No need to say why!
    • XMMS
      A WinAMP for Linux
  • UPDATE UPDATE UPDATE take 2!
    Do another update to make sure you've got everything!
I also added a launcher on my toolbars which by default run nautilus with root privellages (command is 'gksudo nautilus')... i'll post a screenshot of my desk later.

XGL baby yeaH!
If your in for some sweet sweet eye candy try out XGL, its deliciously smooth! Theres a guide on Compiz that worked for me (too many HOW-TOs but most fail!)

Good Resource Sites

Two of the best resources (theres lots if you google but these tend to be where I go) for Ubuntu: Phew, this was a long post... More later...

HotHTML 3 Professional FixPack 5 Released!

Well I decided to take some time off (sleeping) and finalise FixPack 5 for HotHTML 3. The build number is now 3000 (epic milestone!) and mostly caused by alot of rework to make HotHTML 3 load faster, initially I intended to add a new Ftp Editor to make it easier to upload/manage websites, but due to a rewrite of the Ftp core taking longer than expected I decided to postphone it till FixPack 6.

This release is "IE 7 friendly" (atleast Beta 1, Beta 2 and builds inbetween the two) and recognizes all recent releases of Firefox & Opera also:-)

Change Log(View Text)
=========
BUG FIXES
=========
22806. DocumentData > Loading an empty document gives 'No Document Loaded' in 'DocumentData::Core Engine Runtime' which is invalid.
22805. Core > Checkboxes sometimes may raise errors in validation on some dialogs.
22804. Core > **** EXPERIMENTAL **** New fix for the crash when saving documents every now and then (rare to reproduce).
22803. IDE > VS.NET Tabs sometimes doesnt repaint after recieving the focus again.
22802. WebManager Account Manager > Selecting first item causes a save to be placed into the pending queue when it shouldnt.
22801. Tools > SpellCheck raises a fatal runtime error because it cant locate the 'custom.dic' dictionary file.

=========
ADDITIONS
=========
1.DocumentData can now have a padding of '0' (Zero) so it will ignore file-legth checking.

=======
CHANGES
=======
1. Welcome Dialog > When selecting a file from the recent list, if its not found/non-existant it will prompt and leave the dialog open.
Download HotHTML 3 FixPack 5 and have ago, use our servers (Tucows/Download.com havent been updated yet!).

(NOTE: Updates to the website to reflect FixPack 5 will happen in the next couple of days!)

PHP: PHP 5.1 Out!

Finally after almost a year and a wee bit more PHP 5.1 is out! Lots and lots of changes, recommended to Download, test and deploy

Unsafe server-side coding can land you in trouble...

I listen to music whilst coding like anyother sane coder, its what fills the void for a lonely developer at work. Lawyers, Accountants, Doctors, Drivers, Plumbers all have people around them to talk, but we IT nuts are usually head-first deep inside code where only the insane of the insanely live. So music is our only connection to the outside world.

Back to the point of this blog post, I went to the FoxFM website to "Listen Live", after finding in Firefox(who says I dont dig Firefox?) the popup wont show properly (Tools > Javascript Console):
Error: window.showModalDialog is not a function
Source File: http://www.fox.com.au/
Line: 60
So like anyone else who has no life I went to the source of problem and a little loosky... the ListenLive link opens a new window and gives us those nasty ads (they have to make a profit somewhere aye?):
  	function launchPlayerFOX() {  
var radioStation = "15129";
var url = "http://203.48.254.42/ad.php?rsid="+radioStation;
var w = screen.width; // Get the width of the screen
var h = screen.height; // Get the height of the screen
var resources = "dialogHeight: "+h+"px; dialogWidth: "+w+"px; dialogLeft: 0px; dialogTop: 0px; scroll: no; status: no; resizable: no; help: no; center: no;"
var winRadio = window.showModalDialog( url, "", resources);
}
So I browse to this URL in a new instance of Firefox:
http://203.48.254.42/ad.php?rsid=15129
Nothing too shabby, just the ad we're meant to be watching. Screw that, I dont need a mortage! View source it:
var theRSID = jsrsid.value;
var rsMediaFile = jsrsmf.value;
var url = "player.php?rsid="+theRSID+"&rsmf="+rsMediaFile;
var winRadio = window.open( url, "RadWin", "[WINDOW CODE SNIPPED OUT!]");
if (winRadio != null) {
 self.close();
}
and get the URL for the player:
http://203.48.254.42/player.php?rsid=15129
Ooops... I forgot about the rsmf (Radio-Station-Mutha-Faq'er? - Media File) looks like whoever wrote that script didnt think ahead about this and automatically assumed it would have been parsed (as well as rsid - Radio Station ID).... BIG MISTAKE! Just run that URL and see what happens, (please dont over-do it!)

If your a good person and didnt click on it heres what you would have got:
Notice:  Undefined index:  rsmf in E:\zeroklix\ZeroKlix\player.php on line 13
Warning: fopen(media/foxfmmelbourne/clickthru/txt): failed to open stream: No such file or directory in E:\zeroklix\ZeroKlix\player.php on line 49
Warning: feof(): supplied argument is not a valid stream resource in E:\zeroklix\ZeroKlix\player.php on line 50
Warning: fgets(): supplied argument is not a valid stream resource in E:\zeroklix\ZeroKlix\player.php on line 51
The last two lines iterate over and over and over (possible problem with feof?), whats more with a bit more of playing around you can get their clickthru/txt file that lists some data but I wont go into much detail there.

What should have been done would be to check that the file actually exists with file_exists() method and if so continue, otherwise you'd be stuck with the above.

So with that information we know that a company by the name of ZeroKlix hosts the content for them, its stored in E:\ZeroKlix and a few other things that I'll leave out for the time being. Not only that, but its quite easy to get the server to start to hiccup if we simply run that PHP script file(although after the 30 second timeout PHP will stop processing it).

Ohhh before I forget, heres the direct link to the FoxFM "Listen Live" stream:

http://203.48.254.42/media/foxfmmelbourne/playlist.asx

Enjoy!

HotHTML 3 FixPack 4 Final Released!

Well after close to three months of intense testing, I've finally gone live with FixPack 4 for HotHTML 3.

Anyone who has the pre-release betas, alphas or Release Candidates (from builds 1930-2278) you'll need to uninstall it and install the new FixPack 4 release as we're now fully switched to InstallShield 10.5 (we bought 10.5 a month before 11 debut'd but it shall do!)

Download:
http://www.wsoftware.biz/downloads/http/hothtml3/hothtml3eval.exe [ 11MB ]

ChangeLog:
http://www.wsoftware.biz/downloads/http/hothtml3/changes_1900.txt

NOTE:
Website(s)/KB's should be updated in a few hours!

Thanks to everyone who reported issues and spent time testing and messing with the fixes!

Get ready for PHP v5.1 & adventures with beta 3 and PDO!

I've been working after hours on the HotHTML 4 IDE, and it goes without saying that even though this release is being written in .NET 2.0 its not stopping us from still having that rich language support from the previous release. One of the key languages I'm targetting - thats non-MS (like ASP/ASP.NET) is ofcourse PHP.  I took a trip down memory lane when i downloaded PHP 5.1 Beta 3 yesterday, its got some pretty exciting stuff, some of which i'll talk about below...

Among the coolest is PDO, PHP Data Objects. Its what the PEAR DB Modules are currently to php developers, a very abstract and portable set of database classes which makes it easier to make the transisition from one DB to another without breaking code. My beloved REFOLD uses the PEAR modules mainly because we thought in the future we could give our client the ability to move to say Oracle instead and not worry about issues with migration.

Now that this "Framework" is tightly 'integrated' into the PHP engine/runtime itself(?) it will mean that PHP 5.1 developers/sites will be alot easier to manage - think of how much less code the PHPNuke/BB guys have to write?.

Another area is speed, i feel that this release is somewhat faster that the previous v5.x release - I know the release notes added that perf was increased, but I tend to not notice them most of the time. Either way if your working with PHP 5.0, then its HIGHLY RECOMMENDED you take a look at PHP 5.1, its cutting edge, its faster and teh PDO is sooo much easier to work with:-)

Take a look at this WIKI on the basics of PDO, if you dont fall in love, then... (fill insult)