February 7, 2012

Enabling Flash Player logs Flex Applications

Issue :

Enabling Flash Player logs Flex Applications [Windows 7, 2008, Vista]

Solution :

To enable flash logs,

All you need to do is to create file called “mm.cfg” at the location

For eg : C:\Users\< your windows username>

A complete list of the locations for different OS can be found at refer :

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf69084-7fc9.html

 [note : Ensure you have Debug version of Flash player, you can check that by using the Flash player Version test link :

http://kb2.adobe.com/cps/155/tn_15507.html ]

Modify the “mm.cfg” file to include the following


ErrorReportingEnable=1
TraceOutputFileEnable=1

Now run the Flex/Air application on the same machine on which you have made the changes to “mm.cfg” file

You would find the errors in the log created at

C:\Users\<username>\AppData\Roaming\Macromedia\Flash Player\Logs\flashlog.txt

A complete list of the locations for different OS can be found at refer :

http://help.adobe.com/en_US/flex/using/WSda78ed3a750d6b8f-4867184d1239f9d0558-8000.html

Additional Information

Client-Side Logging

http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Developing/WSc3ff6d0ea77859461172e0811f00f6f9ad-7fffUpdate.html

Server-Side Logging

http://help.adobe.com/en_US/LiveCycleDataServicesES/3.1/Developing/WSc3ff6d0ea77859461172e0811f00f7045b-7f42Update.html

5:54 PM Permalink
November 18, 2011

Exporting Flex chart Component to Excel as image

Issue

Exporting Flex chart Component to Excel as image

Solution :

        

  • Create a chart component

 

  • Use the method ImageSnapshot .captureImage() to capture snapshot of any component.

please refer : http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/graphics/ImageSnapshot.html#captureImage%28%29 as in the code, var ImageBA:ByteArray = ImageSnapshot.captureImage( Chart, 0, new JPEGEncoder() ).data;

Store the same on a byte array and forward the same to a ColdFusion component as an argument.
 Remote Object call would look like :
        <s:RemoteObject id="RemoteCall" endpoint="http://localhost:8300/flex2gateway/"
                        destination="ColdFusion" source="ChartToShuyi182703455.CallCFCTest">
            <s:method name="CreateImage"
                      result="onResult(event)"
                      fault="onFault(event)">
            </s:method>
        </s:RemoteObject>

            protected function CreateImage_clickHandler(event:MouseEvent):void
            {
                // TODO Auto-generated method stub
                var ImageBA:ByteArray = ImageSnapshot.captureImage( Chart, 0, new JPEGEncoder() ).data;
                RemoteCall.CreateImage(ImageBA);
            }
<s:Button id="CreateImage" label="CreateImage" click="CreateImage_clickHandler(event)" visible="{SnapshotImage.source != null}"/>

On the ColdFusion Server end

  • Use the binary data from the argument and use CFFile Tag to write the image to a file.
    <cffunction name="CreateImage"
        access="remote"
        output="false" returntype="String" >

        <cfargument name="ImageBA" type="binary" required="true" />
        <cffile action="write" file="#theDir#test.jpg" output="#arguments.ImageBA#" >
        <cfreturn "The Image can be found on server : "&#theDir#>
    </cffunction>
  •  Write the image file to the Excel Spreadsheet using CFspreadsheet

please refer : http://help.adobe.com/en_US/ColdFusion/9.0/Developing/WS434C35B0-279B-4051-A61B-D84B5D76189C.html
and SpreadsheetAddImage please refer : http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-688c.html

    <cffunction name="ExportToExcel"
        access="remote"
                output="false" returntype="String" >
        <cfimage name="ComponentImage" source="#theDir#test.jpg" action="read"  />
        <cfscript>
            SpreadSheetObj=spreadsheetNew();
            spreadsheetAddimage(spreadsheetobj,ComponentImage,"jpg","5,5,25,12");
        </cfscript>
        <cfspreadsheet action="write"
                       name="SpreadSheetObj"
                       filename="#theDir#imagesheet.xls" overwrite="true" >
        <cfreturn "The SpreadSheet with Chart Image can be found on server : "&#theDir#>
    </cffunction>

Additional Information :

Adobe Products used SDK 4.5.1 and ColdFusion 9.0

 

Flex Code [ChartToExcelAsImage.mxml]:

 

 <?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"  
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">

    <fx:Declarations>
        <s:RemoteObject id="RemoteCall" endpoint="http://localhost:8300/flex2gateway/"
                        destination="ColdFusion" source="ChartToShuyi182703455.CallCFCTest">
            <s:method name="CreateImage"
                      result="onResult(event)"
                      fault="onFault(event)">
            </s:method>
            <s:method name="ExportToExcel"
                      result="onResult(event)"
                      fault="onFault(event)">
            </s:method>
            <s:method name="ClearFiles"
                      result="onResult(event)"
                      fault="onFault(event)">
            </s:method>
        </s:RemoteObject>
    </fx:Declarations>
    <fx:Script>
        <![CDATA[
            import mx.collections.ArrayCollection;
            import mx.controls.Alert;
            import mx.graphics.ImageSnapshot;
            import mx.graphics.codec.JPEGEncoder;
            import mx.rpc.events.FaultEvent;
            import mx.rpc.events.ResultEvent;

            private var SnapShot:ImageSnapshot;
            [Bindable]private var medalsAC:ArrayCollection = new ArrayCollection( [
                { Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
                { Country: "China", Gold: 32, Silver:17, Bronze: 14 },
                { Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);
            private var snapshot :ImageSnapshot;
            protected function ScreenShot_clickHandler(event:MouseEvent):void
            {
                SnapshotImage.source=ImageSnapshot.captureImage( Chart, 0, new JPEGEncoder() ).data;
                SnapshotImage.width=ChartComponent.width;
                SnapshotImage.height=ChartComponent.height;
                CreateImage.enabled=true;
            }
            public function onResult(event : ResultEvent) : void
            {
                ServerReturn.text=event.result as String;
            }
            public function onFault(event : FaultEvent) : void
            {
                Alert.show(event.fault.message,event.fault.faultCode );
            }

            protected function CreateImage_clickHandler(event:MouseEvent):void
            {
                // TODO Auto-generated method stub
                var ImageBA:ByteArray = ImageSnapshot.captureImage( Chart, 0, new JPEGEncoder() ).data;
                RemoteCall.CreateImage(ImageBA);
                CreateImage.enabled=false;
                ExportToExcel.enabled=true;
                ClearFiles.enabled=false;
            }

            protected function ExportToExcel_clickHandler(event:MouseEvent):void
            {
                // TODO Auto-generated method stub
                RemoteCall.ExportToExcel.send();
                CreateImage.enabled=false;
                ExportToExcel.enabled=false;
                ClearFiles.enabled=true;
            }

            protected function ClearFiles_clickHandler(event:MouseEvent):void
            {
                // TODO Auto-generated method stub
                RemoteCall.ClearFiles.send();
                CreateImage.enabled=false;
                ExportToExcel.enabled=false;
                ClearFiles.enabled=false;
            }

        ]]>
    </fx:Script>

    <s:layout>
        <s:VerticalLayout verticalAlign="middle" horizontalAlign="center" />
    </s:layout>

    <s:Panel title="BarChart Control"
             color="0x000000"
             borderAlpha="0.15" width="100%">

        <s:layout>
            <s:HorizontalLayout />
        </s:layout>
        <mx:HDividedBox width="100%">

            <s:Panel id="ChartComponent" title="Chart Component" >
                <s:layout>
                    <s:HorizontalLayout/>
                </s:layout>
                <mx:HBox id="Chart" backgroundColor="white">
                    <mx:BarChart id="bar" height="100%" color="0x323232"
                                 showDataTips="true" dataProvider="{medalsAC}">

                        <mx:verticalAxis>
                            <mx:CategoryAxis categoryField="Country"/>
                        </mx:verticalAxis>

                        <mx:series>
                            <mx:BarSeries yField="Country" xField="Gold" displayName="Gold"/>
                            <mx:BarSeries yField="Country" xField="Silver" displayName="Silver"/>
                            <mx:BarSeries yField="Country" xField="Bronze" displayName="Bronze"/>
                        </mx:series>
                    </mx:BarChart>

                    <mx:Legend dataProvider="{bar}" color="0x323232"/>
                </mx:HBox>
            </s:Panel>
            <s:Panel title="Screen Shot">
                <s:Image id="SnapshotImage" width="{ChartComponent.width}" height="{ChartComponent.height}"/>
            </s:Panel>        
        </mx:HDividedBox>

    </s:Panel>
    <s:Panel minWidth="600" minHeight="150">
        <s:layout>
            <s:VerticalLayout verticalAlign="middle" horizontalAlign="center"/>
        </s:layout>
        <s:Button id="ScreenShot" label="Take ScreenShot" click="ScreenShot_clickHandler(event)"/>
        <mx:Text id="ServerReturn" text="no data from server"/>
        <s:Button id="CreateImage" label="CreateImage" click="CreateImage_clickHandler(event)" visible="{SnapshotImage.source != null}"/>
        <s:Button id="ExportToExcel" label="ExportToExcel" click="ExportToExcel_clickHandler(event)" enabled="false" />
        <s:Button id="ClearFiles" label="ExportToExcel" click="ClearFiles_clickHandler(event)" enabled="false" />
    </s:Panel>
</s:Application>

ColdFusion Code :[CallCFCTest.cfc]

 

<cfcomponent displayname="CallCFCTest">
        <cfscript>
            theDir=getDirectoryFromPath(GetCurrentTemplatePath());
        </cfscript>
    <cffunction name="CreateImage"
        access="remote"
        output="false" returntype="String" >

        <cfargument name="ImageBA" type="binary" required="true" />
        <cffile action="write" file="#theDir#test.jpg" output="#arguments.ImageBA#" >
        <cfreturn "The Image can be found on server : "&#theDir#>
    </cffunction>

    <cffunction name="ExportToExcel"
        access="remote"
                output="false" returntype="String" >
        <cfimage name="ComponentImage" source="#theDir#test.jpg" action="read"  />
        <cfscript>
            SpreadSheetObj=spreadsheetNew();
            spreadsheetAddimage(spreadsheetobj,ComponentImage,"jpg","5,5,25,12");
        </cfscript>
        <cfspreadsheet action="write"
                       name="SpreadSheetObj"
                       filename="#theDir#imagesheet.xls" overwrite="true" >
        <cfreturn "The SpreadSheet with Chart Image can be found on server : "&#theDir#>
    </cffunction>
    <cffunction name="ClearFiles"
        access="remote"
                output="false" returntype="String" >

        <cffile action="delete" file="#theDir#test.jpg">
        <cffile action="delete" file="#theDir#imagesheet.xls">
        <cfreturn "The SpreadSheet along with Chart Image have been deleted from Server: "&#theDir#>
    </cffunction>
</cfcomponent>
3:14 PM Permalink
October 28, 2011

How make MX DataGrid Cell components i.e. ItemRenderers Automation Friendly

Issue :

How make MX DataGrid Cell components i.e. Custom ItemRenderers Automation Friendly

Solution :

Developers tend to modify the components that usually make up the default cell [ ItemRenderer=cell ] of a Data Grid, to fullfill there business requirements.
A Default cell of a DataGrid is made up of a ‘UITextField’ which is nothing but Text and no other component associated with it and shows up as ‘FlexListLabel’ when recognized with QTP,


modifications may include adding buttons, link buttons, more text, Text Area etc
but if you don’t add them correctly, the components under the Data Grid which are inside the custom item renderer would not be exposed to Automation.

One of the ways to ensure that all components inside your DataGrid cell remain exposed to automation is as follows,

Please find the sample application below “DataGridLinkedButton.mxml”

Your developers need to define inline or External Item renderers for your Data Grid,

based on a Flex container [in the example we have used “HBox”] which exposes its children automatically to automation [you can use HBox or VBox ].

 

For Inline Item renderer :

<mx:DataGridColumn headerText="Inline Renderer" width="150">
<mx:itemRenderer>
<fx:Component>
<mx:HBox horizontalAlign="center">
<mx:LinkButton label="TestLinkButton" color="haloblue" rollOverColor="haloSilver"/>
</mx:HBox>
</fx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>

 

For External Item Renderer [ refer : “myExternalItemRenderer.mxml “]

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
focusEnabled="true" horizontalAlign="center">
<mx:LinkButton label="LinkButton from External Renderer" color="haloblue" rollOverColor="haloSilver"/>
</mx:HBox>

 

Please refer the Image :

Click operations on

1st ,2nd ,3rd ,

4th column [contains External Item Renderer with LinkButton]

and 5th column [contains Inline Item Renderer with LinkButton]

Would record Automation scripts like so.

 

Automation Scripts :

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).Select “*Christina Coenraets* | 555-219-2270 | ccoenraets@fictitious.com | LinkButton from External Renderer | TestLinkButton”

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).Select “Christina Coenraets | *555-219-2270* | ccoenraets@fictitious.com | LinkButton from External Renderer | TestLinkButton”

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).Select “Christina Coenraets | 555-219-2270 | *ccoenraets@fictitious.com* | LinkButton from External Renderer | TestLinkButton”

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).FlexButton(“LinkButton from External”).Click

