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

focus textInput In flex application

Here is simple solution:

Goto your project >> html-template folder >> index.template.html >>
open it.

Now edit JavaScript in that as follow:-

PUT THIS : document.DocumentName.focus(); ///Document name is your
flex Ex: – main.mxml file just give main

THIS BECAUSE SETFOCUS() JUST FOCUSES FLASH PLAYER NOT BROWSER TO SET
FOCUS WE CAN ADD ABOVE SINGAL LINE IN FOLLOWING CODE AS i DID.

Tour De Flex

Tour de Flex is a desktop application for exploring Flex capabilities and resources, including the core Flex components, Adobe AIR and data integration, as well as a variety of third-party components, effects, skins, and more.

Download is approx 50MB
Manual install – download the AIR file directory from here
Tour de Flex runs on Adobe AIR on Windows, Mac OS and Linux
User Guide (PDF)

Tour de Flex has three primary purposes:

Provide non-Flex developers with a good overview of what is possible in Flex in a “look and see” environment

Provide Flex developers with an illustrated reference tool

Provide commercial and non-commercial Flex developers a place to showcase their work

Tour de Flex includes over 200 runnable samples, each with source code, links to documentation, and other details. Topics include the Flex Core Components, Flex Data Access, AIR Desktop Capabilities, Cloud APIs, Data Visualization, Mapping, and a growing collection of custom components, effects, skins, etc.

——————————————————————————–

Tour de Flex Eclipse Plugin

An Eclipse plugin is available that provides a search interface to the 200+ samples in Tour de Flex. Search by component name, tag or author and double-click any item in the results to immediately see the component in Tour de Flex.

To install the plugin, add the following URL to your Eclipse software update sites: http://tourdeflex.adobe.com/eclipse. Once installed, a new Tour de Flex view is available to add. The plugin has been tested with Eclipse 3.4 and with Flex Builder 3.x.

——————————————————————————–

Showcasing your Flex work in Tour de Flex

One of the objectives of Tour de Flex is to provide a place for developers to showcase their work. We are always looking for new samples to add.

To have your work included in Tour de Flex, follow these steps:

Create demos of your work that look good within the Tour de Flex size constraints (663×246 when not expanded)

Arrange to have all assets hosted

Convert the source code to a color HTML document. You can use Flex Builder’s “View Source” feature to generate the HTML files.

Complete the sample submission form.

——————————————————————————–

Support

If you have suggestions for Tour de Flex or wish to report a bug, please post to the Flex Forum at http://www.adobe.com/go/flex_forums

——————————————————————————–

Share Tour de Flex!

You can help spread the word about Tour de Flex by using the following HTML to embed the install badge in your website: Click here

American Center Logo Design Competition

Contest Description
The American Centers in India are looking for a new logo! Put your graphic skills to work and win a design fellowship to the United States.

We seek the country’s creative community to help us develop a fresh look, which will be widely displayed on all American Center materials. American Centers are the public face of the U.S. Embassy in India. The American Centers in New Delhi and Kolkata, and the U.S. Consulates General in Chennai, Mumbai and Hyderabad support activities that inform the Indian public about American policies, society and values. These activities range from speaking tours and musical concerts, to school outreach, workshops and conferences, English programs, and exhibits. Please review the links above to learn more about the range of our activities.

The logo must be recognizable, dramatic and reflect the presence of the United States in India.

Eligibility
Open to Indian nationals age 18 and over.
Employees of the U.S. Government and their immediate family members are not eligible.
Contest Rules
The logo must be the original work of the designer. The designer must certify that the logo does not violate any copyright.
Submissions of qualifying nature will become the property of the U.S. Embassy, care of the American Center. For any submission the Center takes ownership of, the Center retains the right to change the designs to better fit its needs.
No limit on number of entries per person. Group entries are acceptable, but prizes will only be awarded to individuals.
Logo Guidelines
The logo must have a strong symbolic component such that is recognizable by itself without the words “American Center” beneath it.
The logo must remind the viewer that the American Center is part of the U.S. Government presence in India. It must be appropriate as a U.S. Government symbol.
The logo should be usable in monochrome and color media.
No gradient colors.
All fonts are acceptable.
The logo should be simple enough to be used in a variety of mediums from letterhead to billboard size.
Submissions must be in .GIF, .JPG. or .BMP format, and include the designer’s full name and e-mail address. The designer is welcome to send a short textual description of the logo along with the design. (optional)
Prizes
The contest will award prizes for up to three designers. Top prize is a design fellowship to the United States.*
*Visa eligibility applies.

For more details, contact us at amcenternd@state.gov, or 011-2347-2289/2290.

All submissions must be received by Jan. 15, 2009.

Please e-mail your entries at: amcenternd@state.gov
or
Send in your CD to:

American Center Logo Design Contest
The American Center,
24 Kasturba Gandhi Marg,
New Delhi – 110 001

January 23, 2009-Selection of finalists. Finalists will be posted on our website.
January 30, 2009- Awards ceremony at the American Center, New Delhi

Create columns on the fly for advanced datgrid in (actionscript)as /flex

Write event listner for ur datagrid component, when ever your dataprovider(data provider must be bindable) changes it calls collection change event,

example:-

//genricDG is my datagridgenricDG.addEventListener(CollectionEvent.COLLECTION_CHANGE, columnListener);

private function columnListener(event:CollectionEvent):void
{
var cols:Array = new Array();//genricDG.columns;
if(model.GridColumnName)//array of column name
{
var oColumnDef:Object;
var dgc:AdvancedDataGridColumn;
var iTotalDGWidth:int = 0;
if(model.GridColumnName.length != 0)
{
dgc=new AdvancedDataGridColumn();
dgc.dataField=”tno”;
dgc.headerText=”S. No.”
cols.push(dgc);

for (var i:int=0;i

}
genricDG.columns=cols;
}

else
{
cols=new Array();
genricDG.columns=null;
genricDG.columns=cols;
}
}

}

Free ‘Flex week’ video Training From Adobe

Hi All,

Enjoy Free Flex training On Following Link
http://www.adobe.com/devnet/flex/videotraining/

Regards,
Ranjit sail

Add Thik border on button in flex

Hi All,

This is one of the tricky task I came across. In flex if you increase
the border width of button it does not reflect. instead you can do
this.

buttonId.emphasized=true;

by default this property is false

Regards,
Ranjit

Datagrid cell validation in Action script

T datagrid with property editable=”true”

public var EditingRowIndex:int;private function testItemEditEnd(event:AdvancedDataGridEvent):void
{
EditingcolIndex=event.columnIndex;
//Previous column index
ComparecolIndex=event.columnIndex -1;
EditingRowIndex=event.rowIndex;
colReference=genricDG.columns[EditingcolIndex];
//Gives column name for Comapre Column
comReference=genricDG.columns[ComparecolIndex]["dataField"];
var CompareValue:int=genricDG.dataProvider[EditingRowIndex][comReference];
var EditedValue:int = parseInt(TextInput(event.currentTarget.itemEditorInstance).text);
if(CompareValue > EditedValue)
{

//no validation coz satisfies the condition
//total.text =String(parseInt(total.text) + EditedValue);

}

else
{

//PREVENT DEFAUL WILL PERSIST VALUE OF DATAGRID CELL
event.preventDefault();
//VALIDATION AFTER CONVERTIN itemEditorInstance INTO TextIput
TextInput(event.currentTarget.itemEditorInstance).errorString =
“Value Must be Less than or qual o” + comReference;

}

}