Jump to content

jh_dempsey

Members
  • Posts

    9
  • Joined

  • Last visited

    Never

About jh_dempsey

  • Birthday 02/21/1986

Contact Methods

  • MSN
    jonnyhdempsey
  • Website URL
    http://www.coastervideosonline.co.uk
  • Yahoo
    jh_dempsey

Profile Information

  • Gender
    Not Telling
  • Location
    Leeds

jh_dempsey's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi All I have downloaded a program called shp2text (http://www.obviously.com/gis/shp2text/) The program takes an ESRI shape file and produces an XML document. The program is written in C, and to run the program, you need to call it from the command line with parameters. An example call is like such: shp2text --gpx bike-cape_islands-geo.shp 6 0 > output.gpx shp2text is the actual exe file, --gpx sets the output format (gpx is written in xml), the next bit is the shape file (bike-cape_islands-geo.shp) and the two numbers are some options. "output.gpx" is the name of the file it will create when finished. I would be really nice if i could run this script from PHP. My ultimate aim would be to make a script that uploads the shape file to the server, runs the shp2text file on it, and then does something with the gpx file the program has just created. I have no idea and cant seem to find anything on how to go about this. I have seem functions such as exec(), system() etc.. but i dont seem to have much luck running them (i get no php error messages from them but it hasnt created the file) I need a few pointers in how to get started with this (if its possible) Does the C program need to be in a specific folder for PHP to be able to call it? How do i pass the parameters into the program? What is the best function to use to call the program? exec()? system()? Thanks
  2. Hi All My database is set up with 3 tables with the following column names and a samle set of data nsr_entrants |entrant_id | Name | -------------------- | 1 | Jon | | 2 | Ken | | 3 | Bob | nsr_bibno: |entrant_id | bibno | -------------------- | 1 | 100 | | 2 | 200 | nsr_scores: | entrant_id | score | --------------------- | 1 | 20 | | 3 | 20 | What i need to do is find the entrants (listed within the nsr_entrants table) who have a bib number registered in the nsr_bibno table, but who dont have a score registered in the nsr_scores table. So in the above example, i would want the statement to pick out Ken (id=2) because that person has a bib number registered, but has no score registered. I know how to join the tables seperatley, but im not sure how to do both in one go. My attempts so far have failed. Im using mySQL version 5.0.45 Anyone able to help me out?
  3. Hey All Im pretty new to Javascript, but quite competant in PHP. So when things dont work like they do in PHP, i get a bit stuck!!! Im creating a page which uses the Google Maps API. The idea is that when i click a link, it runs the toggle_overlay() function and shows an overlay on my map. The create_overlay() function creates the polygon object. The idea then is that it returns this object, and then i can add it to the map using the map.addOverlay function. The problem is, the polygon[id] variable im passing the object to appears to not be recieving the object. If i run map.addOverlay(polygon[id]), nothing happens. I know that the polygon is being created ok because if i put the map.addOverlay function inside the create_overlay() function straight after the polygon object was created (ie adding map.addOverlay(poly_function) just after poly_function is created), then the overlay shows up on the map. Why isnt my object being passed to the polygon[id] variable?? The page can be found at www.coastervideosonline.co.uk/floodmodelling/index.html The following code all appears between the <head></head> tags of the page <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAA35aUO1VCBYfikrJho5rctRRlQbv0yLQwDzXq89Ttj6TRJVoXfRRQIjL7jISrTKy0OXgED5SCQK5uMg"> </script> <script type="text/javascript"> // Load the Google Maps API google.load("maps", "2.x"); // Set the location of the XML file. Include a random parameter so the page doesnt cache var url2 = "xml_test.xml?r=" + new Date().getTime(); // Set the map variable var map = null; // Set the array that will hold all the overlays var polygon = new Array(); // Call this function when the page has been loaded function initialize() { // Create a new Google Map Object map = new google.maps.Map2(document.getElementById("map")); // Center the map on a certain point map.setCenter(new google.maps.LatLng(53.869281,-1.691551), 13); // Add the controls to the top left corner map.addControl(new google.maps.LargeMapControl()); // Enable Zoom In/Out via Mouse Scrollwheel map.enableScrollWheelZoom(); google.setOnLoadCallback(initialize); } // Read the data from xml_test.xml function create_overlay(xmldata,i) { // Create an AJAX HTTP request var request = google.maps.XmlHttp.create(); // What to do when the server replys... request.onreadystatechange = function() { if (request.readyState == 4) { var xmlDoc = google.maps.Xml.parse(request.responseText); var coordinates = xmlDoc.getElementsByTagName("coordinates"); // Create an array to hold the Latitude and Longitude values var LatLong = new Array(); for (var i = 0; i < coordinates.length; i++) { // Grab the X and Y coordinates var coord_x = coordinates[i].getAttribute("x"); var coord_y = coordinates[i].getAttribute("y"); // Add these coordinates into the LatLong array, converting to LatLng first LatLong[i] = new google.maps.LatLng(coord_x,coord_y); } // Join the polygon abck to start by making the last point equal to the first point j = coordinates.length + 1; LatLong[j] = LatLong[0]; // Create the Polygon var poly_function = new google.maps.Polygon(LatLong,"#f33f00", 5, 1, "#ff0000", 0.2); return poly_function; } } request.open("GET",xmldata,true); request.send(null); } function toggle_overlay(id) { polygon[id] = new create_overlay(url2,id); debugger; outputEl = document.getElementById("output"); outputEl.childNodes[0].nodeValue = var_dump(polygon[id]); map.addOverlay(polygon[id]); } function var_dump(obj) { if(typeof obj == "object") { return "Type: "+typeof(obj)+((obj.constructor) ? "\nConstructor: "+obj.constructor : "")+"\nValue: " + obj; } else { return "Type: "+typeof(obj)+"\nValue: "+obj; } } </script>
  4. Hey All On my webpage i have 3 groups of checkboxes, all of which have names that are arrays eg uni_id[$i] , open_entrants[$j] and other_entrants[$k ($i , $j and $k will be numbers) What i need is 3 seperate Check All / Uncheck All buttons, one for each group of checkboxes. Ive managed to find the following code that checks every single box on my page. How do i make it so that it only checks the name of the checkbox group that i pass to it?? <SCRIPT LANGUAGE="JavaScript"> <!-- function checkall() { var df=document.form1.elements; for(var i=0;i<df.length;i++) { //alert(df[i].name); df[i].checked=true; } } function uncheckall() { var df=document.form1.elements; for(var i=0;i<df.length;i++) { //alert(df[i].name); df[i].checked=false; } } --> </script>
  5. Yes, session_start() has been called at the top of each page the sessions appear on. Ive even tried putting a session_start(); inside the constructor for the login class
  6. Sorry, that was a typo, thats what it is in my actual script Ive edited my original post to correct this error
  7. Hey All Im having a real headscratch here when trying to set session variables from inside a class I have a page called uni_login.php which includes the file with my class in, and then creates a new instance of the class. One of the functions in the class is the do_login function, and this function check for correct login details, and then will grab all the info from the database and attempt to store this info inside a session so i can get to it later. Im doing it like this: [code]foreach($row as $key => $value) { $_SESSION[$key] = $value; }[/code] All seems to work fine because if i do a var_dump($_SESSION) on my uni_login.php page after i have called the do_login() function then it all seems to display fine. All the values are there along with the correct array keys. Now... If i go to another page (index.php), i start a session with session_start(); and attempt to output some of the variables from within my session. Nothing happens. They are all completley blank. Doing a var_dump($_SESSION) on the index.php page shows it to be completely empty. Ive checked that the session id being used is the same on both pages, and it is, so thats not the problem. Next i tried just typing this somewhere on my uni_login.php page [code]$_SESSION[test_var] = "Test Success";[/code] Now if i go to my index.php page and try and print this variable, it works fine. So what am i doing wrong?? Is there something special i need to do to store session variables from within a class?? Thanks
  8. D'oh!!! Just realised that what i did was right, i just had a mistype when including the string that held my connection details. Now it all works fine...
  9. Hey All At the moment ive got two tables. One holds all the entrants details like their competitor number (bib number), name, and the events they have entered (k1 and c1) The other holds the competitors score for the event. nsr_entrants: | id | bibnumber | name | k1| c1 | k1_slalom_scores: | entrant_id | score | I want to be able to find out if there are any competitors who have been assigned a bib number (ie their bib number is NOT zero), are taking part in the K1 event, and have not been given a score (ie. their entrant_id doesnt exist in the k1_slalom_scores table). If i find any, then i want to output their names to a table. Looking through the mySQL manual i found this which will do roughly what i want: If there is no matching record for the right table in the ON or USING part in a LEFT JOIN, a row with all columns set to NULL is used for the right table. You can use this fact to find records in a table that have no counterpart in another table: mysql> SELECT table1.* FROM table1 -> LEFT JOIN table2 ON table1.id=table2.id -> WHERE table2.id IS NULL; This example finds all rows in table1 with an id value that is not present in table2 (that is, all rows in table1 with no corresponding row in table2). This assumes that table2.id is declared NOT NULL. See Section 7.2.8, “How MySQL Optimizes LEFT JOIN and RIGHT JOIN”. Just to keep things simple to start with, i just tried to get the simple join going. I would try and get the other parameters (like being entered in K1 and bib number not equal to zero) added on later. I tried modifying the above to my table like below but had no luck SELECT *.nsr_entrants FROM nsr_entrants LEFT JOIN k1_slalom_scores ON nsr_entrants.id = k1_slalom_scores.entrant_id WHERE k1_slalom_scores.entrant_id IS NULL Can anyony help me out and tell me what im doing wrong??
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.