Friday, December 19, 2008

Case insensitive SortCompare Function for Strings

Here is a quick post on how to use the sortCompare function to sort strings.

Here goes the sample.Assuming your dataField is called status.This sortcomparefunction will function insensitive to the case of the strings.

private function statusSortCompareFunction(obj1:Object,obj2:Object):int {

if (!obj1.hasOwnProperty("status")) {

obj1.status = null;

}

if (!obj2.hasOwnProperty("status")) {

obj2. status = null;

}

return ObjectUtil.stringCompare(obj1.status,obj2.status,true);

}

Hope it helps!

Thursday, December 4, 2008

Integrating Spring with Flex on TOMCAT

This is a sequel to my post on getting up and running with blazeds/flex/tomcat on eclipse. This little post is going to explain how to integrate your ultra cool flex front end with the spring framework.Checkout http://www.springframework.org/ if you are not familiar with spring or Dependency injection.

Alright.Here are the steps.

1.Setup your blazeds server and client as mentioned in the previous blog post
2.Download the spring framework from http://www.springframework.org. Extract and move the neccessary jars into WEB-INF/lib folder of your server application.
3. Add the spring context param and listener to your web.xml file:

<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>

<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

4.Download the flex spring factory from www.adobe.com. COmpile it and have the class file inside your WEB-INF/classes folder .

5. Add the following configuration to your WEB-INF/flex/services-config.xml file:

<factories>
<factory id="spring" class="flex.samples.factories.SpringFactory" />
</factories>

6.Define your components in spring's XML file. Given the above spring
configuration, they would be placed in WEB-INF/applicationContext.xml. This
file can contain components which are intended to be exposed to flex clients as
remote objects as well as classes to be used as Flex Data Management Services
(FDMS) assembler implementations using the Java adapter.

7.To be constructed by Spring, your component should have a zero argument constructor so
Spring can construct an instance. Your applicationContext.xml file might look like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
<bean name="weatherBean" class="dev.weather.WeatherService" singleton="true"/>

<bean name="myAssembler" class="dev.assemblers.MyAssembler" singleton="true"/>
</beans>

8.Add your flex destination configuration for the components you want to expose to
flex clients. Since these components use the spring factory we define, we add the
additional tag <factory>spring</factory> and the <source> attribute is used to refer
to the spring component's bean name, not the class name as with the default factory.

For Remote object destinations you place your destinations inside of the
<service> tag which refers to the flex.messaging.services.RemotingService,
(by convention this may be in WEB-INF/flex/remoting-config.xml). For example, your
remote destination configuration might look like:

<destination id="WeatherService">
<properties>
<factory>spring</factory>
<source>weatherBean</source>
</properties>
</destination>

9.Use a simple client and set your remote object destination to the one you created on your remoting-config.xml

10.Restart your server.Test. Off you go!!

Bookmark and Share

Sunday, November 30, 2008

Set up blazeds on tomcat with eclipse for FLEX .

Alright,

This is a quick post on how to setup your first blazeds environment for eclipse on your existing tomcat installation.

By the end of this short tutorial you will be able to have a simple flex page that can call your remote object using blazeds on tomcat.

Note:I use eclipse 3.3 with the flex builder plugin installed. Steps will probably remain the same for flex builder with wtp installed too.

1.Download blazeds from adobe.com. Extract the blazeds.war file onto a folder.I will tell you how to use this in a few steps.

2.Create your tomcat server on eclipse. If you had not added your existing tomcat as a runtime in eclipse , this is a good time to do so.

3.Create a new "Dynamic web project " on eclipse. Call it BlazeAllinOne. Now go back to the folder where you had extracted blazeds.war and copy the META-INF and WEB-INF folders from there to the "Webcontent" folder that eclipse had created in the project. The WEB-INF should include lib,flex,classes,src folders. And most importantly the new web.xml file.

4.Right click on the project and change the build path such that the java classes will be compiled into the classes folder.RightClick->properties->java build path->Source tab.


NOtice the "Default output folder" entry that is pointing to the classes folder we copied from blazeds.war

5.Open the services-config.xml file within WEB-INF/Flex folder and change entries from this

endpoint url="http://{host}:{port}/{context-root}/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"

TO

endpoint url="http://localhost:8080/BlazeAllinOne/messagebroker/amf" class="flex.messaging.endpoints.AMFEndpoint"

