Jump to content

Craig Hopson

Members
  • Posts

    212
  • Joined

  • Last visited

Posts posted by Craig Hopson

  1. hi guys been using this code

    <!DOCTYPE html><html><head>   <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>   <title>Google Maps - Moving point along a path</title>   <!--<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> -->   <script src="http://maps.google.com/maps?file=api&v=2&sensor=false&key=AIzaSyC9drFQnsmuob_bO9wFITHv-5K2pM-lgD0" type="text/javascript"></script></head><body onunload="GUnload()">   <div id="map_canvas" style="width: 1000px; height: 800px;"></div>   <script type="text/javascript">   Number.prototype.toRad = function() {          return this * Math.PI / 180;   }   Number.prototype.toDeg = function() {          return this * 180 / Math.PI;   }   GLatLng.prototype.moveTowards = function(point, distance) {             var lat1 = this.lat().toRad();          var lon1 = this.lng().toRad();          var lat2 = point.lat().toRad();          var lon2 = point.lng().toRad();                      var dLon = (point.lng() - this.lng()).toRad();          // Find the bearing from this point to the next.          var brng = Math.atan2(Math.sin(dLon) * Math.cos(lat2),                                                    Math.cos(lat1) * Math.sin(lat2) -                                                    Math.sin(lat1) * Math.cos(lat2) *                                                    Math.cos(dLon));          var angDist = distance / 6371000;  // Earth's radius.          // Calculate the destination point, given the source and bearing.          lat2 = Math.asin(Math.sin(lat1) * Math.cos(angDist) +                                           Math.cos(lat1) * Math.sin(angDist) *                                           Math.cos(brng));          lon2 = lon1 + Math.atan2(Math.sin(brng) * Math.sin(angDist) *                                                           Math.cos(lat1),                                                           Math.cos(angDist) - Math.sin(lat1) *                                                           Math.sin(lat2));          if (isNaN(lat2) || isNaN(lon2)) return null;          return new GLatLng(lat2.toDeg(), lon2.toDeg());   }   function moveAlongPath(points, distance, index) {                  index = index || 0;  // Set index to 0 by default.          if (index < points.length) {                 // There is still at least one point further from this point.                 // Construct a GPolyline to use the getLength() method.                 var polyline = new GPolyline([points[index], points[index + 1]]);                 // Get the distance from this point to the next point in the polyline.                 var distanceToNextPoint = polyline.getLength();                 if (distance <= distanceToNextPoint) {                    // distanceToNextPoint is within this point and the next.                    // Return the destination point with moveTowards().                    return points[index].moveTowards(points[index + 1], distance);                 }                 else {                    // The destination is further from the next point. Subtract                    // distanceToNextPoint from distance and continue recursively.                    return moveAlongPath(points,                                                                 distance - distanceToNextPoint,                                                                 index + 1);                 }          }          else {                 // There are no further points. The distance exceeds the length                   // of the full path. Return null.                 return null;          }     }   var map = new GMap2(document.getElementById('map_canvas'));   var points = [         <? $result = mysql_query("SELECT * FROM location ORDER BY id DESC LIMIT 50");while($row = mysql_fetch_array($result)){echo 'new GLatLng('.$row['latitude'].', '.$row['longitude'].'),';    }?>   ];   var polyline = new GPolyline(points, '#f00', 6);    var nextMarkerAt = 0;         // Counter for the marker checkpoints.   var nextPoint = null;         // The point where to place the next marker.   map.setCenter(new GLatLng(51.5589503 ,0.1462796), 12);   // Draw the path on the map.   map.addOverlay(polyline);   // Draw the checkpoint markers every 1000 meters.   while (true) {          // Call moveAlongPath which will return the GLatLng with the next          // marker on the path.          nextPoint = moveAlongPath(points, nextMarkerAt);          if (nextPoint) {                 // Draw the marker on the map.                                 map.addOverlay(new GMarker(nextPoint));                     // Add +1000 meters for the next checkpoint.                 nextMarkerAt += 10000;              }          else {                 // moveAlongPath returned null, so there are no more check points.                 break;          }                    }   </script></body></html>

    to display a map with a route on it i need to change a few things1......Only have markers where there are GEO locations()2......I want to be able to click the markers or hover and get more information like time (stored in database with $row['latitude'] and $row['longitude'])

  2. hi can some one explain to me what is going on with this code please index.php

    <!DOCTYPE html><script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js" type="text/javascript"></script><script>var data = 'something-here';$.ajax({    type: 'POST',    url: 'post.php',    data: data});</script>

    post.php

    <?phpob_start();var_dump($_POST);$data = ob_get_clean();$fp = fopen("textfile.txt", "w");fwrite($fp, $data);fclose($fp);?>

    textfile.txt

    array(0) {}

    why is the $_POST variable empty? and how would i post 2 variables like $_POST['firstname'] and $_POST['lastname']

  3. ok i got it working using SESSION just fine but it twitches i think its the javascript when there is no update it starts to move then stops "twitching"lol

    <script type="text/javascript">$(function() {	 setInterval(function() {	    $("<div/>").hide().load("inc/feedx.php", function() {	    $(this).prependTo("#foo").slideDown("slow");	    });	 }, 5000);});</script>

  4. ok there is probably a simple way to do this but i cant find it...I would like to auto update from mysql but only new entrys here is what i have index.php

    <script type="text/javascript" src="js/jquery-1.7.2.min.js"></script><script type="text/javascript">$(function() {	 setInterval(function() {	    $("<div/>").hide().load("inc/feedx.php", function() {	    $(this).prependTo("#foo").slideDown("slow");	    });	 }, 5000);});</script><div id="foo"></div>$result = mysql_query("SELECT e.*,f.* FROM emails as e left join files as f on f.email_id=e.id WHERE e.subject='1' ORDER BY e.date DESC LIMIT 20");while($row = mysql_fetch_array($result)){//somestuff}

    feedx.php

    $result = mysql_query("SELECT e.*,f.* FROM emails as e left join files as f on f.email_id=e.id WHERE e.subject='1' ORDER BY e.date DESC LIMIT 1");while($row = mysql_fetch_array($result)){//somestuff}

    the code above works BUT it keeps adding the last SQL entry and "not just new ones"

  5. i still have had no luck with this... That said windows 8 has not been easy for me a would avoid it for a while till drivers are available I don't think there is a problem with the script i think it maybe windows..

  6. ok let me give some more information on what i am doing this is the instructions i'm following

    delete user bugfirst: if you have deleted an user A and another user (or the same user) signs up again with the same username, got to phpMyAdmin --> sql tab and enter
    SELECT `id`,`uri` FROM `jcow_pages` where `type` = 'u' order by `uri`

    by default the listing is limited to the first 30 rows, but you need all the rows.if you have the same uri more than one time, remove the ones with the lowest id.

    ok this would be ok if i didnt have 1000+ entrys so i need the query to show only the lowest id's but not the highest id so i can just delete all this is only a one time problem as i have fixed the bug in the oridgal script Thanks
  7. ok thanks i now have this code

    SELECT a.id, a.uri, a.typeFROM jcow_pages aINNER JOIN jcow_pages b ON a.uri = b.uriAND a.id < b.idWHERE a.type = 'u'LIMIT 0 , 300

    but this is giving me the duplicatse of good entrys any idea why?

  8. ok i worked out that this

    select `id`,`uri` ,count(*) from `jcow_pages` where `type` = 'u' group by `uri` having count(*) > 1

    but this only shows what ones are duplicated and how many times not all the id's of each duplicate

  9. hi guys i have this query

    SELECT `id`,`uri` FROM `jcow_pages` where `type` = 'u' order by `uri`

    the problem is it returns 5000+ entrys, I'm looking only for entrys that have the same url (duplicates) but i dont know what the url would be i only want to display url duplicates and i want to be able to do it in phpmyadmin SQL tab Thanks

  10. Hi guys I have been playing with the new windows 8 metro system and tiles i created this test file but cant get it to work as anyone had any dealings with this

    <?phpif($_GET['id'] == ''){?><!DOCTYPE html><html><head>    <meta charset="utf-8" />    <META name="msapplication-badge" content="frequency=30; polling-uri=http://chsites.co.uk/test.php?id=1"/>    <title>Test Site</title></head><body>    <h1>TwitterRooms</h1>    <p>Some content here</p></body></html><?php}else{header("Content-type: text/xml");$xml_output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";$xml_output .= "<badge value="newMessage"/>\n";echo $xml_output;?><?php}

×
×
  • Create New...