Browser(“Browser”).SparkApplication(“DataGridLinkedButtonQualcomm18″).SparkPanel(“DataGrid Control”).FlexDataGrid(“dg”).FlexButton(“TestLinkButton”).Click

Additional Information :

Input Operation on FlexAdvancedDataGrid Cell using QTP

 

FLEX CODE

DataGridLinkedButton.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
               xmlns:s="library://ns.adobe.com/flex/spark"
               xmlns:mx="library://ns.adobe.com/flex/mx">

        <fx:Declarations>
            <fx:XMLList id="employees">
                <employee>
                    <name>Christina Coenraets</name>
                    <phone>555-219-2270</phone>
                    <email>ccoenraets@fictitious.com</email>
                    <active>true</active>
                    <image>images/arrow_icon_sm.png</image>
                </employee>
                <employee>
                    <name>Joanne Wall</name>
                    <phone>555-219-2012</phone>
                    <email>jwall@fictitious.com</email>
                    <active>true</active>
                </employee>
                <employee>
                    <name>Maurice Smith</name>
                    <phone>555-219-2012</phone>
                    <email>maurice@fictitious.com</email>
                    <active>false</active>
                </employee>
                <employee>
                    <name>Mary Jones</name>
                    <phone>555-219-2000</phone>
                    <email>mjones@fictitious.com</email>
                    <active>true</active>
                </employee>
            </fx:XMLList>
        </fx:Declarations>

        <s:layout>
            <s:HorizontalLayout horizontalAlign="center" />
        </s:layout>

        <s:Panel title="DataGrid Control"
                 color="0x000000"
                 borderAlpha="0.15">

            <s:layout>
                <s:VerticalLayout paddingLeft="10" paddingRight="10" paddingTop="10" paddingBottom="10"/>
            </s:layout>

            <s:Label width="100%" color="0x323232"
                     text="Select a row in the DataGrid control."/>

            <mx:DataGrid id="dg" color="0x323232" width="100%" rowCount="3" dataProvider="{employees}">
                <mx:columns>
                    <mx:DataGridColumn dataField="name" headerText="Name"/>
                    <mx:DataGridColumn dataField="phone" headerText="Phone"/>
                    <mx:DataGridColumn dataField="email" headerText="Email"/>
                    <mx:DataGridColumn headerText="External Renderer" itemRenderer="myExternalItemRenderer" width="250"/>
                    <mx:DataGridColumn headerText="Inline Renderer" width="150">
                        <mx:itemRenderer>
                            <fx:Component>
                                <mx:HBox horizontalAlign="center">
                                    <mx:LinkButton label="TestLinkButton" color="haloblue" rollOverColor="haloSilver"/>
                                </mx:HBox>
                            </fx:Component>
                        </mx:itemRenderer>
                    </mx:DataGridColumn>
                </mx:columns>
            </mx:DataGrid>

            <mx:Form color="0x323232" width="100%" height="100%" paddingTop="0" paddingBottom="0"  >

                <mx:FormItem label="Name" paddingTop="0" paddingBottom="0">
                    <s:Label text="{dg.selectedItem.name}"/>
                </mx:FormItem>
                <mx:FormItem label="Email" paddingTop="0" paddingBottom="0">
                    <s:Label text="{dg.selectedItem.email}"/>
                </mx:FormItem>
                <mx:FormItem label="Phone" paddingTop="0" paddingBottom="0">
                    <s:Label text="{dg.selectedItem.phone}"/>
                </mx:FormItem>

            </mx:Form>

        </s:Panel>