Note BlazeAllinOne was how my project was deployed. Note.Do not WebContent or anythng after your project's name.

6.Build your project, if you have not set Build-Automatically on the project menu.By this point you have generic blazeds-tomcat setup that can invoke remote objects.

Verify your setup by testing if the amf links are active . Paste the endpoint url you changed on services.xml onto your browser. something like this http://localhost:8080/BlazeAllinOne/messagebroker/amf should return you a blank page and not a 404 or 500 error.

If you get 404 error,Somethings wrong!

Now some clarifications. Why did I create a dynamic web project and copy my blazeds files? Because only of its a DWP , eclipse will deploy it in tomcat container. If you had created a simple java project and pointed to your blazeds WEB-INF folder, eclpse will not deploy the app, everytime you start the server through eclipse.

7.Let us now see how we tie up flex to the server side environment we just created..

8.Create a simple java classes on your blaze-server project .Something like this

package test;

public class tester {
public String getData() {
return "hi";
}
}

9.Build the project again. The test.tester.class file should now be generated within the WEB-INF/classes folder.

10.Open your remoting-config.xml file and create a new destination pointing to the new class.
the entry goes like this

<destination id="testremote">
<properties>
<source>test.tester</source>
</properties>
</destination>

Now Lets create the client

11.NewProject-Flex-select J2ee in application server type.Unselect "Create combined flex/java src folder".Click next

12.Deselect the "Use default location for LCDS " and enter the following.

RootFolder :{youreclipseworkspace}\BlazeAllinOne\WebContent\
Root URL:http://localhost:8080/BlazeAllinOne/
Context_Root:BlazeAllinOne/. Click finish

13.Create a simple mxml and paste this code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:RemoteObject id="test" destination="testremote">

</mx:RemoteObject>
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
private function getData():void {
test.addEventListener(ResultEvent.RESULT,resultHandler);
test.addEventListener(FaultEvent.FAULT,faultHandler);
test.getData();
}
private function resultHandler(eve:ResultEvent):void{
Alert.show(eve.message.body.toString());
}
private function faultHandler(eve:FaultEvent):void{
Alert.show(eve.message.toString());
}

]]>
</mx:Script>
<mx:Button label="click" click="getData()">

</mx:Button>
</mx:Application>

Note:The remote object destination I use is testremote.The one I created in remoting-config.xml file.

14.Build all and restart the server if its neccessary. RIght click on your mxml and select "Run as Flex application"

15.Click on the button. You should be getting a pleasant "hi" from your server setup :-)

16.Note that you can setup break points on flex and java and debug them parallely.

There you go. You have the power of flex,blazeds,tomcat on your hands.

Make the world a better place :-)

Hope it helps!


Bookmark and Share

Tuesday, November 25, 2008

What Adobe Air Should be able to do but does'nt!

Alright, after working with adobe air for sometime, I find myself longing for the following features.

 

1.Ability to execute system processes -  I do understand that this poses a security riskl, but what the hell.? The user is installing AIR as an administrator after all. Adobe should learn from SUN here and do what java does best. Even though java is meant to be cross platform, it does provide developers with options like JNI API to use native code whenever required.

 

2.Ability to add options to context menu on file/folder icons – Remember how svn or winzip can add multiple options to context menus that comes when you right click on a file?? This is something I would really love to have in my air application . And no its not there! Cant believe they missed it.

 

3.AIR can have an API to parse EXCEL/WORD files – What I am trying to say is something like apache POI that helps AIR apps to read and write binary data from files in the files ystem and make sense out of it. Even a bridge between Apache POI and air might do the trick

 

4.Auto Sync API – Synching the built in sqlite database can be simpler. Some kind of an auto sync api to update the local db will be very helpful .Right now its just possible to detect a change in network connectivity and you are on your own to do what is to be done.

 

That’s it for now. I will add as soon as I find myself wanting more. Still love AIR/FLEX though! J

 

 

 




Bookmark and Share

Wednesday, November 19, 2008

Flex Specific security considerations

When it comes to security there is no end to what one can do , but the basic techniques that an attacker remains the same. In case of a RIA built with flex, there are a

