Zephyr Logo

Shailesh’s Blog

Implementing RIA technologies to make TestManagement, a breeze

Deploying PHPFileNavigator on tomcat - Step by Step

Posted in Fedora by shailesh.mangal on the October 3rd, 2008

Its not very common to come across a need to install php on a J2EE server. For the same reason, there is not enough documentation written around this. It took me a while to figure out all the pieces. Hope this is helpful.
Environment
Tomcat : 5.5.23
OS: Fedora
PHP: 5.2.6
Assumptions
tomcat is already installed
Mysql is already installed

Steps


1. Download and deploy PHP Java Bridge from http://php-java-bridge.sourceforge.net (just copy the war file to /webapps)
2. Recompile PHP (with various option) that are not there in the binary that come with the above bridge

  • Download php source www.php.net[http://www.php.net/get/php-5.2.6.tar.gz/from/this/mirror]
  • extract it to /home/zephyr/tmp/
  • Install development packs of following
    yum install libpng-devel
    yum install libjpeg-devel
    yum install zlib-devel

  • go to extracted folder and run
    ./configure --prefix=/home/zephyr/tmp/php-5.2.6 --disable-all --enable-session --enable-fastcgi --enable-pcre-regex --with-pcre-regex --with-fastcgi --with-gd --with-mysql --with-zlib
    >> You can ignore following warnings

    Notice: Following unknown configure options were used:

    –enable-pcre-regex
    –with-fastcgi

    make
    make install

  • rename
    $CATALINA_HOME/JavaBridge/WEBINF/cgi/php-cgi-i386-linux --> php-cgi-i386-linux-original

  • Stop tomcat
  • copy the compiled php binary to replace the orignal
    /home/zephyr/tmp/php-5.2.6/bin/php-cgi $CATALINA_HOME/JavaBridge/WEBINF/cgi/php-cgi-i386-linux

  • Start tomcat

    3. Download and extract PhpFileNavigator into $CATALINA_HOME/JavaBridge/explorer
    4. go to http://localhost:8080/JavaBridge/explorer and follow the installation steps

  • Logging Hibernate queries

    Posted in Uncategorized, Hibernate by shailesh.mangal on the August 31st, 2008

    If you are using log4j [Simplest, easiest and most common way of doing it]
    a. log4j.xml
    Add following entry:



    b. log4j.properties
    Create a logger category
    log4j.logger.org.hibernate.SQL=DEBUG

    If you just want these on the console (quick n dirty), then set the hibernate.show_sql to true in your sessionFactory configuration.

    More Info

    360 Flex Day 1

    Posted in Uncategorized by shailesh.mangal on the August 19th, 2008

    I am attending 360Flex in San Jose. Day one wasn’t great in terms of new stuff to learn except few things. I attended following sessions

  • Adam Flater - How to make your AIR app blow up with Merapi, nothing new in the apple accelerometer, Jordan Snyder’s demo of controlling rover using Flex was good. She also discussed processing
  • Axel Jensen - Project Workflow (trac,svn,ANT,XML…) - Nothing new there, though it was good to know Assembla
  • Chris Scott - Introduction to the Swiz Framework for Flex - I should do more homework before I write about swiz, but my first impression of Swiz was that it doesnt suffer with what most frameworks do, Noise of boiler plate. Definitely need seconds level of exploration.
  • Jacob Wright - Advanced ActionScript APIs - Nice to see the use of namespace, some good examples of proxy, IExternizable.

    I also volunteered to participate in FlexCodeJam More on this in next day or two.

  • Are you still not feeling the pain

    Posted in Web by shailesh.mangal on the April 14th, 2008

    This morning as usual, I was browsing google finance and suddenly I noticed this.

    Google Finance

    Does any thing look wrong there. Well, yeah. How is Dow, despite of + growth, showing up in red. And that provoked one of my all time pet peeves - JavaScript. Decades of innovation and evolution and still large amount of web developers still putting up with the inherent pains of the language. Still not feeling the pain?
    Why should you not use java script
    1. Its painful to write
    2. Even more painful to debug
    3. Each browser treats it differently
    4. Error prone
    5. Poor testablity
    6. Hard to read and understand somebody’s code.

    Flex/Actionscript addresses all the above plus
    1. Fun to write
    2. Better maintainability
    3. Works seamlessly with JavaScript and variety of browsers.
    4. Applicability of OOPS concepts and Design patterns
    5. Better XML, JSON and other data format editing capabilities
    6. Asynchronous by nature.
    7. Memory management and bench marking

    And hence, UI of our test management tool, to a great extent, is written in Flex/Actionscript while utilizing strengths of java script also where ever necessary.

    Add a url, missing for google gadget developers

    Posted in Web by shailesh.mangal on the April 8th, 2008

    I am by far not a gadget freak. But I do go out once in a while to check out whats going on. Recently, I had a need to look at the gadget API. While going thro’ Google’s Gadget Tools documentation, I noticed some of the documentation is outdated. One that I was concerned with, was link to add developer gadget. Lazy enough, I googled it and found that other people also noticed that the link has been removed. After a bit of struggling, it turned out, the gadget is still there, just the link is not.

    Here is what I ended up doing as a work around. Type following url in your browser (replace $YOUR_TAB_NAME with your the tab that you want to add that gadget).

    http://www.google.com/ig/directory?root=/ig&igtab=$YOUR_TAB_NAME$&dpos=top&url=developer.xml

    Press enter, you will get following screen

    GOOGLE Developer Gadget
    Add the gadget, and thats it.

    Adobe RIA Architect Summit 2008

    Posted in flex by shailesh.mangal on the April 4th, 2008

    RIA space is rapidly growing even in India and with RIA summit 2008 Adobe demonstrated their leadership in the space. Dr. Naresh Gupta, MD of Adobe India and David Wadhwani, VP of the Platform BU, Ben Forta and James Ward were among the featured speakers. Flex is clearly currently leading the RIA space and with solid backing from Adobe, with a clear roadmap, a long list of fans, it is going to stay that way for a while. There are silverlight and javafx to maintain a healthy competition.

    Mrinal broadcasted (live) the entire event (well, almost) from his mobile phone. Once in a while technology does amaze me. Ravi was able to make it from the Zephyr team and for those who couldn’t attend like me, here is a glimpse of video modcasted by Mrinal. Entire series is here

    You need the Flash Player to view this video.

    Am I Managed? Object is in dilemma

    Posted in lcds, flex by shailesh.mangal on the April 3rd, 2008

    In the context of LCDS (Live Cycle Data Services), Managed Objects are objects that get tracked and get live updates from server. While programming live (managed object), often times there comes a situation where you need to determine if a given object is live (or managed), Specially when you are dealing with combination of managed objects and unmanaged objects (typically newly created ones). It would have been nice if DataService provided a quick easy method of testing this. But it didn’t.

    Zephyr is all about live and vibrant UI, all the data, charts get updated automatically in real time, never need to use F5 or ctrl + R any more. Evidently, we extensively use LCDS and here is how we figured a way to determine if a given object is managed or not.

    UID is the key:
    Each Object in ActionScript has a unique identifier. For non managed object, Flex automatically generates a unique value and populates it in uid field of the object. For managed objects, this fields get populated slightly differently. UID for managed objects is concatenation of following
    1. Destination name: String that you identify in data_management_config.xml
    2. Identifier value : ID field of the managed object (as declared in data_management_config.xml)

    So, if you have a pattern in your destination names, you can simply check if your object’s uid follows that pattern. If it does, the object is managed else it is not.

    Sample Code:

    public function isManaged():Boolean{
    return (uid && String(uid).indexOf(”Assembler”) >= 0);
    }

    Challenge: What if you unmanage a managed object, will the above logic work? Think, try it yourself and discuss here.

    Programmatically firing events into Flex components

    Posted in flex by shailesh.mangal on the March 7th, 2008

    In Flex UI components, events gets fired on User Interaction and you can interrupt or add additional listeners on those. Its also possible to create events and dispatch them to the components. This technique could be very handy when you want to get something done via unrelated trigger. Here is an example.
    Default sort on Flex Datagrid

    Datagrid in flex are sortable and by default clicking on header, you can sort the data. I came across one requirement where I needed to have a default sort on application creation. There are two ways to do it
    1. Sort the dataProvider (suggested in LiveDocs)
    2. Add a callLater function when you set DataProvider of the DataGrid (this could also be done on creationComplete if you already have dataProvider)

    private setDataProvider(dp:ArrayCollection):void{
    customersDataGrid.dataProvider = dp;
    callLater(initialSort);
    }

    private function initialSort():void{
    var columnIndex:int = 0;
    var event:DataGridEvent = new DataGridEvent(DataGridEvent.HEADER_RELEASE, false, false, columnIndex);
    customersDataGrid.dispatchEvent(event);
    }

    JCR Viewer, Finally

    Posted in java, Jcr170 by shailesh.mangal on the January 30th, 2008

    As I mentioned in my previous post, here is the link to jcrViewer. We don’t take any credit what so ever in development of this code. We needed a viewer for our content repository. We found some online but they weren’t working for us and we were getting all kinds of exceptions (connection issues, NoClassDefFound etc). Zephyr team took a stab at combining what is out there and wired the dependencies. It works for us as a eclipse plugin (tested both on Mac and XP running eclipse 3.2.2, JackRabbit 1.3, we DONOT use vista for development)

    How to install

    1. Download above link
    2. Extract contents into $ECLIPSE_HOME/plugins
    3. Restart your eclipse
    4. Go to Windows –> Preferences
    JCRViewer preferences
    5. Setup your preferences in JCRBrowser
    6. Open JCR perspective


    7. Press “login to repository” and if your login credential etc is right, you are now browing your repository.

    JCR 170 repository viewer

    Posted in java, Jcr170 by shailesh.mangal on the January 16th, 2008

    Have you ever wondered what powers Zephyr’s stunning, world class, slick UIs (If you haven’t seen even the screen shots, do yourself a favor and take a look at website). Among other server technologies, there is a 200 Horse Power jack rabbit (open source implementation of JCR-170) engine that runs under the hood. The whole stack (being pure java) turns out to be so light that we decided to package it in our light weight installer (only ~85 MB, light for what it does). We had bunch of challenges in designing this solution. One of most troubling ones was not having any good repository viewers available out there. We found a couple but none of them really worked for us.

    Zephyr dev team took these available tools and ripped them open, fixed what was wrong and concocted a new tool. We are cleaning up this viewer and soon this will be released here. Keep watching. Here it is

    Next Page »