VUVUZELA for BlackBerry

The preferred noisemaker of the 2010 World Cup: the vuvuzela. For some reason these were distributed to fans attending World Cup matches, ruining the match for everyone watching at home.

When played by a stadium full of people the vuvuzela sounds like angry bees. I'm always up for a small project to help improve (or build) my BlackBerry development chops, and a vuvuzela app seemed like a perfect candidate. There are a slew of vuvuzela apps for the iPhone, but I only saw one other vuvuzela app for the BlackBerry, and that one only has a single vuvuzela sound.

Mine? It has 7.

I built the app with the 5.0 JDE. I tested it on a Storm2 9550 and Bold 9700 both running OS 5 and an 8820 running 4.5 and it worked on all three. If it doesn't work for some ancient OS, get a new phone.

Usage

Visit http://j.mp/cfg-vuvuzela using your BlackBerry to install the app. On newer devices the icon can be found in your Downloads folder.

Scroll and click a button to play the sound, or press the keys 1-7. You don't need to hold the ALT down; pressing W is the same as pressing 1. I haven't tested this on a SureType (Pearl) device.

Known Issues

  • Multiple audio threads – This is a J2ME limitation. I use javax.microedition.media.Player to play the audio, and you can only have one Player instance on CDMA devices and two on GSM. I read this on the BlackBerry support forums, and confirmed with a member of RIM's media development team.
  • Initial launch – the first time you launch the app on OS 5 it can take up to two minutes before the screen displays. Oddly enough it launches immediately on an old 8820 running OS 4.5. I'm looking into why this happens.
  • Volume control – I'm actually not sure where the volume setting comes from, I just play the sound and it works, and it's loud. The way the VUVUZELA should be.
  • The folks over at SistMan Software also have a vuvuzela app, and there is a conflict since both of our primary modules are named Vuvuzela (Vuvuzela.cod, etc). Until that's fixed, you can't have both apps installed. I like to think mine is better since it has more sounds, but they launched first and I'll publish a minor update with a unique module name.

Download

Download it OTA – Please link to this page, and not the .jad directly.

ScreenLock for BlackBerry

Adam Zeis from CrackBerry recently asked for an application to lock your BlackBerry screen, since the recently leaked 5.0.0.536 for the BlackBerry 9700 removed the icon.

I needed an excuse to add my new signing to the JDE, and quickly threw together an app (with an ugly icon) to lock your screen.

ScreenLock OTA (.jad) Installation
ScreenLock Offline (.alx) Installation

ColdFusion – SQLServer JDBC Driver Unsupported data conversion

I always forget about this until I start working with ColdFusion and MSSQL again.  You're plugging along, and suddenly a page that was previously working starts throwing an error:

Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver]Unsupported data conversion.

Relax, your code is (likely) fine.  This typically happens when you add a column to your table and use "SELECT *" in the query.  Somewhere along the line the list of columns is cached and since the list of columns you're selecting in the query hasn't changed ColdFusion chokes when what it receives doesn't match what it expects.

The fix couldn't be simpler – just toss a semi-colon at the end of your CFQUERY and watch your problems go away.  If you make another change just remove the semi-colon.

So a query that looks like this:

<CFQUERY NAME="qryUsers" DATASOURCE="dsn">
	SELECT * FROM users
</CFQUERY>

Becomes:

<CFQUERY NAME="qryUsers" DATASOURCE="dsn">
	SELECT * FROM users;
</CFQUERY>

I fully expect that I'll be stumbling across this page in 6 months.

Merge Structs in ColdFusion

Another helper function for ColdFusion, this one to replicate PHP's array_merge which allows you to merge multiple arrays. In this case I'm only concerned with associative arrays, which ColdFusion calls structs.

CFMX provides StructAppend which will merge two (and only two) structures, optionally overwriting keys. I always want to overwrite keys, and I want to merge unlimited structures.

<cfscript>
function struct_merge() {
	var base = {};
	var i = 1;
 
	for( i = 1; i LTE ArrayLen(arguments); i=i+1 ) {
		if( IsStruct(arguments[i]) ) {
			StructAppend(base, arguments[i], true);
		}
	}
	return base;
}
</cfscript>

Usage

<cfscript>
one = {
	a = "a",
	b = "b",
	c = "c",
	d = "d",
	e = "e"
};
 
two = {
	1 = "one",
	2 = "two",
	3 = "three",
	4 = "four",
	a = "one_SetByTwo",
	c = "three_SetByTwo"
};
 
three = {
	a = "one_SetByThree",
	2 = "b_SetByThree"
};
 
new = struct_merge(one, two, three);
</cfscript>
<cfdump var=#new#>

Result:


© 2007-2012, Corey Gilmore | Posts RSS Feed | Comments RSS Feed | Contact

 

The views expressed on these pages are mine alone and not those of any past or present employer. All information presented on this site was obtained lawfully and not through disclosure under the terms of an NDA.