Code Reference

This is my collection of links to useful information for developers.  Unfortunately, most of this information was collected between 2009 to 2012, and technology has moved on and many of the links are now broken.  Some links will even take you to an ancient version of phpfunk.com.  Ah, those were the days!

CSS filters by browser

How about a nice chart that shows you which css rule is understood by each browser so you can work around all those non-standard compliant browser “quirks”.

CSS variable column layout

The ruthsarian skidoo_too layout is so awesome, I can’t say enough about it. One, two or three columns of cross-browser compatible css bliss. You might want to check out the menus too.

Unit Testing

When I started simpletest was the unit testing framework for php that I adopted and continue to use. I’m getting more into JavaScript so of course I’ve got jsunit installed on the development server. Cutest is a nice simple C unit testing framework and it has the best name! And it all started, for me, with junit for java because I learned java first (actually I learned BASIC first, but thats a long story). I actually like the old junit website better. Oh well. And when I had to dig into OO perl I found Test::Simple to be exactly the perl unit testing framework I needed.

AJAX library

I wouldn’t touch ajax without a library. I’m not that crazy about wading thru the DOM with javascript or dealing with browser-specific javascript issues. Someone else who really is crazy about that, fortunately, has already done the hard work. So far I’ve been using prototype and its awesome. Here are some sublimely simple ajax examples with the associated source code for the php server pages.

JavaScript Context Menus

Ever want to make your web app more like a desktop app? What if mouse clicks on various widgets caused context menus to popup, like say to edit a record in a table for example. Proto.Menu is a nice clean javascript context menu library that uses Prototype.

JavaScript Character Counting

This javascript all you to track how many characters user has typed in a field.

PHP Sessions and URLs

Purpose: remove trans SID from URL for XHTML compliance.

Example php code shown here, from mtdev.com article on removing trans sid from URL. Verify that you can actually set these values on the server where you host the php code; to date we found one instance where this was not possible.

 

ini_set(‘session.use_trans_sid’, FALSE);

ini_set(“url_rewriter.tags”,””);

 

Of course you call them before calling session_start().

C Programming

I do not do much C coding, but when I do I go visit this guide at UIUC for a quick reference. If you’re a complete noob to c you could start here.

Source Code Control

I still use cvs.   Nope, I love git now.

There are some best practices for source code version control.

Unicode

Joelonsoftware.com has lots of good info and this post about unicode tells you in a straight-forward manner how it works.

CSV File Format

The csv file format (comma-separate values) is not a “standard” but it should be. Its the time honored way of organizing data. Fortunately someone has put together a nice reference about the non-standard csv “standard”.

Perl How-to

When you cannot remember how to do something in perl, simply search for the how-to. For example, if you cannot remember how hashes work you would search for the perl hash how-to.

Review of Web Hosting Companies

Here find summarized our experiences with some hosting providers. In most cases we have worked on more than one site on each host, and maintained them over a period of a couple years. Hopefully this can help you find reliable hosting company for your site.

Dreamhost.com

Dreamhost.com is the best shared hosting web host. We have hosted on their least expensive plan since 2004, which now includes unlimited domains, unlimited mysql databases and ridiculous bandwidth. Uptime is very good but they have occasional server, dns and network issues, all of which are documented in their blog. That said, their issues are not any more in number than other shared hosting providers, and they can actually tell you in technical details what went wrong. Support is very good: they respond quickly and are knowledgeable. I don”t really remember a time when I had to submit a ticket more than once to get something fixed. They have a custom control panel for managing your account and domains which is better than any other web interface I”ve used. You can request shell access. Dreamhost.com is the best place to host a site if you are on a tight budget. Moreover its a very programmer-friendly environment. They now offer VPS hosting as well. They also publish a monthly email newsletter to keep you up to date on changes.

m5hosting.com

If you are looking for a dedicated server and awesome support look no further than m5hosting.com. They can set up a server to your specifications including OS and partitioning of the disk. The support is fantastic. m5hosting.com has been our best experience with dedicated server hosting and overall our best hosting experience, period.

inmotionhosting.com

Inmotionhosting.com offers a VPS hosting service which is excellent. Includes cpanel and WHM (web host manager) in the backend for easy maintenance. You can get SSH access; select which IPs can get throught the firewall using web host manager. Hosting support is very good. Check out VPS Hosting by InMotion Hosting.

rimuhosting.com

Recently we set up a domain on a VPS hosting account at rimuhosting.com. They also offer dedicated server hosting. The set up was quick and the price is very attractive.

Lunarpages.com

Lunarpages has excellent uptime and support for shared hosting. They have cpanel interface, phpmyadmin but no shell access. Overall, I”d say they offer the best overall shared hosting in terms of performance, service and uptime. Some of our biggest projects are hosted at lunarpages.

Object Oriented JavaScript Inheritance

Here”s the short explanation of how to do inheritance with javascript. This was the best site I found on the subject and I tell the same story albeit tersely.

I defined a base class, called Base just to be clear:

Base = function()
{
}

Base.prototype.say = function(foo)
{    
    return foo;
}

Then I defined a class to extend Base called Extender:

Extender.prototype = new Base;

function Extender()
{
    // this line calls parent class constructor
    // like saying super() in Java
    // or like using parent::Base() in PHP
    Base.call(this);
}

You will have problems if you try to say Extender = function() {}…at least it didn”t work for me written that way.

Override say() method of parent class, but I also call the parent class method:

Extender.prototype.say = function(foo)
{
    // in this case we override but also call the parent method
    return 'extend ' + Base.prototype.say(foo);
}

This was tested with jsunit.