</s:Application>

 

myExternalItemRenderer.mxml

<?xml version="1.0" encoding="utf-8"?>
<mx:HBox xmlns:fx="http://ns.adobe.com/mxml/2009"
                          xmlns:s="library://ns.adobe.com/flex/spark"
                          xmlns:mx="library://ns.adobe.com/flex/mx"
                          focusEnabled="true" horizontalAlign="center">
    <mx:LinkButton label="LinkButton from External Renderer" color="haloblue" rollOverColor="haloSilver"/>
</mx:HBox>
3:15 AM Permalink
September 15, 2011

Flex applications show up as Macromedia Flash objects on QTP Object Spy

Issue :

Flex applications show up as Macromedia Flash objects on QTP Object Spy

Potential Causes :

Ensure the your environment works on Automation enabled build from Adobe, Please refer : http://www.adobe.com/devnet/flex/samples/flex_store_v2.html

  • If the app does not work,the possible causes are

-Issues with compatibility of QTP-Browser-Flex Plugin/Addin
-The Communication between ActiveX Plugin in the browser for Flex-QTP Automaiton Plugin and QTP is interrupted due to Browser Security settings.

  • If the app works then the issue in your environment but your application, the possible causes are

-Application is not compiled with automation swc files i.e. Flex Automation libraries.

