21 May 2008

The "Delete" Keyword in JavaScript

Ever used it? Well, before today, I hadn't!

Basically, if you've got an object, and you're wanting to completely remove a property that it has (not just set it to "null" or "undefined"), you use this keyword!

Say you've got:
myObject = {prop1: "blah", prop2: "blah"}

And you want to remove "prop2" -- not just remove it's value; remove it completely from the object. This is important when returning values to the server -- just the presence of a property name even without a corresponding value can cause problems.

So, what do you do? Well, you can loop through the property with a "for (property in object)" loop, leaving out the one you don't want, or you can just "delete" it:

delete myObject.prop2

And that's it. Now, if you turn "myObject" into JSON or whatever, all you'll have is:

myObject = {prop1: "blah"}

And that's that. I'll be on vacation for the next two weeks, so don't worry about the absence!

Yes, all six of you, don't worry. :P

20 May 2008

Napster rolls out all-MP3 download store

Napster rolls out all-MP3 download store - Yahoo! News

The company is the latest to make the switch to the unrestricted file format, which makes it music tracks compatible with virtually any music player or other device.

"It's great that we have finally gotten here," said Chris Gorog, Napster's chairman and chief executive. "It is really the beginning of a level playing field, which I think is essential for Napster, but also for the health of the digital music business in general."

Tracks downloaded as part of Napster's subscription service will continue to have copyright restrictions.

Good grief.

I've got two questions.

1) What horrible bitrate are these things encoded at?

2) When will you be giving them away for free again so that we can be back to square one? -_-'

15 May 2008

Installing the Flash 10 Pre-release on Ubuntu 8.04 with the Firefox 3 Beta

...isn't the same as what you'd (or the Linux flash installer) expect.

First of all, make sure you go into Synaptic (System/Administration/Synaptic Package Manager), search for "flash", sort by what's installed (just click on the column titled "S"), and then uninstall the two flash-related packages. That'll remove the old flash packages for FF3.

Then, download the tarball of the Flash 10 installer (go ahead and close down your browser and use "wget" in the terminal, lazy butt), un... err, "ball" it, and then look inside the installation folder.

Now, this is where things deviate from the norm, as the installer file adobe has supplied won't work. I'm guessing it's trying to install the flash 10 plugin to "/usr/lib/mozilla/plugins/" but, for whatever reasons, the installer file keeps failing.

Doesn't really matter, anyway -- manually copying the "libflashplayer.so" file to "/usr/lib/mozilla/plugins/" doesn't make it work in Firefox 3.

So, just curious to see where plugins might be referenced from in FF3, I went to my "about:config" page in Firefox, searched for "plugin", and changed the value of "plugin.expose_full_path" to true.

Do the same in your copy, then load up the "about:plugins" page, and you'll notice that quite a few plugins actually come from "/usr/lib/xulrunner-addons/plugins/" instead of the old "/usr/lib/mozilla/plugins".

Well, just copy the "libflashplayer.so" file from the Flash 10 installation directory over to "/usr/lib/xulrunner-addons/plugins/", and you're all done!

Once you start back up Firefox 3, make sure and check the flash 10 demos -- I've got to admit, the work they've done is pretty neat, and what's even cooler is the fact that they've released the Linux version in time with the Window and Mac versions.

Not only that, but check out the native 3D manipulation that's present -- yes, present even on the Linux version (and even in a VMWare virtual machine!). That's particularly neat to me, since I didn't think there was much 3D-acceleration of any sort in Linux virtual machines used with VMWare's free player.

09 May 2008

The Last Straw

Okay, I've had it. Though I have to design on it (and eventually I'm going to be forced to use it at work), I now absolutely refuse to ever install Vista on any of my home machines.


You may remember from my post a while back about Vista's disk defragmenter program trying to contact the internet; well, today whilst in the clutches of my virtual machine, Vista beat that:

Seriously, that's it. The last straw. The last dance. If this was Germany, I'd say something ominous-sounding in German like "Der Tropfen, der das Fass zum Ɯberlaufen bringt."

I don't think I need to even say anything about how utterly senseless it is for a screen saver to need (or even just check for) an internet connection. Seriously, I had no idea all this stuff was going on unnoticed until I installed a third-party firewall (thanks, ZoneAlarm).

