Development

OSCON 2007 Keynote from Steve Yegge

Steve Yegge of the Google presents his keynote: How to Ignore Marketing and Become Irrelevant in Two Easy Steps. From O'Reilly Media's Open Source Convention, July 26, 2007.

test page under 'test group'

test page under test group

PHP Coding Guidelines

PHP coding guidelines

The guidelines that I follow when writing my PHP scripts; can be helpful to have something like this if you're working on a joint project.

These are only the guidelines that I personally chose to follow for the code I write. This is not an indication that any other coding styles, guidelines or standards are wrong. Feel free to use this document as a template to manage your own coding guideline and change whatever you wish as you see fit.

Why are guidelines important?

First of all, let's make one point crystal clear: it doesn't matter what your guidelines are, so long as everyone understands and sticks to them. I've worked on a team where the person in charge preferred to put braces following the expression, rather than on a line all by themselves. Whilst I didn't necessarily agree with this convention, I stuck to it because it made maintaining the whole project much easier.

It cannot be emphasised enough that guidelines are only useful if they are followed. It's no use having a definitive set of coding guidelines for a joint programming project if everyone continues to write in their own style regardless. It is arguable that you can get away with different coding styles if every team member works on a different section which is encapsulated and therefore their coding style doesn't affect the other developers. Unfortunately, this only holds true until a developer leaves and someone else has to take over their role.

If you are running a joint project, you might consider putting your foot down and basically refuse to accept any code that does not conform to your published guidelines, regardless of its technical merit (or lack thereof). This may sound somewhat draconian and off-putting to developers at first, but once everyone begins to code to the guidelines you'll find it a lot easier to manage the project and you'll get more work done in the same time. It will require a lot of effort from some of your developers who don't want to abandon their coding habits, but at the end of the day different coding styles will cause more problems than they're worth.

Getting started with AppleScript Studio

I've been kind of wanting to play around with writing a desktop app for the mac. I am not looking to dive head first into a new development environment so when I heard that Tyler Loch of iSquint and VisualHub fame used AppleScript Studio to write his applications, I decided that this would be a good place to start.

Cocoa Dev Central has a few articles on how to get started with AppleScript Studio including a nice beginner's tutorial that builds a remote control for iTunes. 

Now I just need to decide on something interesting (atleast to me) to build. 

Cross Domain Ajax using Prototype and Ajax Extended

This is a quick guide to building cross domain Ajax applications using Prototype.js and Ajax Extended. First thing you will need to do is download the two needed libraries.
Prototype.js
http://prototype.conio.net/
Ajax Extended
http://ajaxextended.com/

First thing we need to do is modify prototype.js to use the Ajax Extended XMLHTTP object rather than Javascript’s native one.

Prototype.js

getTransport: function() {
return Try.these(
function() {return new ActiveXObject('Msxml2.XMLHTTP')},
function() {return new ActiveXObject('Microsoft.XMLHTTP')},
function() {return new XMLHttpRequest()}
) || false;
},

Needs to be changed to:

getTransport: function() {
return xmlhttp = new XMLHTTP();
},

You can now use cross domain Ajax using prototype.js while keeping all the functionality of prototype.js. Make sure you upload the Ajax Extended files and that you configue the Javascript file to point to your PHP file.

Converting a PDF to JPG using ImageMagick

When converting a PDF to an image, I noticed the quality always seemed to be lacking. Here is a command line example that seems to produce better results..

> convert -geometry 850x -density 300 sourcefile.pdf newfile.jpg

Oracle lauches their new PHP Developer site on OTN

John Coggeshall talks about Oracles new addition to their OTN site for php developers.

While I was attending the International PHP Conference in Amsterdam, I had an opportunity to stop by the Oracle exhibit and get introduced to a brand-new PHP Developer Center on Oracle's Developer Network! This is the second such announcement from a major database company (SAP recently launched a new PHP Development Forum which I am moderating as part of a SAP/Zend joint effort). Between Oracle, SAP and of course IBM it is becoming increasingly clear that PHP has moved from a thriving open source project to an enterprise solution powerhouse for web applications!

Oracle lauches their new PHP Developer site on OTN

John Coggeshall talks about Oracles new addition to their OTN site for php developers.

While I was attending the International PHP Conference in Amsterdam, I had an opportunity to stop by the Oracle exhibit and get introduced to a brand-new PHP Developer Center on Oracle's Developer Network! This is the second such announcement from a major database company (SAP recently launched a new PHP Development Forum
which I am moderating as part of a SAP/Zend joint effort). Between
Oracle, SAP and of course IBM it is becoming increasingly clear that
PHP has moved from a thriving open source project to an enterprise
solution powerhouse for web applications!

Yahoo! Traffic Conditions data in an RSS Feed

Yahoo! has opened their Y! Local Traffic content to allow Apple's Dashboard to create a  Y! Local Traffic widget. For this to work, Yahoo has to expose the data in an easily digestiable format. As it turns out, Yahoo has decided to use RSS to accomplish this.

This is huge since it is now easily consumable by RSS readers, so other people can piggy-back on the feed. There’s already a blog post describing how the widget works and it even provides a little form for making your own URL.

In short, here is how the feed works:

http://maps.yahoo.com/traffic.rss?csz=45202&mag=4&minsev=2

The parameters are:

  • csz The location from which you want to do your search - as far as I know only cities are supported at the moment. You can provide both a zipcode, a city or an address - all seem to work.
  • mag The level of ‘magnification’. 3 = 4 Miles, 4 = 10 Miles, 5 = 40 Miles
  • minserv The minimum severity of the traffic condition. 1 = Minor, 2 = Moderate, 4 = Major, 5 = Critical

I am looking forward to see how many interesting things people can come on ways in which this data can be used..

Turning a background image into a clickable link

I had been trying to find the best approach to making my header logo into a clickable link that would return to the home page of one of my websites ( bearcatnews.com ). The problem was that I really wanted to leave the image inside my style sheet instead of marking it up inline.

Since there is no way that I know of to make a background image a clickable link, I decided to assign the "onclick" event to the div tag that contained my background image.

Here is the result:

HTML Markup -

<div id="header">
<div id="logo" style="width:300px;height:69px;cursor:pointer" onclick="location.href='/'"> </div>
</div>

Syndicate content