Solution :

Issues with compatibility of QTP-Browser-Flex Plugin/Addin

Please refer : http://blogs.adobe.com/vikaschandran/2010/07/10/compatibility-matrix-for-flex-qtp-plugin-3-0-0-and-4-0-0-for-qtp-and-ie-combinations/

 

Application is compiled with automation swc files i.e. Flex Automation libraries.

Please refer :

Compiling Flex 3 Applications to enable automation

http://blogs.adobe.com/vikaschandran/2010/07/11/compiling-flex-3-applications-to-enable-automaiton/

Compiling Flex 4 Applications to enable automation

http://blogs.adobe.com/vikaschandran/2010/07/15/compiling-flex-4-applications-to-enable-automaiton/

 

The Communication between ActiveX Plugin in the browser for Flex-QTP Automation Plugin and QTP is interrupted due to Browser Security settings

This can be avoided by ensuring the following

-the TEAPluginIE.dll which is used by IE ActiveX for the Flex-QTP plug-in loads in Internet explorer when QTP is recording

Because if it’s not loaded in IE nothing would work, Process Explorer should help you check the same.

-the behavior of the Object Spy changes [win objects start showing up] if you change i.e. increase the security properties on the browser for internet and intranet

-if you keep both internet and intranet security to medium or low

i.e. basically allowing the Flex-QTP ActiveX component to do its job without hindrance. Everything would work fine.