few important and unique considerations.

 

  • It’s very very simple to decompile a Flex or Flash file. The file format is public and many decompilers are already in place. The Same can be said about javascript too, but the thing is that with flex based RIA’s a lot of  context and logic is saved on the client side. If you are a fan of saving sensitive data on client side,watch out! Its too easy to know what you are doing on the client.
  • It’s equally easy to monitor requests and results from a Flex app to and from the server. This and the above make it a breeze to get the URI’s and expected parameters for your PHP scripts.Softwarre like ETHEREAL do a great job in finding out what is being sent and received.
  • Most Flex/PHP/JSP architected applications will expect and return clean, simple XML data. This data can be parsed easily to see if any security holes can be exploited.Thats why you will have to seriously consider the binary protocol AMF and start using its implementation in the form of Blazeds.LCDS or AMFPHP

 

Hope it helps!





Bookmark and Share

Tuesday, November 18, 2008

How to test if an object is of a given type?

When dealing with typeCasting its essential to test if the objects are compatible before having a
typecast statement.Forgetting to do this results in fragile code that might throw a type cast error anytime.
Here is an example that shows you how to test this.
Note:A child is a type of parent and the vice versa is not true.


<?xml version="1.0" encoding="utf-8"?>

<mx:Application

creationComplete="test()"

xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">

<mx:Script>

<![CDATA[

import mx.controls.Alert;

import mx.events.CollectionEvent;

import mx.collections.ArrayCollection;

private function test():void {

var parent:Parent = new Parent();

var child:Child = new Child();

if (child is Parent) {

Alert.show("Yes");

} else {

Alert.show("No");

}

}

]]>

</mx:Script>

</mx:Application>

}




Bookmark and Share

Flex - Check if a property exists in an Object

When dealing with typeCasting its essential to test if the objects are compatible before having a
typecast statement.Forgetting to do this results in fragile code that might throw a type cast error anytime.
Here is an example that shows you how to test this.

Note:A child is a type of parent and the vice versa is not true.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
creationComplete="test()"
xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.events.CollectionEvent;
import mx.collections.ArrayCollection;

private function test():void {
var parent:Parent = new Parent();
var child:Child = new Child();

if (child is Parent) {

Alert.show("Yes");

} else {

Alert.show("No");

}

}

]]>

</mx:Script>

</mx:Application>

}



Bookmark and Share

Monday, November 17, 2008

Understanding [Bindable]

One of the most tricky and less understood features of flex is Binding.

Sure binding on first sight, is a very simple concept to grasp , but when one tries to apply it practically , one can have himself pulling his hair out.

Read this before you become a virendar sehwag look alike J.

 

My first doubts on the way [Bindable] arouse when I tried to use the bindable variable on an expression .

I was just wondering if having an expression based on a bindable variable would recompute itself , whenever the variable changed?

I had something like this

 

[Bindable]

private var test:Number = new Number();

 

private function changeText():void {

            this.test=new Number(nameInput.text);

                 }

 

And I set the value of the bindable variable on button click

 

<mx:HBox width="100%">

                        <mx:Form>

                                   <mx:FormItem label="valueOfTest">

                                                <mx:TextInput id="nameInput" width="100"/>

                                    </mx:FormItem>

 

                                    <mx:FormItem label="Check the Binding effect here">     

                                                <mx:TextInput id="valueAfterChange" text="{test > 1}" width="100"/>

                                    </mx:FormItem>

 

                                    <mx:FormItem>

                                                            <mx:Button label="Set" click="changeText()"/>

                                    </mx:FormItem>

 

The value of the second text input did change and the expression was recomputed.

Cool enough. When I removed the [Bindable] metatag the value did not change.That was expected~.

The fact is that the events are not triggered on components that use the variable.Simple.

 

Now, what if you have an function that is assigned to the text attribute of the second text input?

 

See this,

I changed the second text inputs definition to

 

<mx:TextInput id="valueAfterChange" text="{getTextForMe() }" width="100"/>

 

And I added the function which goes like this

                                    private function getTextForMe():Number {

 

                                                return test + 10;

 

                                    }

 

My first instinct was that the value would automatically be recomputed , but it did not.

It turns out that the function should be declared as [Bindable] too, so that the property would be recomputed too.

                                   

                                    [Bindable]

                                    private function getTextForMe():Number {

                                                return test + 10;

                                    }

 

 

 

Alright so here is the moral of the story.

 

