Sunday Dec 13, 2009

Graphs, GXL, dot and Graphviz

Sometimes you may want to quickly generate graphs programmatically and view/analyze those. Examples include, inheritance/type relation diagrams of an object oriented program, function call graphs and any other domain specific graphs (reporting chain of your organization chart for example). I find GXL very useful for this. GXL stands for Graph eXchange Language. It is a simple XML format to specify graphs. A simple graph stating that "JavaFX" language is related to "Java" language is as follows:

File: Test.gxl

<gxl>

<!-- edgemode tells this is directed or undirected graph -->
<graph id="langs" edgemode="directed">

<!-- write your nodes -->
<node id="java"/>
<node id="javafx"/>

<-- now write your edges -->
<edge from="java" to="javafx"/>

</graph>
</gxl>

You can also add number of "attributes" to nodes and edges - like color of the edge, style of the edge and so on. For example, "red" color can be specified for an edge as follows:


<edge from="java" to="javafx">
  <attr name="color"><string>red</string></attr>
</edge>

Now that we have written a simple graph with two nodes and a single edge between them, we may want to view it. There are number of tools/libraries to view GXL documents -- I've used Graphviz. Graphviz displays it's own native format called ".dot". Graphviz comes with a set of command line tools. One such tool is "gxl2dot", which as you'd have guessed, can be used to convert a .gxl file to a .dot file.


    gxl2dot Test.gxl > Test.dot

Once converted the .dot file can be opened in Graphviz GUI and we can export it to .pdf/.jpg/.png and so on. This way you can email the graphs to others and/or publish in your blogs/webpages easily.

The converted .pdf file for the above simple graph is here: test.pdf

I've used GXL graphs in a recent debugging tool related to JavaFX compiler. More on that later...

Tuesday Jul 28, 2009

My twitter updates..

In the past, I blogged about Cricket (the sport and not the insect!) in this space. Once angry reader questioned me why I was writing that here. I guess people read my Sun blogs only tech. stuff. That is fine. So, I've revived my twitter login. I'll be posting my one liners (tech as well as non-tech) there. Longer posts on tech. (mostly Java, JavaFX) topics will continue here.

Tuesday Dec 23, 2008

Installed Ubuntu 8.10 on my PS3

Ubuntu on PS3

I wanted to install Ubuntu on my PlayStation 3.


My Setup

  • PS3 is NTSC 60 GB hard disk version - updated with firmware version 2.42.
  • PS3 is connected to 32 inch 720p Sony LCD TV via HDMI.
  • PS3 is connected to wireless network.

Stuff needed in addition to the above

  1. USB keyboard.
  2. USB mouse.
  3. CD burned with Ubuntu powerpc iso (ubuntu-8.10-alternate-powerpc+ps3.iso).

Preparing PS3

  1. Backup your PS3 hard disk using [Settings] -> [System Settings] -> [Backup Utility] menu. I didn't bother to backup the hard disk.
  2. Go to [Settings] -> [System Settings] > [Format Utility] menu.
  3. Select [Format Hard Disk] and click [Yes].
  4. Choose [Custom] and [Allot 10GB to the Other OS].
  5. Select [Quick Format] and confirm with [Yes].

Installing Ubuntu

  1. Connect USB keyboard and mouse to PS3.
  2. Insert the disk with Ubuntu iso image into PS3.
  3. Go to [Settings] -> [System Settings] > [Install Other OS]. PS3 will detect the install CD and copy files and instruct you to ..
  4. Select [Settings] -> [System Settings] -> [Default System] -> [Other OS]. This will boot PS3 with other OS. From then onwards, follow the Ubuntu installation instructions.

Small hiccup

The installation was smooth except for one small issue - the installation seemed to hang in "Select and install software" step. After 6% the progress bar did not increase at all! Fortunately, this seems to be a known issue with text mode installer. Please refer to Ubuntu 8.10 release notes and bug 290234. I pressed Alt-F4 and Alt-F1 to toggle between logging console and main screen to check the progress. Eventually, the installation completed! While installing I configured network as well -- i.e., giving WEP password etc. -- not sure if this is mandatory, but in my case I have wireless connectivity and so I supplied the configuration values for the same.


