Tuesday, May 11, 2010

Flex Java Springs BlazeDS integration

Flex Java Springs Overview

spell checker in flex 3 / Flash / Action Script 3

Hi All,

Had tried using many spell checkers for Flash UIComponents but none of them work.

Fortunatly there was one it self from Adobe Open Source (Adobe Labs) Squiggly

Which does all which is needed. but there are some loop holes and you have to handle garbage collection your own way or else client system will stole, take 50% of CPU memory..

So if your useing squigly for large project which involve Runtime genration of UI component make sure it has been disabled after use.

Hope this helps.

Ranjit

Monday, May 10, 2010

GraniteDS

Worth looking at as a alternative for LifecycleDS.

GraniteDS

flash 10 security issue filereference workaround example

Upload and download require user interaction
In Flash Player 9, ActionScript could perform uploads and downloads at
any time. With Flash Player 10, the FileReference.browse and
FileReference.download operations may be initiated only through
ActionScript that originates from user interaction. This includes
actions such as clicking the mouse or pressing the keyboard.
What is impacted?
This change can potentially affect any SWF file that makes use of
Filereference.browse or FileReference.download. This change affects
SWF files of all versions played in Flash Player 10 beta and later.
This change affects all non-app content in Adobe AIR (however, AIR app
content itself is unaffected).
What do I need to do?
Any existing content that invokes a browse dialog box using
Filereference.browse or FileReference.download outside of an event
triggered by user interaction will need to be updated. The dialog box
will now have to be invoked through a button, keyboard shortcut, or
some other event initiated by the user.

Solution

