Jump to content

Craig Hopson

Members
  • Posts

    212
  • Joined

  • Last visited

Everything 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. that's the problem i don't understand javascript AT ALL i dont know why i read the tutorial like 3 times
  5. i understand that how do i get javascript to receive the timestame
  6. the timestamp is there but how do i do that (Javascript) i can figure out the php
  7. 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"
  8. 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..
  9. Still not updating the tile... Does anyone else use windows 8? could you try it on yours? i think it might me my computer
  10. thanks for that i will try it right now and post back with results
  11. ok let me give some more information on what i am doing this is the instructions i'm following 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
  12. 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?
  13. 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
  14. i dont know if this is correct or not but it does work i found <input type=button onClick="location.href='afile.php'" value='SOMETHING'>
  15. 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
  16. I have the meta tags in the script
  17. Maybe I don't know that's why I posted here for help!!!
  18. Feel free to try the script at http://chsites.co.uk/test.php I haven't done any debugging cos I don't see any errors in my script (above) and I there are no errors in my script then it must be a windows problem?????
  19. That may be the problem then can you repost the script and ill up date it on my server http://chsites.co.uk/test.php
  20. https://www.google.co.uk/search?q=windows+8+badge+notifications&ie=UTF-8&oe=UTF-8&hl=en-gb&client=safari#sclient=tablet-gws&hl=en&client=safari&tbo=d&q=windows+8+html+badge+notifications&oq=windows+8+html+badge+notifications&gs_l=tablet-gws.3..35i39j0i22.10501.12309.0.13108.5.5.0.0.0.1.420.1236.0j3j0j1j1.5.0.les%3B..0.0...1ac.1.rPYfJaOPReM&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.&fp=e0bfb33bf2a89ab&bpcl=37189454&biw=1024&bih=644THE TOP HIT
  21. This is what I was following http://msdn.microsoft.com/en-gb/library/ie/hh880842(v=vs.85).aspx basically if you put meta tages on your site with a polling URL then windows will check your site for updates every 30min looking for XML output I just wanted to test it to see if it would work so I wrote the script above to test it but it didn't work so I post here
  22. I can't get it to update on the tile but saying that I tried the Microsoft demo tile and that don't work either so maybe it windows problem
  23. the problem my be you have closed the form tag before the form has ended <form method="post" action="http://www.mysite.com/sendquote.php"></form>
  24. 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...