Subversion is an open source version control system for managing changes to documents, programs, and other information stored as computer files which are part of a software project. Why do we need it at all? So that in a team of developers(or even when you are working independently) when someone messes up, one can easily get back to a previous working version. When using Eclipse as our working environment(the one which I personally use and recommend), the best way is to go for Subclipse, which is an Eclipse Team Provider plug-in providing support for Subversion within the Eclipse ID. The reason for that is the seamless integration of Subclipse into Eclipse through its Update Manager. The following steps may be followed:

  • Start your Eclipse IDE.
  • Go over to Help->Install New Software
  • In the space for “Work with”, copy paste the following:
    http://subclipse.tigris.org/update_1.6.x

  • Click on add
  • In the space for name, type Subclipse Plugin and press Ok
  • If prompted to accept terms and conditions
  • Finally restart your eclipse

You should have your Subclipse configured now. Cheers to source control!!

If you use Flex Builder(now called Flash Builder) for your flex development there are no ‘tricks’ involved, so to speak, in compiling flex apps(Imagine having to pay a fortune and then face things NOT working. Annoying isn’t it?) But when it comes to doing things the open source way, we usually experience deadlocks where we cannot decide which approach to follow and we cry “HELP”.

It’s nothing unusual if that is what happens to you(I experience it all the time :P). But what we can do is share the knowledge we have so that we spend less time looking for solutions and more time working on them. That is exactly what I am here for. If you have read my blog entry about “Setting up the Eclipse IDE for Flex“, this tutorial is a direct continuation. Although people who have already set-up their preferred IDE’s will also benefit from this tutorial.

  • We will be using the Apache Ant for our compilation tasks. For using the ant build tool, Apache ant run time environment is required to be installed(which is already installed if you have Flex SDK). No work to be done here.
  • Running flex action script code on Eclipse requires Java runtime environment to be installed.
    • Fire up the terminal(if you are on Linux) and type the following:
      sudo apt-get install sun-java6-jdk
      and press enter. Just accept the terms and conditions and then , you are good to go.
    • Otherwise, you also have the option of going over to the official Sun site(now owned by Oracle) and download the latest JDK version. This link might help.
  • I am assuming you already have the Eclipse IDE installed on your machine. You may want to take a look at my previous post(link above) for guidelines.

Now, the following part needs to be done for each project you make in your Eclipse. Yes you got that right, for EACH project(Hey! what are you grumbling about? Don’t forget you are getting all of this for free; even reading my blog). Alright let’s look at the steps:

  • Make a new Project in your Eclipse.
  • Add a .mxml file in this project, say main.mxml
  • Type in the following example code(you can write any flex code here. This one’s just an example)::
    <?xml version=”1.0″ encoding=”utf-8″?>
    <mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”&gt;
    <mx:Label text=”Hello World!!”/>
    <mx:Button label=”This button does nothing” />
    </mx:Application>

Now comes the most important bit: the build.xml file. What we basically want to do is call the mxml compiler located in the flex directory of your hard drive, with the ant build file through eclipse, for compiling our flex project.

  • For this create another file named “build.xml” in the same Project. For getting the source code, contact me.

    Note that you have to change the 3 paths mentioned in the build.xml(that you will receive),

  • path to your mxmlc file. Note:: if you are working in windows, the location will be something like:
      C:\Program Files\AdobeFlex\bin\mxmlc.exe
  • path to your output folder
  • path to your main .mxml file according to your own settings.

Now to compile your flex app, all you have to do is open the build file in Eclipse, right click somewhere in the body of the file, and then click->Run As->Ant Build. That’s it! Congratulations, you have complied your first Flex app. But a lot more needs to be done to be called a “Flex Developer’. I will be posting some material from time to time on flex and related items. Till then, happy Flex-ing :).

It’s been quite a long time since I did some serious coding work. But something came along this Summer and I decided to dive into it. The project I am working on basically uses the Adobe Flex framework(it is open source) for building RIA(rich internet applications). The whole task of setting up an IDE for Flex was so cumbersome, that I thought it would be nice to have a small tutorial, for all those future Flex developers, so that they do not have to go through all the trouble that I faced. Of course, there is always the option of buying yourself the Adobe Flash Builder 4 Premium Edition, the development environment provided by Adobe for only US $699.00 :). I prefer to go the Open Source way.

