FlashSim Blog

Equipment simulations, Flash, state machines, and personal observations

Measuring Engagement

Thanks to the folks at Unisfair via Twitter, I just saw a very nice blog post about developing metrics for engagement of social media: http://econsultancy.com/blog/4887-35-social-media-kpis-to-help-measure-engagement.  As my focus is on ‘product engagement’, I have been thinking about how that fits into other activities that express a viewer’s/user’s interest level.

Joerg from Unisfair mentions the Unisfair Engagement Index, an attempt to measure engagement in virtual events–another  interesting concept.  It seems like a useful endeavor to focus on a grouping of interaction opportunities — like a virtual trade show — and then distill the engaging elements.

November 6, 2009 Posted by jonkaye | virtual trade show | | No Comments Yet

Embarking on Adventures in Flex Multipage Printing

For my CommandSim project, we have a new Flex application in a late alpha stage that requires multipage DataGrid printing.  Of course I am using PrintDataGrid, but as I am finding out around the Internet, Flex still has a way to go in making this work properly for complex forms.

In our situation, we create an ArrayCollection for the data, then set the dataProvider of the PrintDataGrid to the collection, and then have our form pull out relevant stuff in a variable-sized row.  We also have a form that has a page number and header and footer things.  It almost looks like it is working, but invariably the last one or two rows of the grid either get cut off or consumed.  I would say it is a page size thing except the header and footer print properly, it’s just something to do with the PrintDataGrid getting overly ambitious about stuffing more rows than will fit into the page.

Therefore, I tried to change the height of the PrintDataGrid (usually it is set to fill both height and width of the page), but reducing the height results in some wacky results (1st page ok, 2nd page the whole grid offset to the left of the page — very bizarre!).

In my internet search for help, I found a bunch of complaints regarding PrintDataGrid, and two packages/components that tried to help:

1. FlexReport – Looks interesting, but they say it is for “non-critical” applications.  Mine is not critical, but I need it to work!  I tried their example, and it looked good in the preview pane but didn’t print out correctly on my printer.  I thought maybe it was sized for A4 paper, so I tried printing like that, but I didn’t get the right results.  I didn’t want to mess with it further, given all the caveats in the documentation.

2. BentBit Report – This said it was going to save a lot of frustration, and it’s nice that they give you the component to try.  It costs $400, but I’m all for it if it can save my rear.  I really need to see more examples — they have only 1, though 3 are listed (the link is to only 1 of them).  Also, the web site is not well structured, as the FAQ talks about something completely different.  I contacted support yesterday through email, but have not received a response.  If you’re out there, BentBit people, please let me know!

Anyway, my current thought is to try to mock-up the page using a DataGrid, then set the dataProvider of the PrintDataGrid to the dataProvider of the DataGrid — maybe my problem has to do with me trying to bind variables in the PrintDataGrid based on the info packed in from the array collection.  Who knows…I will post as I continue to try things out!

[11-04-09 Update:

I thought I would go back to basics and make a PrintDataGrid that mirrored a DataGrid exactly — just have a single column, and then stuff all the text into each row, then assign the dataProvider from the DataGrid to the PrintDataGrid.  After all, that is how the included examples seem to suggest it should work.  After some time, I found it was still clipping rows at the end of the page.  I felt like I was almost there — I could use verticalScrollPosition to back up one row on the next page, but there was no way to change the rowCount on the current page to leave the last one off.  Argh!

Anyway, as luck would have it, I made contact with the BentBit folks and we’re working something out now.  Yay!  I am very encouraged.  Still, I’m extremely surprised that this part of Flex is so weak — hopefully it will get some attention in Flash Builder 4.

October 23, 2009 Posted by jonkaye | Flex | | No Comments Yet

Revisiting Git thanks to Scott Chacon and O’Reilly

I just watched Scott Chacon’s excellent video introduction to basic Git functionality: http://video.linuxfoundation.org/video/1516.  The audio was a bit tough to take, but it was free, and the content was so good that the audio didn’t bother me too much.  There are many excellent resources on git-scm.org, home of Git, but for whatever reason I didn’t find anything as straightforward as what Scott has done.  Admittedly, I probably didn’t try to hard, rather I just dove in and then became confused.  The video introduces a bunch of concepts along with the commands, and that helped a lot in terms of orienatation to functionality.

To help me in the future, I made a list of the various commands I think I will be using once I get more into modifying the code of my projects that are now in repositories.  Sorry for the brief explanations but perhaps the list can be useful to you as well (and I’m nervous about just leaving it on my hard drive and then forgetting where I put it, not that that ever happens to me :-) !).