Switching between Operating Systems

  • From Ubuntu to Game OS, use the command
    
        sudo boot-game-os
    
    
  • From Game OS to Ubuntu, use the menu
    
       [Settings] -> [System Settings] -> [Default System] -> [Other OS]
    
    

Few Screenshots

Friday Jun 27, 2008

Working from an office -- for a change!

I work from home in Chennai, India. There is maintenance power shutdown in my part of the city today [from 9.00 AM to 5.00 PM). I'm writing this blog from a Sun office in Apeejay Business Centre, Chennai. It is nice to be in an office after quite some time - at least as a change! But, I think I'd rather prefer to avoid travel, preparation to go office etc. every day :-)

Saturday Jul 28, 2007

If you don't live in Chennai, please skip this post...

I've been receiving many "wrong" calls these days. Apparently, there is a hospital with a telephone number starting with "2664". And my telephone number starts with "2446" and the rest of the digits are same! Looks like folks get confused and dial "44" instead of "66". I end up receiving calls to "Dr. XYZ" at odd times!! Now, I understand what doctors have to go though in their life. Our after working hour conference calls are lot better - at least our US friends understand time zone difficulties and schedule meetings around 8 AM west coast time (which is ~ 8.30 PM in India).

Monday Jul 09, 2007

Do you XYZ @ Sun Microsystems?

One of the frequently asked questions to me is this: "do you know one Mr/Mrs/Ms/Dr XYZ at Sun Microsystems?". Invariably, I don't seem to know the person mentioned :-) I tend to explain that Sun is a big company and it is not possible to know each and every engineer/manager/support staff and so on. And full time work-from-home does not help either - one gets even less chance to meet people :-) I've to wait till next JavaOne/Sun Tech Days or some other event to meet my friends.

Monday Jun 18, 2007

Learning couple of more SCMs!

There are many Software Configuration Management (SCM) systems also called Revision Control Systems and trillion other names :-) ....

Being a Sun employee, I've been using Teamware ever since I joined Sun. During the development of JDK 6, I became involved in integrating JSR-223 reference implementation (RI) code into JDK 6 (javax.script package and Rhino based JavaScript engine). During this effort, I had to learn CVS - because the RI code was kept in CVS repository.

In a recently started project, we have started using Subversion. I read The Subversion book. When I say I "read", I mean I read it just enough for working with a repository. I don't attempt to read to become an expert - I've not done that with Teamware either!

But, OpenSolaris uses Mercurial. Also, OpenJDK will use Mercurial. So, I woke up finally and started learning Mercurial :-) I found the following resources very useful:

I hope I won't have to learn yet another SCM before 2015 :-)

Friday Mar 09, 2007

blog worth meme...


My blog is worth $30,485.16.
How much is your blog worth?

I do agree with Melanie Parsons Gao. I too leave my blog link in blog comments that I make! But, like Kevin, I'd love to know how to cash this ;-)

Tuesday Feb 13, 2007

Programming by Scratch!

No, this is not about scratching head when your manager asks for status :-) I'm talking about the M.I.T Scratch programming language which is based on Squeak. I just downloaded Windows version and played with it for sometime. My son played with it too! They have a very nice Getting Started Guide!

Saturday Oct 28, 2006

My son's Windows "magic"!

This morning my son (3 year old) was watching some video on my PC. He kept pressing keyword - suddenly the screen started looking like this...


I couldn't find how he managed to change (some) setting. Re-starting Windows didn't help. Kannan Balasubramanian helped me. Thanks Kannan! (Sustaining saves the day again!).

Steps to fix "tilted Windows":
  • Right click on the Desktop
  • Choose the "Graphics Options" menu
  • Choose the "Graphics Properties..." submenu
  • In the dialog box, choose the "Rotation" tab
  • In the "Rotation Views", choose "Normal" (my son somehow managed to change this as "180 Degree"!)

For some reason, while Kannan was able to make it "Normal" and immediately view the change, I had to re-boot! Anyway, now it is "Normal" :-)

Thursday Jul 27, 2006

Attended GTLC, installed Solaris Nevada on Laptop and met friends..

