SQLite and AIR apps with Cairngorm

Having never done any SQLite stuff prior to the session survey, building it was a definite learning experience.

The hardest part of building with SQLite I think, is working with existing data. Writing data for later retrieval, cake. retrieving "offline" data, that was a bit more labor.

To start, populating the SQLite DB, isn't fun. I bought an off the shelve tool, SQLite Manager, that I like a whole lot. It supports SQLlite 2 and 3.

I'm not sure, but I'm guessing it's the nature of SQLite files, that once you've created the table and started working with it, making changes to structure, ain't possible.

I suppose since it's a flat file of some sort, making structure changes once populated, wouldn't be possible, but still a pisser. LOL.

Make sure when you create your "offline" tables, you know what you want.

For the survey app, we needed users to be able to still pick a track, and still pick a session from that track.

 

Tom and I ended up making our Cairngorm commands dual prupose. Getting on and off line data. Detecting whether the user is connected as a simple matter of implementing a URLMonitor to ping our site.

The command, looks for our global "am I online" var, and if we're not online, executes the SQLite functionality.

 

In order to make the commands as loosely coupled (for lack of a better term) to being on or off-line, we made the SQL result handler, call the command's normal result. From there the result() looks to see what type of result it's getting, since delegate sends a different type of result Object, than the SQL connection does. From there, it's a matter of formatting the data and storing it.

Our execute() looks like

if (model.networkConnection)
            {
                var delegate:SurveyDelegate = new SurveyDelegate(this);
           
                delegate.getTracks();
            } else {
                var connection:SQLConnection = new SQLConnection();
                var dbFileString : String = "360Survey.sqlite";
               
                var dbFile = File.applicationDirectory.resolvePath(dbFileString);
               
                connection.open(dbFile);
                var sqlQuery:String = "SELECT trackID, trackTitle, trackShortName FROM tbl_tracks";
                dbStatement.sqlConnection = connection;
                dbStatement.text = sqlQuery;
   
                dbStatement.addEventListener(SQLEvent.RESULT, onRetrieveDataResult);
                dbStatement.addEventListener(SQLErrorEvent.ERROR, onDBError);
   
                dbStatement.execute();
               
               
            }

Then the result() does the "what did I just get" logic.

public function result(data:Object):void
{
    trace('[GetTracksCommand] - Result');
    var resultData:ArrayCollection = new ArrayCollection();
    var tmpAC:ArrayCollection = new ArrayCollection();
        
    if (data.hasOwnProperty("result")) {
        resultData = data.result;
        } else {
            resultData = new ArrayCollection(data.data);
        }

I was a bit worried that it would be harder to build a connection aware application, especially since Tom and I didn't really start writing code, until about 2 weeks out from Atlanta. There's still a few things to re-factor in the code, and get cleaned up, but I think when we put this app out into the Open Source domain, other conferences will be able to easily modify it to their needs, they'll need a CF backend, unless they want to replace the CFCs with .NET, PHP or Java whatever, but hey, it'll be a starting place.

 

 

 

 

salarymap.com a google maps mashup

Google is so fun to mash up. Well I assume it is, folks sure like making cool mashups with map data in them. Including my pal Tom (not this Tom). He created SalaryMap, so that people (IT Folks primarily, I think) could see what the salary playing field looked like.

It's a cool idea, and quite informative. Take a look, post your info, if you're up for it.

 

Time for some change

My (albeit) short tenure with Quovadx is coming to a close. This coming week is my final week there, before I start a new role at a new company, in a new town (sorta).

I've decided to join Xylem CCI as a Senior Software Engineer (feels like I'll be launching Space Shuttles or something). I'll be doing CF still, and Flex (hopefully more Flex than I did at Quovadx, that was a shame). I'll also be helping bolster CCI's efforts in the community building and evangelism space, which was really what swayed me in their direction.

360Conferences is very important to me, and our goal is my goal, so CCI taking an interest in that, was very important to me.

