Wednesday, February 23, 2011

Reundo & Redo

Implementing undo is a tricky thing. This release of Gigantt contains a complete rewrite of the undo mechanism and consequently adds support for redo (the opposite of undo).

Undo & redo are very similar to back & forward in a browser. Changes to a Gigantt plan can be thought of as navigating backwards in the plan's history. And of course you can only go back to the future unless you changed something. Browsers work the same way: if you navigate back and then click a link, for example, you can't go forward any more.

Until now undo was implemented in a rather naive way. The entire plan was simply saved as a copy whenever the user changed anything in it. This worked well, but was obviously inefficient. The right thing to do, presumably, is to just save the "diff" (whatever changed). This optimization also makes saving the plan much faster, because it's easy to just send the diff to the server than to upload the entire plan every few seconds.

This little bit of redesign and refactoring doesn't add a whole lot of functionality to the system - just the redo action. But it prepares the ground for a major new feature that's going to arrive in the next few months: collaboration. Being able to support multiple users editing the same plan at the same time, and also allowing each user to undo his actions in case he made mistakes, is a major feature of Gigantt. And the first thing you need to do to implement such a feature is to know how to manage the history of a plan by keeping track of the "diffs" each user makes. I'll write more on how collaboration is going to be supported in Gigantt in future posts. 

One more thing. URLs in the notes panel are now highlighted as links. You can Ctrl-Click on them to navigate (in a new window/tab). So if you have a work item for fixing a certain bug, you can add a link to its corresponding page in a issue-tracking system, for example.

This is release #10 of Gigantt. We're moving to a quicker release cycle where each release has one major feature and usually plenty of bug fixes. Next release will bring the ability to set an explicit start-date to items. This makes it possible to add "receivables" to the plan - items that may have very short duration but can only start on a certain date in the future. More on that in an upcoming post. Enjoy 0.10!

Sunday, February 13, 2011

How to build the Flex SDK

Gigantt's UI is built with Adobe Flex 4.1. It's a great web development SDK, but Adobe is notoriously slow to respond to bug reports. So sometimes we find ourselves having to go into the Flex SDK's source code in order to debug stuff or work around bugs. In order to fix a bug in mx:DateField today I had to download and build the SDK (which is open source) from Adobe.
It's not hard, but I thought I'd share the how-to with the world:

How to build the Flex SDK on Windows
(based on Windows 7 64-bit)

  • Java - You'll need the JDK, not just the JRE (the runtime which comes with Flash Builder, for example).
    • I used the 64 bit version:
      "c:\Program Files\Java\jdk1.6.0_23" 
  • Ant - You can download the binaries:
    • I used 1.8.2
    • Just unzip it to c:\dev\ant
  • Flex open-source SDK
    • I used
    • Unzip it to c:\dev\sdk (just for simplcity)
  1. Let's create a batch file to set some useful envars: envars.bat
    set JAVA_HOME=c:\Program Files\Java\jdk1.6.0_23
    set PATH=c:\dev\ant\bin;%PATH%
    set ANT_OPTS=-Xmx256m
    1. Open cmd.exe and run it...
  2. Edit c:\dev\sdk\frameworks\build.xml 
    1. Look for:
      <target name="datavisualization" description="Builds datavisualization.swc">
    2. And fix the location of the manifest file from:
      "${datavis.dir}/manifest.xml" to:
  3. Run Ant:c:\dev\sdk\frameworks> ant
    1. It should end with such a message: BUILD SUCCESSFUL
  4. Now let's tell Flash Builder where to find this new SDK: c:\dev\sdk 
    1. Add it to the "Installed SDKs" settings in Flash Builder
    2. Make sure your project is configured to use this SDK (it was probably created with the original one and still refers to it).
  5. Rebuild your project. It should work.