Adobe Flex and .NET using WebORB

Two weeks back  got a chance to write a technical article on my present company’s blog where I decided to write something related to my current project where we have an application being developed with Adobe Flex on the front end and .NET as the server side technology. In order to invoke .NET objects into the Flex client we are using WebORB for .NET and my experience with it till now is pretty good.

Check out the article which explains how to create a simple Flex application which communicates with .NET objects using WebORB and also it’s configurations – http://tinyurl.com/weborb-flex

Cheers 🙂

Advertisements

FX4 Event in Ahmedabad

Ahmedabad Flash Platform User Group is organizing a special UG meet named FX4 Event. For the very first time we will have some one from Adobe to speak for the User Groupin Ahmedabad. Sujit Reddy from the Adobe evangelist team will be taking sessions for this event on Flex 4, Flash Builder. Livecycle DS, Flash Player etc.In Ahmedabad since we are only maturing as a user group it is pretty hard to pull out people from their comfort zone to attend such events but I believe events like this will make a change in the mindset of the crowd and we are trying hard to pull in more crowd to this event.

Initially we were a little hung up with the venue since first we targeted a technical institute then due to some wrong communications and the norms of the Institute we had to change the venue two days back to my office premise where we have a pretty decent conference room.Now everything seems to be set and all geared up for the event.Also will be exciting to see Sujit in action.

Often I have heard companies in Ahmedabad stating that we do not get enough of quality Flash/Flex developers from Ahmedabad and I would say as a user group we can help you out and that is why the user group across the world organize such events. Until and unless people get to know some new things/share experience about the technology they work on, there is no scope for improvement at any level. Hope all the companies in Ahmedabad take these events seriously enough to allow their developers/designers to be a part of such event. The event details are as shown below and for registration http://fx4eventahmedabadfug.eventbrite.com/. Fingers crossed and lets hope for the best.

TextArea with dynamic height based on the text

I am sure all the Flex/Air developers might have to use text area most of the times when you are building an application. Text area control with dynamic height seems not be an issue in normal cases but if the height needs to calculated based on text in the control then we need to think. I had the same requirement. Of course no SCROLLS.

I extended mx.controls.TextArea and here is what  I did quickly.

This worked for me.Maybe there is a better way to do this. Let me know if you have tried this in a different way

Cheers. 🙂

Adobe DevSummit, ’09 Hyderabad

I was  busy and  a bit lazy about writing for the last two months 😉 Well,  This was the very first time for me  to attend an event held by Adobe. I always wanted to attend similar developers conferences(in most of the cases the busy schedules do not permit me to attend such conferences) which I believe will make you aware of the new things in the market as well as an introduce you to the enhancement made to platform that you work on. The major thing which you feel after attending such conferences is that it gives you a clear idea on where you stand in terms of the technology of platform that you are working on.

The event held at Taj Krishna, Hyderabad was really a grand one which pulled in huge amount of people from different technical backgrounds. The event started off with the session from Ramesh Srinivasaraghavan, senior scientist @ Adobe about the future of Adobe Flash Platform which was a real inspiration for people like me. Also , the sessions on Flash Catalyst by Harish and about DCD in Flash Builder by Sujit was really rocking. Other sessions from people from Adobe and other community geeks was also interesting. Overall, the event was very informative for the community and an oppurtunity for networking.

It is true and I did feel that sessions become more interesting once the speaker start showing live demos. The audience love it and get more involved.
Looking forward to be there in such events next year.

FlexPMD

Ted Patrick has posted an interesting information about the open source project FlexPMD which is a tool to find out the worst parts of your code. The tool alerts and points out the bad coding practices that you have followed in your Flex project which I believe is a great thing,  given that while developement you tend to leave behind complex, redundant code and unused variables/piece of code which might give you the expected output but may be not considered as the best practice.
There is also a Flex application FlexPMD Rule set creator which enable to set custom rules for your application, that can be exported and used. The FlexPMD can be downloaded in three forms – CommandLine, Ant Task, Mac OSX Automater.
Once we start development on a  project,  in the initial stages most of us do rather take care to follow the best practices and try delete the unwanted code / unused code, but as soon as the code gets larger and more complex and as the project manager start talking only about delivery dates, it is always a time taking and horrendous process to sit and go through the code and remove all those rubbish stuffs that we have written. Now,I am going to download and try out this tool, if it works well then my code will look pretty in and out. What do you guys think ? 😉
For more info – http://opensource.adobe.com/wiki/display/flexpmd/FlexPMD

Source Code Formatter for Flex Builder

