Archive for October, 2009

Quick Alternative to phpMyAdmin

Wednesday, October 28th, 2009

If you need Web based MySQL admin, and phpMyAdmin isn’t your cup of tea, give SQL Buddy a go.  It’s super easy to setup (just upload a folder to your server (but please employ some sort of security!)), has a slick GUI, and seems to be feature rich.

First Glimpse Of Chrome OS

Wednesday, October 14th, 2009

GoogleChromeLogoFollowing TechCrunch’s, it looks like those wily folks at Google have removed the “chromeos” folder from the Chromium build folder. Too bad. But luckily, before they did, TechCrunch reader and Linux user, Jonathan Frederickson, was able to grab the code and managed to install it. He has posted some results in our comments section and even more on his blog.

It would seem that the result is the browser aspect of Chrome OS running inside of Linux. As you can see in the screenshots below, it looks very similar to Chrome, the browser, on Windows (still the only officially released version of Chrome), but there are some key differences.

First of all, it looks like there is a new logo of some kind. If you look in the upper left hand corner, you’ll see a a colorful circle with a white center. This is obviously different from the Chrome browser logo, which looks like the children’s game, Simon.

According to Frederickson, clicking on this logo opens a Google Short Links window. Unfortunately, you need a Google.com domain (which he obviously didn’t have) to go any further. It seems reasonable to assume that this page houses a simple link page to all the major Google Apps. But what’s odd is the wording that reads, “Google is not affiliated with the contents of Google Short Links or its owners.” No clue what that means, but maybe that’s just placeholder text.

Meanwhile, on the opposite side of the window, the far right side, you’ll notice a clock, a network status indicator (the “X”), and a battery level indicator. Of these, only the clock appears to be working at the moment. But all of those things are in line with what has been found in the code for Chrome OS so far.

There is also a drop down menu button. Here, you’ll find the options that will be familiar to users of the browser version of Chrome. But you’ll also notice the new “Chrome OS” tab. Here, you’ll find Network options, as well as Touchpad settings. Okay, this is the point where I’ll admit it was silly to think the “touchpad” may have been some sort of device, rather than simply a notebook trackpad. I noted that was probably the case yesterday, but I also let my imagination get a little carried away.

Source: TechCrunch

Mac PHP Function Reference Dashboard Widget

Tuesday, October 13th, 2009

php_widegtHere is my new favourite Dashboard Widget for the Mac, well, for this month anyway!

PHP Function Reference allows you to quickly lookup the documentation for the PHP web programming language.

Brilliantly, it also has a quick-link to the Date Formatter, that is also interactive!  You can live test in the Dashboard your desired date format.

JavaScript: Object Literals to Pass Optional Arguments

Saturday, October 10th, 2009

Here is a handy coding tip to keep in mind when dealing with functions that can accept a large number of optional arguments. Instead of passing the large number of arguments in the conventional fashion, which could unnecessarily complicate the function, you can pass just one argument which ends up being a collection of arguments declared in an object literal.

Let’s look, first of all, at how we might do this in the typical manner, so we can see the contrast:

function showStatistics(name, team, position, average, homeruns, rbi) {
 document.write("<p><strong>Name:</strong> " + arguments[0] + "<br />");
 document.write("<strong>Team:</strong> " + arguments[1] + "<br />");
 if (typeof arguments[2] === "string") {
 document.write("<strong>Position:</strong> " + position + "<br />");
 }
 if (typeof arguments[3] === "number") {
 document.write("<strong>Batting Average:</strong> " + average + "<br />");
 }
 if (typeof arguments[4] === "number") {
 document.write("<strong>Home Runs:</strong> " + homeruns + "<br />");
 }
 if (typeof arguments[5] === "number") {
 document.write("<strong>Runs Batted In:</strong> " + rbi + "</p>");
 }
}
showStatistics("Mark Teixeira");
showStatistics("Mark Teixeira", "New York Yankees");
showStatistics("Mark Teixeira", "New York Yankees", "1st Base", .284, 32, 101);

The function above can take up to 6 arguments. The first two arguments are mandatory, so inside the function, we don’t check for their existence. The last 4 arguments are not mandatory, so we only display their values if they exist.

We call the function 3 different times (last 3 lines), with different numbers of arguments each time. You can see that if the number of passed arguments was in the dozens, or more, the code could look a little messy, and would be harder to maintain, or read.

Now let’s look at the same code using object literals to pass the arguments:

function showStatistics(args) {
 document.write("<p><strong>Name:</strong> " + args.name + "<br />");
 document.write("<strong>Team:</strong> " + args.team + "<br />");
 if (typeof args.position === "string") {
 document.write("<strong>Position:</strong> " + args.position + "<br />");
 }
 if (typeof args.average === "number") {
 document.write("<strong>Average:</strong> " + args.average + "<br />");
 }
 if (typeof args.homeruns === "number") {
 document.write("<strong>Home Runs:</strong> " + args.homeruns + "<br />");
 }
 if (typeof args.rbi === "number") {
 document.write("<strong>Runs Batted In:</strong> " + args.rbi + "</p>");
 }
}
showStatistics({
 name: "Mark Teixeira"
});
showStatistics({
 name: "Mark Teixeira",
 team: "New York Yankees"
});
showStatistics({
 name: "Mark Teixeira",
 team: "New York Yankees",
 position: "1st Base",
 average: .284,
 homeruns: 32,
 rbi: 101
});

Technically, this second method of passing the arguments might require a little bit more code, but with a large collection of arguments, there are a few advantages.

First, the function itself is simplified because it accepts only one argument (args), which is a collection of all the values passed from the object literal (name, team, position, etc). Plus, the actual argument values are easy to read, and can easily be understood, updated, or modified, since the correlation between the values and the argument references are more direct.

If the function required only a small number of arguments, then this method would not be necessary, and might actually have the opposite effect. So, use this technique sparingly, and only in situations where you foresee the collection of arguments being hard to maintain over time.

Source: Six Revisions

Enable Xray folders in Snow Leopard

Saturday, October 3rd, 2009

xrayAnother little Snow Leopard hack has shown up at MacOSXHints that will go well with the eye candy freaks. If you’re ever Quick Look’ed a folder, you know how you wasted a precious keystroke to no use.
FreakTheClown over at MacOSXHints has found a tasty hack that embeds the content previews inside the folder preview, while animating them (Watch video). To get it working simply open up the Terminal app, and enter:

defaults write com.apple.finder QLEnableXRayFolders 1 && killall Dock

Change 1 to 0 if you want to revert back. Now watch as Quick Look generates cute content previews, and animates them if you stick around long enough.

Source: smoking apples

The History of Web Browsers

Thursday, October 1st, 2009

browser_historyI know of Mosiac, but the first I ever used was good old Netscape.

This article is a great illustration of past and present web browsers from Jacob Gube over at Six Revisions.