Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: Project

  1. #1
    Junior Member
    Join Date
    Sep 2012
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Project

    This will be a complex post and question which will contain Second Life LSL (scripting language) and a PHP DB Query which is on the server with the MYSQL data base. I will try to present it in a short logical manner and I am not asking for code or solutions. I just want possibilities and initial thoughts about processes. While it is a bit involved it might be interesting to some. Ok My ultimate goal is to upload x y co-ordinates to the java in the api to plot aircraft in Second life on the web.

    First question is could I use a JDBC DB Query in place of the PHP? Next question can I insert variables into the java in the api from the data base or even dynamic LSL uploads?

    Here is a google map on one web page showing the waypoints. I am using a SL google map api to show Second Life maps on the web.

    http://www.sliditerod.com/waypoints.html

    A portion of the java code used in the map api:
    function loadmap() {
      mapInstance = new SLMap(document.getElementById('map-container'));
      mapInstance.centerAndZoomAtSLCoord(new XYPoint(1145, 1055), 6);
     
    // plots one waypoint using the x y cords
     var marker2_image = new Img("images/mapways.gif", 400, 50);
     var marker2_icon = new Icon(marker2_image); 
    var marker2_images = [marker2_icon, marker2_icon,];
     var marker2a = new Marker(marker2_images, new XYPoint(1139, 1106));
     mapInstance.addMarker(marker2a);

    Second phase:

    Using LSL inworld a prim (primitive) puts up a dialog which gives user choice and selection of a waypoint the passes the name to another prim. This prim uses this code (partial)for a llHttpResponse to the PHP on the server.

          string rurl = "http://www.sliditerod.com/track.php";//get waypoint x y z
           link_message(integer sender_num, integer num, string choice, key id)
        {
            god = ((string)choice);  llSay(0, "god" + ((string)god));
          state scal;
        }    
    }
           state scal
         {       state_entry()
            {
               llSay(0, "name is" + ((string)god));
     
            string xyz = "name=" + god; way_name = ((string)god);
            query = llHTTPRequest(rurl, [HTTP_METHOD,"POST",HTTP_MIMETYPE,"application/x-www-form-urlencoded"] , xyz);
             }
     
     
     
     
    ///////// GETS XYZ /////
     
     http_response(key qid, integer status, list meta, string url)
            {
                if ( qid == query )
                {
                    if ( status != 200 ){
                        llSay(0, "Server Error");
                    }
                    else
                    {
                        //get waypoint x y z
                        list info = llParseString2List(url,[" "],[" "]);
                        map_x = llList2Float(info,0);
                        map_y = llList2Float(info,1);
                        map_z = llList2Float(info,2);
                        wregion =  llList2String(info,3)

    The PHP
    <?php
    $name = $_POST["name"];
    $url = $_POST["surl"];
     
     
     
     
     
    include 'slidconnect.php';
     
     
    // Get a specific result from the "example" table
    $result = mysql_query("SELECT * FROM xyz
     WHERE pname='$name'") or die(mysql_error());  
     
    // get the first (and hopefully only) entry from the result
    $row = mysql_fetch_array( $result );
    // Print out the contents of each row into a table 
    echo $row ['x'] . "  " . $row['y'] . "  " . $row['z'] . "  " . $row[regions];
     
     
     
    msqli_close($dbc);
    ?>


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Project

    A portion of the java code used in the map api...
    That look like javascript not java....this is a java centric forum, are you sure your question isn't javascript specific?

Similar Threads

  1. Help with Project
    By rawrxeroes in forum Object Oriented Programming
    Replies: 1
    Last Post: October 12th, 2011, 07:12 AM
  2. need help in my project
    By flana in forum The Cafe
    Replies: 4
    Last Post: October 11th, 2011, 06:13 AM
  3. Project
    By Mac in forum What's Wrong With My Code?
    Replies: 15
    Last Post: June 4th, 2010, 04:39 AM
  4. help with project
    By pairenoid in forum Object Oriented Programming
    Replies: 1
    Last Post: May 7th, 2010, 08:55 AM
  5. Project - Please Help
    By toxikbuni in forum Java Theory & Questions
    Replies: 0
    Last Post: April 20th, 2010, 09:58 AM