Archive for the 'Utilities' Category

Cairngen 2.1

Monday, November 19th, 2007

Last week Cairngen 2.0 was released, and judging by my Firestats totals there has been on average, roughly 250 downloads per day.

Based on the feedback I have received so far, the single most requested feature users are asking for is an additional target which will generate multiple Event, Command and Business Delegate classes (Sequences) simultaneously.

Ironically, prior to the Cairngen 2.0 release one of the contributors (I don’t remember who, so if you read this please leave a comment and take credit where it is due) added a few additional tasks which did just this.

So after a bit of fine tuning and testing I have added three new targets which are as follows:

  • create-multiple-sequences-include-delegates
    Generates multiple Event, Command and Business Delegate classes simultaneously. To do so simply assign a comma delimited list of Sequence names to the sequence.name property in project.properties.
    (e.g. sequence.name=Login, Logout, RegisterUser, UnregisterUser)
  • create-multiple-sequences-exclude-delegates
    Generates multiple Event and Command classes simultaneously. To do so simply assign a comma delimited list of Sequence names to the sequence.name property in project.properties.
    (e.g. sequence.name=Login, Logout, RegisterUser, UnregisterUser)
  • create-multiple-value-objects
    Generates multiple Value Object classes simultaneously. To do so simply assign a comma delimited list of VO names to the vo.name property in project.properties.
    (e.g. vo.name=Login, Logout, RegisterUser, UnregisterUser)
  • I have also updated the comments in both the project.properties file and the build.xml files, respectively.

    If you have any additional feature requests you would like to see added to Cairngen, or if you have already implemented these features. feel free to leave a comment or send me an email.

    Download Cairngen 2.1

    Cairngen 2.0

    Thursday, November 15th, 2007

    It has been awhile since the release of Cairngen 1.0, and the feedback I have received from the community has been very encouraging. I am happy to have provided a first-of-it’s-kind utility which allows developers to save time when building Flex applications on Adobe Cairngorm. Additionally, many of you have contacted me with some really cool new features that you have added, some of which are now available in this latest release.

    Objective
    The main objective of Cairngen 2.0 was to address 2 issues which were inherent to Cairngen 1.0. The first being that Event / Command mappings were not automated. In Cairngen 1.0 developers had the ability to generate sequences which consisted of an Event, Command and optional Business Delegate. And although this was very useful as it generated all of the required classes, handled upcasting events and instantiating Business Delegates, developers were still required to implement addCommand() in the FrontController manually. The second issue was that Event types were not generated as uppercase. Event types are static constants therefore they should always be uppercase. This is not required, however it is a best practice. Again developers could easily generate the required Event class but they would have to manually modify the event type to make it uppercase.

    These two issues were the main thing preventing Cairngen from full circle code generation and implementation. Cairngen 2.0 addresses these 2 issues by automating the process, thus allowing for even faster development of Cairngorm projects.

    So what’s new in Cairngen 2.0?

  • FrontController addCommand automation
    Event / Command mappings via the FrontController are now automated. When generating a sequence (Event, Command, Business Delegate) the FrontController will be modified to implement an additional addCommand for the Event and Command. This is achieved by a simple //todo comment which is uses as a token and replaced when sequences are generated.
  • Event TYPE
    Event type constants are now generated as upper case. Additionally the value of the event type is set to the fully qualified namespace of the event, thus preventing it from possible collisions with other Events.
  • User prompted before deleting
    You will now be prompted prior to deleting directories in Cairngen 2.0. You can override this by setting the new “prompt.on.delete” property to false
  • Class file copyright header
    Developers can add a specific copyright header for each class file generated. When specified the header will be added before the package definition.
  • Remote class VOs
    The ability to generate and register remote classes with a VO is now available
  • Logging
    Developers can toggle between logging the console output. This can be accomplished by setting the “log.output” property to true or false
  • What’s next?
    I don’t know, you tell me? If you have additional features you would like to see added to Cairngen, or if you have extended Cairngen to provide these features, feel free to leave a comment on this page. I am planning on adding some new features in the near future. One of which will be the ability to detect duplicate addCommands.

    I would like to thank the many developers who have contributed to the development of Cairngen 2.0. I am in the process of compiling a list of contributors, at which point I will update the release notes.

    Cairngen is licensed under the MIT License.

    Ant and Ant-contrib are licensed under The Apache Software License

    Download Cairngen 2.0

    MD5, SHA1 and SHA-256 Encryption Utility

    Saturday, October 6th, 2007

    If you work with different types of encrypted data it is often quite useful to have a utility available from which you can utilize to encrypt a String to a specific encryption format.

    I find it particularly useful to isolate each available encryption object into a single Helper / Utility class to help facilitate encryption requests; essentially providing a wrapper for all encryption objects.

    The Encryption utility is an all static class which is intended to provide a solution for centralizing access to encryption classes. The Encryption utility simply wraps all encryption types available in a Flex Application and provides a single static method for encrypting a String to the specified encryption type.

    Additionally, the Encryption utility provides constants which represent each supported encryption type; SHA-256, SHA1 and MD5.

    Using the Encryption utility is simple and straightforward as one might expect. The following examples demonstrate a typical use-case in which a String; “test”, is encrypted utilizing each defined encryption type:

    trace(Encryption.encrypt("test",Encryption.CRYPTO_SHA256));
    //df3f619804a92fdb4057192dc43dd748ea778adc52bc498ce80524c014b8
    //1119

    trace(Encryption.encrypt("test",Encryption.CRYPTO_SHA1));
    //a94a8fe5ccb19ba61c4c0873d391e987982fbbd3

    trace(Encryption.encrypt("test",Encryption.CRYPTO_MD5));
    //098f6bcd4621d373cade4e832627b4f6

    So if you need an easy to use, centralized location from which you can conveniently call up to encrypt a String, feel free to utilize the Encryption utility.

    The Encryption utility is protected under the MIT license.

    ASDocAntTask project for Eclipse

    Thursday, June 7th, 2007

    A very important, yet somewhat overlooked area of design is documentation. For every public API published the quality of the code and it’s resulting usage is dramatically affected by the accompanying documentation.

    In ActionScript 3.0 the ASDoc tool is invaluable. Not only is it fully supported, it is the standard for all ActionScript and mxml code documentation. Unfortunately, it is somewhat tedious to manually compile the documentation from the command line for each API you develop. To help assist developers in generating ASDocs from their code I have created a very simple ANT task which can easily be integrated within a Flex project to automate ASDoc generation.

    The ASDocAntTask can be utilized from within Eclipse just as one would typically use a standard build file. Simply create an Eclipse project from the extracted file and specify the location of the source code you would like to compile documentation for as well as the directory where the generated ASDocs are to reside.

    The ASDocAntTask project is comprised of the following files: asdoc.xml and asdoc.properties. Developers can specify project specific settings in asdoc.properties and run the default main target from asdoc.xml to both create the output directory, generate documentation from the source code as well as create a log file for the generated ASDocs.

    The asdoc.properties file contains the following properties:

    • asdoc.exe (location of asdoc.exe)
    • src (location of source code)
    • main.title (Documentation title)
    • window.title (HTML window title)
    • output.dir (Documentation output location)

    The asdoc.xml contains file contains the following targets:

    • clean (creates the output directory)
    • create-docs (generates the ASDocs)
    • log (creates the log.txt file)

    These tasks can easily be modified to match your specific environment. They are very easy to use so if you do not regularly document your work then hopefully this will help get you in the habit.

    You can download the ASDocAntTask eclipse project here