6:04 PM Permalink

Debugging checking and tracking variables in QTP with Flex-QTP Addin

ISSUE

Debugging and tracking variables in QTP

SOLUTION

Have a look at QTP  break point options in the image below

the red dots you see in QTP in the image below are the Break points

 

-right click on the Breakpoint to see the options,

-Use “Run from Step” and “Run to step”

 

Or Use “Debug from Step”

To add the variables to debug viewer you need to add watch on them use “Add to watch”

and check the “Debug viewer” panel to have look at the variables,

 

And once the playback starts use “F10” and “F11” to step through the Automation Scripts line by line

keep an eye on the “Object Repository

To check on the values,

You may also use the following code

myvariable=Browser(“Browser”).SparkApplication(“ADGFidelity182547968Nikhil”).SparkPanel(“AdvancedDataGrid Control”).FlexAdvancedDataGrid(“myADG”).GetROProperty(“automationname”)

print myvariable               //myADG that you see on the image below is the print output

myvariable2=Browser(“Browser”).SparkApplication(“ADGFidelity182547968Nikhil”).SparkPanel(“AdvancedDataGrid Control”).FlexAdvancedDataGrid(“myADG”).GetROProperty(“automationindex”)

msgbox  myvariable2     //index:0 is the msgbox output


4:14 PM Permalink
September 1, 2011

Red X instead of image in distributed environment ColdFusion 8 or 9 and IIS : Coldfusion does not serve the Static content by default

ISSUE

Red X instead of image in distributed environment ColdFusion 8 or 9

i.e. when IIS and ColdFusion are on 2 separate physical servers and files [Static content or Dynamic content] does not reside on Web Server but resides on Application server i.e. server machine which has ColdFusion.

SOLUTION [One of the possible solutions]

Basically when it comes to Static content like images,
ColdFusion does not serve the Static content by default

It looks to IIS to serve static content [due to the mapping that are set while configuring the web connector only CFM, CFC, CFR, CFML i.e. ColdFusion specific content would be processed by ColdFusion]

So when you place a request for any content,