Have your variables annotated with [Bindable] meta tag whenever the changes to it has to reflect elsewhere.

Changes to variables that are bindable will reflect even if the variable was used in an arithematic expression. I mean any property that uses the bindable variable to compute, its value will be recomputed.

If you are using functions to determine value for  any property that uses the bindable variable , have the function declared as bindable.

 

 

Hope it helps I did actually stop you from becoming a virendar sehwag llok alike J




Bookmark and Share

Friday, November 14, 2008

Watch for Changes in an ArrayCollection

ArrayCollection is one of the most beautiful aspects of flex which makes it what it is. When dealing with ArrayCollections, one may want to have some kind of a callback when the items are changed.

This is how you can do it.

The magic lies in  flash.events.Event.CollectionEvent. To detect a change just add a listener to the CollectionEvent.COLLECTION_CHANGE on the arrayCollection.

Even if your array collection is not bindable, this is a sure shot way to get notified of changes made to the array collection.

NOTE:The event will be triggered only when you add or delete items from the array collection and not when it is re assigned or re initialized  and not when you change the values of item within.

 

Here is the example:

 

<?xml version="1.0" encoding="utf-8"?>
<mx:Application
    creationComplete="setUpListeners()"
     xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
        <![CDATA[
            import mx.controls.Alert;
            import mx.events.CollectionEvent;
            import mx.collections.ArrayCollection;
            private var testAC:ArrayCollection = new ArrayCollection();
           
            private function setUpListeners():void {
                testAC.addEventListener(CollectionEvent.COLLECTION_CHANGE,showChange);
            }
            private function changeArrayCollection():void{               
                var obj:Object = new Object();
                obj.name=nameInput.text;
                obj.age=ageInput.text;
                testAC.addItem(obj);
                //var temp:ArrayCollection = new ArrayCollection();
                //temp.addItem(new Object());               
                //testAC=temp; Will not trigger!
                //Note:testAC=new ArrayCollection(); Will not trigger!
               
            }
            private function showChange(eve:CollectionEvent):void {
                Alert.show("Collection Changed.Operation was of type->"+ eve.kind
                + "at location-> " + eve.location);
               
            }
        ]]>
    </mx:Script>   
    <mx:HBox width="100%">
        <mx:Form>
            <mx:FormItem label="name">
                <mx:TextInput id="nameInput" width="100">
                   
                </mx:TextInput>               
            </mx:FormItem>
            <mx:FormItem label="age">
                <mx:TextInput id="ageInput" width="100">
                   
                </mx:TextInput>               
            </mx:FormItem>
            <mx:FormItem>
                <mx:Button label="change" click="changeArrayCollection()">
                   
                </mx:Button>
            </mx:FormItem>
        </mx:Form>
       
    </mx:HBox>
</mx:Application>
 

Hope it helps!!       

        

 

 

 

 





Bookmark and Share

Thursday, November 13, 2008

Hide Show a Tab on Tab Navigator

Right, just a short code-snippet I'd like to share for those who have been searching for a solution for ages (like I have). I was looking for a way to hide specific tabs in a TabNavigator in Flex 3 without removing a child form the ViewStack

This is not possible by simply hiding a child in the viewstack (child.hide = true) or by setting its visibility to false (child.visible = false). 

With an easy workaround you can set the visiblity of a specific tab to false: 

tabNavigator.getTabAt(1).visible = false;

Probably more people have found this solution, but I couldn't find it on the web so here it is.

 





Bookmark and Share

How to copy an ArrayCollection

 

There are many ways to copy an arrayCOllection to another one.Here is a couple of them

Initialize the new array with the older arrayCollection's source.

Example :var a : ArrayCollection = new ArrayCollection(array);   var b : ArrayCollection = new ArrayCollection(a.source);

Use mx.utls.ObjectUtil.Copy

Example :var arrayCollection1 : ArrayCollection = ObjectUtil.copy(arrayCollection2)

Hope it helps!





Bookmark and Share

Proper Form Validation in flex

Validators in flex have always been a mystery and I happened to encounter one of those really upsetting quirks in one of my projects.What I am talking about is the un invited red borders that get visible when you tab out of fields which have validators assigned.One would expect that the error tooltip would also appear when the red borders come.But you know, flex throws some unpleasant surprises at you at times and this is one such thing.Don't contemplate harrikiri yet :-). Every problem has a solution hidden inside it.

 

