Jump to content
Larry Ullman's Book Forums

DuPreez

Members
  • Posts

    13
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by DuPreez

  1. I cannot figure out what is causing these warnings:

     

    Ignoring on line CDATA because other XML elements exist

    Ignoring: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in CDATA because other XML elements exist.

     

    The line number for both is line 2 of my main mxml application:

    line 1<?xml version="1.0" encoding="utf-8"?>

    line 2<!-- main application myApp.mxml -->

    line 3<s:Application minWidth="800" minHeight="600" height="100%" width="100%" .."

     

    I cannot export a release version without resolving these warnings.

     

    Thanks - really would appreciate some help/pointers!

  2. I developed on my Windows XP machine with a Wamp server and developed in Flash Builder 4. While I was developing and using data services - when prompted by Flash Builder I let it install the Zend Framework. Now I need to deploy a Flex 4 web application developed in Flash Builder 4 on an Ubuntu Linux production server which has MySQL and php already installed.

    Am I supposed to install Zend on the Linux server?

     

    The Adobe Help documentation is confusing...

     

    According to: http://help.adobe.com/en_US/flashbuilder/using/WSe4e4b720da9dedb5-13a250c812e8e9b5533-7ff9.html :

    "(PHP server projects only) For PHP projects, perform these additional steps:

    Install the Zend framework on the server. See Installing Zend Framework. ".

     

    However, according to http://help.adobe.com/en_US/flex/accessingdata/WSbde04e3d3e6474c45b672e6c12574edcc5e-8000.html :

     

    For productions servers, Adobe recommends that you move the ZendFramework folder outside the web root. Update the zend_path variable defined in amf_config.ini.

    If the zend_path variable is commented out, uncomment the zend_path variable. Specify the location of your Zend Framework installation.

    If Flash Builder installed the Zend Framework, check the following:


    • The location of the web root folder
      Flash Builder installs the Zend Framework in the project’s web root folder. Check the location of the web root folder. Select Project > Properties> Flex Server.

    • Ensure that the web server is configured to use PHP.

    • Examine the zend_path variable in amf_config.ini.
      amf_config.ini is in the project output folder.

    Thanks for the help!

  3. I want to convert an XMLList into an Array (not an ArrayCollection). I do understand that an ArrayCollection is actually only a wrapper around an Array & at the heart of an ArrayCollection is in fact an Array.

    At this stage I can convert the XMLList into an ArrayCollection like so:

    testInfo = event.result.node; // testInfo is an XMLList

    myData = new ArrayCollection(mx.utils.ArrayUtil.toArray(testInfo.LoadType)); // myData is an ArrayCollection.

     

    Testing (component implementation), the only way I’ve been able to access the content (stripped of start & end XML tags) is like so:

    In a combobox: <mx:ComboBox dataProvider="{myData.getItemAt(0)}" />

    or in a List: <mx:List dataProvider="{testInfo}" labelField="LoadType"/>

    If I use <mx:ComboBox dataProvider="{myData}"/> without the getItemAt(0)-part, the start & end XML tags are still included. Why???

     

    The reason I want an Array is to ultimately use it in a PieSeries to bind to perWedgeExplodeRadius.

    I'm using Flex 4 with FlashBuilder IDE.

     

    Thanks.

  4. Flex 4. And in the meantime I got it working like so:

    <fx:Style>

    @namespace mx "library://ns.adobe.com/flex/mx";

    @namespace s "library://ns.adobe.com/flex/spark";

    @font-face {

    src: local("Verdana");

    fontFamily: VerdanaEmbedded;

    fontWeight: bold;

    color: #000000;

    embedAsCFF: false;

    }

    mx|ColumnChart {

    fontFamily: VerdanaEmbedded;

    fontSize: 10;

    }

     

    For some reason the fontWeight must be 'bold'. If I change it to 'normal' it doesn't work anymore. A great mystery...

    • Upvote 1
  5. Cannot rotate columnChart labels. I'm embedding a font & using a horizontal axisrenderer, yet still I cannot rotate the labels! Please help! Here's my code:

    <fx:Style>

    @namespace mx "library://ns.adobe.com/flex/mx";

    @font-face {

    src: url("assets/fonts/DiavloM.otf");

    font-family: Dia;

    fontStyle: normal;

    fontWeight: normal;

    embedAsCFF: false;

    }

    mx|ColumnChart {

    fontFamily: Dia;

    fontSize: 12;

    }

    </fx:Style>

    <mx:ColumnChart id="testChart2" dataProvider="{testInfo}" showDataTips="true" width="80%" height="30%">

    <mx:horizontalAxis>

    <mx:CategoryAxis id="haxis" categoryField="Type" dataProvider="{testInfo}"/>

    </mx:horizontalAxis>

    <mx:verticalAxis>

    <mx:LinearAxis minimum="0" maximum="{maxNum}" interval="1"/>

    </mx:verticalAxis>

    <mx:series>

    <mx:ColumnSeries yField="num" fontSize="10" showDataEffect="{changeEffect1}" xField="Type" displayName="Type"/>

    </mx:series>

    <mx:horizontalAxisRenderer>

    <mx:AxisRenderer labelRotation="-45" axis="{haxis}" />

    </mx:horizontalAxisRenderer>

    </mx:ColumnChart>

  6. Well, just out of curiosity, why would you use POST here? To me, POST is inappropriate and GET is the correct request method to use. POST is normally used to change server data; GET used to request server data.

    Hi, thanks for the reply. It is solved. The problem was I never called/invoked the POST HTTPService in my Flex application. However, I've since dropped the POST HTTPService altogether. I'm only using a GET HTTPService with <s:Request/> where I send the itemID data to the server. Also, in my php file I use $_REQUEST, but I know I can also use $_GET.

    Thanks again.

  7. For some reason I cannot POST a value using HTTPService in Flex to my php file.

    If I hardcode the value in the php it works 100%, using just the HTTPService with GET.

    I need the xml result as dataProvider for a Flex graph and like I said, it works 100% and the graph displays correctly with a hardcoded value in the php.

    If I test in the browser like so:

    http://localhost/...my_url//myfile.php?itemID=1 I get an undefined index error and obviously if I run my Flex application I get no graph.

    If I change the $_POST to $_GET in php and just test in browser I get the correct output.

     

    Please help!

     

    Here's the php:

    <?php header("Content-Type:text/xml");

    echo '<data>';

    //connection info

    define("DATABASE_SERVER", "localhost");

    define("DATABASE_USERNAME", "root");

    define("DATABASE_PASSWORD", "");

    define("DATABASE_NAME", "xx");

     

    $dbc = mysqli_connect(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME);

     

    $itemID=$_POST['itemID'];

     

    $q = "SELECT ID, Name FROM inventory where AreaID = $itemID";

    $i=0;

    $r = mysqli_query($dbc,$q);

     

    while ($row=mysqli_fetch_array($r, MYSQLI_ASSOC)){

    $i++;

    echo "<node>

    <Type>{$row["Designation"]}</Type>

    <num>{$i}</num>

    </node>

    ";

    }

     

    echo '</data>';

    ?>

     

    Here's the Flex:

     

    <s:HTTPService id="testData" url="...my_url/myfile.php"

    method="GET" resultFormat="e4x" result="xmlHandler(event)"/>

    <s:HTTPService id="getChartData" url="...my_url/myfile.php"

    method="POST" resultFormat="text" result="getChartData_resultHandler(event)">

    <mx:request>

    <itemID>{1}</itemID>

    </mx:request>

    </s:HTTPService>

     

    [bindable]

    private var testInfo:XMLList;

     

    private function xmlHandler(event:ResultEvent):void

    {

    testInfo = event.result.node;

    testChart.dataProvider=testInfo;

    }

     

    protected function getChartData_resultHandler(event:ResultEvent):void

    {

    testData.send();

    }

  8. Okay, the easy solution is to change the XML, if that's an option. If not, I think you're either going to have create a custom data renderer or convert the raw XML to a more usable format.

     

    I think my problem is with the php script that generates the XML data for my tree component. I think I need a package (from PEAR) called Query2XML to generate XML from a sql query.

    However, when I try and install the package on my wampserver 2.0 via the commandline:

    c:\wamp\bin\php\php5.3.0>pear install XML_Query2XML-1.7.1,

     

    I get the following error 'failed to mkdir C:\php5\pear\docs\XML_Query2XML\cases\case01

     

    And as a test: if I try and run in my browser the following php script:

     

    <?php

    require_once 'XML/Query2XML.php';

    require_once ('PEAR/Exception.php');

    require_once 'DB.php';

    $db = DB::connect('mysql://root@localhost/Query2XML_Tests');

    $query2xml = XML_Query2XML::factory($db);

    ?>

    :(

    I get this error:

    Warning: require_once(XML/Query2XML.php) [function.require-once]: failed to open stream: No such file or directory in C:\wamp\www\try.php on line 2

     

    Fatal error: require_once() [function.require]: Failed opening required 'XML/Query2XML.php' (include_path='.;C:\php5\pear') in C:\wamp\www\try.php on line 2

     

     

    I really need to get the xml data via sql and php into a tree component and I reckon I need to use the sql to xml query. What am I doing wrong???

     

    Can you please help? Thanks a lot. :(

  9. Firstly, apologies because I've e-mailed this question to Larry as well...

    Based on pp. 248-249 of Effortless Flex 4: trying to get XML data to display correctly in Tree component, but nodes are duplicated: parent duplicates itself as a child which in turn duplicates itself again as another child.

    When I run my xmlData.php script in browser, the hierarchical layout is correct:

    <?xml version="1.0" encoding="utf-8" ?>

    - <kettles>

    - <kettle>

    <child>Auto kettle</child>

    <child>Salton SSSAK22</child>

    </kettle>

    - <kettle>

    <child>Eon Kettle</child>

    <child>Kenwood SJ900</child>

    </kettle>

    - ...etc.etc...

    </kettles>

    I'm using HTTPService, XMLList and bind XMLList to my tree component:

    <s:HTTPService id="XMLService" url="http://localhost/EE/services/xmlData.php" method="GET" resultFormat="e4x" result="getXMLDataResult(event)"/>

    [bindable]

    private var XMLDataList:XMLList;

    private function getXMLDataResult(event:ResultEvent):void{

    XMLDataList=event.result.kettle;

    }

    <mx:Tree id="applTree" creationComplete="XMLService.send()"

    dragEnabled="true" labelField="child" dataProvider="{XMLDataList}" dragStart="tree_dragStartHandler(event)"/>

     

    I URGENTLY need to get rid of the duplication. Please help!! Thanks.

×
×
  • Create New...