by default the request goes to IIS first it checks the extension of the file requested,

if the extension matches the ones which correspond to ColdFusion extensions,

The request is forwarded to ColdFusion to be processed.

 

If not it goes to IIS for processing.

 

Since in certain environments its not possible to keep the files in IIS webroot

And all files are required to be kept at the Application Server Tier/Level.

 

All we need to resolve this issue is to setup the application to use a context root.

So modify the

“Application.xml”

file under location “C:\JRun4\servers\<server instance>\cfusion-ear\META-INF”

 

<web>

<web-uri>cfusion-war</web-uri>

<context-root>/</context-root>

</web>

 

To use an appropriate Context root.

Say

<web>

<web-uri>cfusion-war</web-uri>

<context-root>/Aline</context-root>

</web>

This would force the Application to serve the static content from the Application Server end.

And the control would not go to IIS to serve the static content.

4:41 AM Permalink

Port number required While configuring the web connector in distributed environment between IIS and Coldfusion 8 or 9

ISSUE

Port number required While configuring the web connector in distributed environment between IIS and Coldfusion 8 or 9

SOLUTION

While configuring the connector using the “Wsconfig” tool in distributed environment between IIS and Coldfusion we need access to 3 port numbers

The Remote port :

At “C:\Jrun4\servers\<serverInstance>\SERVER-INF\jndi.properties”

At line

java.naming.provider.url=localhost:2904

Here 2904 is the remote port.

The Proxy port :

At “C:\Jrun4\servers\<serverInstance>\SERVER-INF\jrun.xml”

<service class=”jrun.servlet.jrpp.JRunProxyService” name=”ProxyService”>

<attribute name=”activeHandlerThreads”>25</attribute>

<attribute name=”backlog”>500</attribute>

<attribute name=”deactivated”>true</attribute>

<attribute name=”interface”>*</attribute>

<attribute name=”maxHandlerThreads”>1000</attribute>

<attribute name=”minHandlerThreads”>1</attribute>

<attribute name=”port”>51020</attribute>

 

Here 51020 is the proxy port

 

And the RMI port [there is no way to determine this port ]: so disable firewall while configuring the connector in distributed architecture,

once the connector is configured re-enable the firewall with exceptions for Proxy port [Mandatory]

ADDITIONAL INFORMATION

If this does not work the only way to configure a connector is

Manual Configuration of Web Connector

please refer : http://www.adobe.com/devnet/coldfusion/articles/iis-configuration.html

4:07 AM Permalink
August 18, 2011

Traversing Spark Dropdown list with large number of items Flex SDK 4.x using QTP

ISSUE

Traversing Spark Dropdown list with large number of items Flex SDK 4.x using QTP

SOLUTION

The solution consists of two parts

PART 1

Change the Dropdown code [Application code] to include a property

useVirtualLayout=”false”

[for more details please refer : Using virtualization with list-based controls]


<s:DropDownList id=”DropDownTest” dataProvider=”{arrElementsDdl}” useVirtualLayout=”false” selectedIndex=”0″/>

as in the sample application provided Please refer code below : SparkDropDownFidelity182460106CODE

PART 2

Consists of using the automation Scripts as described below,

‘Get the number of  children under the Drop Down

Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).Open
Num=Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).GetItemsCount
Print “‘GetItemsCount’ value for Spark Drop Down: “&Num

‘Loop through the items inside Drop Down using SelectIndex
For i=0 to Num-1
Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).SelectIndex i

‘Always open the list before checking for the items
Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).Open
temp=Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).SparkListLabel(“automationindex:=index:”&i).Exist
print “Object Exists ? : ” &temp
set SparkGetItem=Browser(“Browser”).SparkApplication(“SparkDropDownFidelity182460106″).SparkDropDownList(“DropDownTest”).SparkListLabel(“automationindex:=index:”&i)

‘Access the properties of the item
ItemAutomationname=SparkGetItem.GetROProperty(“automationname”)
ItemAutomationindex=SparkGetItem.GetROProperty(“automationindex”)
print “Spark Automationname : ” & ItemAutomationname&” Automationindex : ” &ItemAutomationindex
Next

ADDITIONAL INFORMATION

SparkDropDownFidelity182460106CODE

<?xml version=”1.0″ encoding=”utf-8″?>
<s:Application xmlns:fx=”http://ns.adobe.com/mxml/2009″
xmlns:s=”library://ns.adobe.com/flex/spark”
xmlns:mx=”library://ns.adobe.com/flex/mx” minWidth=”955″ minHeight=”600″>