This is how it looks

 

 

 

            Turns out that the ToolTipManager can help one hiding and showing tooltips as and when requried.

           

            Here is some sample code.

 

            <mx:FormItem label="Your name">

                <mx:HBox>

                    <mx:TextInput id="yourName" change="onChangeText(event);" focusOut="onChangeText(event);"/>                

                </mx:HBox>

            </mx:FormItem>

 

            private function onChangeText(eve:Event):void {

                       

          var target:TextInput = eve.currentTarget as TextInput;

if (target.text == "")

                        {

            // Has the error message ToolTip already been created?

            // (A reference to created ToolTip instances is saved in a hash called errorMessageToolTips.)

                   // Create the ToolTip instance.

        var pt:Point = new Point(target.x, target.y);

        pt = target.contentToGlobal(pt);

        var errorTip:ToolTip = ToolTipManager.createToolTip(errorMessages[target.name] + " cannot be empty", pt.x + target.width + 5, pt.y) as ToolTip;

        errorTip.setStyle("styleName", "errorTip");

        errorTip.visible=true;      

                        }

            }

 

           

 

            Comments Welcome .. As always.       

 





Bookmark and Share

Wednesday, August 27, 2008

FlEX = UI + LOT MORE!

It infuriates me when I hear people say flex is Just another UI technology.Even the most tech savvy people have no clue what flex can do , but assume that its just about looks .. well good looks.. Though creating a cool UI is a very important part of flex's capablities, it can do much more.. I mean much much more!

Here is a short summary of capabilities that flex can bring to your next application.
  • Consistent behaviour across browsers: How many times have we abused bill gates and his IE team for not being standards compliant when it comes to browser behaviour?? The flash runtime is probably the most matured runtime that can run on a browser. Code once written will never require a change no matter which browser you intend to use it on.Please note that by behaviour I am not trying to mean the look and feel alone.Many times HTML based applications just cant work on all intendedd browsers
  • A stateful client : Flex allows an application to have a stateful client. When a client understands the state of itself , it saves a lot of server memory wasted in maintaining the state.Imagine something like ebay in which millions are logged in and are amidst a chekout process. SERVER MEMORY = MONEY and flex can save lots of it when you build your next web application
  • Real time data: This is something that traditional web applications really suck at and flex is pretty darn good at. Flash supports sockets which is the only way to have the server push data on to multiple clients. For enterprise applications flex data services or cocomo can help one achieve PUSH .. Its just impossible to achieve with plain AJAX. Direct web remoting is an option many developers opt to but one review with firebug says its just as good as polling :-)
  • MVC: Flex plays amazingly well in a system that uses MVC or MVP. Adobe backs up this aspect of flex with great support for "Cairngorm" the mvc micro architecture which is very widely used. PureMVC is another option that one would want to check out.
  • Event Model: Flex works on an event model that will be very very similar for java swing developers. In flex every communication is done via events. What this really means is that your components don't really have to know anything about the callers. True component reuse :-)
  • Multimedia: Youtube got sold for a few billions.. All by leveraging flex/flash multimedia capabilities.
  • Remoting: Flex data services and blaze data services helps you bypass the xml/html layer that makes traditional applications horribly slow. The real magic here is the protocol called AMF that makes your apps render server side data in a whizzy.
  • WEB TO DESKTOP in a minute: Your flex applications can be converted into desktop applications and vice versa in a matter of minutes.. Adobe AIR combines the connectivity of web apps with the responseiveness of desktop! Converting you flex applications to desktop application is a matter of changing the root tag from mx:application to mx:windowedapplication in most cases..
    Checkout adobe air here
  • Compoenent Architecture: Last but not the least the component architecture built into flex is what makes flex what it is. One can opt to deliver components as closed source(think .swc) if required. Flex components do not suffer from DLL hell or the much talked about JAR hell that traditional apps suffer from

Now stop saying flex is just about UI!!!!
As always.. Comments are welcome.. :-)

Sunday, August 24, 2008

MVC with FLEX

