Archive for the ‘Web Development’ Category

7 Worthy Alternatives To Google Search

Friday, February 26th, 2010
No Gravatar

2-26-2010 4-39-35 PM

Today, I was wondering how I could ever search for something if Google didn’t exist and I asked myself, “How do I look for answers without using Google?”

I certainly wanted to answer my own question really bad so I dug up a few worthy search engines out there that can be my alternative to Google search.

Here are some of my early favorites (in no order):

1) Yahoo!

www.yahoo.com

No introduction is needed for the 3rd largest website in the world.

2-26-2010 4-08-50 PM

2) Bing

www.bing.com

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:

Managing Sessions accross multiple domains, securely – Part 3

Thursday, September 3rd, 2009
No Gravatar

Back to Part 2

——-

The HTTPS session is the “authority” session, and due to authenticity tests will not accept the HTTP session data as being “valid” as it doesn’t contain the correct information that an HTTPS session data file contains. So while it may still be possible for a user to hi-jack the HTTP session, it’s not possible for them to gain access to another users account or personal information by tampering with the HTTP headers and sending someone’s session id, because once they hit a page or perform an operation which pushes them to the HTTPS website, they immediately become logged out, and any personal information is cleared from the session data. For a user to hi-jack another visitors HTTPS session they’d need to have the ability “sniff” the secure session id, which is sent over the network in an encrypted fashion and is very unlikely – which is just as safe as always using HTTPS.

Quick Tip: Redirect Your Misspelled Domain Names

Thursday, August 20th, 2009
No Gravatar

We’ve written about how smart online companies use smart domain names a few weeks back and we’d like to give you another tip. Redirect your misspelled domain names to your main website. Why? Because it make sense and having it offline doesn’t help users.

Take this for example. Type http://www.futurshop.ca (without the ‘e’ on the word future) on your browser and you should see that the link is broken. For some users they would think, “What? Futureshop is down?” and some would simply close the browser and go away. End point, lost potential customer.

fs

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.