February 28, 2005

Forcing Java CFX Reload in ColdFusion

I've been working on extending CF with a few Java utilities and came across a rather frustrating problem. Whenever I need to test a change in the CFX I have to restart the CF application server. Using ColdFusion MX 7, this process can take up to half a minute.....not the ideal development scenario.

So I discovered an attribute that I had read about in the past but have never put it to work. The attribute is called "reload" and I set the value to "always". Therefore the call to the custom tag looks like:

<CFX_WEATHER zip="75214" reload="always">

This should only be done in a development environment as there is performance degradation in loading the class each time. Once you go to a production environment be sure to remove the attribute which will default to auto. This means the class will only be reloaded if it or a dependent class is changed.

Posted by dennis baldwin at 11:34 PM | Comments (0)

February 22, 2005

Long Dates with Flash and ColdFusion

Dealing with dates can be a frustrating task when developing certain applications. After working with Web Services that return dates as long integers, I've had no problem handling them with Flash. Take the value 1109129227359 as an example. This is the number of milliseonds that have elapsed since midnight on 1/1/1970. The following code in Flash:

trace(new Date(1109129227359));

will print:

Tue Feb 22 21:27:07 GMT-0600 2005

So it's fairly simple to handle these long values returned from a Web Service or any other service for that matter. With ColdFusion this is a different story. I never had to deal with long integers in ColdFusion, but didn't find any functions readily available to use. I tried createdate, createdatetime, parsedate, parsedatetime all with no luck. Finally I tried calling:


#isdate(1109129227359)#

which printed "NO" and left me confused. After some further investigation I decided to try a little math and add the number of seconds that elapsed to 1/1/70. Which led to the following code:

<cfset variables.temp = 1109129227359/1000 />
<cfoutput>
#DateAdd("s", variables.temp, "January 1 1970 00:00:00")#
</cfoutput>

Lo and behold! This worked like a champ but notice how I had to convert from milliseconds to seconds. For some reason CF didn't support adding milliseconds even though the docs say there's support for it: click here.

At some point I'd like to dig into this further but you know the saying, if it ain't broke....

Posted by dennis baldwin at 09:35 PM | Comments (0)

February 20, 2005

M2M Blog = Machine Blog

If you're interested in learning about M2M or following what's going on in the space, check out MachineBlog. I just released the site this past week and am working with a few co-workers and associates to provide up-to-date information on the M2M industry. We'll be looking at M2M from all different angles including:

