Skip to main content
Mary Pieroszkiewicz
Known Participant
March 2, 2011
Question

My application - Google Map API + MySQL + ColdFusion 9 + Flex 4

  • March 2, 2011
  • 10 replies
  • 3673 views

I have a problem with displaying the correct latitude and longitude of my application. And when I want to make changes in the data grid displays a ColdFusion error.

Please help and check the source code.


Source code: Database MySQL: http://wklej.org/id/485509/
Source code: ColdFusion 9: http://wklej.org/id/485525/
Source code: Flex 4: http://wklej.org/id/485529/

    This topic has been closed for replies.

    10 replies

    Mary Pieroszkiewicz
    Known Participant
    April 5, 2011

    Thank you all for your help!

    Mary Pieroszkiewicz
    Known Participant
    March 24, 2011

    I'm writing my thesis, I have some questions.

    The application consists of the MySQL database combined with ColdFusion and Flex.


    I want to write a section of the application architecture.

    Will my application is based on a three-tiered architecture, or on MVC ?

    Mary Pieroszkiewicz
    Known Participant
    March 21, 2011

    I gave advice to put it on the server CF. Already running.
    The application is already on the server.

    Mary Pieroszkiewicz
    Known Participant
    March 19, 2011

    I have a problem in Flex with the export release build. I have WAMP installed and configured ColdFusion 9 and I want to do export release build. When I did not work on my application.



    Shows the error: [RPC Fault faultString = "Send failed" faultCode = "Client.Error.MessageSend" faultDetail = "Channel.Security.Error error Error # 2048 url: 'http://localhost/flex2gateway/'"]
    Community Expert
    March 20, 2011

    Are you testing by opening your application with a localhost URL?

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Dave Watts, Eidolon LLC
    Mary Pieroszkiewicz
    Known Participant
    March 13, 2011

    I need in my application. How to use ColdFusion and Flex upload pictures to the server

    Can you help me. Thank you!

    Community Expert
    March 13, 2011

    I don't have a code example sitting right in front of me, but basically, here's what you're going to do.

    On the CF server, you'll write a CF page that uses CFFILE with ACTION="UPLOAD".

    On the Flex application, you'll create an instance of flash.net.FileReference. You'll use the browse method to let the user select the file, then use the upload method to initiate the upload. You'll specify an event handler for the upload completion, and optionally another one to track progress.

    Google "flex filereference" for more information about the Flex side of things.

    Dave Watts, CTO, Fig Leaf Software

    http://www.figleaf.com/

    http://training.figleaf.com/

    Dave Watts, Eidolon LLC
    Mary Pieroszkiewicz
    Known Participant
    March 13, 2011

    Thank you Dave,

    I would like to do this using ColdFusion 9 Services - Upload Service but I do not know how to do it. I found this tutorial http://blog.flexexamples.com/2007/09/21/uploading-files-in-flex-using-the-filereference-class/, but instead this code:
    <cffile action = "upload"
             filefield = "Filedata"
             destination = "# ExpandPath ('./')#"
             nameconflict = "OVERWRITE" />

    Services use ColdFusion 9: Upload Service, in my Flex file.

    This file will look like this

    <cf:File
    id = "FileUpload"
    action = "upload"
    filefield = "Filedata"
    destination = "# ExpandPath ('./')#"
    nameconflict = "OVERWRITE" />

    Mary Pieroszkiewicz
    Known Participant
    March 10, 2011

    I changed in my file cf,

    cfqueryparam cfsqltype = "cf_sql_decimal" on cfqueryparam cfsqltype = "cf_sql_float"

    and I left the MySQL database to decimal (10,7) and displays show the correct results.

    <cffunction name="createMarkers" output="false" access="remote"  returntype="Numeric">
           <cfargument name="name" required="true" type="string">
           <cfargument name="latitude" required="true" type="Numeric">
           <cfargument name="longitude" required="true" type="Numeric">
           <cfquery name="qItem" datasource="google_map" result="result">
               INSERT INTO markers
                  (name, latitude, longitude)
               VALUES
                  (<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.name#">,
                   <cfqueryparam cfsqltype="cf_sql_float" value="#arguments.latitude#">,
                  <cfqueryparam cfsqltype="cf_sql_float" value="#arguments.longitude#">)
           </cfquery>
           <cfreturn result.GENERATEDKEY>

    </cffunction>

    <cffunction name="updateMarkers" output="false" access="remote"  returntype="void"  >
           <cfargument name="id" required="true" type="Numeric">
           <cfargument name="name" required="true" type="string">
           <cfargument name="latitude" required="true" type="Numeric">
           <cfargument name="longitude" required="true" type="Numeric">
           <cfquery name="qItem" datasource="google_map">
               UPDATE markers SET 
                     name=<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.name#">,
                     latitude=<cfqueryparam cfsqltype="cf_sql_float" value="#arguments.latitude#">,
                     longitude=<cfqueryparam cfsqltype="cf_sql_float" value="#arguments.longitude#">
              WHERE id=<cfqueryparam cfsqltype="cf_sql_integer" value="#arguments.id#">
           </cfquery>

    </cffunction>

    Mary Pieroszkiewicz
    Known Participant
    March 10, 2011

    I changed in my file cf from cfqueryparams decimal to cfqueryparams float and I left the MySQL database in decimal and displays correctly :]

    Could this all the interpretations.

    My source code ColdFusion - http://wklej.org/hash/25d772313a9/

    Inspiring
    March 10, 2011

    Maria Pieroszkiewicz wrote:


    I changed in my file cf from cfqueryparams decimal to cfqueryparams float

    and I left the MySQL database in decimal and displays correctly :]

    Could this all the interpretations.


    I don't understand what you changed in ColdFusion.


    The original code sample http://wklej.org/id/485525/ had this in createMarkers():


            <cfquery name="qItem" datasource="google_map" result="result"> 
               INSERT INTO markers
                   (name, latitude, longitude)
              VALUES
                  (<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#ARGUMENTS.item.name#">,
               <CFQUERYPARAM CFSQLTYPE="CF_SQL_FLOAT" VALUE="#ARGUMENTS.item.latitude#">,
               <CFQUERYPARAM CFSQLTYPE="CF_SQL_FLOAT" VALUE="#ARGUMENTS.item.longitude#">)
            </cfquery
    >

    The last code example http://wklej.org/hash/25d772313a9/ had this
    createMarkers():

           <cfquery name="qItem" datasource="google_map" result="result">
               INSERT INTO markers
                   (name, latitude, longitude)
                   VALUES
                             (<cfqueryparam cfsqltype="cf_sql_varchar" value="#arguments.name#">,
                     <cfqueryparam cfsqltype="cf_sql_float" value="#arguments.latitude#">,
                     <cfqueryparam cfsqltype="cf_sql_float" value="#arguments.longitude#">)
            </cfquery>


    They are the same.

    Mary Pieroszkiewicz
    Known Participant
    March 7, 2011

    I have a problem with the application.

    Inspiring
    March 10, 2011

    The FLOAT data is being rounded either in the AMF serialization on directly in the UI.  I think you need to use the Flex NumberFormatter on your FLOAT data.

    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/formatters/NumberFormatter.html

    I tested inserting and querying the data in ColdFusion (without Flex UI) and the data precision is maintained correctly.

    <cfquery datasource="map" name="createTable">
       
        create table markers (
            id MEDIUMINT NOT NULL AUTO_INCREMENT,
            name CHAR(50) NOT NULL,
            latitude FLOAT(10,6) NOT NULL,
            longitude FLOAT(10,6) NOT NULL,       
            PRIMARY KEY (id)
        ) ENGINE=MyISAM;
    </cfquery>

    <cfset items = ArrayNew(2)>
    <cfset items[1][1] = 'Mikolow'>
    <cfset items[1][2] = 50.179016>
    <cfset items[1][3] = 18.903805>
    <cfset items[2][1] = 'Katowice'>
    <cfset items[2][2] = 50.264893>
    <cfset items[2][3] = 19.023781>

    <cfloop from="1" to="#arraylen(items)#" index="i">
        <cfquery name="qItem" datasource="map" result="result">
           INSERT INTO markers
                (name, latitude, longitude)
            VALUES
             (<CFQUERYPARAM CFSQLTYPE="CF_SQL_VARCHAR" VALUE="#items[1]#">,
              <CFQUERYPARAM CFSQLTYPE="CF_SQL_FLOAT" VALUE="#items[2]#">,
              <CFQUERYPARAM CFSQLTYPE="CF_SQL_FLOAT" VALUE="#items[3]#">)
         </cfquery>

        <cfdump var="#result#" label="RESULT"/>

    </cfloop>

    <cfquery name="qGetMarkers" datasource="map">
           SELECT *
           FROM markers
    </cfquery>
           
    <cfdump var="#qGetMarkers#">

    Mary Pieroszkiewicz
    Known Participant
    March 3, 2011

    I changed in the MySQL database with latitude and longitude float (10,6) to Decimal (10,6) when I entered the data (screen_1). Data in the table (screen_2). When re-launching applications, I change the value of latitude longitude (screen_3).

    I do not know why this happens. I could not find the error. Please help me.

    Participant
    March 2, 2011

    It's pretty obvious that you have an error in your SQL syntax, so you should debug that. Make sure that you can print that entire SQL statement, run it directly on the database and you'll get some error that will say more.

    Mary Pieroszkiewicz
    Known Participant
    March 2, 2011

    Source code ColdFusion at line 60 I had the extra comma. Now the update function works..

    But what about those results latitude longitude...?

    Inspiring
    March 3, 2011

    On 3/3/2011 2:30 AM, Maria Pieroszkiewicz said:

    But what about those results latitude longitude...?

    and what about them? what exactly is wrong?