try{
var urlReq:URLRequest = new URLRequest(“http://www.myUrl.com/file”);
fileReference.download(urlReq);
}

catch(error:Error)
{
Flash10Workround();

}

WorkAround Method :

var popup:Somepopupcustomobject;

private function Flash10Workround():void
{
popup= new Somepopupcustomobject();
PopUpManager.addPopUp(popup,this,true);
PopUpManager.centerPopUp(popup);
popup.LABEL=”File is Ready to Exported, Please Click Ok to continue”;
popup.submitSub.addEventListener(MouseEvent.CLICK, closePopUp);
}

private function closePopUp(e:MouseEvent):void
{
var urlReq:URLRequest = new URLRequest(“Ur Link here”);
fileReference.download(urlReq);
PopUpManager.removePopUp(Object218PopUp);

}

Regards,
Ranjit Sail

chm To .pdf Converter

Well I Was thinking of reading mysql 5.0 certification Guide and came across the this .chm extension which not user friendly i feel , so was looking out for ways of puting it in pdf format, well you google it out chmtopdf pilot Click Here was there, it adds some text on top of the page but its fine till u want to have better user experiance.

well Let me know if you know better tool for the same.

Mysql Timestamp a useful Data type

Till now we were using DateTime Datatpe but latly found that there is some thing better for tracking user updation and insertion tracking, say we use for security purpose time crate and time update there Timestamp can be best used as it automatically updates column without mentioning it , following is the example

mysql> CREATE TABLE ts_test1 (

-> ts1 TIMESTAMP,

-> ts2 TIMESTAMP,

-> data CHAR(30)

-> );

Query OK, 0 rows affected (0.00 sec)

mysql> DESCRIBE ts_test1;

+——-+———–+——+—–+———————+——-+

| Field | Type | Null | Key | Default | Extra |

+——-+———–+——+—–+———————+——-+

| ts1 | timestamp | YES | | CURRENT_TIMESTAMP | |

| ts2 | timestamp | YES | | 0000-00-00 00:00:00 | |

| data | char(30) | YES | | NULL | |

+——-+———–+——+—–+———————+——-+

3 rows in set (0.01 sec)

mysql> INSERT INTO ts_test1 (data) VALUES (‘original_value’);

Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM ts_test1;

+———————+———————+—————-+

| ts1 | ts2 | data |

+———————+———————+—————-+

| 2005-01-04 14:45:51 | 0000-00-00 00:00:00 | original_value |

+———————+———————+—————-+

1 row in set (0.00 sec)

mysql> . . . time passes . . .

mysql> UPDATE ts_test1 SET data=’updated_value’;

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> SELECT * FROM ts_test1;

+———————+———————+—————+

| ts1 | ts2 | data |

+———————+———————+—————+

| 2005-01-04 14:46:17 | 0000-00-00 00:00:00 | updated_value |

+———————+———————+—————+

1 row in set (0.00 sec)

The same behavior occurs if you specify both DEFAULT CURRENT_TIMESTAMP and ON UPDATE CURRENT_TIMESTAMP explicitly for the first TIMESTAMP column. It is also possible to use just one of the attributes. The following example uses DEFAULT CURRENT_TIMESTAMP, but omits ON UPDATE CURRENT_TIMESTAMP. The result is that the column is initialized automatically, but not updated when the record is updated:

mysql> CREATE TABLE ts_test2 (

-> created_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

-> data CHAR(30)

-> );

Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO ts_test2 (data) VALUES (‘original_value’);

Query OK, 1 row affected (0.01 sec)

mysql> SELECT * FROM ts_test2;

+———————+—————-+

| created_time | data |

+———————+—————-+

| 2005-01-04 14:46:39 | original_value |

+———————+—————-+

1 row in set (0.00 sec)

mysql> . . . time passes . . .

mysql> UPDATE ts_test2 SET data=’updated_value’;

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> SELECT * FROM ts_test2;

+———————+—————+

| created_time | data |

+———————+—————+

| 2005-01-04 14:46:39 | updated_value |

+———————+—————+

1 row in set (0.00 sec)

Note that even though the record is updated, the created_time column is not. In versions of MySQL Server before 4.1, the UPDATE statement would have caused the created_time column to be updated as well.

The next example demonstrates how to create a TIMESTAMP column that is not set to the current timestamp when the record is created, but only when it is updated. In this case, the column definition includes ON UPDATE CURRENT_TIMESTAMP but omits DEFAULT CURRENT_TIMESTAMP:

mysql> CREATE TABLE ts_test3 (

-> updated_time TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

-> data CHAR(30)

-> );

Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO ts_test3 (data) VALUES (‘original_value’);

Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM ts_test3;

+———————+—————-+

| updated_time | data |

+———————+—————-+

| 0000-00-00 00:00:00 | original_value |

+———————+—————-+

1 row in set (0.00 sec)

mysql> UPDATE ts_test3 SET data=’updated_value’;

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> SELECT * FROM ts_test3;

+———————+—————+

| updated_time | data |

+———————+—————+

| 2005-01-04 14:47:10 | updated_value |

+———————+—————+

1 row in set (0.00 sec)

Note that you can choose to use CURRENT_TIMESTAMP with neither, either, or both of the attributes for a single TIMESTAMP column, but you cannot use DEFAULT CURRENT_TIMESTAMP with one column and ON UPDATE CURRENT_TIMESTAMP with another:

mysql> CREATE TABLE ts_test4 (

-> created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

-> updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

-> data CHAR(30)

-> );

ERROR 1293 (HY000): Incorrect table definition; there can be

only one TIMESTAMP column with CURRENT_TIMESTAMP in DEFAULT

or ON UPDATE clause

Nevertheless, you can achieve the effect of having one column with the creation time and another with the time of the last update. To do this, create two TIMESTAMP columns. Define the column that should hold the creation time with DEFAULT 0 and explicitly set it to NULL whenever you INSERT a new record. Define the column that should hold the updated time with DEFAULT CURRENT_TIMESTAMP:

mysql> CREATE TABLE ts_test5 (

-> created TIMESTAMP DEFAULT 0,

-> updated TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,

-> data CHAR(30)

-> );

Query OK, 0 rows affected (0.01 sec)

mysql> INSERT INTO ts_test5 (created, data)

-> VALUES (NULL, ‘original_value’);

Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM ts_test5;

+———————+———————+—————-+

| created | updated | data |

+———————+———————+—————-+

| 2005-01-04 14:47:39 | 0000-00-00 00:00:00 | original_value |

+———————+———————+—————-+

1 row in set (0.00 sec)

mysql> . . . time passes . . .

mysql> UPDATE ts_test5 SET data=’updated_value’;

Query OK, 1 row affected (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 0

mysql> SELECT * FROM ts_test5;

+———————+———————+—————+

| created | updated | data |

+———————+———————+—————+

| 2005-01-04 14:47:39 | 2005-01-04 14:47:52 | updated_value |

+———————+———————+—————+

1 row in set (0.00 sec)

By default, MySQL defines TIMESTAMP columns as NOT NULL and stores the current timestamp in the column if you assign it a value of NULL. If you want to be able to store NULL in a TIMESTAMP column, you must explicitly write the column definition to allow NULL when creating or altering the column:

Change Color, weight , font size of tree node

Write a Actionscript class which extends “TreeItemRenderer” as below, and use this class in ur tree tag as





Actionscript class
package
{
import mx.controls.treeClasses.*;
import mx.collections.*;
public class MyTreeItemRenderer extends TreeItemRenderer
{

public function MyTreeItemRenderer()
{
super();
mouseEnabled = false;
}
override public function set data(value:Object):void
{
super.data = value;
if(TreeListData (super.listData).hasChildren)
{
setStyle(“color”, 0xff0000);
setStyle(“fontWeight”, ‘bold’);
}
else
{
setStyle(“color”, 0×000000);
setStyle(“fontWeight”, ‘normal’);

}
}

override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void
{
super.updateDisplayList(unscaledWidth, unscaledHeight);
if(super.data)
{
if(TreeListData(super.listData).hasChildren)
{
var tmp:XMLList = new XMLList(TreeListData(super.listData).node);
var myStr:int =tmp[0].children().length();
super.label.text = TreeListData(super.listData).text + “(” + myStr + “)”;
}

}

}
}
}

Regards,
Ranjit Sail