— DevONCode

I recently needed a solution to send SMS messages to customers of a site I run, Binstream, when tasks have been completed. SMS messages would be faster than sending e-mails, since in this day and age, everyone seems to have his or her cell phone available at any given moment.

Read More

I came across something that really caught my eye a few months ago. The Apple iPhone stores GPS data for each image it takes in it’s EXIF data. Grabbing this data is extremely easy, so easy that it raised a few security concerns for me.

More information and code after the jump.

Read More

Just a quick blog post here.

I recently ran across Lets Be Trends, a service that allows you to cURL the service and receive a JSON version of the top ten trends on Twitter. I wanted to flex some more jQuery, so I put together Trends.

I wanted to do each div as using:

$(".container").mouseover( function() {
        $(this).find(".content").slideDown(500);
}).mouseleave( function() {
        $(this).find(".content").slideUp(500);
    });

which caused it to cause this horrible laggy effect.
Thanks to Matt Campbell, I was introducted to jQuery UI, specifically the accordion. Outstanding.

Read More

I have updated Portable Eclipse.

Changelog:

  • Upgraded Eclipse to 3.5 (Still without Java EE parts)
  • Upgraded JDK from 6u14 to 6u16

Click the button at the top of the page for [Portable Eclipse] to download

Read More

At my job, I was tasked to create a “quick demo” for a “social portal” of sorts for alumni students of a university. The emphasis on the workorder is “quick” .. as the client is only being billed for a demo, not a full site.

For me, this meant limited OO design. So when it came to database operations, there wasn’t going to be any ADO or PDO libraries involved.. just mysql_* being called directly. But, “Demo” or not, I still prefer to use parameterized queries, as a basic security measure against SQL injection-related attacks.

So here’s a quick way to do this, without a 3rd party library…

Read More

I am extremely excited about Moblin, a Linux Foundation-supported Netbook distribution. I can sit here and be long-winded and describe everything about the distro, but I think this video will suffice:

I decided to go ahead and try it on my laptop. Even though that the distro is built to be used on netbooks with Intel Atom processors, I figured I’d give it  a whirl. I became disappointed when the first message displayed by the kernel was:

microcode: no support for this CPU vendor

On the Moblin website, it says that netbooks and laptops are supported as long as the processor supports SSE3. My laptop runs an AMD 64-bit Dual Core processor and does have SSE3 support.  I suppose that either support for non-Atom processors or AMD processors is not compiled into the kernel. Now, I must resist the temptation for buying a netbook.

Read More

Earlier this week I had the task of building an installer for a Smartphone Emulator at work.  I had never forayed into the design of MSI installers, which was required for it,  and only really had experience with NSIS. In order to actually build the MSI, I decided to use the Windows Install XML (WiX) toolset. I figured that it would be right up my alley since I am already familiar with XML.

So, I packed all of the required files into a cabinet and threw together a quick 59 line XML file to be parsed. The way that WiX pretty much works is that you run the .wxs file through a parser called candle.exe and run the file that is generated through light.exe. Light will then package together a working Microsoft Installer.

I happily ran through the hoops, ironed out a few error messages I got when either candle or light ran, and had a brand new MSI file.

However, when I ran it I got this monstrosity of an error message:

[code]

Property(C): PrimaryVolumeSpaceRemaining = 0
Property(C): INSTALLLEVEL = 1
=== Logging stopped: 6/10/2009  23:31:48 ===
MSI (c) (BC:98) [23:31:48:250]: Note: 1: 1708
MSI (c) (BC:98) [23:31:48:250]: Note: 1: 2262 2: Error 3: -2147287038
MSI (c) (BC:98) [23:31:48:250]: Note: 1: 2262 2: Error 3: -2147287038
MSI (c) (BC:98) [23:31:48:250]: Product: COMPANY_NAME Smartphone Emulator 1.0 -- Installation failed.

MSI (c) (BC:98) [23:31:48:250]: Grabbed execution mutex.
MSI (c) (BC:98) [23:31:48:250]: Cleaning up uninstalled install packages, if any exist
MSI (c) (BC:98) [23:31:48:250]: MainEngineThread is returning 1603
=== Verbose logging stopped: 6/10/2009  23:31:48 ===
[/code]

The full error log is here. The error message that I’m actually referring to is: “Error 3: -2147287038.” Through Google, I found that it actually means “Stream Not Available.” What stream isn’t available though or what is causing the error to appear?

Read More

Recursion is a dieing art. When it comes to iteration, loops are the king. Between while loops, do…while loops, for loops, and for…in loops, there is no real need for recursion. Also, unlike recursion, loops are independent of the stack size. In fact, some of the popular functional languages will convert a tail-optimized recursion into a loop.


However, recursion is still one of the best ways to write algorithms. Recursive algorithms are usually more readable than those that employ loops.


Here is one of the most popular recursion examples, the factorial function:

[code lang="javascript"]
function factorial(number, value) {
  if (number === 0) {
    return value;
  }
  return factorial(number-1,value*number);
}
[/code]

The key necessity in recursion is, of course, the ability for the function to reference itself. This works fine for regular functions, but what about anonymous functions?


Earlier today I ran into a little gem: arguments.callee. This allows a function to reference itself regardless of its name (even if it doesn’t have one).


Now, I can’t think of any really useful applications for this, but in case you ever wanted to assign the factorial of 5 to a variable without keeping the function in memory …

[code lang="javascript"]
var n = (function(x,y) {
  if (x === 0) {
    return y;
  }
  return arguments.callee(x-1,y*x);
}(5,1));

// n is now 120
[/code]
Read More

Well, I figure I might as well start this off right!

I’m going to be honest. I love Eclipse so much that I probably swear by it. The problem is that I use multiple computers daily. This probably averages about three or four per day. Sure, I can use Subversion to move my files around with me, and run an update at each computer. But to tell you the truth, I’d rather not.

So, I decided to look for a Portable Eclipse, a la PortableApps.com. To my dismay, the developer had not created a portable version of Eclipse. I decided to do it myself.

Introducing PortableEclipse!

Includes:

  • Eclipse 3.4.2 For Java Developers (sans Java EE parts)
  • Sun JDK 1.6 Update 14
  • VirtualSwing 0.9.12.I20090527-2200

Download Now

Simply run the installer, point it to a directory (e.g. thumb drive) and the self-extractor will create a folder named Eclipse. Simply run Eclipse.exe. By default, the workbench is \Eclipse\Workbench. You can change this if you want to, but it forces you to carry your workbench around with you.

Please let me know if there are any bugs that you find or any plug-ins you think should be added.

Read More