Author Archive

Is NoSQL the future of databases?

Friday, August 13th, 2010
No Gravatar

Unfortunately the title of this post is nonsensical. NoSQL isn’t any one thing, it’s a broad spectrum of emerging technologies. NoSQL could be used to describe just about any data store that isn’t a traditional database, and it turns out there are many flavours of databases.

I haven’t used any NoSQL product personally but I have the answers to some important questions:

Are these database systems proven and used in large scale productions?

They sure are.

Do they provide advantages over traditional RDBMS’s?

In some cases they are very interesting, in others there is debate as to whether they’re the right tool for the job.

Integrating Symfony with Existing Software

Thursday, June 3rd, 2010
No Gravatar

Lately we’ve been looking for ways to build custom web applications faster. Our existing software is great but it’s not quite up to the calibre of some of the frameworks out there. After deciding on using Symfony to build our next generation software, and loving it, I set out to wrap our existing software in Symfony. As it turns out that was fairly easy thanks to Symfony’s routing system.

Getting Longitude and Latitude from Google Maps

Friday, February 26th, 2010
No Gravatar

I’ve recently needed to get longitude and latitude coordinates for several locations. I first went about it by getting the values from http://www.geonames.org/. This was difficult because it requires you convert degrees, minutes and seconds to the wgs84 format. This is no treat.

After some googling I discovered that it’s pretty simple to make a Google map with a pin on it which tells you the coordinates of the pin in the wgs84 format.

Here’s the code:

HTML

<p id="coords"></p>
<div id="map_canvas" style="height: 600px"></div>

Javascript

 
function gogmap() {
 
	var map,
		marker, 
		point = new GLatLng(52.482780222078205, -102.65625); // default position
 
	var posChange = function() {
		point = marker.getLatLng();
		document.getElementById('coords').innerHTML = "lat: " + point.lat() + "<br>lng: " + point.lng();
	};
 
	map = new GMap2(document.getElementById("map_canvas"));
	map.addControl(new GLargeMapControl());
	map.addControl(new GNavLabelControl());
	map.setCenter(point, 4);
 
	marker = new GMarker(point, {draggable: true});
 
	GEvent.addListener(marker, "dragend", posChange);
 
	map.addOverlay(marker);		
 
	posChange();
}
 
gogmap();

Live Example

When you drag the pin to a new location the longitude and latitude below will update.

Using Symfony’s sfForm Standalone

Friday, January 22nd, 2010
No Gravatar

Forms are something a web developer makes and maintains nearly every day. Despite their common occurrence they’re easy to do badly. Luckily they are something of a solved problem. There are many tools out there that help the PHP developer create forms including PEAR‘s HTML_QuickForm2, Zend Framework‘s Zend_Form, eZ Components‘s ezcInputForm, CodeIgniter‘s Form Helper, and many others. Having drunk the Symfony Kool-Aid and being pretty impressed with it I thought I would see if I could use their sfForm class in a non Symfony project.

Combining CSS or JavaScript Files on the Fly with PHP

Thursday, November 12th, 2009
No Gravatar

In pursuit of creating excellent performing web pages, and inspired by YUI’s combo system, I decided to see what would be required to combine CSS or JavaScript files with PHP. My goal in doing so is to reduce the number of HTTP requests to our servers which should result in a speed up in page load times and a decrease in the load on our servers.

With performance in mind I set the following criteria for my solution:

  • It should cache combined files to increase performance.
  • When a CSS or JavaScript file is modified the cache should be expired.

YUI Uploader and Crossdomain Permissions

Thursday, October 29th, 2009
No Gravatar

I’ve recently updated to YUI 2.8.0r4 for a project that was using YUI 2.7. Unfortunately after pointing my script tag to use the newer version of YUI the uploader widget stopped working with the existing code.

As it turns out uploader.swf found in the build directory is broken but uploader.swf found in the examples directory works.

For testing purposes I updated my script to use uploader.swf hosted by YAHOO with the following javascript:

YAHOO.widget.Uploader.SWFURL = "http://developer.yahoo.com/yui/examples/uploader/assets/uploader.swf";

This didn’t work either and since I was no longer hosting uploader.swf on the same domain. The reason for this is best explained by the YUI team:

Form Serialization with YUI

Thursday, October 1st, 2009
No Gravatar

I’ve been a big fan of the YAHOO! User Interface Javascript library for some time now. It provides so many richly featured widgets and it has really forced me to learn how to write better Javascript code. That’s why I was excited by the latest release of the version 2 branch of YUI : 2.8. One new feature in YUI 2.8 that I nearly missed is form serialization. It’s a feature that I’ve been wanting for a long time and it’s a reason I’ll turn to  jQuery for its serialize function.

Validating web images in Symfony 1.2.8 with PHP 5.3.0

Friday, September 4th, 2009
No Gravatar

If you’re developing a Symfony 1.2.8 (and possibly other older releases) application with PHP 5.3.0 you won’t be able to use the sfValidatorFile with mime_categories set to web_images without changing Symfony code. Was that really English? Since PHP 5.3.0 finfo will return charset information with the mime type. See more about this change in this php bug report.

If you try to use web_images, the validator will fail on images it should accept with an error like: “Invalid mime type (image/gif; charset=binary).”

As a work around until this is fixed, you can change your file validator to something like this:

Working with Remote Files in Netbeans

Thursday, July 30th, 2009
No Gravatar

If you’re like me and you develop applications for the Linux platform from a remote computer, then you may find the following tutorial interesting.

For a long time jEdit was the perfect editor for me. It has syntax highlighting for just about every language and it has an excellent (S)FTP file browser. What more could you need as a PHP developer? Apparently a lot. With the maturation of PHP development came IDEs which provide code completion, inline documentation, a class browser, SCM integration, fonts that are prettier than jEdit’s and so much more. The PHP IDE that has stood out the most to me is Netbeans.

Javascript Private and Public Object Members

Friday, July 17th, 2009
No Gravatar

Javascript can be a frustrating language to jump into. I can recall personal experiences from my early days with it when I was sure there was some voodoo involved. A big reason for my confusion is that I approached it like a classical object oriented language. You can spend time fighting it and trying to make it behave like Java but in the end you’ll have a more pleasant experience if you accept that programming in Javascript is a different paradigm than programming classical object oriented languages.