(Edit: I know that's technically not a valid IP address it's trying to contact. However, that doesn't change the fact that a screen saver is still trying to do something network related. Why?)

Stop Windows from Copying Files Accidentally When Ctrl-Click Selecting

Fixing Annoyances: Stop Windows from Copying Files Accidentally When Ctrl-Click Selecting :: the How-To Geek

Have you ever tried to select a bunch of files in Windows Explorer while holding down the Ctrl key, and then all of a sudden there are duplicate copies of all of those files sitting in the folder? Really irritating, so how do we fix it?

And to think I've used TweakUI for nearly 6 years now without finding out about this little tip. This "accidental copying" of files in the Windows Explorer regularly annoys the ever-loving-HELL out of me, especially when you're selecting a lot of (big) files and then all of a sudden your system slows down to a crawl as it starts to copy them to the same bloody folder they're in.

I must admit, though, the fix isn't that intuitive (it's not bad, it's just not easy to find), so I don't so bad about all the millions of wasted megabytes of copied files I've created over the years!

07 May 2008

Nesting "default" Configurations in Ext Component Declarations

(Man I love fancy-schmancy sounding titles.)

Did you know that you could nest your "default" specifications when doing ExtJS lazy-rendering?

Try it! Take the following example "default" spec for a panel that you create:
defaults: { // applied to each contained form
autoHeight: true,
bodyStyle: "background-color: transparent;",
defaults: { // Applied to each fieldset within the form
autoHeight: true,
defaultType: "radio",
defaults: { // applied to everything within that fieldset
labelSeparator: ""
xtype: "fieldset"
border: false,
labelWidth: 1,
xtype: "form"

...and apply it against the following example "items" for that panel (this example comes from my little "PowerWizard" extension that I submitted to ExtJS:

id: "card-1",
items: {
id: "card-1-fieldset-1",
title: "Are you available to work without restriction?",
items: [{
boxLabel: "Yes",
inputValue: "Yes",
name: "opt01"
boxLabel: "No",
inputValue: "No",
name: "opt01"

The default parameters will cascade down the item tree, being applied to each component they come in contact with.

It's so much easier that way, isn't it? Now, imagine a bunch of "item" declarations (like the one in the second code block) and think about how much time that will save you.

Remember: if you're programming, and you catch yourself coding the same thing over and over and over again, then you can be sure that there's an easier way to do it.

06 May 2008

The Google App Engine

I've been accepted to the Google App Engine! It's somewhat exclusive for right now, I think -- well, it was when I signed up to be a tester a while back.

Going through the tutorials now -- never used Python before, and it's different, that's for sure. Lots of objects and methods, properties and calls.

05 May 2008

Who's That?

Face Your Manga Image

Just a little bit of fun to spruce up my Monday.

[Taken from San Baldo, a design blog that I've been visiting for two years for some inexplicable reason]

01 May 2008

The Ext Debacle

By now, if you're an Ext user, you've probably heard of the recent hubbub about Jack Slocum changing the license for Ext.

At first, I was outraged along with everyone else, but then I started understanding more about licensing and what it really means to be "open source" (that is, educating myself), and I now see the entire situation from an entirely different light.

Get acquainted with the whole issue (if you haven't already), and then read this little analogy posted by Jack over at Ajaxian.com in the form of the famous "free as in beer" debate (it's in the comments):

I once heard about a beer brewer who walked into a bar with beer and handed out mugs of good beer to everyone. On every mug of beer was a label with the recipe. In his hand he held a sign:

“Free beer.”

Soon, many people heard about the beer and the bar started to fill up - so many people he now needed help brewing and pouring the beer. Many people were now helping to pour the beer but he was very particular about the taste of the beer and needed to hire connoisseurs to help with brewing it. After discussion with the beer drinkers, he changed his beer policy to something they mutually agreed. Since he was now responsible for the people he had hired, he was advised to give his recipe some protection so people wouldn’t use it to create a duplicate beer. So he made a new sign and stuck it up on the wall.

The sign read: “This beer is free for you to consume. But if you sell it and make money off it, please kick in on the brewing. You may use the recipe on the mug to produce beer for yourself but you may not give beer produced with the recipe away.”

The bar continued to fill with people who had all heard of the free beer. Many of these people were not around when the initial discussion took place, did not bother reading the sign stuck on the wall and all they heard was all the talk about the free beer.

Then some expert beer drinkers, armed with sign readers came in and started saying the beer wasn’t really free beer because the sign made it so you couldn’t even give beer produced with the recipe away for free. Free beer couldn’t have those restrictions.

So the brewer changed the beer policy again, this time instead of asking that those that sell the beer to kick in on the brewing, the are now required. He took down his sign and replaced it with a neon billboard to make sure the message was clear and visible to all.

The sign read: “This beer is free for you to consume. However, if you plan to sell it to someone else and make money off it, then you are required to kick in on the brewing. You may use the recipe on the mug to produce beer for yourself and if you want to give the beer you produce to others you can as long as you create a sign like this one.”

Some beer drinkers, now drunk, decided that the brewer had scammed them into thinking they were getting free beer. They called him names, said his first sign was BS and decided to use the recipe and start a brewery anyway. The brewer, advised that his first sign wasn’t BS tried to deter them from making that mistake. One beer drinker, who also liked cats, decided to instead create preservative for the old beer attempting to make it last forever.

Get it now?