Satya Aravind Kopparthi Weblog

05/19/2009

Flex AMF DS comparisons

Filed under: Uncategorized — akopparthi @ 7:14 pm

GDS over BlazeDS:

If you are a software provider using Java EE persistent technologies such as Hibernate, you will certainly feel the importance of a framework that takes great care of your lazy fetching strategy. One of the most important features of GDS (and one of the main reasons of its creation) was the possibility to use exact ActionScript3 copies of Hibernate detached objects on the client side, just like if we were in the web layer of a classical Java EE application. This does not seem to be possible at all with BlazeDS, and that means that you cannot just replace GDS with BlazeDS. Additionally, you’ll be able to use Gas3 code generation features which are real time savers.

 

 

 

 

 

Feature BlazeDS GraniteDS WebORB LifeCycleDS
Data management Services
Client-Server synchronization - + + +
Conflict resolution - - + +
Data paging - + + +
SQL adapter - - + +
Hibernate adapter - + + +
Document Services
LiveCycle remoting - - + +
RIA-to-PDF conversion - - +(plugin) +
Enterprise-Class Flex application services
Data access/remoting + + + +
Proxy service + + + +
Automated testing support - - +(through RIA AppPuncher –coming soon) +
Software clustering + + + +
Web tier compiler - + + +
Flex code generation - + + -
Enterprise Integration
WSRP generation - - - +
Ajax data services + - + +
Flex-Ajax bridge + - - +
Runtime configuration + - + +
Open adapter architecture + - - +
JMS adapter + + + +
Server-side component framework integration + + + +
Stateful services (session scope for Java objects) - + + ?
Singleton services (application scope for Java objects) - + + ?
Server-to-client method invocation - - + ?
ColdFusion integration - - + +
Service browser
displaying POJOs,
Spring beans, EJBs and
a list of deployed JAR
files
- - + -
Offline Application Support
Offline data cache - - + +
Local message queuing - - + +
Real – Time Data
Publish and Subscribe messaging + - + +
Real -time data quality of service - + + +
RTMP tunneling - - + +
Frameworks build-in integration
Spring - + + -
EJB3 - + ? -

 

I used the following articles:

http://sujitreddyg.wordpress.com/2008/01/31/blazeds-and-lcds-feature-difference/

 http://www.infoq.com/news/2008/02/granite-data-services

http://www.themidnightcoders.com/weborb/java/product_editions.shtm

http://www.graniteds.org/confluence/display/DOC/1.1.+What+is+Granite+Data+Services


http://www.adobe.com/products/livecycle/dataservices/features.html

02/15/2009

JSF Flex Framework

Filed under: Uncategorized — akopparthi @ 9:39 pm

JSF Flex goal is to provide users capability in creating standard Flex components as JSF components {note dynamic charts and some other components are not part of standard Flex components}. So users would create the components as normal JSF components and the project will create the necessary MXML, SWC, SWF files and etcetera and link the values of the components back to the managed beans using JSON+Javascript and Actionscript. {standard Flex components have been open sourced through MPL license}
Components

JSF Flex project contains concrete JSF component for each Flex component.

Each of the JSF component that needs to preserve the value will have the following syntax of values checked during the decode process

