Nov 9 2008

Java 2D and Groovy, A Perfect Match

Andres Almiray gave a presentation on Java 2D and Groovy at Silicon Valley Codecamp 2008. Andres started the session by highlighting some key benefits of Groovy’s language features. For example, in Groovy setters and getters are explicitly created for you by simply defining a property, semicolons are optional and the return keyword are optional. Parenthesis are optional in many cases. Groovy strings are sexier, known, as GString short for Groovy Strings, and provide string interpolation familiar to Rubyist and Perl programmers. Even return types are optional in many cases and to this Andres said, “the def keyword is like var keyword in JavaScript.” Another highlight of Groovy’s features are closures. Andres said, “We don’t know if we have closures in Java 7, Groovy has closures right now!” After highlighting Groovy language features we where reminded of Groovy’s mantra: Groovy is Java, Java is Groovy.

After introducing Groovy to the audience, Andres demoed GraphicsBuilder. GraphicsBuilder is to Java2D what SwingBuilder is to Swing. The builder pattern is commonly used with great effect in Groovy due to the languages dynamic and reflective nature. GraphicsBuilder can be used to draw basic shapes, those included in Java 2D which is not much, and many more shapes like stars, triangles, balloons, crosses, arrows, donuts, etc. GraphicsBuilder has import and export to SVG via Batik and has partial experimental export to Flash’s SWF format. Andres recreated JavaFX demos simply using Groovy and GraphicsBuilder.

Technorati Tags: , , , , , , , , ,


Nov 1 2008

Juixe Open Source Awards 2008

I always find myself amazed and inspired by the great open source applications and projects I use on a daily basis. In honor of all the time and money saving applications that I have successfully used over the past year, I present the Juixe Open Source Awards (JOSA) 2008. So in no particular order here are the recipients of this years Juixe Open Source Awards…

Juixe Open Source Awards 2008

If you feel I have left out any note worthy Open Source application or project please feel free to nominate it in the comments section.

Technorati Tags: , , , , , , , , , , , , ,


Oct 30 2008

Create Flex Application with FlashDevelop

I’ve been having a lot of fun programming Flex and ActionScript applications since I have discovered FlashDevelop. In this article, I will go through the motions to create a simple Flex demo application based on the primordial Hello, World. To get started, download and install FlashDevelop. Once you have FlashDevelop installed and configured with the latest release of the Flex SDK you are all set to create Flex applications.

FlashDevelop is a very good IDE for ActionScript and Flex applications. It is simple to use and familiar if you have used visual Studio. It might be lacking a few features like design view mode, but it does come with really smart code assist out of the box.

To get started create a new Flex 3 Project by clicking New Project from the Project menu.

For our Hello Flex example we are going to add a text field where you can enter your name. Once you enter your name, you press a Generate Greetings button to output a personalized greetings in a label. To help us visualize the task at hand, here is a screenshot of the sample Flex application…

Hello, Flex

To layout out the text field, button, horizontal rule, and label components involved I will use the Grid container. Here is the MXML markup to create the above GUI.

<?xml version="1.0"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml">
  <mx:Grid>
    <mx:GridRow >
      <mx:GridItem>
        <mx:Label text="Name"/>
      </mx:GridItem>
      <mx:GridItem>
        <mx:TextInput id="inputName"/>
      </mx:GridItem>
    </mx:GridRow>
    <mx:GridRow>
      <mx:GridItem colSpan="2">
        <mx:Button label="Generate Greetings"/>
      </mx:GridItem>
    </mx:GridRow>
    <mx:GridRow>
      <mx:GridItem colSpan="2">
        <mx:HRule width="200" />
      </mx:GridItem>
    </mx:GridRow>
    <mx:GridRow>
      <mx:GridItem colSpan="2">
        <mx:Label id="labelGreeting" />
      </mx:GridItem>
    </mx:GridRow>
  </mx:Grid>
</mx:Application>

The above MXML code will generate the GUI but at this point there will be no action taken when the Generate Greetings button is clicked. We first need to create a function that will execute when the button is pressed. Add the following ActionScript snippet right below the Application tag.

<mx:Script>
  <![CDATA[
    public function generateGreetings():void {
      labelGreeting.text = "Hello, " + inputName.text + "!";
    }
  ]]>
</mx:Script>

Notice that label identified as labelGreetings and the text input identified as inputName are referenced in the ActionScript code. Next, to get everything working we need to add the click event listner to the button. Modify the button to the following.

<mx:Button label="Generate Greetings" click="generateGreetings()" />

Hit F5 to build the project and execute, or open in your favorite browser, the index.html file under the bin.

Technorati Tags: , , , ,


Oct 28 2008

Silicon Valley Code Camp 2008

The Silicon Valley Code Camp is happening this year at Foothill College on Nov 8-9. There are over 100+ scheduled sessions lined up with nearly 1000 developer attending. Although you need to register, attending the Code Camp is free. Looking at the scheduled session, it will be a very diverse conference with talks on Open Source, Java, C#, and Web Development. Speakers include Douglas Crockford of Yahoo, Paul King of Groovy in Action, Bill Venners of Artima, Arun Gupta of Sun, Karthik Gurumurthy of Wicket, David Pollak of Lift, Andres Almiray author of several Groovy Builders, and a ton of other Bay Area coders and hackers.

Some of the session talks that I am most interested in attending include the following…

  • GridGain – Java Grid Computing Made Simple, Nikita Ivanov
  • JavaScript: The Good Parts, Douglas Crockford
  • Introduction to Building RIA with Adobe Flex and AIR, Abdelmonaim Reman
  • Introduction to Spring Web Services, Pyounguk Cho
  • Building Rich Applications with Groovy’s SwingBuilder, Andres Almiray
  • The Feel of Scala, Bill Venners
  • Rails powered by GlassFish, Arun Gupta
  • Ruby Meta-programming, Bala Paranj
  • Building Enterprise RIAs with Cairngorm Microarchitecture, Abdelmonaim Remani
  • Develop Rich Internet Applications using JavaFX, Sridhar Reddy
  • Flex and 3D UI, for games and more, Vic Cekvenich
  • Introduction to Grails, James Williams
  • Lift: a simply functional web framework, David Pollak

Technorati Tags: , , , , , , , , , , ,


Oct 27 2008

SQL Server Who Lock

When working with SQL Server, two procedures that I use from time to time is sp_who and sp_lock. The sp_who procedure provides information as to which loginame, hostname, dbname are for current users. Usually I am just interested the activity on a given user, which you can use the following SQL command.

sp_who @loginame = 'sa'

The sp_lock procedure reports on which sessions ids are locked in the database. There are different level of locks such as database, table, and data locks.

Technorati Tags: , , , , , ,


Oct 26 2008

The Rubyist: September Edition

Here is a recap of the top Ruby-related links for the month of September 2008. Links for The Rubyist are provided by A Rubyist Railstastic Adventure, a tumblelog.

Technorati Tags: , , , , , , , , ,