Remote Call to Blazeds and displaying the result set in grid

Hi,
I want to call a remote method using Flex application from Blazeds and display the values in DataGrid. Can anyone help in this ?
-- I am using AMFChannel
-- The method to be called is PolicyApnVO.getPoliciesApn()
-- Please advice any correction if required
Here is the mxml code :
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
                creationComplete="initApp()" viewSourceURL="srcview/index.html">
    <!--
    Simple client to demonstrate runtime configuration of destinations.
    The "runtime-employee" destination is configured in
    EmployeeRuntimeRemotingDestination.java.
    -->
    <mx:Script>
        <![CDATA[
            import mx.messaging.ChannelSet;
            import mx.messaging.channels.AMFChannel;
            import mx.rpc.remoting.mxml.RemoteObject;
            [Bindable]
            public var srv:RemoteObject;
            public function initApp():void
                var channel:AMFChannel = new AMFChannel("my-amf", "http://192.168.102.208:8400/policyAnalytics/messagebroker/amf");
                var channelSet:ChannelSet = new ChannelSet();
                channelSet.addChannel(channel);
                srv = new RemoteObject();
                srv.destination="runtime-policy";   
                srv.channelSet = channelSet;
                srv.PolicyApnVO.getPoliciesApn();
        ]]>
    </mx:Script>
    <mx:Panel title="Policy Details" width="100%" height="100%">
        <mx:DataGrid width="100%" height="100%" dataProvider="{srv.PolicyApnVO.getPoliciesApn.lastResult.data.result}"
                     showDataTips="true">
            <mx:columns>
                <mx:DataGridColumn headerText="APN Id" dataField="apnId"/>
                <mx:DataGridColumn headerText="APN Name" dataField="apnName"/>
                <mx:DataGridColumn headerText="Policy ID" dataField="policyId"/>
                <mx:DataGridColumn headerText="Policy Name" dataField="policyName"/>
            </mx:columns>
        </mx:DataGrid>
    </mx:Panel>
</mx:Application>

There may be other ways to do this but here's what I would do:
1) add a results method to the remote object:
src.result="onResult(event.result)";
2) add the callback method: private function onResult(event : * = null)
:void{
                                                     if(event is
ArrayCollection)
                                                            myData =
ArrayCollection(event);
3) add the variable: private var myData:ArrayCollection;
4) make the dataProvider for the grid use the my data :
dataProvider=""
You can probably avoid all this by adjusting your dataProvider. I am just
not sure what it would be without experimenting. But definitely not what
you have. Maybe just {svc.result}.