<fx:Declarations>
<!– Place non-visual elements (e.g., services, value objects) here –>

</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.collections.ArrayCollection;

[Bindable]
public var arrElementsDdl:ArrayCollection = new ArrayCollection([
{label:"Item 1", data:1},
{label:"Item 2", data:2},
{label:"Item 3", data:3},
{label:"Item 4", data:4},
{label:"Item 5", data:5},
{label:"Item 6", data:6},
{label:"Item 7", data:7},
{label:"Item 8", data:8},
{label:"Item 9", data:9},
{label:"Item 10", data:10},
{label:"Item 11", data:11},
{label:"Item 12", data:12},
{label:"Item 13", data:13},
{label:"Item 14", data:14},
{label:"Item 15", data:15}]);
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>

<s:ComboBox id=”cboxTest” dataProvider=”{arrElementsDdl}” selectedIndex=”0″ />
<s:DropDownList id=”DropDownTest” dataProvider=”{arrElementsDdl}” useVirtualLayout=”false” selectedIndex=”0″/>
<mx:Text id=”testText” text=”SDK 4.0 test 2 with useVirtualLayout=false”/>
</s:Application>

11:11 AM Permalink
July 15, 2011

Running servlets on Coldfusion 9

ISSUE

Running servlets on Coldfusion 9

Continue reading…

7:53 PM Permalink
July 11, 2011

Using a Servlet to render a HTML wrapper to call a flex application for automation

ISSUE

Using a servlet to render a HTML wrapper to call a flex application for automation.

SOLUTION

Please find the sample servlet code which is based on the default HTML wrapper generated by Flash Builder.

as long as you have mentioned the right SWF name and compiled the SWF to be automation enabled.

you should be able to record and playback automation scripts.

[ NOTE : Also ensure that you have the related files in place

[ history folder, AC_OETags.js, playerProductInstall.swf, automation enabled application SWF file]

you may find them in any project created from Flash builder (can be found in “Bin-Debug” folder or any release build exported from Flash builder) ]

after adding the files your directory structure would look like this.

 