I was in India Engineering Center, Bangalore for the last 3 days to attend the Global Technology Leadership Conference. Sun's Distinguished Engineers visited from the US. There were few Sun customers. And there were local tech. leads from Bangalore. It is good to know about various product offerings from Sun and to hear from the customers. I visited Banglore after quite some time (yes, I work from home @ Chennai). It is always a great pleasure to meet friends!

Solaris sustaining friends helped by installing Solaris Nevada on my Dell laptop - the trick was to install without disturbing the other OS in the laptop. Thanks to Venky T.V and friends! (sorry for not being exhaustive)

Met AppServer friends - Sahoo, Binod and Java sustaining friends (Kannan, Thilak...). We discussed many things - this is one thing that you miss with work-from-home - these informal face-to-face meetings/chat are great.

Monday Jan 10, 2005

JSP, XSLT and Separation of concerns

I was reading on Apache Tapestry web application framework. It seems to me that the main advantage of Tapestry is this: HTML authors ("page designers") can use standard HTML editing tools and view the page in webbrowser -- without requiring any special edit tools and/or webserver along with that. Dynamic portions of HTML page are identified by a special attribute used with standard HTML tags. Because browsers ignore attributes that are not understood, these special attributes are ignored while viewing. Server side components replace/modify the tags with these special attribute to generate the dynamic content. This way, roles are very clearly separated. Page designers don't even need to know or use any special tags or scripts.

With JSP and JSTL, we can completely avoid scripts in dynamic web pages. But, still the dynamic webpages can't be edited/viewed with standard HTML editing tools/browser. We have to use a webserver. More importantly, page designer is not isolated from JSP tags. i.e., s/he needs to know/use JSP/JSTL tags for dynamic content.

How can we achieve Tapestry-like separation of concerns with JSP/JSTL model? I think that is where XSLT can help us. Page author uses standard XHTML editing tools and identifies dynamic portions of the page by special attributes (jsp:id?). Then, we transform the XHTML page using a XSL stylesheet. The XSLT sheet transforms the XHTML page into a JSP page. i.e., dynamic content writer writes a XSLT sheet that transforms page author's XHTML page into a JSP page. Contract b/w page designer and dynamic content author is list of special attributes and values of the same.

This transformation mentioned above can be done either at development time or at runtime. In development time transform, JSP generation occurs by a build step in ant or other make tool. The XHTML page is kept in the webapp only for future static content editing -- not for serving clients. In runtime transformation, XHTML page is translated by JSP page to put dynamic content in it at request time. We may use JSTL XML transformation tags in the JSP page (instead of XSLT). To make runtime XML manipulation faster, JSP container implementations may have to "inline" JSTL XML tags (i.e., specially compile JSTL XML tags instead of calling Tag classes) -- may be, generate XSLTC-like code in the resultant servlet? or is it possible to compile such a XSLT file (that transforms input XML into JSP) as a servlet directly?

Apart from separation of concerns, there is atleast 2 advantages I can see with this style.

  • As of now, a JSP page is compiled into one method in a servlet class. If the page is huge, at times the resultant JSP servlet's _jspService method reaches JVM maximum method size limit (which is 65534 bytes with JVM spec. second edition). At that point, user to resort to techniques like HTML-frames or using JSP include feature -- not a very pleasant situation. With transformation happening at runtime, we will not have any such limit (other than memory needed for keeping internal representation of input XML).
  • runtime transformation style may also be used to implement (messaging style) webservices. Such a webservice will be written completely in XML files. (no Java code at all).

Friday Dec 31, 2004

Searching phone numbers, addresses in Chennai, India

Chennai, India's leading telephone service provider BSNL has this site : http://chennai.bsnl.co.in. This site has directory search facility by which we can find number by name, number by address, name by number and so on. Very useful to search with incomplete information.

Tuesday Dec 28, 2004

How can we help in Tsunami relief?

http://www.tsunamihelp.blogspot.com/ has news and information about resources, aid, donations and volunteer efforts.

Monday Dec 27, 2004

Tsunami hits south asia

Tsunami hits south asia. I stay in Chennai. On saturday, I was in a beach resort - enjoying 11'th year re-union after graduation. Just the very next day, the east coast got washed away. Death toll seems increasing continuosly :-(
About

sundararajan

Search

Categories
Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today
Bookmarks
Links

No bookmarks in folder

Blogroll

No bookmarks in folder

News

No bookmarks in folder