27 Replies Latest reply on Sep 28, 2008 3:58 PM by Newsgroup_User

    trying to build a live feed dash board..

    ice9_us Level 1
      I am a little stuck due to my lack of understanding....
      I have yet to understand how to decrypt the help stuff here since i don't fully understand all the parts...
      I am learning so go light on me :) I am a UNIX guy who has stuck with VI and C/C++..
      so this is a rather large move for me..

      http://172.16.1.6/flex/cgi-bin/get_cpu.cgi
      is the url... I would like to use this type example to build several graphs.. this is info for a server cpu time..
      This ( i would like) to be, at some point, a live feed, but a refresh of the url to build the graphs every X seconds is fine.. I am trying to understand exactly how to get the dataProvider into the X/Y value in the chart..
      so I can show 3 lines at 1 time..
      idle time/ system time/ user time

      To give an idea of where i am going.. this is a display:

      <?xml version="1.0" encoding="utf-8"?>
      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
      initialize="getlogin.send()">

      <mx:Script>
      <![CDATA[

      import mx.collections.ArrayCollection;
      import mx.rpc.events.ResultEvent;

      [Bindable]
      private var graphData:ArrayCollection;
      private function handleLogin(event:ResultEvent):void {

      }

      ]]>
      </mx:Script>

      <mx:HTTPService id="getlogin" url=" http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi"
      method="GET" result="handleLogin(event)" resultFormat="e4x" >
      </mx:HTTPService>
      <mx:Panel x="268" y="365" width="363" height="219" layout="absolute">
      </mx:Panel>
      <mx:Panel x="10" y="365" width="250" height="219" layout="absolute">
      </mx:Panel>
      <mx:Panel x="639" y="365" width="226" height="219" layout="absolute">
      </mx:Panel>
      <mx:Panel x="873" y="365" width="285" height="219" layout="absolute">
      </mx:Panel>
      <mx:Panel x="10" y="10" width="250" height="347" layout="absolute">
      </mx:Panel>
      <mx:Panel x="268" y="10" width="890" height="347" layout="absolute">
      <mx:Canvas x="0" y="0" width="252" height="107">
      <mx:LineChart x="0" y="0" id="linechart1" height="107" width="134">
      <mx:series>
      <mx:LineSeries displayName="ServerA" yField=""/>
      </mx:series>
      </mx:LineChart>
      </mx:Canvas>
      <mx:Canvas x="0" y="105" width="252" height="103">
      </mx:Canvas>
      </mx:Panel>




      </mx:Application>



      Any help on getting this basic graph data would be great.. I think/hope i can run with it from that point..

      the bottom panes will hold grid data that will be read in via the same type url with the same typ functions..
      the tutorials on line have been a great help in me collecting that data...
      for anyone involved in that flex in a week stuff.. big thanks.. great work..

        • 1. Re: trying to build a live feed dash board..
          ice9_us Level 1
          first off.. sorry about the url above...
          that is
          http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi

          2nd.. any one know what this means?

          Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed: cannot convert XMLList@6b90311 to mx.collections.ArrayCollection.)
          main/handleLogin
          main/__getlogin_result
          flash.events::EventDispatcher/dispatchEventFunction [no source]
          flash.events::EventDispatcher/dispatchEvent [no source]
          mx.rpc.http.mxml::HTTPService/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent
          mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler
          mx.rpc::Responder/result
          mx.rpc::AsyncRequest/acknowledge
          DirectHTTPMessageResponder/completeHandler
          flash.events::EventDispatcher/dispatchEventFunction [no source]
          flash.events::EventDispatcher/dispatchEvent [no source]
          flash.net::URLLoader/onComplete [no source]
          --
          other than the obvious...
          what am i doing wrong?

          <?xml version="1.0" encoding="utf-8"?>
          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
          initialize="getlogin.send()">

          <mx:Script>
          <![CDATA[

          import mx.collections.ArrayCollection;
          import mx.rpc.events.ResultEvent;

          [Bindable]
          private var graphData:ArrayCollection;
          private function handleLogin(event:ResultEvent):void {
          graphData = event.result.cpu_data;
          }

          ]]>
          </mx:Script>

          <mx:HTTPService id="getlogin" url=" http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi"
          method="GET" result="handleLogin(event)" resultFormat="e4x" >
          </mx:HTTPService>
          <mx:Panel x="268" y="365" width="363" height="219" layout="absolute">
          </mx:Panel>
          <mx:Panel x="10" y="365" width="250" height="219" layout="absolute">
          </mx:Panel>
          <mx:Panel x="639" y="365" width="226" height="219" layout="absolute">
          </mx:Panel>
          <mx:Panel x="873" y="365" width="285" height="219" layout="absolute">
          </mx:Panel>
          <mx:Panel x="10" y="10" width="250" height="347" layout="absolute">
          </mx:Panel>
          <mx:Panel x="268" y="10" width="890" height="347" layout="absolute">
          <mx:Canvas x="0" y="0" width="252" height="107">
          <mx:LineChart dataProvider="{graphData}" x="0" y="0" id="linechart1" height="107" width="134">
          <mx:series>
          <mx:LineSeries displayName="ServerA" yField=""/>
          </mx:series>
          </mx:LineChart>
          </mx:Canvas>
          <mx:Canvas x="0" y="105" width="252" height="103">
          </mx:Canvas>
          </mx:Panel>




          </mx:Application>
          -----------------
          thanks in advanced for any help.
          • 2. Re: trying to build a live feed dash board..
            ice9_us Level 1
            ok.. i am getting the data, but it is not viewing it as xml type data and not using it in the graph...
            cut and past from debugger...

            result XML
            <cpu_data>
            <idle>
            "99"
            <sys>
            "1"
            <user>
            "0"
            <idle>


            -----------------
            i am getting my data but getting that XML type error..

            Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed: cannot convert XMLList@6592551 to mx.collections.XMLListCollection.)
            main/handleLogin
            main/__getlogin_result
            flash.events::EventDispatcher/dispatchEventFunction [no source]
            flash.events::EventDispatcher/dispatchEvent [no source]
            mx.rpc.http.mxml::HTTPService/ http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent
            mx.rpc::AbstractInvoker/ http://www.adobe.com/2006/flex/mx/internal::resultHandler
            mx.rpc::Responder/result
            mx.rpc::AsyncRequest/acknowledge
            DirectHTTPMessageResponder/completeHandler
            flash.events::EventDispatcher/dispatchEventFunction [no source]
            flash.events::EventDispatcher/dispatchEvent [no source]
            flash.net::URLLoader/onComplete [no source]


            ---------------------------------------------
            from this point.. i have zero clue.. would be most thankful for any help..
            • 3. Re: trying to build a live feed dash board..
              Peter Lorent Level 2
              I think your problem is in the data you are retrieving. It consists of 1422 individual nodes without any structure.
              So, to do something with data in a component you must feed it with data it 'understands'.
              Usually when you specify E4X as the result you have a xml-schema with a repeating node and you can build an ArrayCollection of that repeating nodes. Someting a long the lines of

              <cpu_data>
              -<system>
              --<id>1</id>
              --<user>0</user>
              -</system>
              -<system>
              --<id>1</id>
              --<user>1</user>
              -</system>
              </cpu_data>

              You might want to download a copy of Adobe Flex 3 Data Visualization Developer Guide on http://www.adobe.com/support/documentation/en/flex/ that shows you how to work with several types of data.
              • 4. Re: trying to build a live feed dash board..
                ice9_us Level 1
                do you mean something along the lines of:

                <cpu_data>
                <cpustat>
                <idle>99</idle>
                <sys>1</sys>
                <usr> 0 </usr>
                </cpustat>
                ..
                ..
                ..
                </cpu_data>


                • 5. Re: trying to build a live feed dash board..
                  Level 7

                  "ice9_us" <webforumsuser@macromedia.com> wrote in message
                  news:gbk95h$745$1@forums.macromedia.com...
                  > first off.. sorry about the url above...
                  > that is
                  > http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi
                  >
                  > 2nd.. any one know what this means?
                  >
                  > Main Thread (Suspended: TypeError: Error #1034: Type Coercion failed:
                  > cannot
                  > convert XMLList@6b90311 to mx.collections.ArrayCollection.)
                  > main/handleLogin
                  > main/__getlogin_result
                  > flash.events::EventDispatcher/dispatchEventFunction [no source]
                  > flash.events::EventDispatcher/dispatchEvent [no source]

                  It means you should be trying to use your result as the source of an
                  XMLListCollection, not trying to cast it to ArrayCollection.

                  Try

                  [Bindable]
                  private var graphData:XMLListCollection=new XMLListCollection();
                  private function handleLogin(event:ResultEvent):void {
                  graphData.source = event.result.cpu_data;
                  }


                  • 6. Re: trying to build a live feed dash board..
                    Peter Lorent Level 2
                    Yes, now you can parse the repeating node <cpustat>
                    • 7. Re: trying to build a live feed dash board..
                      ice9_us Level 1
                      GRR...
                      What am i doing wrong? As far as i can tell.. this is fine.. I realize that something is missing.. I am not sure what..


                      <?xml version="1.0" encoding="utf-8"?>
                      <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
                      initialize="getcpu.send()">

                      <mx:Script>
                      <![CDATA[

                      import mx.collections.ArrayCollection;
                      import mx.collections.XMLListCollection;
                      import mx.rpc.events.ResultEvent;

                      [Bindable]
                      private var graphData:XMLListCollection=new XMLListCollection();
                      private function handleLogin(event:ResultEvent):void {
                      graphData.source = event.result.cpu_data;
                      }


                      ]]>
                      </mx:Script>

                      <mx:HTTPService id="getcpu" url=" http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi"
                      method="GET" result="handleLogin(event)" resultFormat="e4x" >
                      </mx:HTTPService>

                      <mx:Panel x="268" y="365" width="363" height="219" layout="absolute"/>

                      <mx:Panel x="10" y="365" width="250" height="219" layout="absolute" title="ECC Reporting Center">
                      <mx:DataGrid x="0" y="0" width="230" height="179"/>
                      </mx:Panel>


                      <mx:Panel x="639" y="365" width="226" height="219" layout="absolute"/>

                      <mx:Panel x="873" y="365" width="285" height="219" layout="absolute"/>

                      <mx:Panel x="10" y="10" width="250" height="347" layout="absolute" title="NodeList" >
                      </mx:Panel>



                      <mx:Panel x="268" y="10" width="890" height="347" layout="absolute">
                      <mx:Canvas x="0" y="0" width="252" height="107">
                      <mx:LineChart dataProvider="{graphData}" x="0" y="0" id="linechart1" height="107" width="134">
                      <mx:series>
                      <mx:LineSeries displayName="usr" yField="usr"/>
                      <mx:LineSeries displayName="idle" yField="idle"/>
                      <mx:LineSeries displayName="sys" yField="sys"/>
                      </mx:series>
                      </mx:LineChart>
                      </mx:Canvas>
                      <mx:Canvas x="0" y="105" width="252" height="103">
                      </mx:Canvas>
                      </mx:Panel>




                      </mx:Application>
                      • 8. Re: trying to build a live feed dash board..
                        Peter Lorent Level 2
                        Since you just want to display the data I would use the good old ArrayCollection. So, don't specify E4X and just let ArrayCollection do its work looping over the repeater node.
                        • 9. Re: trying to build a live feed dash board..
                          ice9_us Level 1
                          Now.. i have a design question/how do i even start

                          On a larger scale...
                          i want this for several servers.. in that pane...
                          and populate dynamically as it finds data in a arraylist of servers...
                          reading feeds from that cgi script..

                          I have zero clue how to start.. and i think... there is likely a far better way of doing this .. than the way i am thinking...
                          which will involve a httpservice request loop... for every single server i have donig the update...

                          any idea on the best approach for this.. or is there a location i can find the data?

                          and thanks everyone for helping me learn this stuff...
                          • 10. Re: trying to build a live feed dash board..
                            Level 7

                            "LuigiL" <webforumsuser@macromedia.com> wrote in message
                            news:gbls7n$5r7$1@forums.macromedia.com...
                            > Since you just want to display the data I would use the good old
                            > ArrayCollection. So, don't specify E4X and just let ArrayCollection do its
                            > work
                            > looping over the repeater node.

                            I don't think that the difference is ArrayCollection vs. XMLListCollection
                            (though I do think that when you're working with XML, you're better off
                            using XML specific data types). I think he has a disconnect between the
                            structure of the data and what he's expecting to see on the screen.

                            OP (I didn't see where you said your name), could you give us an update of
                            what your service is returning? Please post in full, since there are
                            certain things that can happen based on what the data is (or isn't).


                            • 11. Re: trying to build a live feed dash board..
                              ice9_us Level 1
                              I think he has a disconnect between the
                              structure of the data and what he's expecting to see on the screen.
                              --------------------------------------------------------------------------------
                              i think your correct..
                              but at some point i will get it...
                              It can't be to far from c or c++

                              i just have to grasp the abse of what is gong on for sure..
                              what the extra functions are.. how the variables work. ie.. xmllink.result.x.y points to what exactly..
                              and why is trace used.. how do i access different data... and how data is gathered...
                              i know events are stored in
                              some event.result.....

                              this much is starting to sink in..as i look at more and more dynamic sample code... and static code.. i better understand what "exactly" is going on..

                              I just wanted to make sure i say thanks for all the help and info..

                              • 12. Re: trying to build a live feed dash board..
                                ice9_us Level 1
                                OP (I didn't see where you said your name), could you give us an update of what your service is returning? Please post in full, since there are certain things that can happen based on what the data is (or isn't).
                                ----------------------------------------------------
                                My name is Ray.....

                                I can post the data no worries.. (this is basically why i post the url data as well.) The data isn't guarded since it isn't any big deal...
                                i hope to take my mass data collection from the old junk and post it into a easily viewed state of data with forms and junk like that...

                                mostly to play around with ideas...
                                I am a kernel kind of guy(UNIX).. and collecting stats is what i love to do.. curnch numbers and do some stuff with data.....

                                i love to play with stuff.. this is my "CAR" if you will....
                                some people watch TV/play games.. I do this. :) you can keep the WII give me a compiler and let me brain storm...

                                • 13. Re: trying to build a live feed dash board..
                                  Peter Lorent Level 2
                                  I'm not considering a difference in ArrayCollection and XMLListCollection. I just don't see the point in using XMLListCollection and using E4X if you don't have the need to do something 'extra' with the data using the E4X format. In such cases I prefer to use the default behaviour when working with complex objects and straight away let the ArrayCollection do it's magic. Just personal preference.

                                  Ray, really, the Adobe Flex 3 Data Visualization Developer Guide is a very good source to study this.
                                  • 14. Re: trying to build a live feed dash board..
                                    ice9_us Level 1
                                    I am trying to understand the e4x.. text and other data types,,, so i am goofing around with it all...
                                    I really want to understand this stuff and start using it.. playing around with C/java as the engine for everything is fine.. but the time it takes is really large. I had my interface built and my graphs laid out... In no time... All i had to do at that point was go get the data and make it work... That is where i am stuck...

                                    My data is on the server ready for display....


                                    source code...
                                    <?xml version="1.0" encoding="utf-8"?>
                                    <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
                                    initialize="getcpu.send()">

                                    <mx:Script>
                                    <![CDATA[

                                    import mx.collections.ArrayCollection;
                                    import mx.collections.XMLListCollection;
                                    import mx.rpc.events.ResultEvent;

                                    [Bindable]
                                    private var graphData:XMLListCollection=new XMLListCollection();
                                    private function handleLogin(event:ResultEvent):void {
                                    graphData.source = event.result.cpu_data;
                                    }


                                    ]]>
                                    </mx:Script>
                                    <mx:HTTPService id="getcpu" url=" http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi"
                                    method="GET" result="handleLogin(event)" resultFormat="e4x" >
                                    </mx:HTTPService>

                                    <mx:Panel x="268" y="365" width="363" height="219" layout="absolute"/>

                                    <mx:Panel x="10" y="365" width="250" height="219" layout="absolute" title="ECC Reporting Center">
                                    <mx:DataGrid x="0" y="0" width="230" height="179"/>
                                    </mx:Panel>


                                    <mx:Panel x="639" y="365" width="226" height="219" layout="absolute"/>

                                    <mx:Panel x="873" y="365" width="285" height="219" layout="absolute"/>

                                    <mx:Panel x="10" y="10" width="250" height="347" layout="absolute" title="NodeList" >
                                    </mx:Panel>



                                    <mx:Panel x="268" y="10" width="890" height="347" layout="absolute">
                                    <mx:Canvas x="0" y="0" width="252" height="107">
                                    <mx:LineChart dataProvider="{graphData}" x="0" y="0" id="linechart1" height="107" width="134">
                                    <mx:series>
                                    <mx:LineSeries displayName="usr" yField="usr"/>
                                    <mx:LineSeries displayName="idle" yField="idle"/>
                                    <mx:LineSeries displayName="sys" yField="sys"/>
                                    </mx:series>
                                    </mx:LineChart>
                                    </mx:Canvas>
                                    <mx:Canvas x="0" y="105" width="252" height="103">
                                    </mx:Canvas>
                                    </mx:Panel>




                                    </mx:Application>




                                    Now the way i understand it...
                                    my httpservice will get the data and post that data to handleLigin(event) function which will
                                    take the event:resultevent and put that data into graphData.source
                                    i do that by making graphData.source = to the data returned by the debugger which shows
                                    event.result.cpu_data

                                    what i expect to see in the debugger is exactly what i get...


                                    result XML
                                    <cpu_data>
                                    <cpustat>
                                    <idle>
                                    "99"
                                    <sys>
                                    "1"
                                    <usr>
                                    "0"
                                    <cpustat>
                                    <cpustat>
                                    <cpustat>

                                    however.. the source for graphData doesn't show what i want...

                                    graphData mx.collections.XMLListCollection (@fbd2841)
                                    [inherited]
                                    source XMLList (@179be161)


                                    i tried to make my graphData.source = event.result.cpu_data.cpustats as well to collect the user idle and sys.. but no luck.. I am going to read up on the ...child(); thing...

                                    I also read the online stuff, but what as amy suggest.. I am at a bit of cross roads of not understanding some stuff here.. which is fine.. this is a major learning curve for me.. So to get some understanding on that stuff i came here.. which now that i think about it.. that mabye should have been my question to start with.. :)

                                    I think some of it has to do with the fact i know zero about ActionScript as well..
                                    • 15. Re: trying to build a live feed dash board..
                                      Level 7

                                      "ice9_us" <webforumsuser@macromedia.com> wrote in message
                                      news:gbnvlf$mja$1@forums.macromedia.com...
                                      >I am trying to understand the e4x.. text and other data types,,, so i am
                                      > goofing around with it all...
                                      > I really want to understand this stuff and start using it.. playing around
                                      > with C/java as the engine for everything is fine.. but the time it takes
                                      > is
                                      > really large. I had my interface built and my graphs laid out... In no
                                      > time...
                                      > All i had to do at that point was go get the data and make it work... That
                                      > is
                                      > where i am stuck...
                                      >
                                      > My data is on the server ready for display....
                                      >
                                      >
                                      > source code...
                                      > <?xml version="1.0" encoding="utf-8"?>
                                      > <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
                                      > layout="absolute"
                                      > initialize="getcpu.send()">
                                      >
                                      > <mx:Script>
                                      > <![CDATA[
                                      >
                                      > import mx.collections.ArrayCollection;
                                      > import mx.collections.XMLListCollection;
                                      > import mx.rpc.events.ResultEvent;
                                      >
                                      > [Bindable]
                                      > private var graphData:XMLListCollection=new XMLListCollection();
                                      > private function handleLogin(event:ResultEvent):void {
                                      > graphData.source = event.result.cpu_data;
                                      > }
                                      >
                                      >
                                      > ]]>
                                      > </mx:Script>
                                      > <mx:HTTPService id="getcpu"
                                      > url=" http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi"
                                      > method="GET" result="handleLogin(event)" resultFormat="e4x" >
                                      > </mx:HTTPService>
                                      >
                                      > <mx:Panel x="268" y="365" width="363" height="219" layout="absolute"/>
                                      >
                                      > <mx:Panel x="10" y="365" width="250" height="219" layout="absolute"
                                      > title="ECC Reporting Center">
                                      > <mx:DataGrid x="0" y="0" width="230" height="179"/>
                                      > </mx:Panel>
                                      >
                                      >
                                      > <mx:Panel x="639" y="365" width="226" height="219" layout="absolute"/>
                                      >
                                      > <mx:Panel x="873" y="365" width="285" height="219" layout="absolute"/>
                                      >
                                      > <mx:Panel x="10" y="10" width="250" height="347" layout="absolute"
                                      > title="NodeList" >
                                      > </mx:Panel>
                                      >
                                      >
                                      >
                                      > <mx:Panel x="268" y="10" width="890" height="347" layout="absolute">
                                      > <mx:Canvas x="0" y="0" width="252" height="107">
                                      > <mx:LineChart dataProvider="{graphData}" x="0" y="0" id="linechart1"
                                      > height="107" width="134">
                                      > <mx:series>
                                      > <mx:LineSeries displayName="usr" yField="usr"/>
                                      > <mx:LineSeries displayName="idle" yField="idle"/>
                                      > <mx:LineSeries displayName="sys" yField="sys"/>
                                      > </mx:series>
                                      > </mx:LineChart>
                                      > </mx:Canvas>
                                      > <mx:Canvas x="0" y="105" width="252" height="103">
                                      > </mx:Canvas>
                                      > </mx:Panel>
                                      >
                                      >
                                      >
                                      >
                                      > </mx:Application>
                                      >
                                      >
                                      >
                                      >
                                      > Now the way i understand it...
                                      > my httpservice will get the data and post that data to handleLigin(event)
                                      > function which will
                                      > take the event:resultevent and put that data into graphData.source
                                      > i do that by making graphData.source = to the data returned by the
                                      > debugger
                                      > which shows
                                      > event.result.cpu_data
                                      >
                                      > what i expect to see in the debugger is exactly what i get...
                                      >
                                      >
                                      > result XML
                                      > <cpu_data>
                                      > <cpustat>
                                      > <idle>
                                      > "99"
                                      > <sys>
                                      > "1"
                                      > <usr>
                                      > "0"
                                      > <cpustat>
                                      > <cpustat>
                                      > <cpustat>

                                      Your problem could be that only your first node has any data for the fields
                                      you are trying to chart. Unless you put an itemRenderer to show the actual
                                      point, you will not see a line on the chart, since there is no such thing as
                                      a one-point line.

                                      HTH;

                                      Amy


                                      • 16. Re: trying to build a live feed dash board..
                                        ice9_us Level 1
                                        I am not sure what you mean..
                                        from what i understand..
                                        the getData.source should hold all the values.. pointed do by cpustats
                                        so i reference cpustats.sys or idle to get the time..

                                        At this point.. i can really say.. i have no clue and need to keep reading and playing..
                                        • 17. Re: trying to build a live feed dash board..
                                          ice9_us Level 1
                                          progress:

                                          <?xml version="1.0" encoding="utf-8"?>
                                          <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
                                          initialize="getcpu.send()">

                                          <mx:Script>
                                          <![CDATA[

                                          import mx.collections.ArrayCollection;
                                          import mx.collections.XMLListCollection;
                                          import mx.rpc.events.ResultEvent;

                                          [Bindable]
                                          private var graphData:XMLListCollection=new XMLListCollection();
                                          private function handleLogin(event:ResultEvent):void {
                                          graphData.source = event.result.cpustat;
                                          }


                                          ]]>
                                          </mx:Script>
                                          <mx:HTTPService id="getcpu" url=" http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi"
                                          method="GET" result="handleLogin(event)" resultFormat="e4x" >
                                          </mx:HTTPService>

                                          <mx:Panel x="268" y="365" width="363" height="219" layout="absolute"/>

                                          <mx:Panel x="10" y="365" width="250" height="219" layout="absolute" title="ECC Reporting Center">
                                          <mx:DataGrid x="0" y="0" width="230" height="179"/>
                                          </mx:Panel>


                                          <mx:Panel x="639" y="365" width="226" height="219" layout="absolute"/>

                                          <mx:Panel x="873" y="365" width="285" height="219" layout="absolute"/>

                                          <mx:Panel x="10" y="10" width="250" height="347" layout="absolute" title="NodeList" >
                                          </mx:Panel>



                                          <mx:Panel x="268" y="10" width="890" height="347" layout="absolute">
                                          <mx:Canvas x="0" y="0" width="252" height="107">
                                          <mx:LineChart dataProvider="{graphData}" x="0" y="0" id="linechart1" height="107" width="134" >
                                          <mx:series>
                                          <mx:LineSeries displayName="idle" yField="idle" form="curve" >
                                          <mx:lineStroke>
                                          <mx:Stroke color="blue" weight="1" alpha=".8" />
                                          </mx:lineStroke>
                                          </mx:LineSeries>
                                          </mx:series>
                                          </mx:LineChart>
                                          </mx:Canvas>
                                          <mx:Canvas x="0" y="105" width="252" height="103">
                                          </mx:Canvas>
                                          </mx:Panel>




                                          </mx:Application>


                                          I have the graph i like.. with idle time... now i want to do this
                                          so it updates dynamically...
                                          sending a service request and reading the new xml data

                                          and how do i get the graph to layout as it is built...
                                          so the user/myself doesn't have to look at a blank screen so long..

                                          • 18. Re: trying to build a live feed dash board..
                                            ice9_us Level 1
                                            When trying to catch and display data in my data grid.. My stuff isn't really running.. it just sort of hangs... After the chart builds.. the stuff just sits still doesn't trigger my break in the debugger so i can see my stuff for getHD...
                                            do i need to do something to the first httpservice call or something?

                                            <?xml version="1.0" encoding="utf-8"?>
                                            <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" layout="absolute"
                                            initialize="getcpu.send()" >

                                            <mx:Script>
                                            <![CDATA[

                                            import mx.collections.ArrayCollection;
                                            import mx.collections.XMLListCollection;
                                            import mx.rpc.events.ResultEvent;

                                            [Bindable]
                                            private var graphData:XMLListCollection=new XMLListCollection();
                                            private function handleLogin(event:ResultEvent):void {
                                            graphData.source = event.result.cpustat;
                                            }

                                            private var getHDData:XMLListCollection=new XMLListCollection();
                                            private function handleHD(event:ResultEvent):void {
                                            getHDData = event.result.tickets;
                                            }

                                            ]]>
                                            </mx:Script>
                                            <mx:HTTPService id="getcpu" url=" http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi"
                                            method="GET" result="handleLogin(event)" resultFormat="e4x" >
                                            </mx:HTTPService>

                                            <mx:HTTPService id="getHD" url=" http://genesis.dvrdns.org/flex/cgi-bin/list_hdQ.cgi"
                                            method="GET" result="handleHD(event)" resultFormat="e4x" >
                                            </mx:HTTPService>

                                            <mx:Panel x="268" y="365" width="363" height="219" layout="absolute"/>

                                            <mx:Panel x="10" y="365" width="250" height="219" layout="absolute" title="ECC Reporting Center">
                                            <mx:DataGrid x="0" y="0" width="230" height="179"/>
                                            </mx:Panel>


                                            <mx:Panel x="639" y="365" width="226" height="219" layout="absolute"/>

                                            <mx:Panel x="873" y="365" width="285" height="219" layout="absolute"/>

                                            <mx:Panel x="10" y="10" width="250" height="347" layout="absolute" title="NodeList" >
                                            </mx:Panel>



                                            <mx:Panel x="268" y="10" width="890" height="347" layout="absolute">
                                            <mx:Canvas x="0" y="0" width="252" height="107">
                                            <mx:LineChart dataProvider="{graphData}" x="0" y="0" id="linechart1" height="107" width="134" >
                                            <mx:series>
                                            <mx:LineSeries displayName="idle" yField="idle" form="curve" >
                                            <mx:lineStroke>
                                            <mx:Stroke color="blue" weight="1" alpha=".8" />
                                            </mx:lineStroke>
                                            </mx:LineSeries>
                                            </mx:series>
                                            </mx:LineChart>
                                            </mx:Canvas>
                                            <mx:Canvas x="0" y="105" width="252" height="103">
                                            </mx:Canvas>
                                            </mx:Panel>




                                            </mx:Application>
                                            • 19. Re: trying to build a live feed dash board..
                                              Level 7

                                              "ice9_us" <webforumsuser@macromedia.com> wrote in message
                                              news:gbof67$c1l$1@forums.macromedia.com...
                                              >I am not sure what you mean..
                                              > from what i understand..
                                              > the getData.source should hold all the values.. pointed do by cpustats
                                              > so i reference cpustats.sys or idle to get the time..
                                              >
                                              > At this point.. i can really say.. i have no clue and need to keep reading
                                              > and
                                              > playing..

                                              From what you posted, only your first node has a "usr", "stats", or "idle"
                                              field. Your other nodes are empty.


                                              • 20. Re: trying to build a live feed dash board..
                                                Level 7

                                                "ice9_us" <webforumsuser@macromedia.com> wrote in message
                                                news:gboicc$fuf$1@forums.macromedia.com...
                                                > progress:
                                                >
                                                > <?xml version="1.0" encoding="utf-8"?>
                                                > <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml"
                                                > layout="absolute"
                                                > initialize="getcpu.send()">
                                                >
                                                > <mx:Script>
                                                > <![CDATA[
                                                >
                                                > import mx.collections.ArrayCollection;
                                                > import mx.collections.XMLListCollection;
                                                > import mx.rpc.events.ResultEvent;
                                                >
                                                > [Bindable]
                                                > private var graphData:XMLListCollection=new XMLListCollection();
                                                > private function handleLogin(event:ResultEvent):void {
                                                > graphData.source = event.result.cpustat;
                                                > }
                                                >
                                                >
                                                > ]]>
                                                > </mx:Script>
                                                > <mx:HTTPService id="getcpu"
                                                > url=" http://genesis.dvrdns.org/flex/cgi-bin/get_cpu.cgi"
                                                > method="GET" result="handleLogin(event)" resultFormat="e4x" >
                                                > </mx:HTTPService>
                                                >
                                                > <mx:Panel x="268" y="365" width="363" height="219" layout="absolute"/>
                                                >
                                                > <mx:Panel x="10" y="365" width="250" height="219" layout="absolute"
                                                > title="ECC Reporting Center">
                                                > <mx:DataGrid x="0" y="0" width="230" height="179"/>
                                                > </mx:Panel>
                                                >
                                                >
                                                > <mx:Panel x="639" y="365" width="226" height="219" layout="absolute"/>
                                                >
                                                > <mx:Panel x="873" y="365" width="285" height="219" layout="absolute"/>
                                                >
                                                > <mx:Panel x="10" y="10" width="250" height="347" layout="absolute"
                                                > title="NodeList" >
                                                > </mx:Panel>
                                                >
                                                >
                                                >
                                                > <mx:Panel x="268" y="10" width="890" height="347" layout="absolute">
                                                > <mx:Canvas x="0" y="0" width="252" height="107">
                                                > <mx:LineChart dataProvider="{graphData}" x="0" y="0" id="linechart1"
                                                > height="107" width="134" >
                                                > <mx:series>
                                                > <mx:LineSeries displayName="idle" yField="idle" form="curve" >
                                                > <mx:lineStroke>
                                                > <mx:Stroke color="blue" weight="1" alpha=".8" />
                                                > </mx:lineStroke>
                                                > </mx:LineSeries>
                                                > </mx:series>
                                                > </mx:LineChart>
                                                > </mx:Canvas>
                                                > <mx:Canvas x="0" y="105" width="252" height="103">
                                                > </mx:Canvas>
                                                > </mx:Panel>
                                                >
                                                >
                                                >
                                                >
                                                > </mx:Application>
                                                >
                                                >
                                                > I have the graph i like.. with idle time... now i want to do this
                                                > so it updates dynamically...
                                                > sending a service request and reading the new xml data
                                                >
                                                > and how do i get the graph to layout as it is built...
                                                > so the user/myself doesn't have to look at a blank screen so long..

                                                I think the thing that is taking the time is the call to the HTTPService, so
                                                it's not going to be able to start drawing before that comes back.


                                                • 21. Re: trying to build a live feed dash board..
                                                  Level 7

                                                  "ice9_us" <webforumsuser@macromedia.com> wrote in message
                                                  news:gbol97$jie$1@forums.macromedia.com...
                                                  > When trying to catch and display data in my data grid.. My stuff isn't
                                                  > really
                                                  > running.. it just sort of hangs... After the chart builds.. the stuff just
                                                  > sits
                                                  > still doesn't trigger my break in the debugger so i can see my stuff for
                                                  > getHD...
                                                  > do i need to do something to the first httpservice call or something?

                                                  At some point you need to call getHD.send().


                                                  • 22. Re: trying to build a live feed dash board..
                                                    ice9_us Level 1
                                                    can directly call
                                                    gethd.send() or does it have to be called by some type of initalize type function?

                                                    thanks for the xml link eariler...


                                                    Quick question through... IRT to the following::
                                                    -----------------

                                                    thePeople.person.(attribute("suffix") == "III"); //OK, Mims' nodechild(name), children()
                                                    These axes find the children of the given node[s]; by child I mean a first-generation descendent. The first finds a child of a specific name, and is the same as typing that name in literally. The second finds all children, which we’ve seen before as the asterisk operator.
                                                    --------------------------------------

                                                    Does this mean i can make a call like
                                                    if ( cpu_stat.cpustat.(attribute(idle) == "100") {
                                                    somestuff///
                                                    }

                                                    is the same as..
                                                    if ( somenode.somesubnode.(attribute(stringattribute)) == "string" ) {
                                                    somestuff
                                                    }

                                                    and i don't have to say type init or double or anything like that... just compare it as a string..


                                                    • 23. Re: trying to build a live feed dash board..
                                                      Level 7

                                                      "ice9_us" <webforumsuser@macromedia.com> wrote in message
                                                      news:gborqi$rh5$1@forums.macromedia.com...
                                                      > can directly call
                                                      > gethd.send() or does it have to be called by some type of initalize type
                                                      > function?

                                                      You could probably go ahead and call it from your init function or your
                                                      other result handler.

                                                      > Quick question through... IRT to the following::
                                                      > -----------------
                                                      >
                                                      > thePeople.person.(attribute("suffix") == "III"); //OK, Mims'
                                                      > nodechild(name),
                                                      > children()
                                                      > These axes find the children of the given node[s]; by child I mean a
                                                      > first-generation descendent. The first finds a child of a specific name,
                                                      > and is
                                                      > the same as typing that name in literally. The second finds all children,
                                                      > which
                                                      > we?ve seen before as the asterisk operator.
                                                      > --------------------------------------
                                                      >
                                                      > Does this mean i can make a call like
                                                      > if ( cpu_stat.cpustat.(attribute(idle) == "100") {
                                                      > somestuff///
                                                      > }

                                                      I didn't see that you have a variable called cpu_stat. I guess at least in
                                                      part the answer depends on what is in there. But you also need to enclose
                                                      the name of the attribute in quotes as well. But please note that the thing
                                                      you've called "idle" is a node, not an attribute.

                                                      so a more accurate way to do this would be:

                                                      myXMLList = event.result.cpustat;

                                                      -OR-

                                                      myXMLList = event.result.child('cpustat')

                                                      AND THEN

                                                      if (myXMLList.child('cpustat') =='100') {
                                                      ...
                                                      }

                                                      > is the same as..
                                                      > if ( somenode.somesubnode.(attribute(stringattribute)) == "string" ) {
                                                      > somestuff
                                                      > }

                                                      That, again, depends on how your variables are populated and what they
                                                      contain. At this point, I think you need to get a real handle on what's in
                                                      your variables at any given moment.

                                                      > and i don't have to say type init or double or anything like that... just
                                                      > compare it as a string..

                                                      The contents of all nodes and attributes are strings.

                                                      HTH;

                                                      Amy


                                                      • 24. Re: trying to build a live feed dash board..
                                                        ice9_us Level 1
                                                        [Bindable]
                                                        public var memoryUsage:ArrayCollection = new ArrayCollection();
                                                        public function initTimer():void {
                                                        // The first parameter in the Timer constructor
                                                        // is the interval, in milliseconds. The second
                                                        // parameter is how many times to run (0 is
                                                        // infinity).
                                                        var myTimer:Timer = new Timer(1000, 0);
                                                        // Add the listener for the timer event.
                                                        myTimer.addEventListener("timer", timerHandler);
                                                        myTimer.start();
                                                        }
                                                        public function timerHandler(event:TimerEvent):void {
                                                        var o:Object = new Object();
                                                        // Get the number of milliseconds since Flash
                                                        // Player started.
                                                        o.time = getTimer();
                                                        // Get the total memory Flash Player is using.
                                                        o.memory = flash.system.System.totalMemory;
                                                        // Add new object to the ArrayCollection, which
                                                        // is bound to the chart's data provider.
                                                        memoryUsage.addItem(o);
                                                        }

                                                        I am not sure i follow this live doc example..

                                                        i see the call to initTimer().. and it being setup
                                                        I see the timerHandler() and it being setup...

                                                        I see in the startup..
                                                        <mx:Application xmlns:mx=" http://www.adobe.com/2006/mxml" initialize=
                                                        "initTimer()">

                                                        initTimer is called which Adds the timeHandler and starts the timer...

                                                        My issue is..

                                                        In the rest i see only this:

                                                        <mx:LineChart id="chart"
                                                        dataProvider="{memoryUsage}"
                                                        showDataTips="true">
                                                        <mx:horizontalAxis>
                                                        <mx:LinearAxis/>
                                                        </mx:horizontalAxis>
                                                        <mx:verticalAxis>
                                                        <mx:LinearAxis minimum="5000000"/>
                                                        </mx:verticalAxis>
                                                        <mx:series>
                                                        <mx:Array>
                                                        <mx:LineSeries yField="memory"/>
                                                        </mx:Array>
                                                        </mx:series>
                                                        </mx:LineChart>
                                                        </mx:Application>

                                                        does that example loop. with out any call to a for or while(1)

                                                        from my view i see it being called only 1 time..
                                                        so everything in the Script part runs during start up

                                                        only because of the call to the initalize at the top..
                                                        then on the run of the mx: stuff after the call to script..
                                                        it displays it..
                                                        what makes that data update during the hwole process?

                                                        If i were to apply my sample code httpservice graph stuff..
                                                        where in the world would i enter the call to update the xml data for httpservice..
                                                        do i destory what i have collected thus far.. and redraw the graph..
                                                        or does flex handle that build the stack and free memory....

                                                        I am asking becuase in C i see the process taking place..
                                                        int a=0;
                                                        char *ptr;
                                                        prt = malloc(1); << making 1 byte of memory to hold a #

                                                        while(1) { < start my loop;
                                                        snprintf(ptr, "%d",a);
                                                        graph_my_a();
                                                        a=malloc(a+1);
                                                        a++
                                                        }

                                                        this will run forever allocating 1 byte and adding 1 to whatever number a is.. so i would graph.. in theroy..
                                                        x=1 y=1
                                                        x=2 y=2 ....

                                                        right.. and slowly eat memory... since i never call free

                                                        i the script example.. i see it the stuff getting called... but running only 1 time.
                                                        I see a call to addItem(o) but never freeing the line..
                                                        • 26. Re: trying to build a live feed dash board..
                                                          ice9_us Level 1
                                                          myXMLList = event.result.cpustat;

                                                          -OR-

                                                          myXMLList = event.result.child('cpustat')

                                                          AND THEN

                                                          if (myXMLList.child('cpustat') =='100') {
                                                          ...
                                                          }


                                                          ok.. the xml setup is like this..
                                                          <cpu_stat>
                                                          <cpustats>
                                                          <idle></idle>
                                                          <sys></sys>
                                                          <usr></usr>
                                                          </cpustats>
                                                          </cpu_stat>

                                                          so with that..
                                                          cpu_stat.cpustats.attribute(idle) << for the string value of idle

                                                          or
                                                          cpu_stat.cpustats.attribute(*) << for the string value of all
                                                          ?
                                                          • 27. Re: trying to build a live feed dash board..
                                                            Level 7

                                                            "ice9_us" <webforumsuser@macromedia.com> wrote in message
                                                            news:gbott2$pq$1@forums.macromedia.com...
                                                            > myXMLList = event.result.cpustat;
                                                            >
                                                            > -OR-
                                                            >
                                                            > myXMLList = event.result.child('cpustat')
                                                            >
                                                            > AND THEN
                                                            >
                                                            > if (myXMLList.child('cpustat') =='100') {
                                                            > ...
                                                            > }
                                                            >
                                                            >
                                                            > ok.. the xml setup is like this..
                                                            > <cpu_stat>
                                                            > <cpustats>
                                                            > <idle></idle>
                                                            > <sys></sys>
                                                            > <usr></usr>
                                                            > </cpustats>
                                                            > </cpu_stat>
                                                            >
                                                            > so with that..
                                                            > cpu_stat.cpustats.attribute(idle) << for the string value of idle
                                                            >
                                                            > or
                                                            > cpu_stat.cpustats.attribute(*) << for the string value of all
                                                            > ?

                                                            Look, I really don't have time to go over your code line by line and teach
                                                            you how to code. Maybe someone else does. But you might find it
                                                            instructive to look at the Flex 3 Training from the Source book. It leads
                                                            you through the creation of a basic application step by step.

                                                            HTH;

                                                            Amy