git clone <git repo> – creates a git repo in current directory from the git repo id. If you clone, creates a remote called origin by default
git init – creates a new git repo in the current directory

git branch <new branch>
git checkout <branch> – switch to branch
git checkout -b <branch> – creates new branch and switches to it
git branch -v – shows last commit on each branch

gitk – visually shows branches
gitk –all

git commit -am ‘commit message here’ – does staging and committing in one shot
git add file – adds file to repo, or stages it if already there

git status – shows status of current repo
git log – shows log of commits
git diff – what changed between last commit and current
git add –p

git config –global <x> (for changing global values)
git config –list (for listing environment values)

git merge <branch> – Merges branch with current branch
git branch -d <branch> – removes a branch

git branch <new branch> <old branch> – creates a branch from old branch. You can use id from git log as old branch to identify branch point

git remote add <remote name> <remote code> – specifies a new remote location given by name and code
git push <remote name> <branch name> – pushes the branch to the remote location
git remote -v – lists the remotes for the repo
git fetch <origin> – gets the repo from the origin (remote) as a local branch (not override, like pull)

git log <branch> –not <other branch> – show a log of what is in branch but not in other branch
git log –stat <branch> –not <other branch> – shows log of specific lines in changes

git blame – lets you see who modified a line last

git bisect – awesome tool to help figure out where error introduced
git bisect good <commit point sha> – that point it was good
git bisect reset – resets to where you were before bisect process
git bisect bad – current point was bad
git bisect start – starts bisect by checking out middle commit, which you can test and then say good or bad

[Update: this wasn't part of the video, but a very useful command for people like me who rush to commit only after realizing I forgot to add a new file: git reset --soft HEAD^ - undoes the most recent commit, ready for me to add the right files and re-commit]

I also found this great resource from github.com: http://learn.github.com/

September 11, 2009 Posted by jonkaye | Git | | No Comments Yet

Latest AS3 state engine on new area in Google Code

I’ve been plugging away on my AS3 state engine, and with a side-trip through repo-learning land, I think  I finally am at a point I can return to the work that I get paid for :-) !.

In any event, I messed up a Google Code project in my Git experiment, so the new home for the AS3 state engine is http://code.google.com/p/flash-state-engine.  I created a simple example to demonstrate it, a digital watch.  I will add more examples as time goes on.  Thanks to Zjnue Brzavi for his help in combing through the code to reveal bugs that demonstrate I shouldn’t be coding/developing too late at night.  He is developing a haXe port, though as I re-implemented the engine in AS3, I also have been mucking around with the API–sorry, Zjnue!

August 17, 2009 Posted by jonkaye | AS 3.0, Google Code, State Machines | | No Comments Yet

Moving back into Subversion

Over the past few days, I’ve been struggling to get a simple process for converting my Git repo into an SVN repo for upload/changes to Google Code.  In spite of the artices I mentioned, it was a real struggle and I’m just not ready to spend the time to figure it all out — I give up, Google Code, I am going back to Subversion / Tortoise.  Of course the latter is a very nice tool/environment, but it just works so well with Google Code that I can’t justify more time in trying to finagle Git and Google Code to cooperate.  Also, my repo is pretty small, so maybe in a few months when I’ve forgotten the pain over the last few days, I’ll take another shot.