Today one of my friends asked me if there is a way or any facility  in Flex Builder to format a messy/unformatted code rather than doing it manually. There are no ways as such in the flex builder IDE which is based on Eclipse to provide indent to a particular block of code or to format a certain block of code. With the help of my colleague we found out that there is a plugin called Flex Formatter for Flex builder which will take care of  the formatting of your code once you have made a messed up code in your application.
The Flex Formatter is an open source project which enables source code formatting of Adobe Flex code ie. MXML and AS 3.0 files inside FlexBuilder.
How to use it?
1. Download the project from http://sourceforge.net/projects/flexformatter/ which will have a WINRAR Zip Archive which is named as FlexPrettyPrintCommand_0.6.27.
2. Unzip this file and you will have three more WINRAR Archive file.
3. Copy the three zip files and goto the FlexBuilder folder in Windows where the Flex Builder files are installed.
4. Open the plugin folder and paste the three files there.
5. Close and restart your flex builder and now it is ready to use.
As soon as you restart the flex builder you will have 5 icons at the top in your toolbar as shown in screen below:
icons

The Flex Formatter has the following features:
1. Format Flex Code (selected lines or documents).
2. Indent Flex Code (selected lines).
3. Re arrange AS code(whole file).
4. Generate AS Doc comments for files.
5. Generate AS Doc comment for current element.
I have tried the features with small blocks code and small AS files and it did work very well but I am still wondering how it will work with files which has more than thousand lines of code? Will the builder crash ?Need to check it out.Since writing a code which is messed up  is not at all recommended when delivering an application, but developers who have to live with it have a simple solution using Flex Formatter. Plug it in your flex builder and see the difference for yourself 🙂

Encoding & Decoding functions in Flex

The other day one of my colleagues asked me whether do we have any functions inside flex that can encode a URL . Even though it quite obvious that something can be done manually to replace the strings, but in order to find some answers I looked into the Top level packages where I found encodeURI() and decodeURI() . What does these functions actually do?
encodeURI():
This function bascially encodes the string into a valid URI. The following shown below are not encoded by encodeURI() unless it is a small group of basic characters as given in the documentation.

Characters that are not encoded
0 1 2 3 4 5 6 7 8 9
a b c d e f g h i j k l m n o p q r s t u v w x y z
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
; / ? : @ & = + $ , #
- _ . ! ~ * ' ( )

There is another encoding function that is slightly different from encodeURI()encodeURIComponent() which also does the same encoding of strings to URI but.Before we talk about the major difference we should be aware of some terms :

URIComponent: is the text that appears in between any special characters..for eg: http and http://www.google.com are the  URI components in http://www.google.com.
Component Seperatorsare the special characters used in a URI (: ; / ?)

Now coming back to the major difference the encodeURIComponent() in encodes the same as encodeURI() and additionally also encodes special characters (; / ? : @ & + $ , # )

decodeURI():
This function does the exact reverse of encodeURI() , it decodes the encoded URI into string where all encoded characters are restored into unencoded representation.

Escape sequence not decoded Characters equivalents
%23 #
%24 $
%26 &
%2B +
%2C ,
%2F /
%3A :
%3B ;
%3D =
%3F ?
%40 @

Using the decodeURIComponent() the escape sequence in the above table can be decoded.
All the above functions are in addition to the already existing escape() and unescape() functions which were also used in flash.escape() encodes all nonalphanumeric charachters into format % and hexadecimal sequence and unescape() decodes the URL encoded format to string.
So , there are plenty of things to play with when you need some strings to be encoded, each function does look similar but it has some variations which needs to be closely observed.Before concluding here is a small code snippets which includes the usage of above functions:


var redirectUrl:String = "http://www.somedomain.com?loggedin=true& username=Sun";
    
var escaped:String = escape(redirectUrl);
var unescaped:String = unescape(escaped);
    
var encoded:String = encodeURI(redirectUrl);
var decoded:String = decodeURI(encoded);
    
var encodedURI:String = encodeURIComponent(redirectUrl);
var decodedURI:String = decodeURIComponent(encodedURI);
    
trace("escaped: "+escaped); //escaped: http%3A//www.somedomain.com%3Floggedin%3Dtrue%26username%3DSun
trace("unescaped: "+unescaped); //unescaped:
http://www.somedomain.com?loggedin=true&username=Sun
    
trace("encoded: "+encoded); //encoded:
http://www.somedomain.com?loggedin=true&%20username=Sun
trace("decoded: "+decoded); //decoded: http://www.somedomain.com?loggedin=true&username=Sun
    
trace("encodedURI: "+encodedURI); //encodedURI: http%3A%2F%2Fwww.somedomain.com%3Floggedin%3Dtrue%26username%3DSun
trace("decodedURI: "+decodedURI); //decodedURI:
http://www.somedomain.com?loggedin=true&username=Sun


Meanwhile when I was googling more on this, I found out a bug reported to Adobe where it was reported that encodeURI and decodeURI misbehaves with httpservice which is mentioned to be deferred and will be fixed in 4.0 hmm..I am curious to know about your experiences when using these functions…