1. Software development (that's my area of expertise)
2. Hardware
3. Carriers and gateways
4. Backend applications such as SensorLogic's M2M Portal
5. System integration

If you feel that you have something to contribute to MachineBlog then please get in touch with me.

Posted by dennis baldwin at 09:39 PM | Comments (0)

Nokia and Macromedia Join Forces

Nokia and Macromedia have teamed up to provide Macromedia Flash content on Series 60 devices. I can't explain how excited this makes me! I've had a good amount of experience developing applications for Series 60 written in Symbian C++. Let me be the first to say that this isn't for the weak at heart. I've spent hour after hour trying to figure out how to develop a rich user interface in Symbian and fell short many a time. This led to total frustration.

Now let me get excited again. Leveraging Macromedia Flash and more than a million Flash developers is the right move for both Nokia and Macromedia. I think this will lead to incredible digital experiences in the coming months. Yet these experiences won't come to the desktop but right in the palm of your hand! As an application developer I believe this will lead to much more fierce competition. With this competition comes higher quality applications and the end user will ultimately benefit. Stay tuned for more mobile contentas well as some mobile Flash source code (Flash Lite to be exact).

Posted by dennis baldwin at 10:03 AM | Comments (0)

February 10, 2005

ColdFusion MX 7 Reporting Using CFDOCUMENT

It's late but I couldn't resist blogging about ColdFusion MX 7, which was finally released two days ago. First off, ColdFusion has come a LONG way since the 4.0 days. That's when I fell in love with the technology and never looked back. You see I work in a shop of hardcore Java developers, the best in the business and I'm sure they think I'm crazy when I start talking about ColdFusion. I'm sure you've had the conversation as well. If you ask any serious Java developer they'll most likely laugh at CF.

My point is not that CF is better than Java because it runs on a Java engine and CFML compiles down to Java bytecode. Anyway, I would like to stress how Macromedia has done an amazing job with the latest version allowing developers to generate reports with the greatest of ease.

So I wanted to take a quick look at one piece of the reporting functionality in CFMX 7. I want to walk you through the steps of creating a static PDF using HTML wrapped up in the CFDOCUMENT tag. So your general CFML will look like the following:

This simple code will generate the following PDF:

Note that I'm using the free developer edition which is stamped on all the reports. I'm not sure to what extent the reporting engine supports HTML as well as CSS. I will be doing some more experiments and post my results here. I can confidently say that you won't find an easier way to generate reports with any other technology. The crazy thing is that I haven't even started talking about the CF report builder which is a WYSIWYG tool for creating report templates. More on that later!

Posted by dennis baldwin at 12:50 AM | Comments (0)

February 06, 2005

Bluetooth GPS for Symbian = BlueGPS

The more I think about M2M I start to realize that there are so many examples of M2M in our daily lives without noticing them. Last night I was thinking about this application I developed 6 months ago and started realizing that it's an M2M application.

The application is called BlueGPS and runs on Symbian UIQ devices. This includes devices such as the Sony Ericsson P800/P900/P910. Motorola has a UIQ device as well. Anyway, I developed this app in my spare time because I was very interested in Bluetooth and GPS. The basic concept is that the phone discovers the Bluetooth GPS receiver, in my case this is a Belkin, and then starts communicating with it. The user interface on the phone then updates with the current lat, lon, speed, and direction. It also has the ability to upload GPS data to a remote server which can then be used for further processing, ie mapping and creating routes.

At the time of this blog entry I've received over 7,500 downloads from Handango and all sorts of requests for improvements. I'm thinking about porting it to J2ME for the phones that support JSR 82 because it will be much easier for me to develop and maintain! If you're interested in helping beta test or have suggestions then please feel free to contact me.

Posted by dennis baldwin at 10:02 AM | Comments (4)

February 02, 2005

What is M2M?

I normally post about Flash and server-side technologies but I'd like to shift focus and talk about device programming a little bit. I actually need to take a bigger step back and mention an acronym that you've probably heard: M2M. If you haven't heard it before I can guarantee you'll hear about it in the coming months. For a good definition of M2M I would suggest checking out this link from M2M Magazine. It boils down to being able to communicate with machines out in the field. These machines consist of vending machines, elevators, oil wells, automobiles, road signs....you name it. Communicating with these machines means getting data from them as well as sending commands down to them.

For example, a vending machine might be programmed to report its inventory at 10:00AM everyday. If the machine is low on Coca Cola then it has the ability to stage a phone call, send a text message, or send an email saying "Hey, I'm low, please fill me up!". If you think of the value proposition in this sort of solution you can realize that the normal approach to filling a vending machine might be:

1. Driver starts daily route
2. Driver stops and every machine and checks its inventory
3. If the machine is low go out to the truck and get Cokes
4. Come back to the machine and fill it up
5. Leave and go to the next machine not knowing if it needs to be filled

Oh yeah, did I mention the gas and wear and tear on the tires from having to carry a fully stocked truck? With an M2M deployment the process could be:

1. Machine calls, emails, or sends text message saying it needs 24 Cokes
2. Driver stocks machine
3. Driver leaves for next machine knowing ahead of time what it needs

Think about how optimized this new approach can be. Integrating GPS into the solution can only add to the value and return on investment. Now the driver can determine the most efficient route and make the most effective use of their time. You might be asking how all of this can be down and let me start by talking about the device side of things.

I recently had the pleasure of writing an article for M2M Magazine that discusses integrating the Nokia 12 module with a GPS receiver. Let me say that this module is incredible and you wouldn't believe the amount of functionality that's built into something the size of a matchbook. This module operates on GSM networks and has access to HTTP, SMS, GPS, I/O, RS232...the list goes on and on. To me the most powerful thing is that you can program using J2ME. You actually develop IMlets, which are a subset of J2ME MIDlets. The programming environment is very intuitive and you can literally be up and running in minutes.

So think about programming this module and embedding it into an automotive application. The module could tie into GPS and periodically check its location and post it to the internet (I'll get to this shortly). It could also be programmed to receive commands that do such things as unlock your car doors or start your car engine (if you're really lazy!). You could have your own miniature OnStar app up and running over the weekend. This assumes that you have some bit of hardware experience since you'll need to interface it with your vehicle!

Now it gets really exciting. You've probably been wondering how to interface with the module. Instead of writing your own web portal application SensorLogic will take care of providing your backend application. Of course I'm plugging SensorLogic because it's where I work and we seriously have the most robust M2M Portal application that you'll find anywhere. Plus we have all the carrier relationships already established so you can deploy over cellular, satellite, pager, etc. You can even communicate over ethernet if necessary.

With the SensorLogic M2M Portal you'll be able to monitor your automobile as well as send commands to tell it to unlock its doors or start its engine. You could even add what we call "Behaviors" that add intelligence to your machine. An example of a behavior would be to have the M2M Portal check the status of the car doors every night after 10:00PM. If they are unlocked then the M2M Portal could automatically lock them for you. Just so you know that this isn't a figment of my imagination check out the screen shot below. This is map interface with 100s of assets deployed. The customer can click on the assets and send commands down to them without ever getting out of their chair!!

The M2M Portal is an incredible application and I will post more about it in the future. I will also try to most more developer related information on the Nokia 12 in the coming weeks. In the meantime, do your M2M research and see what the buzz is all about.

Posted by dennis baldwin at 10:16 PM | Comments (1)