There has been a lot of talk about flex being the next generation development tech for enterprise solutions. Whenever one gets to think about the idea of building enterprise solutions , one word can never be ignored "DESIGN PATTERNS". When you think of a MVC implementation with flex Caingorm and pureMVC frameworks are the ones all developement teams will consider.
I havent used pureMVC but worked with Cairngorm and havent felt too good with it. The problem I face with Cairngorm is that there is need to use observers to detect the change in the model. I mean the the view really has no idea when the model it consumes would change.
The problem here is when multiple UI components are trying to detect a change to the model, you have no idea about the order in which the views react. So cairngirm became a sure shot way of getting into trouble for me.

So I had to find other approaches. And a different approach find did I. :-) . Here is a brief description of my little MVC implementation.

  1. Create an interface that acts a contract between the view and the controller(handler)
2. Have the view implement the interface. This helps you create a handler that doesnt need to know much about the view that is consuming it.

Ex: -- > mx:Application implements="com.simplemvc.IsampleInterface"

3.Create a reference to the handler in the view . The handler should also hold a refernce to tghe view. Have something like

Ex:--> handler:SampleHandler id="myHandler" view="{this}" myData="{this.gridData}"



4. Call the methods in handlers/controllers when you need to .
Ex: handler.getData();

5.Have the handler call your remote Object/web service/httpservice and call back the view using the reference
Ex:view.updateCollection(data:ArrayCollection)

Checkout the source code here

Comments welcome.

Monday, August 11, 2008

How to set Up Flex Builder for JAVA

Quick post on how to set up flex builder for editing and debugging java code in parallel.

You must have flex builder 3 installed for this.

1. Install WTP using Help->Software updates->Find and Install.

2. Create a new flex project .

3. Select the J2ee project type.

4. Select the create a combined flex using WTP option. Click Next

5. Select your tomcat home .

6.Select the location of your flex.war on the next screen. (Note: You can download flex.war and flex data services from adobe.com)

7. Click finish.

Flex builder would have create all the necccessary code structure and xml files create for you

To create a simple remote object project follow this tutorial.

http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/lcds/help.html?content=rpc_remoteobject_2.html

There goes your first java enabled flex project.

Comments welcome!

Will be posting on and soon!

Thursday, May 29, 2008

who is the ideal flex developer? Flash dev or Java dev or DHTML/Ajax dev?

Alright!! I know the topic is a little stupid , May be I should-phrase it to "who should I hire ?"

Whatever it be , I am just trying to figure out who would be my flex developer ??! . Is it the graphics guy Joe who had done numerous animations for web sites based on flash MX, spendign time on the timelines and frames using action script just a little to prevent the headaches that can happen later OR is it the java guy who was creating windows/Desktop applications with java swings and felt miserable with lack of flexibility (Think UI,colors,themes,god looking apps). Thank you sun! OR Is it the web developer who was toiling and moiling with the ugly browser quirks and the so called Ajax hacks and frameworks that are growing at tons per second.

Who would I hire If I had to ?

Well.Lemme try to summarize what command over flex really means and my opinion on who excels in which aspects?


1. OOPs principles
  • Java Guy - It goes without saying that the java guys excels here.The java masters know how to apply a structured approach to problem solving. Picking up somethign like Cairnghorm will be a piece of cake if one is a proper Java developer. The event model is something that all java developers would find to be very very inituitive. Last but not the least, Java guys are almost always familiar with design pattenrs.Though these folks may have a tendency to write really large code, they structure the solution properly!! They Scale.
  • Flash guys - Well ..How Object Oriented is actionscript? Most flash guys of 2000 - 2005 were working with actionscript2.0 which really did not have much to offer from an OO perspective
  • Web Developer - Web developers are so to hacks that they are never really allowed to do oops with javascript . Thanks to lack of Mature Object Oriented aspects in javascript, no web developer really knows to crack a tough problem by breaking it into objects, if not rare.
2. Interface Design
  • Java Guys: These folks are a little dumb here.. They never value the coolness that a tool like flex can bring to ones interface. They like simple interfaces lot more! Though using mxml will be very easy thanks to their familiarity with xml based frameworks like jsf
  • Flash Guys: These folks will harness the power of flash animations to the fullest.just try giving them a login page as a sample. You will fall in love with flex on first sight. :-)
  • Web Developer: These folks can do a decent enough job , but will surely take more time.. Reason. They are so to frameworks like prototype , SCriptaculous that it takes a bit of time for em to get rid of that "div" thing :-)