So Monday the 25th, I'll be light railing my a$$ up to Denver. I've worked in Denver once before and really enjoyed it, especially in the spring and summer, when every one is out. the people watching is excellent.

 

Wish me luck!

 

(it would seem my brain was a little disconnected. I work for Xylem, CCI, not Zylem CCI, and I added a link.)

My Dev setup

In reading a post recently on Universal Mind's blog about getting FDS installed on a mac, it occured to me, i should post my set up, not only for my reference in the future, but in case anyone is wondering how to do CF and Flex on a mac.

I followed the Definitive guide, with a lot of help from Sim, to get jrun and CF installed. I run MySQL for my database because... well Microsoft isn't sharing the M$ SQL love with the mac users of the world :( For my "enterprise manager" I use Navicat. Not free, but worth the price. Great app. Truth be told, I now wish all my prod DBs were MySQL so I wouldn't have to fire up Parallels to do prod DB work. Kinda sucks.

I moved from VSS while still on the PC, favoring now, subversion. Love it! It's great, my apps are source controlled off site so I can get them when needed (I do maintain local backups just in case) but I can check code out on the mac, or when using Parallels/XP, there as well.

I run Mac dreamweaver because I wrote a review of Studio, which had Mac and PC licenses. I don't think I'd buy it. Of course I use FlexBuilder 2.0.1 also. in stand a lone mode with CFEclipse (Truly great, get it, now, do it.), Subclipse, and JSEclipse installed as plugins. It's a great environment.

Back to Subversion (SVN). I was using zigversion, which was great, but didn't support the latest SVN release, and was not in the least bit, feature rich. Not their fault, and it's free. I did some googlin' and found SmartSVN. I haven't ponied up for the advanced features yet, the free ones being enough, but I probably will.

I also use ServiceCapture so I can see what CF is saying to Flex, which helps a lot sometimes.

