Archive for October, 2006

FTP Applet Uploader

Sunday, October 29th, 2006

I’m sure most web programmers have come across difficulty uploading large files through HTTP forms.

Firstly, there is usually a myriad of different configuration options that need to manipulated and tweaked to actually allow large files to be submitted without the server killing the connection prematurely. Then there is the fact there is no actual user feedback to indicate what is going on. The page just remains static for long periods of time without any indication of the progress of the upload, so users understandably get frustrated and start clicking “refresh”, which (of course) just compounds the problem.

So, what’s the solution? Well, Macromedia (Adobe) has put its two cents in with the Flash 8 File Uploading functionality, but this is limited to files smaller than 100MB. Thankfully there is another web technology which has been used quite extensively throughout the internet that can perform this sort of stuff: Java applets.

Using java we can create an FTP connection to the server and upload a file to a drop area for movement by PHP (or your language of choice). Of course there are a few security hoops to jump through; you can only upload to the server that you loaded the applet from and the applet needs to be signed with a digital certificate before it can access files from your computer. However once these things are out of the way, we are good to go!

And here is the finished product. You can change the colours used by simply passing different parameters to the applet so that it fits in correctly with your website. The bundle also includes a detector applet that will ensure the user has the required Java Virtual Machine before showing the uploader to the user.

FTP Applet
FTP Applet

While this doesn’t fix the issue, it should provide an effective work-around for those wanting a little bit more than what the good ole file input type provides.

Programming Fonts

Sunday, October 29th, 2006

Anyone who knows me knows that I am pedantic about my fonts.

The first thing I always do when installing Linux is download the Freetype source, enable the byte-code interpreter and install it so the True Type fonts look correct. Then I enable sub-pixel rendering (clear-type to windows-folks). Finally I install all of my windows fonts “˜cause I just can’t stand not having things looking the way I’m used to.

I have looked for a long time and the only font that I ever felt comfortable with for coding is Courier New. Some others came close (proggy) but they never really trumped the mono-spaced classic. I figured that other font makers were just not interested in creating programming typefaces”¦

ConsolasThen I came across Consolas. Consolas was created as a clear-type font for use in the up and coming Vista release. It is also bundled with the new Office 2007 and is available as a free download for Visual Studio 2005.

I have been using Consolas for a week or so now and I am very happy with it. It is clean, easy on the eyes and goes well with my new favourite VIM colour scheme Zenburn. Give it a go and see what you think, get it here. Just make sure you have cleartype enabled or else it looks rather unattractive.

Cool Stuff with Video

Thursday, October 19th, 2006

Okay, so I’ve been looking into how good ole youtube would work. The whole concept of video has been hideously complex on computers for a long time with the wide range of codecs (which are independent of the audio codecs), limited bandwidth and a multitude of encapsulating frameworks.

Thankfully the late Macromedia has stepped up to the plate with its flash video offering. This guarantees that anyone who has the flash player (most people on the earth) will have all that is required to support the playback of reasonable quality video at minuscule file sizes. Thus services like you-tube can soar, and so it has, recently being bought for billions of dollars by Google.

Finally we can do away with our AVIs, our Quicktimes and the stress of trying to find a common enough codec to use so that most people will get more than an empty box with a lone audio track.

So, how do we create these brilliant flash movies on the server-side? I decided to have a dig around and found this excellent guide that details how to do the whole thing using Open Source tools! Thank you to whoever managed to decipher the new Sorenson codec and write the FFmpeg plugin for it!

This is all very cool, the only piece of the puzzle that I’m missing is being able to track the progress of encoding a video. This would mean it can be done in the background without the user waiting for the page to appear for hours and reported on through a control panelly type setup. I might just have to give it all a go and see if I cant get FFmpeg to spit it out for me. Otherwise, I might have to resort to writing my own wrapper for the library (yuck). All good fun!