Alright. Without further ado let’s get to business::

  • Get the latest version of the Adobe Flex SDK. At the writing of this post, it was Flex SDK version 4.0.0.14159. You can get the current latest version HERE.
  • Next get your preferred IDE. I would strongly recommend Eclipse as..

    it is a highly successful open source application platform…. also an open source ecosystem populated by hundreds of companies and thousands of developers producing and consuming components.

    As quoted from the Eclipse site. And since even the rest of the post is written assuming you have Eclipse on your machine, you better get it. You can download Eclipse from HERE. [Make sure you download the Eclipse IDE for Java and Report Developers, about 220 MB file]

  • Next we need the Eclipse Web Tools Platform to be installed. More specifically we need the Web Standards portion for editing the .mxml files. The following are the four packages need to be downloaded::

    Note that the versions mentioned here are the ones which were the latest during the writing of this post. Please check for newer versions.

  • Now, extract each of the four files and copy the contents of the Features and Plugins directories of each package into Eclipse’s Features and Plugins directories respectively. Restart Eclipse if it is running. Now WST(Web Standards Tools) is installed in your machine. Congratulations!! Give yourself a pat on the back :). But wait, it is not over yet. A little more needs to be done.
  • By now, we have got the plugins installed. We now need to configure Eclipse for proper syntax highlighting of .mxml files. Start Eclipse and select a workspace on your hard drive, if you haven’t done it already. All your Flex apps will reside in this directory when you make new projects. Ok, now from the Menu Bar select Window->Preferences. Then expand ‘General’ and select ‘Content Types’. Expand Text and click on(do not expand) XML. In the file associations, select ‘Add’ and in the Content Type, write “*.mxml” without the quotes. Click on OK and then once again, to close the preferences window.Eclipse should now recognize any mxml tags using the mx: namespace and highlight them with proper colors. With all those colors in your editor, you will surely experience the joy of coding :).

Flex uses two languages for its working: mxml and ActionScript. In the above segment we saw how to add code highlighting for .mxml files. But as you move ahead in Flex development, you will discover that coding in ActionScript enables you to leave hard-coding practices of mxml, and introduces more opportunities for re-use of code. So might as well add ActionScript Support for Eclipse.

This part is way easier than the previous segment:support for mxml.

  • Start Eclipse. In the Menu bar, select Help->Install new Software. Click the Addbutton. Type ASDT in the space for name and type:http://aseclipseplugin.sourceforge.net/updatesin the space for Location (ASDT is basically ActionScript Development Tools, which we want to install in our Eclipse). Select Release or Beta whichever one you want and click on Next. It will show “calculating dependencies and requirements”.
  • In the next page, select the file shown in the Panel and click Next. Accept terms and click Finish. Eclipse will now download the required files for its working. Accept any warnings that may crop up in between. And that’s it! Restart Eclipse and next time when you make a .as (ActionScript file), it will have code highlighting and syntax support. Presto!

This concludes the tutorial for Setting up the Eclipse IDE for Flex. So, what are you waiting for? Go out there and make some breathtaking Flex apps. Cheers! :D.

For compiling Flex apps in Eclipse, I have a separate tutorial here. Enjoy!

Python and NetworkX

Posted: December 14, 2009 in Networks
Tags: , , ,

I have been trying to use the NetworkX Python package in my work with Social Networks. But I faced some confusion in trying to link it to my Python Interpreter. Finally, I have found a solution [:)] after hours of mind racking. The following steps may be followed:

1:      If you do not already have Python in your system [:-o], download it from here. If you already have Python, proceed to the next step.

For those who are sceptical about using Python, should take a break and visit this link. Seriously though, Python provides a much simpler code structure, and does not scare off starters. First timers will realise the joy of programming using Python. And particularly for working in Networks and Graphs, Python has this NetworkX library, which is very clean and free from all those lines of code. Of course, one can also work in C++ or for that matter, JAVA. But python provides you with the freedom and very less headache!

2:     Now once you have installed python in your system, you need to download NetworkX package from here. Note that you are NOT to use the .egg file, rather take the latest version zip file or .tar.gz

3:     I assume that you have WinZip(or any other unzipping facility). Extract your zip(or .tar.gz.) file using that. Open the folder to find a folder named “networkx”. Copy this folder to your Python directory (e.g. C:\python\). You can also install networkx in your system. If you want to do so, read up the INSTALL.txt file(also in the .zip folder) and follow the provided instructions. I personally found the former quite an easier and hassle free way to integrate NetworkX in Python, but you are welcome to learn it the harder(and dirtier) way.

4:     Next and the last step is to start  your Python Interactive interpreter and type the following at the prompt:

>>>import networkx as nx

and press ENTER. If you get

>>>import networkx as nx

>>>

then you are done. Congrats !!

If  however you get some error regarding module does not exist, then you need to review your steps in integrating NetworkX. Start over and carefully check each step. With some luck, you will succeed.

Happy Networking!! :D