3. Product Engineering Capablities

  • (Will be continued)

Friday, March 28, 2008

Problems with High end phones

Source: Wikipedia
I switched from a low end nokia 1100 to a much advanced Nokia N72 recently.

Though N series comes power packed with a lot of features, typing SMS on it is a pain.

Why is it that all these high end phones make life difficult for users?? Another bizzare effect of this is that Application developers who want to develop applications that will require a bit of typing.

Say for instance mobile versions of EQO,EBuddy, HeySan..
These clowns had made it so painfull to type for a long time on the mobile...

With the mobile phones market fetting more competitive,
I am sure that the company that makes it easy for one to type sms withiut hurting one's fingers will have an edge..

Not the one that targets to make science fictions come ttue with that little device..

Vengu!

Thursday, March 27, 2008

Flex Interview Questions

A few interview questions on flex,

1. Is it possible to make httpService Requests synchronous?
2. I need to load an image from flickr into my application. Do I need a crossdomain.xml file on flickr?
3. What is the difference between httpService and Data Service?
4. How do you generate random numbers within a given limit with actionscript?
5. Have you built any components with actionscript? If so explain how you did it?
6. How do you implement push on a flex applications?
7.I am going to add images into a tag. How will it resize itself?
8. What is a resource Manager??
9.What are the similarities between java and flex
10. What is the dynamic keyword used for?
11.How do you implement push with flex data services?
12. What are the methods called when a UI component is intialized?
13. How do you implement drag and drop on components that do not support ondrag and ondrop?
14.Can you write to the file system from flex?
15. What is a drag manager?
16 . HOw do you call javascript from Flex?
17. How do you use a repeater?
18. what are three ways to skin a component in flex?
19. How do you use css styles in flex?
20. What is the difference between sealed class and dynamic classes?
21.what is MVC and how do you relate it to flex apps?
22.what is state? what is the difference between states and ViewStack?
23.how does item renderer work? How do I add item renderer at runtime?
24.what keyword allows you to refer to private variables of a class?
25.how polymorphism works on actionscript?
26.how do you overload functions in actionscript?
27.what is dynamic keyword used for?
28.what are sealed classes ?
29 what are runtime shared libraries?
30.What is caringhorm ? how do you use it?Have you worked with Cairnghorn?
31.What keyword allows you to implement abstraction better?
32.What design patterns have you used? in Actionscript and java?

Try to get answers for these.
You can be me :-)

Friday, March 14, 2008

How meebo works? (My guess of how they might be doing it!!)

We all know how useful and good meebo is.

The web based instant messaging client is a big brand now on its own and has been growing exponentially after it received funding a few months back.

Just out of curiosity, I started digging into the possible ways that meebo might have been implemented.

After a few minutes of research I think I have a vague idea of the components involved.

1. At the heart of meebo's backend is the open source API called libgaim which is under the pidgin project now. So technically anything that pidgin can support will be supported by meebo too :-)

2. Wrappers that write to a socket. The libgaim api sends signals that can be registered to callbacks that handle the signals. I believe the signals are being written to a port.

3. Direct Web remoting / Flash based remoting. This is the layer that perfoms the task of the web based client getting the messages that are being written to the socket from the wrappers that listen to gaim signals.

4.A small UI layer with Ajax frameworks like dojo/scriptaculous that gives you that cool look and feel.

Off course there might be hundred of tweaks that meebo would have done , but this I see is the core engine

There you go. :-) If you can do this , you can have your own version of meebo for your company, office.

Thanks,
Venkat

Thursday, February 21, 2008

Push without Flex Data Services

We all know that flex data services is good but is it really neccesary to implement push on flex page?? As a developer with very little money to spend on tools, I was looking out for alternatives.

And Alternative I did find!! The magic is called "XMLSocket"

Though the xmlsocket implementation is depicted as a way for the client and server to talk with xml , there is nothing potentially stopping us from sending just plain text ...

So this is how I did it..

1. Create a java based service that runs on a port (5976 in my case) that spits out content on the port when ever it is available. (This can easily be replaced by a JMS). This includes setting up a thread to write to the socket whenever data is available.

2.Open a xml socket to the server from the flash client.

3. create an ondata handler in the flex part that updates your interface .

There you have it.. :-)

I will be posting the code sample and explanation shortly .. watch out.

Happy flexing.