August 17, 2009 Posted by jonkaye | Git, Google Code | | 1 Comment

A few nice resources that helped me get started with Git and Google Code

I thought I would be pretty trendy and use Git for my Google Code project, though reading a bit through the Google Code docs tells me that SVN still reigns (some docs are old, though).

I originally had installed Cygwin on my Windows machine to use with Git, but I saw that msysgit makes the process easier, and of course I prefer easier.  I am a bit concerned that when setting up Git, I chose the Windows options, and I don’t know how that will affect my downloads on non-Windows machines.  A challenge for a later day.

I muddled through my first commit using the GUI provided with msysgit — very nice, lots of buttons to muck about with.  It seems like I got it after one or two tries.  I had created a new folder for my code and documentation, then git init to create the repository.  A few minutes later, with the code in the folders, I made my first commit. Yay!

After I installed Git, I started watching Scott Chacon’s video tutorials.  They gave me a whole new set of commands to play with, which I did through the Git Bash (shell), but comparing those commands with what I could see in the Git GUI, I got a better idea of what I was doing.

Emboldened by the appearance of success (though I still have my doubts), I decided to put my code on GitHub, so everyone who is waiting on the edge of their seat for my code can get access immediately.  The GitHub documentation was pretty gentle, and helped me to commit my code there, only after a few tries.  Through the Git Bash, I tried to create a remote origin and then push my stuff, but I kept getting GitHub to hang up on my process.  Then I saw I had to give GitHub my public RSA key, which is probably why it kept hanging up on me.  I could generate the key through Git Bash, then set it to the account.  I’m not sure if I have to make a new key for each repository, but again, not my problem right now.  A few more minutes later and the sweet smell of success!

Now I’m off to see how to synchronize GitHub with Google Code, or at least my local Git reposity with my Google Code repository.  I found an article from last year about this, “Develop with Git on a Google Code Project“.  Stay tuned…

[Update, 4PM]

Trying to follow the article above (Develop with Git on a…), I got frustrated for two reasons.  First, because of the ambiguity I thought in the line:

First we perform the equivalent of a svn checkout. In an empty subdirectory, run:

$ git svn clone --username your-name -s https://your-project.googlecode.com/svn

Which username, the one for Google Code or the one for Git?  It was pretty obviously the Google Code username, no problem.  But “in an empty subdirectory”?  Subdirectory of my Git repository?  Any folder?  Again, trying to remain calm, I figured a subdirectory of my repository.  So I created one, then I changed into it.  Finally, I was ready:

git svn clone  --username myname https://flashsim-state-engine.googlecode.com/svn

Argh!  Unexpected errors after it created the clone.  I spent the next 45 minutes clearing things out (couldn’t find a Git command for removing a clone, so the ol’ rm seemed to work in the end).  Nothing doing, I was almost ready to give up.  Once it looked like it was working, it would ask for my password.  Which password?  I found the password on Google Code, Profile, Settings.  Great!  But I was still getting problems.

Time to search for more help on Google.  I came across this article, by digitaleagle,  regarding trying to get Git and Google Code to work together.  I was very grateful the blogger had put a transcript of commands, so I could verify I was creating the right subdirectory.

Second issue I had–it then dawned on me that my code project is at “flashsim-state-engines”, not “flashsim-state-engine”.  When I repeated the steps, voila!

So apparently I have my code now on Google Code and on GitHub.  I see in Git GUI there is a place for a remote push — I wonder if I can hook it up right through the GUI (that would be nice).  I’m not betting on it because it doesn’t seem to ask for all the info that was explained.

[Update, 4:45]

Seemed like it was uploading stuff, but on my Google Code page there is nothing.  Bummer.  I also saw this follow-up article to one of the previous articles, and it got the uploads started, but I don’t see anything in my Google Code page.

[Update, 5:30]