I was using Lingon for my servers, but (again with Sim's influence) I moved to jsut doing it command line. I use iTerm and set bookmarks to the stop and start command of each of my Jrun servers (jmc admin, cfusion, clientcode, FDS, etc...) that way I have a console open and can see what CF is up to, and if need be, restart the service. It's nice and very easy.

So that's pretty much my set up. If I'm reading this because I did a format/fresh install and forgot something, I'm welcome, if you're looking to make the switch to a mac, hopefully this and the links herein help make it less arduous.

Newsletter registration page

Since 360Flex is sold out, I worked up a (soon to go live) registration page for people to sign up  so that we can keep 'em posted on future events, and such. It was my first time using a RemoteObject (Usually use web services) figured I'd try some stuff I hadn't used betore.

With a little guidence from Sim, I was ablet o get my first (simple) RemoteObject set up and running. This is also my first new application using MYsql, since I am trying to ween myself off of M$ products. I don't mis Windows but sure do miss M$ SQL.

Also took advantage of Abdul Qabiz's AS class for getting name value pairs out of the URL. He made it remarkably easy to to pick out vars from the URL.

import com.abdulqabiz.utils.QueryString;

if (qs.parameters.code)
                    subscriberRO.confirmation(qs.parameters.code);

in this case i'm simply looking for the url var 'code' which has the confirmation code from the auto generated email that the user received.

The app should go live tomorrow.

When launching CFMX, don't forget the Sudo

Was trying to checka WSDL today on my mac install of CFMX, and got an AXIS permission denied error. After consulting with Simeon ( i knew it'd be something silly, and it was) i discovered that when using my handy little applescript app, it wasn't firing the shell script off as root. Well duh, that would explain my problem.

After a little poking around, I found this. which said this.

do shell script "command" user name "me" password "mypassword" with administrator privileges

 

I went back to my AppleScript app, made the change, and viola, WSDL loaded just fine. Don't be a Wilker and forget to run things as root.

Simeon pointed out I coulda changed the entire directory to be mine, so it'd all work under my login, but i opted to figure out my as root problem.

 

Now if I could get my MS SQL data to MySQL I'd be in 7th, or probably 8th or 9th heaven

CFMXJrun on the MacBook Pro is (more or less) complete

With much help from Simeon I'm all set with CFMX and jrun on my MBP.

I initially followed (again with some nudges from Simeon) the Definitive guide. And now that I'm done, have gotten adventurous.

The guide calls for using Lingon, which does just fine, except I'd rather not run the servers when I'm writing, surfing the web etc. No need to waste resources when they can be put to other uses :)

Some googling led me to a post from Sean, that (it took me a while to realize this) was almost 3 years old. Before I could even start doing what Sean prescribed (*nix n00b here) I had to learn what a shell script was and how to write one.

That done. I started playing with what Sean described. And then Simeon came to my aide yet again with an example script he uses to fire off servers. He's more of a Command line(r) than I am, so I took that and what Sean described 3 years ago and came up with what's below. It's mostly the same app Sean wrote about, except the command line to fire off CFMX and java are  different.

So to start my servers

[More]

Getting closer to CFMX on my MacBook Pro

In the end I may just stick to parallels, but if nothing else I wouldn't mind having the option to do all my dev directly in OS X.

Thanks to Simeon for pointing out the answer to my first road block. Since then I've gotten jrun compiled, and modded the httpd.conf file. And now I get this in my log file when browsing to any of these addresses.

 

http://localhost/CFIDE/Administrator/index.cfm,

 

http://127.0.0.1:8300/CFIDE/Administrator/index.cfm,

or http://localhost:8300/CFIDE/Administrator/index.cfm


 

 

[Sun Dec 31 18:32:48 2006] [notice] jrApache[9877:52727] could not open "/Applications/JRun4/lib/wsconfig/1/jrunserver.store": Permission denied
[Sun Dec 31 18:32:48 2006] [notice] jrApache[9877:52727] initialized proxy for 127.0.0.1:51020
[Sun Dec 31 18:32:48 2006] [notice] jrApache[9877:52727] Couldn't initialize from remote server, JRun server(s) probably down.
[Sun Dec 31 18:32:48 2006] [notice] jrApache[9877:52727] JRun will not accept request.  Check JRun web server configuration and JRun mappings on JRun server.

 I've made sure my wsconfig.properties and jrunserver.store are both rw-r--r-- and my mod_jrun.so is rwxr-xr-x

Still no love. Thanks also to Scott P for the thoughts on my previous woes.

a road bump in the road to getting CFMX installed on my Macbook Pro

I've been reading Simeon's blog, and followed the definitive guide, and bam road block.

 

When I attempt to compile the jrun connector i get the following error.

gcc -DDARWIN -DUSE_HSREGEX -DUSE_EXPAT -I../lib/expat-lite -g -Os -pipe-DHARD_SERVER_LIMIT=2048 -DEAPI -DSHARED_MODULE -I/usr/include/httpd -w-c mod_jrun.c
i686-apple-darwin8-gcc-4.0.1: mod_jrun.c: No such file or directory
i686-apple-darwin8-gcc-4.0.1: no input files
apxs:Break: Command failed with rc=1

 

I've reinstalled the apple dev tools, re traced my steps. Double checked that the file is present.

No love.

 

 

Time to try leaving Windows for Dev

Normally I do my Web Dev in Windows thanks to Paralels, but I've been thinking it might be time to get CF running in OS X, especially since I am doing more Flex work and can do Flex on the mac, it'd be nice to have it all in the mac OS.

 

I've found the Definitive guide, which looks to be just what I need, we'll see. From what i've read it's pretty straight forward.

 

Wish me luck

The Inland Empire CFUG is back!

Charlie Griefer is getting the band back together so to speak. He's starting up the Inland Empire ColdFusion Users Group (website forthcoming) out in Redlands. I'm glad to see the IE getting UG love again. SoCal in general, for that matter. It seems the OC CFUG doesn't exist, the umbarella SCCFUG is gone, I think LA might still be going, can't recall. It's cool that Charlie is getting it going again.

While I'm no longer in CA, I signed up on the Google Group, you should to! And in January you should be in Redlands for his first meeting.

You go Charlie! Good luck!

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.5.1.