_ {i.e. for List _selectedIndex}. For certain components there will be a set of ids sent to the decode process {i.e. RadioButton component has two values checked during the JSF decode process { _selectedValue and _selected }.

JSF Flex project utilizes the myfaces build plugIn which automatically creates :

the concrete class for each abstract class of JSF component
the tag class for each JSF component
the tld file
the facesconfig.xml for the configuration
In order to view how to create such components, please refer to the current components within jsf-flex project.

better support for creating XMLList and its associated data for Facelet using dataBinding + static XML data
possible creation of Array + list of Objects using dataBinding to beans {similar implementation as for XMLList + XML}
Main points for JSF Flex Renderers

Main thing to note in terms of design for the renderers are the following :

Classes which are not concrete, meaning MXML.+TemplateRenderer will mainly have a method called mapFields which is simply to inspect either the replaceMapping XML or annotation {depending on the JRE version} to retrieve the values from the sub-class of UIComponent during the JSF Flex’s encodeBegin lifecycle.
Concrete classes have a method createPreMxml which is to create the preMxml file with the responsibility of creating these files lie with implementations of _FileManipulatorTaskRunner interface {default being VelocityFileManipulatorTaskRunnerImpl }. The implementation choice for this interface and two other interfaces _CommonTaskRunner and _FlexTaskRunner are determined during the maven build process.
MXMLComponentBaseRenderer class during the encodeEnd will write the body content of the component {i.e. MXMLScript} as long as the correct content is pushed to the attribute map. For an example, view the MXMLUIScriptTag within the jsf-flex project where the body content is pushed to the component’s attribute map as MXMLConstants.TAG_BODY_CONTENT_ATTR.
MXMLApplicationRenderer is a special class that has an added responsibility during its encodeEnd to
merge the preMxml files into a MXML file
create SWC file for the system’s library
extract the SWF file from SWC for the shared resource of all application SWF files
flush necessary resources {i.e. componentValueMapper.xml} for the system’s library to the correct directory
extract the flexSDK to the correct directory
create the application’s SWF file.

References
Further details and the source code: http://code.google.com/p/jsf-flex/

02/14/2009

8 essential MySQL queries

Filed under: Uncategorized — akopparthi @ 9:43 pm

Here”s a list of queries that I found myself using very often and that save me a lot of development time. I hope you can benefit from them as well.

1. Create a quick backup

Before testing a new piece of code you suspect might mess up data in one or more tables it”s always a good practice to create a backup. To quickly create a backup copy of a table, use this query:

CREATE TABLE backup SELECT * FROM TABLE original;

The query creates a table backup which is a copy of the original table and includes both structure and content.

2. Create/change/restore a password

Many applications store MD5-crypted passwords in the database. If you want to quickly create a new MD5-ed password, or you have forgotten your password, use the following query to get a new one:

SELECT MD5(“somepasshere”);

This statement will give you “b5bab206cc8002bf7c10d47b24a2d0e6″ which is the encrypted version of the string “somepasshere”. There are other function that crypt stings in MySQL using different algorithms, most notably PASSWORD() which is using MySQL“s own crypting algorithm.

3. Working with Unix timestamps

To convert from human-readable MySQL date/time format into Unix timestamp, use: SELECT UNIX_TIMESTAMP(); Without parameters, this will give you the timestamp of the current date and time. With parameters, you can get timestamp for any date. For example: SELECT UNIX_TIMESTAMP(“2006-12-31″); This statement gives you the timestamp 1167541200. To get a date back from a timestamp, use: SELECT FROM_UNIXTIME(1167541200); This results in “2006-12-31 00:00:00″

4. Quick increment

To increment an integer stored in a table (useful for stats for example), use: UPDATE sometable SET counter=counter+1 WHERE …; Here “counter” is the name of the field that stores the integer value.

5. Toggle a value

If you have a field that stores a Boolean type of value, like 0/1 or yes/no, you can easily toggle the value with one if-statement:

UPDATE sometable SET flag=(IF(flag=”no”,”yes”,”no”));

6. Find/replace

Say you want to update a piece of text if all records in a table field. REPLACE() comes to the rescue:

UPDATE sometable SET field = REPLACE(field, “black”,”white”);

This statement will replace all occurrences of the string “black” with the string “white” in all records of the “field” column. Apart from the string “white” the rest of the text contained in the field will be left as is.

7. Get a random record

If you want to select a random row in your table, you can use the statement:

SELECT * FROM table ORDER BY RAND();

8. Upper/lower case

If you want to modify a value and make it upper or lowercase, use the UPPER or LOWER functions, like this:

SELECT LOWER(“Value”); // gives you “value”

SELECT UPPER(“Value”); // gives you “VALUE”

I hope you learned something new today which will make your everyday life as a developer just a bit easier. Thank you for reading!

02/13/2009

eclipse -ganymede save action

Filed under: Uncategorized — akopparthi @ 7:08 pm

I am absolutely convinced that source code must be formatted according to rules a team agrees on. Therefore I have my Save Actions setup for auto-formatting my code (by the way I just rely on the eclipse built-in rules, I would only adjust the line length to 120) every time it is saved. For those who often need to fix/change unformatted code (code that is not auto formatted at all) are going nuts. Once you start comparing with older revisions you can’t actually tell anymore what exactly you have modified, the auto-formatter has done a damn good job! So now you can set an option that only formats actually modified lines code.

Windows-preferences->java->Editor->Save Actions
Check Perform the selected actions on save
and select format edited lines.

01/04/2009

Cutsomizing RichFaces skins

Filed under: Uncategorized — akopparthi @ 10:53 am

RichFaces comes with the following skins:

* DEFAULT
* plain
* emeraldTown
* blueSky
* wine
* japanCherry
* ruby
* classic
* deepMarine
* NULL

To use a skin, all you need to do is set the name in web.xml file:

org.richfaces.SKIN
ruby

Suppose you like the skin, but you want to make some small changes to it. Here is what to do.

1. Unzip richfaces-impl-3.2.x.GA.jar file. All the skin files are under META-INF/skin
2. Take the skin you want to modify and save it under a different name in resources folder for Maven developers or under class path for others. For example rubycustom.skin.properties
3. Open the file and change the parameter you need. For example

headerBackgroundColor=#FFFFFF

then just set the new skin in web.xml file:

org.richfaces.SKIN
mySkin

Save and restart the server.

Starting with RichFaces 3.2.1, this process has become simpler. You still create a new custom skin file under Java source, and specify which skin to extend:

baseSkin=ruby

this means the skin is based on ruby skin. Next, you just over write the parameter that you need. In this example, it would look like this:

baseSkin=ruby
headerBackgroundColor=#FFFFFF

01/01/2009

JSF can handle GET requests as any other Web Frameworks : using shale-view

Filed under: Uncategorized — akopparthi @ 2:29 pm

1.  Add shale-view, shale-application and shale-core jars deprendcies  to your pom

2. Define Shale filter in web.xml

<filter>
<filter-name>shale</filter-name>
<filter-class>
org.apache.shale.application.faces.ShaleApplicationFilter
</filter-class>
</filter>

<filter-mapping>
<filter-name>shale</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>

3. manage your managed beans in faces-config.xml

<managed-bean>

<managed-bean-name>backing</managed-bean-name>

<managed-bean-class>com.foo.BackingBean</managed-bean-class>

<managed-property>

<property-name>personId</property-name>

<value>#{param.personId}</value>

</managed-property>

</managed-bean>

4. Extend your managed bean with Shale AbstractViewController or ViewController  and write business logic in prerender method.

public class BackingBean implements ViewController {

private int personId;

public int getPersonId() { return this.personId; }

public void setPersonId(int personId) { this.personId = personId; }

public void prerender() {

// By the time you get here, personId has aready

// been converted and injected, so use it to go look

// up the relevant information

}

}

04/17/2008

Flex

Filed under: Uncategorized — akopparthi @ 6:43 am

  • Working with the Flash Player cache
  • The Flash Player cache is a new feature available in Flash Player 9 Update 3 (9,0,115,0). The cache allows files signed by Adobe to be cached by Flash Player. These files end in the file extension .swz.
    The Flash Player cache differs from the browser cache in some useful ways. Because the cached SWZ files are signed by Adobe, they can be reused in more than one domain and are not limited to reuse within the domain in which they originated. For example, imagine that framework.swz is loaded from http://www.a.com and is placed in the cache of Flash Player. If the same framework.swz file needs to be downloaded from http://www.b.com, Flash Player looks in its cache to find a.com’s framework.swz file. When it finds a match, it uses the cached file rather than loading a new file from b.com


  • Blog at WordPress.com.