In a true Homer Simpson moment, I realized what the problem was.  I had set my Google Code to use Mercurial versioning, since the comment there said it was for systems like Git.  All this time making a subversion-compatible upload, I didn’t think I would have to set the versioning to Subversion.  Needless to say, when I switched the option over to Subversion (in the Administer tab), I saw my code in all its glory.  Yay!

August 10, 2009 Posted by jonkaye | Git, Google Code | | No Comments Yet

Packaging my Hierarchical State Machine implementation for AS 3.0

It has been a long time in coming, but I am finally getting ready to release our alpha version of our hierarchical state machine for Flash ActionScript 3.0!

I will be writing blog entries over the next few weeks as I document my path to release.  It hasn’t been hard to organize things, but I’ve certainly benefitted from finding blog posts about installing or doing this or that.

To begin the process, I created a Google Code project here.  I had to choose a version control system for the code, so I chose Git.  I was using Tortoise SVN for other projects, but I have heard good things about Git, and the idea of allowing others to fork projects without creating a whole new project was really intriguing to me.  I have only had mild encounters with Flex, but I certainly believe that one of the great values in making a state machine implementation is going to be integrating the engine into Flex.  However, I’m not the guy to do it well.  Therefore, I’m trying to appeal to others who are more familiar to create a Flex fork, perhaps, or maybe haXe, and allow these other projects to influence where I might go with the AS3 implementation.  The wonderful thing about not understanding all of this is that I am not limited to what the things actually do, only what I believe they should do :-) !

I have been developing the AS3 code in FlashDevelop, which is wonderful (needless to say).  While of course I have Flash CS4, on my kick-ass iCore 7 Vista machine, the ActionScript editor inside Flash becomes painfully slow with only 1 or 2 pages of code, especially when I start typing things inside quotation marks.  I’m now cleaning up the comments and generating the documentation via ASDoc.  FlashDevelop has a command to initiate ASDoc, you just have to provide a few key pieces of information.  For example, for AS 3, FlashDevelop requires you to specify where asdoc.exe resides.  I have Flex Builder and the Flex SDK, so it was simple to navigate over to the sdk/ folder, find the latest version (3.3), and point to it inside the bin/ folder.

The Adobe Flex docs are pretty good for helping to understand the tags for ASDoc.

August 8, 2009 Posted by jonkaye | AS 3.0, FlashDevelop, Git, Google Code, State Machines | | No Comments Yet

Dispatching custom event in handler for other event [AS3]

I’ve been struggling with an issue that I can’t seem to understand, but I found a workaround so I have to move on.  Maybe someone out there will have a better grasp of what is going on.

In my event handler for a Timer object, I dispatch a custom event, but not the event that came into the handler.  To try to save some space, since my custom event could be called a lot of times, I keep a single copy of the event in my custom class.  Here is my Timer object event handler:

   private function timerElapsed (ev:Event) : void {
      dispatchEvent(pulseEvent);
   }

In the initialization of my class, I create the pulseEvent object:

   internal var pulseEvent:EventWithData;
   ...
   pulseEvent =  new EventWithData(PulseActivity.TICK, false, false, customData);

When I run the code, the pulseEvent is sent along fine the FIRST time.  The second and subsequent times, Flash sends a different event which does not have the custom data.

This led me to suspect something to do with clone(), judging from the AS3 documentation:

Returns a new Event object that is a copy of the original instance of the Event object. You do not normally call clone(); the EventDispatcher class calls it automatically when you redispatch an event—that is, when you call dispatchEvent(event) from a handler that is handling event.

The new Event object includes all the properties of the original.

When creating your own custom Event class, you must override the inherited Event.clone() method in order for it to duplicate the properties of your custom class. If you do not set all the properties that you add in your event subclass, those properties will not have the correct values when listeners handle the redispatched event.