SERVLET CODE :

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
*
* @author chandran
*/
@WebServlet(name = “QtpServlet”, urlPatterns = {“/QtpServlet”})
public class QtpServlet extends HttpServlet {

/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType(“text/html;charset=UTF-8″);
PrintWriter out = response.getWriter();
try {
/*
out.println(“<html>”);
out.println(“<head>”);
out.println(“<title>Servlet QtpServlet</title>”);
out.println(“</head>”);
out.println(“<body>”);
out.println(“<h1>Servlet QtpServlet at ” + request.getContextPath () + “</h1>”);
out.println(“</body>”);
out.println(“</html>”);
*/

out.println(“<html lang=\”en\”>”);

out.println(“<head>”);
out.println(“<meta http-equiv=\”Content-Type\” content=\”text/html; charset=utf-8\” />”);

/*  BEGIN Browser History required section */
out.println(“<link rel=\”stylesheet\” type=\”text/css\” href=\”history/history.css\” />”);
/*  END Browser History required section */

out.println(“<title></title>”);
out.println(“<script src=\”AC_OETags.js\” language=\”javascript\”></script>”);

/*  BEGIN Browser History required section */
out.println(“<script src=\”history/history.js\” language=\”javascript\”></script>”);
/*  END Browser History required section */

out.println(“<style>”);
out.println(“body { margin: 0px; overflow:hidden }”);
out.println(“</style>”);
out.println(“<script language=\”JavaScript\” type=\”text/javascript\”>”);
/*
// —————————————————————————–
// Globals
// Major version of Flash required*/
out.println(“var requiredMajorVersion = 9;”);
// Minor version of Flash required
out.println(“var requiredMinorVersion = 0;”);
// Minor version of Flash required
out.println(“var requiredRevision = 124;”);
// —————————————————————————–
// */
out.println(“</script>”);
out.println(“</head>”);

out.println(“<body scroll=\”no\”>”);
out.println(“<script language=\”JavaScript\” type=\”text/javascript\”>”);
/*
// Version check for the Flash Player that has the ability to start Player Product Install (6.0r65)*/
out.println(“var hasProductInstall = DetectFlashVer(6, 0, 65);”);

// Version check based upon the values defined in globals
out.println(“var hasRequestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);”);

out.println(“if ( hasProductInstall && !hasRequestedVersion ) {“);

// DO NOT MODIFY THE FOLLOWING FOUR LINES
// Location visited after installation is complete if installation is required
out.println(“var MMPlayerType = (isIE == true) ? \”ActiveX\” : \”PlugIn\”;”);
out.println(“var MMredirectURL = window.location;”);

out.println(“document.title = document.title.slice(0, 47) + \” – Flash Player Installation\”;”);
out.println(“var MMdoctitle = document.title;”);

out.println(“AC_FL_RunContent(“);
out.println(“\”src\”, \”playerProductInstall\”,”);
out.println(“\”FlashVars\”, \”MMredirectURL=\”+MMredirectURL+\’&MMplayerType=\’+MMPlayerType+\’&MMdoctitle=\’+MMdoctitle+\”\”,”);
out.println(“\”width\”, \”100%\”,”);
out.println(“\”height\”, \”100%\”,”);
out.println(“\”align\”, \”middle\”,”);
out.println(“\”id\”, \”AccordianHeader182345208\”,”);
out.println(“\”quality\”, \”high\”,”);
out.println(“\”bgcolor\”, \”#ffffff\”,”);
out.println(“\”name\”, \”AccordianHeader182345208\”,”);
out.println(“\”allowScriptAccess\”,\”sameDomain\”,”);
out.println(“\”type\”, \”application/x-shockwave-flash\”,”);
out.println(“\”pluginspage\”, \”http://www.adobe.com/go/getflashplayer\”");
out.println(“);”);
out.println(“} else if (hasRequestedVersion) {“);
// if we\”ve detected an acceptable version
// embed the Flash Content SWF when all tests are passed
out.println(“AC_FL_RunContent(\”src\”, \”AccordianHeader182345208\”,\”width\”, \”100%\”,\”height\”, \”100%\”,\”align\”, \”middle\”,\”id\”, \”AccordianHeader182345208\”,\”quality\”, \”high\”,\”bgcolor\”, \”#ffffff\”,\”name\”, \”AccordianHeader182345208\”,\”allowScriptAccess\”,\”sameDomain\”,\”type\”, \”application/x-shockwave-flash\”,\”pluginspage\”, \”http://www.adobe.com/go/getflashplayer\”);”);
out.println(“} else {  // flash is too old or we can’t detect the plugin”);
out.println(“var alternateContent = \’Alternate HTML content should be placed here. \’+ \’This content requires the Adobe Flash Player. \’+ \’<a href=http://www.adobe.com/go/getflash/>Get Flash</a>\’;document.write(alternateContent);”);
// insert non-flash content
out.println(“}”);
// */
out.println(“</script>”);
out.println(“<noscript>”);
out.println(“<object classid=\”clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\”");
out.println(“id=\”AccordianHeader182345208\” width=\”100%\” height=\”100%\”");
out.println(“codebase=\”http://fpdownload.macromedia.com/get/flashplayer/current/swflash.cab\”>”);
out.println(“<param name=\”movie\” value=\”AccordianHeader182345208.swf\” />”);
out.println(“<param name=\”quality\” value=\”high />”);
out.println(“<param name=\”bgcolor\” value=\”#ffffff />”);
out.println(“<param name=\”allowScriptAccess\” value=\”sameDomain\” />”);
out.println(“<embed src=\”AccordianHeader182345208.swf\” quality=\”high\” bgcolor=\”#ffffff\”");
out.println(“width=\”100%\” height=\”100%\” name=\”AccordianHeader182345208\” align=\”middle\”");
out.println(“play=\”true\”");
out.println(“loop=\”false\”");
out.println(“quality=\”high\”");
out.println(“allowScriptAccess=\”sameDomain\”");
out.println(“type=\”application/x-shockwave-flash\”");
out.println(“pluginspage=\”http://www.adobe.com/go/getflashplayer\”>”);
out.println(“</embed>”);
out.println(“</object>”);
out.println(“</noscript>”);
out.println(“</body>”);
out.println(“</html>”);

} finally {
out.close();
}
}

// <editor-fold defaultstate=”collapsed” desc=”HttpServlet methods. Click on the + sign on the left to edit the code.”>
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}

/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return “Short description”;
}// </editor-fold>
}

6:38 PM Permalink