Similar Messages

  • How to Read the one Source Column data and Display the Results

    Hi All,
         I have one PR_ProjectType Column in my Mastertable,Based on that Column we need to reed the column data and Display the Results
    Ex:
    Pr_ProjectType
    AD,AM
    AD
    AM
    AD,AM,TS,CS.OT,TS
    AD,AM          
    like that data will come now we need 1. Ad,AM then same we need 2. AD also same we need 3. AM also we need
    4.AD,AM,TS,CS.OT,TS in this string we need AD,AM  only.
    this logic we need we have thousand of data in the table.Please help this is urgent issue
    vasu

    Hi Vasu,
    Based on your description, you want to eliminate the substrings (eliminated by comma) that are not AD or AM in each value of the column. Personally, I don’t think this can be done by just using an expression in the Derived Column. To achieve your goal, here
    are two approaches for your reference:
    Method 1: On the query level. Replace the target substrings with different integer characters, and create a function to eliminate non-numeric characters, then replace the integer characters with the corresponding substrings. The statements
    for the custom function is as follows:
    CREATE FUNCTION dbo.udf_GetNumeric
    (@strAlphaNumeric VARCHAR(256))
    RETURNS VARCHAR(256)
    AS
    BEGIN
    DECLARE @intAlpha INT
    SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric)
    BEGIN
    WHILE @intAlpha > 0
    BEGIN
    SET @strAlphaNumeric = STUFF(@strAlphaNumeric, @intAlpha, 1, '' )
    SET @intAlpha = PATINDEX('%[^0-9]%', @strAlphaNumeric )
    END
    END
    RETURN ISNULL(@strAlphaNumeric,0)
    END
    GO
    The SQL commands used in the OLE DB Source is like:
    SELECT
    ID, REPLACE(REPLACE(REPLACE(REPLACE(dbo.udf_GetNumeric(REPLACE(REPLACE(REPLACE(REPLACE([ProjectType],'AD,',1),'AM,',2),'AD',3),'AM',4)),4,'AM'),3,'AD'),2,'AM,'),1,'AD,')
    FROM MyTable
    Method 2: Using a Script Component. Add a Derived Column Transform to replace the target substrings as method 1, use Regex in script to remove all non-numeric characters from the string, add another Derived Column to replace the integer
    characters to the corresponding substring. The script is as follows:
    using System.Text.RegularExpressions;
    Row.OutProjectType= Regex.Replace(Row.ProjectType, "[^.0-9]", "");
    References:
    http://blog.sqlauthority.com/2008/10/14/sql-server-get-numeric-value-from-alpha-numeric-string-udf-for-get-numeric-numbers-only/ 
    http://labs.kaliko.com/2009/09/c-remove-all-non-numeric-characters.html 
    Regards,
    Mike Yin
    TechNet Community Support

  • Convert this query to ABAP and display the results

    Hi Everyone,
    I have a sql query in native sql (oracle). I want execute it in ABAP editor and display the results.
    I need to get this to an internal table and display the results. How do i write the script any help will be great use to me.
    Here is the query:
    <i> select (select decode(extent_management,'LOCAL','*',' ') ||
                   decode(segment_space_management,'AUTO','a ','m ')
              from dba_tablespaces where tablespace_name = b.tablespace_name) || nvl(b.tablespace_name,
                 nvl(a.tablespace_name,'UNKOWN')) name,
           kbytes_alloc kbytes,
           kbytes_alloc-nvl(kbytes_free,0) used,
           nvl(kbytes_free,0) free,
           ((kbytes_alloc-nvl(kbytes_free,0))/
                              kbytes_alloc)*100 pct_used,
           nvl(largest,0) largest,
           nvl(kbytes_max,kbytes_alloc) Max_Size,
           decode( kbytes_max, 0, 0, (kbytes_alloc/kbytes_max)*100) pct_max_used from ( select sum(bytes)/1024 Kbytes_free,
                  max(bytes)/1024 largest,
                  tablespace_name
           from  sys.dba_free_space
           group by tablespace_name ) a,
         ( select sum(bytes)/1024 Kbytes_alloc,
                  sum(maxbytes)/1024 Kbytes_max,
                  tablespace_name
           from sys.dba_data_files
           group by tablespace_name
           union all
          select sum(bytes)/1024 Kbytes_alloc,
                  sum(maxbytes)/1024 Kbytes_max,
                  tablespace_name
           from sys.dba_temp_files
           group by tablespace_name )b
    where a.tablespace_name = b.tablespace_name order by 1;
    </i>
    Thanks,
    Prashant.

    Hi Prashant,
    Native SQL commands in ABAP are placed between EXEC SQL and ENDEXEC. You can place all your statements in between these EXEC SQL and ENDEXEC in a report.
    EXEC SQL [PERFORMING <form>].
      <Native SQL statement>
    ENDEXEC.
    Check this link to know about Native SQL
    http://help.sap.com/saphelp_47x200/helpdata/en/fc/eb3b8b358411d1829f0000e829fbfe/frameset.htm
    Thanks,
    Vinay

  • Minus and passing the result set

    I have a query in a procedure....let us say "test.prc":
    select A.VALUE from TABLE A
    where A.VALUE_ID = get_rec.VALUE_ID minus
    select B.VALUE from TABLE B
    In the above query, I am passing the "get_rec.VALUE_ID" from a cursor above the query.
    Now is there a way to capture the result set of the above minus operation and pass the result set to the calling sql program (called "call_test.sql")?
    Thanks,
    Chiru
    Message was edited by:
    Megastar_Chiru

    I got what I was trying to do...
    I have 1 more question though....I am printing out my output using dbms package from sql*plus...using the following command
    dbms_output.put_line(nvl('Flex Value set Id : '||get_rec.flex_value_set_id,0)||' values that have no corresponding alias : ' || nvl(v_flex_val,0));
    "get_rec.flex_value_set_id" gets passed in from my cursor above the dbms statement.
    and it looks like below:
    Flex Value set Id : 20118 values that have no corresponding alias : 00
    Flex Value set Id : 20118 values that have no corresponding alias : 10
    Flex Value set Id : 20118 values that have no corresponding alias : 11
    Flex Value set Id : 20118 values that have no corresponding alias : 20
    Flex Value set Id : 20118 values that have no corresponding alias : 30
    Flex Value set Id : 20124 values that have no corresponding alias : Standard
    Is there some way to neatly break when the value set id changes? ...ie., make it print output something like below:
    Flex Value set Id : 20118
    values that have no corresponding alias : 00
    values that have no corresponding alias : 10
    values that have no corresponding alias : 11
    values that have no corresponding alias : 20
    values that have no corresponding alias : 30
    Flex Value set Id : 20124
    values that have no corresponding alias : Standard
    Thanks,
    Chiru

  • How to access oracle in javabeans and display the result in jsp

    In my project ,i use the javabean to access the database and do the calculations and i display the result in the jsp page,,,
    any body can help me with your precious codes
    kodi...

    any body can help me with your precious codesStepped in the wrong place, try reading something on JDBC.

  • JSP Servlet and convert the result set of an SQL Query To XML file

    Hi all
    I have a problem to export my SQL query is resulty into an XML file I had fixed my servlet and JSP so that i can display all the records into my database and that the goal .Now I want to get the result set into JSP so that i can create an XML file from that result set from the jsp code.
    thisis my servlet which will call the jsp page and the jsp just behind it.
    //this is the servlet
    import java.io.*;
    import java.lang.reflect.Array;
    import java.sql.*;
    import java.util.ArrayList;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import javax.naming.*;
    import javax.sql.*;
    public *class *Campaign *extends *HttpServlet
    *private* *final* *static* Logger +log+ = Logger.+getLogger+(Campaign.*class*.getName());
    *private* *final* *static* String +DATASOURCE_NAME+ = "jdbc/SampleDB";
    *private* DataSource _dataSource;
    *public* *void* setDataSource(DataSource dataSource)
    _dataSource = dataSource;
    *public* DataSource getDataSource()
    *return* _dataSource;
    *public* *void* init()
    *throws* ServletException
    *if* (_dataSource == *null*) {
    *try* {
    Context env = (Context) *new* InitialContext().lookup("java:comp/env");
    _dataSource = (DataSource) env.lookup(+DATASOURCE_NAME+);
    *if* (_dataSource == *null*)
    *throw* *new* ServletException("`" + +DATASOURCE_NAME+ + "' is an unknown DataSource");
    } *catch* (NamingException e) {
    *throw* *new* ServletException(e);
    protected *void *doGet(HttpServletRequest request, HttpServletResponse response)
    throws IOException, ServletException
    Connection conn = *null*;
    *try* {
    conn = getDataSource().getConnection();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select post_id,comments,postname from app.posts");
    // out.println("Le r&eacute;sultat :<br>");
    ArrayList <String> Lescomments= *new* ArrayList<String>();
    ArrayList <String> Lesidentifiant = *new* ArrayList<String>();
    ArrayList <String> Lesnoms = *new* ArrayList <String>();
    *while* (rs.next()) {
    Lescomments.add(rs.getString("comments"));
    request.setAttribute("comments",Lescomments);
    Lesidentifiant.add(rs.getString("post_id"));
    request.setAttribute("id",Lesidentifiant);
    Lesnoms.add(rs.getString("postname"));
    request.setAttribute("nom",Lesnoms);
    rs.close();
    stmt.close();
    *catch* (SQLException e) {
    *finally* {
    *try* {
    *if* (conn != *null*)
    conn.close();
    *catch* (SQLException e) {
    // les param&egrave;tres sont corrects - on envoie la page r&eacute;ponse
    getServletContext().getRequestDispatcher("/Campaign.jsp").forward(request,response);
    }///end of servlet
    }///this is the jsp page called
    <%@ page import="java.util.ArrayList" %>
    <%
    // on r&eacute;cup&egrave;re les donn&eacute;es
    ArrayList nom=(ArrayList)request.getAttribute("nom");
    ArrayList id=(ArrayList)request.getAttribute("id");
    ArrayList comments=(ArrayList) request.getAttribute("comments");
    %>
    <html>
    <head>
    <title></title>
    </head>
    <body>
    Liste des campagnes here i will create the xml file the problem is to display all rows
    <hr>
    <table>
    <tr>
    </tr>
    <tr>
    <td>Comment</td>
    <td>
    <%
    for( int i=0;i<comments.size();i++){
    out.print("<li>" + (String) comments.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>nom</td>
    <td>
    <%
    for( int i=0;i<nom.size();i++){
    out.print("<li>" + (String) nom.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    <tr>
    <td>id</td>
    <td>
    <%
    for( int i=0;i<id.size();i++){
    out.print("<li>" + (String) id.get(i) + "</li>\n");
    }//for
    %>
    </tr>
    </table>
    </body>
    </html>
    This is how i used to create an XML file in a JSP page only without JSP/SERVLET concept:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%
    // Identify a carriage return character for each output line
    int iLf = 10;
    char cLf = (*char*)iLf;
    // Create a new empty binary file, which will content XML output
    File outputFile = *new* File("C:\\Users\\user\\workspace1\\demo\\WebContent\\YourFileName.xml");
    //outputFile.createNewFile();
    FileWriter outfile = *new* FileWriter(outputFile);
    // the header for XML file
    outfile.write("<?xml version='1.0' encoding='ISO-8859-1'?>"+cLf);
    try {
    // Define connection string and make a connection to database
    Connection conn = DriverManager.getConnection("jdbc:derby://localhost:1527/SAMPLE","app","app");
    Statement stat = conn.createStatement();
    // Create a recordset
    ResultSet rset = stat.executeQuery("Select * From posts");
    // Expecting at least one record
    *if*( !rset.next() ) {
    *throw* *new* IllegalArgumentException("No data found for the posts table");
    outfile.write("<Table>"+cLf);
    // Parse our recordset
    // Parse our recordset
    *while*(rset.next()) {
    outfile.write("<posts>"+cLf);
    outfile.write("<postname>" + rset.getString("postname") +"</postname>"+cLf);
    outfile.write("<comments>" + rset.getString("comments") +"</comments>"+cLf);
    outfile.write("</posts>"+cLf);
    outfile.write("</Table>"+cLf);
    // Everything must be closed
    rset.close();
    stat.close();
    conn.close();
    outfile.close();
    catch( Exception er ) {
    %>

    Please state your problem that you are having more clearly so we can help.
    I looked at your code I here are a few things you might consider:
    It looks like you are putting freely typed-in comments from end-users into an xml document.
    The problem with this is that the user may enter characters in his text that have special meaning
    to xml and will have to be escaped correctly. Some of these characters are less than character, greater than character and ampersand character.
    You may also have a similiar problem displaying them on your JSP page since there may be special characters that JSP has.
    You will have to read up on how to deal with these special characters (I dont remember what the rules are). I seem to recall
    if you use CDATA in your xml, you dont have to deal with those characters (I may be wrong).
    When you finish writing your code, test it by entering all keyboard characters to make sure they are processed, stored in the database,
    and re-displayed correctly.
    Also, it looks like you are putting business logic in your JSP page (creating an xml file).
    The JSP page is for displaying data ONLY and submitting back to a servlet. Put all your business logic in the servlet. Putting business logic in JSP is considered bad coding and will cause you many hours of headache trying to debug it. Also note: java scriptlets in a JSP page are only run when the JSP page is compiled into a servlet by java. It does not run after its compiled and therefore you cant call java functions after the JSP page is displayed to the client.

  • OBIEE Answers does not display the result set of a report query

    Hi,
    We have a pivot table type of report in Oracle Business Intelligence Enterprise Edition v.10.1.3.3.2 Answers that has the following characteristics:
         3 Pages
         3 Sections , 4 Columns
         18363 Rows in the result set
    As per the NQQuery.log, the query for this report executes successfully resulting in 18363 rows. However, nothing comes up in the display on Answers. Moreover, no error is reported. The instanceconfig.xml file has the following setting:
    <PivotView>
         <CubeMaxRecords>30000</CubeMaxRecords>
         <CubeMaxPopulatedCells>300000</CubeMaxPopulatedCells>
    </PivotView>
    Even with these settings, Answers just returns a blank page - nothing is displayed in the name of the result set of the report query. Has anyone encountered this problem scenario before?
    Any help is much appreciated.
    Thanks,
    Piyush

    Hi Fiston / Pradeep,
    Thanks for your inputs. A few points to note:
    -> I am actually not getting any error message in answers or the NQQuery log. Moreover I am not getting any errors related to "query governor limit exceeding in cube generation" also.
    -> I have other pivot table type of reports in the same repository that work fine. In fact the report which has this issue even works sometimes - what actually is happening is that if I alter the number of sections from 3 to 4, then the result set changes from 14755 Rows to 18363 Rows and as per the NQQuery.log in both cases the query completes successfully. However, when the result set has 14755 rows, I get to see the output in Answers; however when the result set is 18636 rows, the Answers screen just goes blank and does not show any output or error. This makes me believe that there is some parameter in instanceconfig or the NQSconfig file - I have tried a lot of changes but nothing works !
    Any help is much appreciated.
    Best Regards,
    Piyush

  • Call a JSP from applet and display the results in the browser

    Hello All,
    I have written an applet which performs some functionality at the clinets browser. When the applets method finishes exectution, I would like to call
    a jsp. The results of the JSP should be displayed like a normal page in the browser.
    I tried creating a HttpURLConnection and calling the jsp but two things happened
    1. The jsp call failed because the applet doesn't have a valid session id.
    2. even if I disable the valid user check at the jsp, the results of the jsp are returned as a set of bytes to the applet. They are not displayed in the browser window.
    Then I tried applet.getAppletContext().showDocument()... However with this api I cannot do a POST operation on the JSP with some input data because this takes only a URL as an input parameter.
    Please help me in this problem and I will be very gratefull to you.
    1. applet uses the same session id as the browser so that when applet makes a request to the jsp it does not get user invalid exception.
    2. the results of the jsp are displayed on the browser and not given to the applet.
    Thank you so much for your help.
    regards,
    Abhishek.

    I hope this can help you
    I made a package calls fun
    and a clsss calls JspTestingFun
    package fun;
    public class JspTestingFun{
      private String sample = "welcome to jsp";
      //Access sample property
      public String getSample() {
        return sample;
      //Access sample property
      public void setSample(String newValue) {
        if (newValue!=null) {
          sample = newValue;
    }then I make a jsp file
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="http://java.sun.com/jstl/sql" prefix="sql" %>
    <%@ page import =  "fun.JspTestingFun"%>
    <html>
    <head>
    <title>
    jspTest
    </title>
    </head>
    <jsp:useBean id="mytest" scope="session" class="fun.JspTestingFun" />
    <jsp:setProperty name="mytest" property="*" />
    <body bgcolor="#ffffff">
    <%
    mytest.getSample();
    %>
    <h1>
    Just for testing
    </h1>
    <form method="post">
    <br>Enter anything   :  <input name="sample"><br>
    <br><br>
    <input type="submit" name="Submit" value="Submit">
    <input type="reset" value="Reset">
    <br>
    this what we get<jsp:getProperty name="mytest" property="sample" />
    </form>
    </body>
    </html> 

  • How to search XML data from a HTTPMultiService and display the result on the Spark List

    Hello all,
    I am totally new to Flash Builder and Actionscript and hope someone might be able to help me out. I basically create a mobile app with a single view. The view has a TextInput as a search box and a search button. I conntected a Data/Service using a local XML file and bind the Data to a Spark List. Innitally the List will show nothing until the user enter the search term and hit the button. The List suppose to show the XML data that match the search term.
    Now is my problem. I cannot make the List to show the data that match the search text. The List just shows ALL the data.
    Here are my MXML code:
    <?xml version="1.0" encoding="utf-8"?>
    <s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
            xmlns:s="library://ns.adobe.com/flex/spark"
            xmlns:shopping="services.shopping.*"
            title="Search">
        <fx:Script>
            <![CDATA[
                import mx.events.FlexEvent;
                protected function button1_clickHandler(event:MouseEvent):void
                    navigator.popView();
                protected function list_creationCompleteHandler(event:FlexEvent):void
                    getDataResult.token = shopping.getData();
                protected function seach_clickHandler(event:MouseEvent):void
                    getDataResult.token = shopping.getSearchData(searchTxt.text);
            ]]>
        </fx:Script>
        <fx:Declarations>
            <s:CallResponder id="getDataResult"/>
            <shopping:Shopping id="shopping"/>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <s:actionContent>
            <s:Button height="79" label="Back" click="button1_clickHandler(event)"/>
        </s:actionContent>
        <s:List id="list" left="0" right="0" top="111" bottom="0"
                creationComplete="list_creationCompleteHandler(event)" labelField="english">
            <s:AsyncListView list="{getDataResult.lastResult}"/>
        </s:List>
        <s:TextInput id="searchTxt" x="80" y="34" width="250" height="49" enabled="true"
                     prompt="search..."/>
        <s:Button id="search" x="338" y="35" width="72" height="49" label="s"
                  click="seach_clickHandler(event)"/>
    </s:View>
    Here is the _Super_Shopping.as file:
    * This is a generated class and is not intended for modification.  To customize behavior
    * of this service wrapper you may modify the generated sub-class of this class - Shopping.as.
    package services.shopping
    import com.adobe.fiber.core.model_internal;
    import com.adobe.fiber.services.wrapper.HTTPServiceWrapper;
    import com.adobe.serializers.xml.XMLSerializationFilter;
    import mx.rpc.AbstractOperation;
    import mx.rpc.AsyncToken;
    import mx.rpc.http.HTTPMultiService;
    import mx.rpc.http.Operation;
    import valueObjects.Shop;
    [ExcludeClass]
    internal class _Super_Shopping extends com.adobe.fiber.services.wrapper.HTTPServiceWrapper
        private static var serializer0:XMLSerializationFilter = new XMLSerializationFilter();
        // Constructor
        public function _Super_Shopping()
            // initialize service control
            _serviceControl = new mx.rpc.http.HTTPMultiService();
             var operations:Array = new Array();
             var operation:mx.rpc.http.Operation;
             var argsArray:Array;
             operation = new mx.rpc.http.Operation(null, "getData");
             operation.url = "assets/data/shopping.xml";
             operation.method = "GET";
             operation.serializationFilter = serializer0;
             operation.properties = new Object();
             operation.properties["xPath"] = "/::shop";
             operation.resultElementType = valueObjects.Shop;
             operations.push(operation);
             operation = new mx.rpc.http.Operation(null, "getSearchData");
             operation.url = "assets/data/shopping.xml";
             operation.method = "GET";
             operation.resultFormat = "text";
             argsArray = new Array("item");
             operation.argumentNames = argsArray;
             operation.properties = new Object();
             operation.properties["xPath"] = "/::shop";
             operation.resultElementType = valueObjects.Shop;
             operations.push(operation);
             _serviceControl.operationList = operations;
             preInitializeService();
             model_internal::initialize();
        //init initialization routine here, child class to override
        protected function preInitializeService():void
          * This method is a generated wrapper used to call the 'getData' operation. It returns an mx.rpc.AsyncToken whose
          * result property will be populated with the result of the operation when the server response is received.
          * To use this result from MXML code, define a CallResponder component and assign its token property to this method's return value.
          * You can then bind to CallResponder.lastResult or listen for the CallResponder.result or fault events.
          * @see mx.rpc.AsyncToken
          * @see mx.rpc.CallResponder
          * @return an mx.rpc.AsyncToken whose result property will be populated with the result of the operation when the server response is received.
        public function getData() : mx.rpc.AsyncToken
            var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getData");
            var _internal_token:mx.rpc.AsyncToken = _internal_operation.send() ;
            return _internal_token;
        public function getSearchData(item:String) : mx.rpc.AsyncToken
            var _internal_operation:mx.rpc.AbstractOperation = _serviceControl.getOperation("getSearchData");
            var _internal_token:mx.rpc.AsyncToken = _internal_operation.send(item);
            return _internal_token;
    The getSearchData() supposed to return XML data that match the search text, but it doesn't. Can anyoen help?
    Thank you!

    Hi,
    are you able to change dynamically the  operation.url = "assets/data/shopping.xml";?
    i need to do that based on the users input.
    Thanks in advance,

  • Is it possible to read and write to a file at the same time and display the results in a RichTextBox?

    Hi All,
    I have a purpose in winforms to have a "notepad like" editor that saves what ever i type to a file on the hard drive and reads from based. 
    So what i have is a tab with a richtextbox docked to fill. I would like to have that richtextbox read from a file on the hard drive, then save the changes i type when i either click off the tab or live if possible.
    I wills state that i am fairly new to the c# game and if this is possible and someone could post an example that would be awesome and totally appreciated.
    Thanks,
    jAC

    For those that are looking for the solution I went with here are the details
    Reading the file:
    // Wish List Section
    wishListRichTextBox.ResetText();
    string wlFolder = Application.StartupPath + "\\wishLists\\";
    string wlPath = wlFolder + selectedProduct + ".rtf";
    // Read from the text file and out put the results
    try
    { // create directory if it does not exist
    if (!Directory.Exists(wlFolder))
    Directory.CreateDirectory(wlFolder);
    } // create file if it does not exist
    if (!File.Exists(wlPath))
    File.Create(wlPath).Dispose();
    var iStream = new FileStream(wlPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
    var sr = new System.IO.StreamReader(iStream);
    var readData = sr.ReadToEnd();
    wishListRichTextBox.Text = readData;
    sr.Close();
    // If the read fails then output the error message in the same section
    catch (Exception ex)
    wishListRichTextBox.Text = "Error: " + ex.Message;
    Writing the file:
    private void wishlistTabChanged(object sender, EventArgs e)
    if(menuTabControl.SelectedTab != wishListTab){
    if (productComboBox.SelectedIndex >= 0)
    try
    string wlFolder = Application.StartupPath + "\\wishLists\\";
    string wlPath = wlFolder + productComboBox.SelectedItem + ".rtf";
    var oStream = new FileStream(wlPath, FileMode.Open, FileAccess.Write, FileShare.Read);
    oStream.SetLength(0);
    var sw = new System.IO.StreamWriter(oStream);
    sw.WriteLine(wishListRichTextBox.Text);
    sw.Close();
    catch (Exception ex)
    MessageBox.Show("Wish list for " + productComboBox.Text + " save failed. \n\nError: " +
    ex, "Wish List Save Failed", MessageBoxButtons.OK, MessageBoxIcon.Error);
    I mainly used Ammar.Zaied thought
    process on this. Thanks to everyone though, as you all pointed me in the right direction

  • How to join two lists and display the results in datasheet view.?

    hello,
    i have two lists that i would like to join, i know a method that has been described  in the link below
    http://www.codeproject.com/Articles/194252/How-to-Link-Two-Lists-and-Create-a-Combined-Ciew-i
    however, here the data view is only limited to 30 rows and my resultant list is huge. I would like to know if there is a possibility to view the resultant list in a data sheet view ?

    I don't believe you can use the OOTB Datasheet view when joining lists. However, you should be able to increase your limit from 30 items to as many as you need (that doesn't trip the threshold set in Central Admin).
    Dimitri Ayrapetov (MCSE: SharePoint)

  • How can I connect multiple devices to Mac mini display port? I need to connect a Canon 5D to my Mac and display the result on a VGA video projector. I am using mini hdmi to mini display for the camera. Can I connect the VGA to any other port?

    Hi there I am connecting a Canon 5D to my laptop trying to use it as a webcam trough camtwist.
    At the same time I need to output the streaming to a videoprojector.
    The cam is connected to the mini display port do there is no port available for the VGA cable anymore.
    Do I need to use a different port for the projector? Should I buy a video card?
    Can't connect the camera via USB as that is too slow and it will freeze.
    Many thanks for all your help
    Best
    Faeve

    You might do better on a forum other than this one, which is "Using iPhone"

  • I would like to read a file and display the results in a table containing both strings and numbers?

    Hi,
    I just need a simple way of doing this as at the moment, i read one line at the time containing strings and numbers, whenever i convert this line to an array i loose the strings, if i want to display it, it displays as a group of lines while i would like to display it as a table with column headers. The file is an .xls worksheet.
    Any suggestions?
    Thanks
    Me

    Hi,
    Look at attach vi.
    If this is not what you need please clarify.
    With ActiveX you can Open Excel, interact with it (read and write values to cells...
    But if you can read it this way, I think it's easier.
    Hope this helps,
    Paulo
    Attachments:
    XL.zip ‏24 KB

  • Some methods are displaying the result on the server instead on the client.

    When I test (form SeatReservationClient class) the method sri.showReservations() located in SeatReservationClient class the results are being displayed on the server side instead on the client but the method sri.numReservations() is displaying the result as i want it i.e. on the client. Please can anyone help me (as always on this forum) find a solution to this problem and display the results correctly?
    I have 5 classes:
    Interface
    public interface SeatReservationInterface extends java.rmi.Remote
         public boolean isReserved(int row, int seat) throws java.rmi.RemoteException;
         public boolean reserve(int row, int seat) throws java.rmi.RemoteException;
         public boolean cancel(int row, int seat) throws java.rmi.RemoteException;
         public int numReservations() throws java.rmi.RemoteException;
    public void showReservations() throws java.rmi.RemoteException;
    Implementation
    public class SeatReservationImpl extends java.rmi.server.UnicastRemoteObject implements SeatReservationInterface
         private Seat[][] theatre;
         * Implementations must have an explicit constructor in order to declare the RemoteException
         * exception.
        * Theatre constructor makes a new movie theatre with numRows rows and numSeats
        * seats (chairs) in each row. All seats are unreserved (unoccupied) in the beginning.
        public SeatReservationImpl(int numRows, int numSeats) throws java.rmi.RemoteException
              theatre = new Seat[numRows][numSeats];
              for(int row = 0; row <theatre.length; row++)
              for(int col = 0; col<theatre[row].length; col++)
              theatre[row][col] = new Seat();
        * The method returns true if the seat at location (row, seat) is reserved.
        * The method returns false in all other cases.
        * Be careful that row numbers run from 1 to numRows, and seat numbers from
        * 1 to numSeats.
         public boolean isReserved(int row, int seat) throws java.rmi.RemoteException
             return theatre[row-1][seat-1].isOccupied();
        * Books the seat at location (row, seat) and returns true if that seat is available.
        * Returns false if that seat is already reserved.
         public boolean reserve(int row, int seat) throws java.rmi.RemoteException
              return theatre[row-1][seat-1].occupy();
        * Cancels a seat reservation at location (row, seat) is that seat was booked, and returns
        * true in that case. The method returns false if that seat had not been reserved.
         public boolean cancel(int row, int seat) throws java.rmi.RemoteException
              return theatre[row-1][seat-1].release();
        * Returns the number of reserved seats.
         public int numReservations() throws java.rmi.RemoteException
              int count = 0;
              for(int i = 0; i < theatre.length; i++)
              for(int j = 0; j < theatre[j].length; j++)
              if(theatre[i][j].isOccupied())
              count++;
              return count;
    * Prints an overview over all reservations. Reserved seats are shown as "*", available seats
    * as "-". For each row the row number is shown, then a couple of blanks, and then the
    * reservations. An example is
    * 8 -----****----
    * 7 ---**---**---
    * 6 ----***------
    * 5 -------------
    * 4 -------------
    * 3 ----------***
    * 2 **-------
    * 1 -------------
    public void showReservations() throws java.rmi.RemoteException
              for(int row = theatre.length-1; row>=0; row--)
                   System.out.print((row+1) + "\t");
                   for(int j = 0; j<theatre[row].length; j++)
                   if(theatre[row][j].isFree())
                   System.out.print("-");
                   else
                   System.out.print("*");
                   System.out.println();
              return;
    [i]Server import java.rmi.Naming;
    public class SeatReservationServer
    public SeatReservationServer()
    try
         SeatReservationInterface sri = new SeatReservationImpl(10, 5);
         Naming.rebind("rmi://localhost:1099/SeatReservationService", sri);
    catch (Exception e)
    System.out.println("Trouble: " + e);
    public static void main(String args[])
    new SeatReservationServer();
    Client
    import java.rmi.Naming;
    import java.rmi.RemoteException;
    import java.net.MalformedURLException;
    import java.rmi.NotBoundException;
    public class SeatReservationClient
        public static void main(String[] args)
            try
                   SeatReservationInterface sri = (SeatReservationInterface) Naming.lookup("rmi://localhost/SeatReservationService");
                   /* Make two reservations */
                   System.out.println("Reservations:");
                   System.out.println("1,2");
                   System.out.println("1.3");
                   System.out.println("1,4");
                   sri.reserve(1,2);
                   sri.reserve(1,3);
                   sri.reserve(1,4);
                   System.out.println("The Seat is occupied - " + sri.isReserved(1,2));
                   System.out.println("The Seat is occupied - " + sri.isReserved(1,3));
                   System.out.println("The Seat is occupied - " + sri.isReserved(1,4));
                   /* Show the theatre */
                   sri.showReservations();
                   /* Release a seat that had been booked */
                   System.out.println("Release seat row 1 seat 2");
                   sri.cancel(1,2);
                   System.out.println("The Seat is occupied - " + sri.isReserved(1,2));
                   /* Show the number of total reservations and the theatre */
                   System.out.println("Number of reservations: " + sri.numReservations());
                   sri.showReservations();
            catch (MalformedURLException murle)
                System.out.println();
                System.out.println("MalformedURLException");
                System.out.println(murle);
            catch (RemoteException re)
                System.out.println();
                System.out.println("RemoteException");
                System.out.println(re);
            catch (NotBoundException nbe)
                System.out.println();
                System.out.println("NotBoundException");
                System.out.println(nbe);
            catch (java.lang.ArithmeticException ae)
                System.out.println();
                System.out.println("java.lang.ArithmeticException");
                System.out.println(ae);
    Class containing instance methods
    public class Seat
    private boolean occupied;
         * Constructors:
         Seat()
         Seat(boolean o)
              occupied = o;
         * Instance methods:
         public boolean isFree()
              return !this.occupied;
         public boolean isOccupied()
              return this.occupied;
         public boolean occupy()
              if(occupied)
              return false;
              else
                   occupied = true;
                   return true;
         public boolean release()
              if(!isOccupied())
              return false;
              else
              occupied = false;
              return true;
    }

    Your code is working as expected. The server executes System.out.println in showReservations() and this comes out on the server console. The client executes System.out.println() after calling numReservations and this comes out at the client. Any other expectations are misplaced.

  • Running Interactive commands in java and displaying the output.

    Hi All,
    I'm running a sample code to execute a user defined command (cmd1) and display the results. The output of the command when executed in command prompt is
    (1) Executing the command cmd1
    (2) Do you want to continue(Y/N)_ <waits for user input>
    (3) Based on user input
    (Y) Displays the results
    (N) Interrupted
    But i'm facing problem when i execute the below code. When the results are being displayed instead of displaying line(1) and (2) and then waiting for the input- the code waits for the input and then only displays the results.
    O/p
    inside output
    inside input
    y (------ gets the input and then only displays the results).
    Executing the command cmd1
    Do you want to continue(Y/N)
    results
    Please help out how to resolve this issue.
    Thanks.
    Sample Code for reference.
    import java.util.*;
    import java.io.*;
    public class SampleCheck {
         public static void main(String[] args) throws Exception {
              (new SampleCheck()).test();
         void test() throws Exception {
              Process proc = Runtime.getRuntime().exec("cmd1");
              // any error from the process?
              StreamHandlerErr errorStream = new StreamHandlerErr(proc
                        .getErrorStream(), System.err);
              // any output from the process?
              StreamHandlerOutput outputStream = new StreamHandlerOutput(proc
                        .getInputStream(), null);
              // any input to the process?
              // FileInputStream fin = new FileInputStream(new File("textfile1.txt"));
              StreamHandlerInput inputStream = new StreamHandlerInput(System.in, proc
                        .getOutputStream());
              // start the stream threads
              // errorStream.start();
              outputStream.start();
              inputStream.start();
              // wait till it returns
              int exitVal = proc.waitFor();
              System.exit(exitVal);
         class StreamHandlerInput extends Thread {
              InputStream is;
              OutputStream os;
              StreamHandlerInput(InputStream is, OutputStream os) {
                   this.is = is;
                   this.os = os;
              public void run() {
                   System.out.println("inside input");
                   try {
                        int c;
                        while ((c = is.read()) != -1) {
                             os.write(c);
                             System.out.println("c= " + c);
                             os.flush();
                   } catch (IOException e) {
                   System.out.println("End of Run Method..Input");
         class StreamHandlerOutput extends Thread {
              InputStream is;
              OutputStream os;
              File f=new File("jbsrt_output.txt");
              StreamHandlerOutput(InputStream is, OutputStream os) {
                   this.is = is;
                   this.os = os;
              public void run() {
                   System.out.println("inside output");
                   try {
                        int c;
                        FileOutputStream fs=new FileOutputStream(f);
                        /*PrintStream ps =new PrintStream(;
                        ps.print(arg0)
                        ps.close();*/
                        InputStreamReader ir = new InputStreamReader(is);
                        //System.out.println(ir.read());
                        BufferedReader br = new BufferedReader(ir);
                        String line = null;
                        while((line=br.readLine())!=null)
                             System.out.println(line);
                   } catch (Exception e) {
                   System.out.println("End of Run Method..Output");
         class StreamHandlerErr extends Thread {
              InputStream is;
              OutputStream os;
              StreamHandlerErr(InputStream is, OutputStream os) {
                   this.is = is;
                   this.os = os;
              public void run() {
                   System.out.println("inside Err");
                   try {
                        int c;
                        while ((c = is.read()) != -1) {
                             os.write(c);
                             os.flush();
                   } catch (IOException e) {
                   System.out.println("End of Run Method..Err");
    }

    Console input is line buffered. This means you only get the first character a line after the newline has been inputed.
    The same thing happen if you just type on the console.
    I am not aware of any simple way around this.
    IDEs get around this by changing the application run so that the input/output is captured as it happens and sent over a socket connection.

Maybe you are looking for

  • How do you install OS 9 or Classic with OSX 10.21??

    I have never used Classic - went from OS-9 to OSX. I am trying to get a dual-usb IBook to run OS-9 so I can get the data off my old Jaz disks. The Jaz drive will run on UUSB only with OS-9. To run it on OSX 10.2  (which came with this model) requires

  • How to consume XML Gateway WS from a remote Oracle DB (10g)?

    Hi, I'm currently looking into consuming EBS web services, particularly the XML Gateway service from a remote database. For ease of use, I'm also using an Oracle 10g database. It seems there are several ways to skin a cat though. Hope you can help. 1

  • Generate web-service.xml

    I need to configure the deployment descriptor web-services.xml, but I don't know where or how to generate it. I use version 8.1 of weblogic. Someone can help me? thanks!

  • Streaming WMVs in Quicktime?

    I use both Safari and Camino for web browsing, and something has started happening with both that's driving me insane. Quicktime attempts to play any embedded or streaming WMV files, but it can't do it correctly; sometimes it skips, sometimes it fail

  • Can I gift a friend in Russia with a book in the US store?

    Can I gift a friend in Russia with a book in the US store?