The odd part in this is that I’m not redispatching the event coming in — I’m dispatching a different event (the one I’ve created and stored in the custom class).  I suspect somehow my new event dispatch is getting caught up in this and Flash is cloning the event, but since I didn’t create an override (lazy me) for clone, I’m paying the price.

Rather than going this route, I realized I don’t really need my custom Event class, rather, I can use Event and use the target property (ev.target) to get to the object dispatching the event, then make a property off that class to store the custom info I want (Whew!).  I am a bit unsettled with all the potential cloning going on, but I am under a deadline so I will have to revisit it in the future (which could be way in the future).  I hate these kinds of loose ends!

[8/6/09 Update, 14:20.  Yes, it turned out to be the clone issue.  When I correctly added a clone override, the original code worked.  I think this means that the space I'm trying to save is not working because clone gets invoked to create a new event.  Oh, well, can't say I didn't try.  If I see a problem regarding the load, maybe I will try to address it again in the future]

August 6, 2009 Posted by jonkaye | AS 3.0 | | No Comments Yet

Critiquing “Instrument maker invests in 3-D demos”

I just recently saw an article by Karen Bannan at B2B-Online entitled “Instrument maker invests in 3-D demos“.  It is great to see the word getting out regarding the success that companies are having who recognize the investment in online product demos.  The article presents some of the typical argument for going this route, such as cost and logistics savings.  The important parts are clearly that this company, Malvern Instruments, is

  • Reaching many more people than it could ordinarily do so with demo units
  • Helping customers understand a sophisticated device in an easy way
  • Seeing that prospects/customers are using the online demos to gain confidence in the purchase
  • Saving a lot of money.

Regarding the particulars, Malvern Instruments is using a 3-D modeling software from Kaon Interactive, but I don’t believe the results are necessarily special to that software.  When I visited Kaon’s web site, they have demos of 3-D renderings of products, but as far as I could tell, little real interaction apart from zoom, pan, and rotate.  So much more so, then, the arguments should be for demos in which prospects, customers, and salespeople can really try out the product, in a simulated real environment.

The article barely scratches the surface about what is possible, for example, the enhanced tracking and user behavior monitoring possibilities that can help companies understand how prospects are evaluating their products.  Nonetheless, It’s always good to see these kinds of stories because ultimately companies considering going this route want to know there are real results.

August 4, 2009 Posted by jonkaye | General Interest, effective sim applications, sim marketing, virtual trade show | | No Comments Yet

Flash Builder 4 inline syntax for states looks slick but encourages bad behavior

I’ve been gearing up to dive into Flash Builder 4 and have read a couple of articles  about its new features.  One that caught my attention was a new, inline syntax for referring to states, e.g., <s:Button label.A="Button" label.B="State B" includeIn="A,B" />, to switch the label for the button depending on the current state (A or B).  As Jon Rose explains it:

The legacy state syntax in Flex 3 required components and properties to be modified within the state block. This was out-of-context, often verbose, and frequently confusing. Flex 4 introduces a new inline syntax that is both flexible and terse.

Not to single out Jon, because I saw it in other articles as well, but it points to a lack of understanding of one of the strengths of a state-based approach: all the code for a state is contained in the same location, and hence it is much easier for the developer to understand what the application does in that state.  The new, inline syntax for states allows developers to sprinkle behavior related to different states on the same element, which means if one wants to understand the overall behavior of a state, one has to examine all the potential elements.

I was particularly struck by Jon’s comment that because “Flex 3 required components and properties to be modified within the state block”, it was “out-of-context” and “frequently confusing”.  That sounds strange to me, because requiring changes to be enclosed in the state block actually is the correct context, namely things that happen in that state, where one looks for information about how that state behaves!

Admittedly, I have not really worked in Flex 3 or Flex 4 (yet), but I believe the concept of states should transcend the development platform.  Therefore, I have to give a ‘thumbs down’ to this new inline syntax for states.

July 22, 2009 Posted by jonkaye | Flash Builder 4, State Machines | | 4 Comments