Search Results

Search found 70 results on 3 pages for 'gevent'.

Page 2/3 | < Previous Page | 1 2 3  | Next Page >

  • Google maps API - info window height and panning

    - by Tim Fountain
    I'm using the Google maps API (v2) to display a country overlay over a world map. The data comes from a KML file, which contains coords for the polygons along with a HTML description for each country. This description is displayed in the 'info window' speech bubble when that country is clicked on. I had some trouble initially as the info windows were not expanding to the size of the HTML content they contained, so the longer ones would spill over the edges (this seems to be a common problem). I was able to work around this by resetting the info window to a specific height as follows: GEvent.addListener(map, "infowindowopen", function(iw) { iw = map.getInfoWindow(); iw.reset(iw.getPoint(), iw.getTabs(), new GSize(300, 295), null, null); }); Not ideal, but it works. However now, when the info windows are opened the top part of them is sometimes obscured by the edges of the map, as the map does not pan to a position where all of the content can be viewed. So my questions: Is there any way to get the info windows to automatically use a height appropriate to their content, to avoid having to fix to a set pixel height? If fixing the height is the only option, is there any way to get the map to pan to a more appropriate position when the info windows open? I know that the map class has a panTo() method, but I can't see a way to calculate what the correct coords would be. Here's my full init code: google.load("maps", "2.x"); // Call this function when the page has been loaded function initialize() { var map = new google.maps.Map2(document.getElementById("map"), {backgroundColor:'#99b3cc'}); map.addControl(new GSmallZoomControl()); map.setCenter(new google.maps.LatLng(29.01377076013671, -2.7866649627685547), 2); gae_countries = new GGeoXml("http://example.com/countries.kmz"); map.addOverlay(gae_countries); GEvent.addListener(map, "infowindowopen", function(iw) { iw = map.getInfoWindow(); iw.reset(iw.getPoint(), iw.getTabs(), new GSize(300, 295), null, null); }); } google.setOnLoadCallback(initialize);

    Read the article

  • load multiple directions in parallel in google map

    - by Maneesh
    My aim is to get distance between many locations thru GDirection object. Since I am using multiple objects, am not able to get distnace. Can someone help me out. Below is the code. for(ct=0;ct<size;ct++) { var gd=new GDirections(); gd.load("from: " + address + " to: " + offaddress[ct]); GEvent.addListener(directions,"load", function() { sor[ct]= gd.getDistance().html; }

    Read the article

  • threading.local equivalent for twisted.web?

    - by defnull
    In asynchronous environments, threading.local is not guaranteed to be context-local anymore, because several contexts may coexist within a single thread. Most asynchronous frameworks (gevent, eventlet) provide a get_current_context() functionality to identify the current context. Some offer a way to monkey-patch threading.local so it is local to 'greenthreads' or other framework-specific contexts. I cannot find such a functionality in the twisted documentation. How do I do this?

    Read the article

  • Google map "zoomend" event issue

    - by ebae
    On my html page, I have a google map with a few markers. I want all the markers to be cleared once the zoom is changed on the map with the following code. GEvent.addListener(map, "zoomend", function() { map.clearOverlays(); } But what happens is actually the markers are removed by the "clearOverlays()" function, but then they appear again. Any idea why? Where is it going after the event is handled?

    Read the article

  • call JavaScript function within Google Maps Listener

    - by Queueball
    Ok, simple question but is it possible to call an external javascript function within a google maps listener? GEvent.addListener(map,"click", function(overlay, latlng) { testfunction(latlng); }); testfunction doesn't run, so is there a particular way i need to go about this? I'm new to google maps and javascript.

    Read the article

  • Pure python implementation of greenlet API

    - by Tristan
    The greenlet package is used by gevent and eventlet for asynchronous IO. It is written as a C-extension and therefore doesn't work with Jython or IronPython. If performance is of no concern, what is the easiest approach to implementing the greenlet API in pure Python. A simple example: def test1(): print 12 gr2.switch() print 34 def test2(): print 56 gr1.switch() print 78 gr1 = greenlet(test1) gr2 = greenlet(test2) gr1.switch() Should print 12, 56, 34 (and not 78).

    Read the article

  • How can I make Google Maps icon to always appear in the center of map - when clicked?

    - by JHM_67
    For simplicity sake, lets use the XML example on Econym's site. http://econym.org.uk/gmap/example_map3.htm Once clicked, I would like icon balloon to be displayed in the middle of the map. What might I need to add to Mike's code to get this to work? I apologize for asking a lot.. Thanks in advance. <script type="text/javascript"> //<![CDATA[ if (GBrowserIsCompatible()) { side_bar var side_bar_html = ""; var gmarkers = []; function createMarker(point,name,html) { var marker = new GMarker(point); GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml(html); }); gmarkers.push(marker); side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length-1) + ')">' + name + '<\/a><br>'; return marker; } function myclick(i) { GEvent.trigger(gmarkers[i], "click"); } var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.setCenter(new GLatLng( 43.907787,-79.359741), 9); GDownloadUrl("example.xml", function(doc) { var xmlDoc = GXml.parse(doc); var markers = xmlDoc.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { // obtain the attribues of each marker var lat = parseFloat(markers[i].getAttribute("lat")); var lng = parseFloat(markers[i].getAttribute("lng")); var point = new GLatLng(lat,lng); var html = markers[i].getAttribute("html"); var label = markers[i].getAttribute("label"); var marker = createMarker(point,label,html); map.addOverlay(marker); } document.getElementById("side_bar").innerHTML = side_bar_html; }); } else { alert("Sorry, the Google Maps API is not compatible with this browser"); } //]]> </script>

    Read the article

  • Google Maps panTo AND setCenter

    - by Harry
    The default panTo only pans to the edge of the screen. I like setCenter but would like to pan to that point. Any ideas welcome map.setCenter(mymarker.getPoint()); GEvent.trigger(mymarker,"click"); //open the info window

    Read the article

  • Don't know why this small shell script wont work

    - by tominated
    Hi, I'm trying to make a small script to start up gunicorn for a python website I'm making. I have modified the script found at https://github.com/benoitc/gunicorn/blob/master/examples/gunicorn_rc slightly. Here's my version. #!/bin/sh GUNICORN=/usr/local/bin/gunicorn ROOT=/srv/mobile-site/app PID=/var/run/gunicorn.pid APP=mobilecms:app if [ -f $PID ]; then rm $PID fi cd $ROOT exec $GUNICORN -b 127.0.0.1:8080 -w 8 -k gevent --pidfile=$PID $APP When I try to run the script though, it shows this error /etc/init.d/gunicorn: 13: Syntax error: end of file unexpected (expecting "fi") Does anyone know what's wrong?

    Read the article

  • Google Maps: remember id of marker with open info window

    - by AP257
    I have a Google map that is showing a number of markers. When the user moves the map, the markers are redrawn for the new boundaries, using the code below: GEvent.addListener(map, "moveend", function() { var newBounds = map.getBounds(); for(var i = 0; i < places_json.places.length ; i++) { // if marker is within the new bounds then do... var latlng = new GLatLng(places_json.places[i].lat, places_json.places[i].lon); var html = "blah"; var marker = createMarker(latlng, html); map.addOverlay(marker); } }); My question is simple. If the user has clicked on a marker so that it is showing an open info window, currently when the boundaries are redrawn the info window is closed, because the marker is added again from scratch. How can I prevent this? It is not ideal, because often the boundaries are redrawn when the user clicks on a marker and the map moves to display the info window - so the info window appears and then disappears again :) I guess there are a couple of possible ways: remember which marker has an open info window, and open it again when the markers are redrawn don't actually re-add the marker with an open info window, just leave it there However, both require the marker with an open window to have some kind of ID number, and I don't know that this is actually the case in the Google Maps API. Anyone? ----------UPDATE------------------ I've tried doing it by loading the markers into an initial array, as suggested. This loads OK, but the page crashes after the map is dragged. <script type="text/javascript" src="{{ MEDIA_URL }}js/markerclusterer.js"></script> <script type='text/javascript'> function createMarker(point,html, hideMarker) { //alert('createMarker'); var icon = new GIcon(G_DEFAULT_ICON); icon.image = "http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png"; var tmpMarker = new GMarker(point, {icon: icon, hide: hideMarker}); GEvent.addListener(tmpMarker, "click", function() { tmpMarker.openInfoWindowHtml(html); }); return tmpMarker; } var map = new GMap2(document.getElementById("map_canvas")); map.addControl(new GSmallMapControl()); var mapLatLng = new GLatLng({{ place.lat }}, {{ place.lon }}); map.setCenter(mapLatLng, 12); map.addOverlay(new GMarker(mapLatLng)); // load initial markers from json array var markers = []; var initialBounds = map.getBounds(); for(var i = 0; i < places_json.places.length ; i++) { var latlng = new GLatLng(places_json.places[i].lat, places_json.places[i].lon); var html = "<strong><a href='/place/" + places_json.places[i].placesidx + "/" + places_json.places[i].area + "'>" + places_json.places[i].area + "</a></strong><br/>" + places_json.places[i].county; var hideMarker = true; if((initialBounds.getSouthWest().lat() < places_json.places[i].lat) && (places_json.places[i].lat < initialBounds.getNorthEast().lat()) && (initialBounds.getSouthWest().lng() < places_json.places[i].lon) && (places_json.places[i].lon < initialBounds.getNorthEast().lng()) && (places_json.places[i].placesidx != {{ place.placesidx }})) { hideMarker = false; } var marker = createMarker(latlng, html, hideMarker); markers.push(marker); } var markerCluster = new MarkerClusterer(map, markers, {maxZoom: 11}); </script>

    Read the article

  • Jquery, XML and Google Map

    - by EXPennD
    Hi, I'm integrating a Google Map in my website that user could add some thumbnails and details of their own house. Here's a code preview of what I want to happen. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> Jquery and Google Map // var locations = {}; function load() { var map = new GMap2(document.getElementById("map")); map.setCenter(new GLatLng(47.614495, -122.341861), 13); GDownloadUrl("markerdata.xml", function(data) { var xml = GXml.parse(data); var markers = xml.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { var name = markers[i].getAttribute("name"); var address = markers[i].getAttribute("address"); var type = markers[i].getAttribute("type"); var latlng = new GLatLng(parseFloat(markers[i].getAttribute("lat")), parseFloat(markers[i].getAttribute("lng"))); var store = {latlng: latlng, name: name, address: address, type: type}; var latlngHash = (latlng.lat().toFixed(6) + "" + latlng.lng().toFixed(6)); latlngHash = latlngHash.replace(".","").replace(".", "").replace("-",""); if (locations[latlngHash] == null) { locations[latlngHash] = [] } locations[latlngHash].push(store); } for (var latlngHash in locations) { var stores = locations[latlngHash]; if (stores.length > 1) { map.addOverlay(createClusteredMarker(stores)); } else { map.addOverlay(createMarker(stores)); } } }); } function createMarker(stores) { var store = stores[0]; var newIcon = MapIconMaker.createMarkerIcon({width: 32, height: 32, primaryColor: "#00ff00"}); var marker = new GMarker(store.latlng, {icon: newIcon}); var html = "<b>" + store.name + "</b> <br/>" + store.address; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } function createClusteredMarker(stores) { var newIcon = MapIconMaker.createMarkerIcon({width: 44, height: 44, primaryColor: "#00ff00"}); var marker = new GMarker(stores[0].latlng, {icon: newIcon}); var html = ""; for (var i = 0; i < stores.length; i++) { html += "<b>" + stores[i].name + "</b> <br/>" + stores[i].address + "<br/>"; } GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(html); }); return marker; } //]]> description I want this feature to be fully interactive. If possible user can drag and drop a marker to the location on the Google map and the description field would be enabled after adding the marker so user could add details and submit it. Also here's my current situation. The reason why I want it to be done in XML is the Content Management System that I currently use for this project don't allow me to add Database and Php scripts. The only thing that I have access is I could add new HTML on the BODY section and also External Javascript on the HEAD section. Sorry about the way I write it, it sounds like demanding. Its because I'm still learning Jquery. Thanks everyone!

    Read the article

  • google map V-3 simple problem with latlng

    - by amar
    hi, i was using v2 of google maps. Now i shifted to v3. In version 2, this WAS working GEvent.addListener(map, "click", function(overlay, latlng) { myLatitude = latlng.lat(); myLongitude = latlng.lng(); alert(myLatitude + ' data ' + myLongitude); }); what should be the equvalant of this code in v3 ?? i searched a lot, but couldn't find any good result.. I have tried this.. google.maps.event.addListener(map, 'click', function(overlay , latlng) { myLatitude = latlng.lat(); //myLongitude = latlng.lng(); alert('hi! ' + myLatitude); }); but no results.. thanks

    Read the article

  • How to add labels on Google Maps Pinpoints?

    - by Jason
    Creating a google map with store locations within 50 miles of user entered address. Have map & pinpoints showing correctly but all of the pinpoints just have a dot on them. I'd like to be able to label them A, B, C, D, etc so that I can list out locations & addresses in sidebar. How would I do this? Here's the code I'm using to add my pinpoints. var point = new GLatLng(latitude, longitude); var marker = new GMarker(point); GEvent.addListener(marker, "click", function () { map.openInfoWindowHtml(point, myHtml); }); map.addOverlay(marker);

    Read the article

  • Inserting a rails link into a Google Maps infowindow

    - by Sonia
    Hi, I would like to insert a link into the Google Maps InfoWindow to show more information about the point the user has clicked on in my rails app. My current code: $.getJSON("/places", function(json) { if (json.length > 0) { for (i=0; i<json.length; i++) { var place = json[i]; addLocation(place); } } }); function addLocation(place) { var point = new GLatLng(place.lat, place.lng); var marker = new GMarker(point); map.addOverlay(marker); GEvent.addListener(marker, "click", function() { var info = place.name + "<br>[link]"; map.openInfoWindowHtml(point, info); }); } I would like the link to take the user to the page for that marker (ie. /places/id), but am unsure of how to go about this...any help would be much appreciated!

    Read the article

  • Super Noob C++ variable help

    - by julian
    Ok, I must preface this by stating that I know so so little about c++ and am hoping someone can just help me out... I have the below code: string GoogleMapControl::CreatePolyLine(RideItem *ride) { std::vector<RideFilePoint> intervalPoints; ostringstream oss; int cp; int intervalTime = 30; // 30 seconds int zone =ride->zoneRange(); if(zone >= 0) { cp = 300; // default cp to 300 watts } else { cp = ride->zones->getCP(zone); } foreach(RideFilePoint* rfp, ride->ride()->dataPoints()) { intervalPoints.push_back(*rfp); if((intervalPoints.back().secs - intervalPoints.front().secs) > intervalTime) { // find the avg power and color code it and create a polyline... AvgPower avgPower = for_each(intervalPoints.begin(), intervalPoints.end(), AvgPower()); // find the color QColor color = GetColor(cp,avgPower); // create the polyline CreateSubPolyLine(intervalPoints,oss,color); intervalPoints.clear(); intervalPoints.push_back(*rfp); } } return oss.str(); } void GoogleMapControl::CreateSubPolyLine(const std::vector<RideFilePoint> &points, std::ostringstream &oss, QColor color) { oss.precision(6); QString colorstr = color.name(); oss.setf(ios::fixed,ios::floatfield); oss << "var polyline = new GPolyline(["; BOOST_FOREACH(RideFilePoint rfp, points) { if (ceil(rfp.lat) != 180 && ceil(rfp.lon) != 180) { oss << "new GLatLng(" << rfp.lat << "," << rfp.lon << ")," << endl; } } oss << "],\"" << colorstr.toStdString() << "\",4);"; oss << "GEvent.addListener(polyline, 'mouseover', function() {" << endl << "var tooltip_text = 'Avg watts:" << avgPower <<" <br> Avg Speed: <br> Color: "<< colorstr.toStdString() <<"';" << endl << "var ss={'weight':8};" << endl << "this.setStrokeStyle(ss);" << endl << "this.overlay = new MapTooltip(this,tooltip_text);" << endl << "map.addOverlay(this.overlay);" << endl << "});" << endl << "GEvent.addListener(polyline, 'mouseout', function() {" << endl << "map.removeOverlay(this.overlay);" << endl << "var ss={'weight':5};" << endl << "this.setStrokeStyle(ss);" << endl << "});" << endl; oss << "map.addOverlay (polyline);" << endl; } And I'm trying to get the avgPower from this part: AvgPower avgPower = for_each(intervalPoints.begin(), intervalPoints.end(), AvgPower()); the first part to cary over to the second part: << "var tooltip_text = 'Avg watts:" << avgPower <<" <br> Avg Speed: <br> Color: "<< colorstr.toStdString() <<"';" << endl But of course I haven't the slightest clue how to do it... anyone feeling generous today? Thanks in advance

    Read the article

  • Passing GLatLng from array to Google

    - by E. Rose
    Hello All, To preface this, I am a complete programming amateur so this may be quite easily solved. As is though, it is frustrating me to no end. Basically, I have a database of Venue Names with GLat and GLng (other stuff too) that I am pulling down to my website based on a geolocated search. The javascript that I have pulls in a formatted subset of the database, dumps the glat and glng into an array and is supposed to take those points and plot out several markers each with an info window containing the details behind each marker. For some reason, the marker geodata is not being populated and/or is not being passed. The array is declared using [] and will not work when normally declared using (). It only brings up a map with the first value in the array and goes blank if i try to manually input later entries. There is a large block of commented out code relating to directions generation. That code worked for some reason. If anyone can tell me what I am doing wrong in rewriting it to map the markers and not give directions, please tell me. Any help would be much appreciated. var letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; google.load("maps", "2", {"other_params":"sensor=true"}); var map function initialize(){ window.map = new google.maps.Map2(document.getElementById("map")); map.addControl(new GLargeMapControl()); } google.setOnLoadCallback(initialize); function getVenueResults(_zip, _num, _remove){ var rFlag = ''; if(_remove != null){ rFlag = "&removeId=" + _remove; } var url = 'ajax/getVenues.php?zip=' + _zip + "&num=" + _num + rFlag; new Ajax.Updater('resultsContainer', url, { onComplete: processResults }); } function processResults(){ window.map.clearOverlays(); var waypoints = []; var resultsList = $$('.resultWrapper'); var stepList = $$('.resultDirections'); for(i=0; i for(i=0; i<resultsList.length; i++){ var resultsElem = resultsList[i]; resultsElem.removeClassName('firstResult'); resultsElem.removeClassName('lastResult'); if(i == 0){ resultsElem.addClassName('firstResult'); } if(i == resultsList.length - 1){ resultsElem.addClassName('lastResult'); } var insertContent = '<div class="resultDirections" id="resultDirections' + i + '"></div>'; Element.insert(resultsElem, { bottom : insertContent }) var num = resultsElem.getElementsByClassName('numHolder'); num[0].innerHTML = '<b>' + letters[i] + ".</b> "; var geolat = resultsElem.getElementsByClassName('geolat')[0].value; var geolong = resultsElem.getElementsByClassName('geolong')[0].value; var point = new GLatLng(geolat, geolong); waypoints[i] = point; } if(waypoints.length == 1){ map.setCenter(waypoints[0], 16); map.addOverlay(new GMarker(waypoints[0])); resultsElem.getElementsByClassName('numHolder')[0].innerHTML = ''; }else{ map.setCenter(waypoints[0], 16); for(j=0; j< waypoints.length; j++) { var vLoc = waypoints[j]; var vInfo = resultsElem.getElementByClassName('resultBox[j]]').innerHTML; //unfinished function to mine name out of div and make it the marker title //x = resultsElem.getElementsByTagName("b"); // for (i=0;i<x.length;i++) // //marker.value = resultsElem.getElementBy('numHolder').innerHTML var marker = createMarker(vLoc, vInfo); map.addOverlay(marker); } } function createMarker(vLoc, vInfo) { var marker = (new GMarker(vLoc)); var cont = vInfo; GEvent.addListener(marker, 'click', function() { marker.openInfoWindowHtml(cont); }); return marker; } //var directions = new GDirections(window.map, document.getElementById('directionsPanel')); //directions.loadFromWaypoints(waypoints, { travelMode: G_TRAVEL_MODE_WALKING }); //GEvent.addListener(directions, "load" , function() { // var numRoutes = directions.getNumRoutes(); // for(j=0; j< numRoutes; j++){ // var thisRoute = directions.getRoute(j); // var routeText = ''; // for(k=0; k < thisRoute.getNumSteps(); k++){ // var thisStep = thisRoute.getStep(k); // if(k != 0){ routeText += " &nbsp;||&nbsp; "; } // routeText += thisStep.getDescriptionHtml(); // } // $('resultDirections' + j).innerHTML = routeText; // } // $('resultDirections' + numRoutes).hide(); //}); } function moveUp(_obj){ var parentObj = $(_obj).up().up(); var prevSib = parentObj.previous(); prevSib.insert({before: parentObj}); processResults(); } function moveDown(_obj){ var parentObj = $(_obj).up().up(); var nextSib = parentObj.next(); nextSib.insert({after: parentObj}); processResults(); }

    Read the article

  • google maps clicking inside a polygon

    - by amarsh-anand
    The following javascript snippet is supposed to do the following: As the user clicks on the map, initialize headMarker and draw a circle (polygon) around it As the user clicks inside the circle, initialize tailMarker and draw the path between these two markers 1 is happening as expected. But as the user clicks inside the circle, overlay is non-null while point is null in the function(overlay,point) . Can someone tell me a way out. GEvent.addListener(map, "click", function(overlay,point) { if (isCreateHeadPoint) { // add the head marker headMarker = new GMarker(point,{icon:redIcon,title:'0'}); map.addOverlay(headMarker); isCreateHeadPoint = false; // draw the circle drawMapCircle(point.lat(),point.lng(),1,'#cc0000',2,0.8,'#0',0.1); } else { // add the tail marker tailMarker = new GMarker(point,{icon:greenIcon,title:''}); map.addOverlay(tailMarker); isCreateHeadPoint = true; // load thes path from head to tail direction.load("from:" + headMarker.getPoint().lat()+ ", " + headMarker.getPoint().lng()+ " to:" + tailMarker.getPoint().lat() + "," + tailMarker.getPoint().lng(), {getPolyline:true}); } });

    Read the article

  • Google Maps Api v2 error

    - by Harry
      var mymarkers= []; //array function createMarker(point,html,ref){ var marker = new GMarker(point); mymarkers[ref] = marker; GEvent.addListener(newmarker,'click',function(){newmarker.openInfoWindowHtml(html);}); map.addOverlay(newmarker); } This function works well, it adds a marker to the map no problem, but when trying to use mymarkers[] array of markers they have not been stored? Is there a validator to check the GMarker is nice and clean? google maps main.js throws a wobbly: Uncaught TypeError: Cannot read property '__e_' of undefined

    Read the article

  • google maps plot route between two points

    - by amarsh-anand
    I have written this innocent javascript code, which lets the user create two markers and plot the route between them. It doesnt work, instead, it gives a weird error: Uncaught TypeError: Cannot read property 'ya' of undefined Can someone suggest me whats wrong here: // called upon a click GEvent.addListener(map, "click", function(overlay,point) { if (isCreateHeadPoint) { // add the head marker headMarker = new GMarker(point,{icon:redIcon,title:'Head'}); map.addOverlay(headMarker); isCreateHeadPoint = false; } else { // add the tail marker tailMarker = new GMarker(point,{icon:greenIcon,title:'Tail'}); map.addOverlay(tailMarker); isCreateHeadPoint = true; // create a path from head to tail direction.load("from:" + headMarker.getPoint().lat()+ ", " + headMarker.getPoint().lng()+ " to:" + tailMarker.getPoint().lat() + "," + tailMarker.getPoint().lng(), { getPolyline: true, getSteps: true }); // display the path map.addOverlay(direction.getPolyline()); } });

    Read the article

  • How do I detect a click event on a google maps PolyLine overlay?

    - by Tom
    It seems to me that I should be able to do the following to detect a click event on a line on a google map: var line = new GPolyline( ... ); map.addOverlay(line); GEvent.addListener(line, "click", function(latlng){ alert("clicked"); }); The api reference says this is available in version 2.88, which was released in 2007(!?), so I'm assuming that's what I'm using, but I don't know how to confirm that. I also tried setting the {clickable:true} option explicitly (it's supposed to be the default.) I've tested in FireFox 3 and Opera 9.6 so doubt it's browser specific. I'm also using jQuery on the page. I have plenty of code detecting clicks on markers that works fine, clicking on lines would be really nice, can anyone enlighten me?

    Read the article

  • Accessing loop iteration in a sub-function?

    - by DisgruntledGoat
    I'm using the Google Maps API to plot several points on a map. However, in the click event function below, i is always set to 4, i.e. its value after iterating the loop: // note these are actual addresses in the real page var addresses = new Array( "addr 1", "addr 2", "addr 3", "addr 4" ); for (var i = 0; i < addresses.length; i++) { geocoder.getLatLng(addresses[i], function(point) { if (point) { var marker = new GMarker(point); map.addOverlay(marker); map.setCenter(point, 13); GEvent.addListener(marker, "click", function() { // here, i=4 marker.openInfoWindowHtml("Address: <b>" + addresses[i] + "</b>"); }); } }); } So when the marker displays it's using addresses[4] which is undefined. How do I pass the correct value of i to the function?

    Read the article

  • Why won't my service start, and why doesn't upstart output any errors?

    - by Alex Waters
    I am trying to 'start gunicorn' as a service via upstart as user ale. I'm using gunicorn/flask on ubuntu 12.04 w/ init (upstart 1.5) Here is my /etc/init/gunicorn.conf setuid btw setgid flask script export HOME=/home/btw export WORKON_HOME=$HOME/.virtualenvs . $HOME/.virtualenvs/default/bin/activate cd $HOME/flask workon default gunicorn -c gunicorn.py bw:app end script It doesn't output anything other than gunicorn start/running, process 12992. If i then do 'status gunicorn' I get stop/waiting. any ideas on how to debug this? I tried following http://upstart.ubuntu.com/wiki/Debugging but it didn't help. If I do the following as user ale in the app's directory: 1. workon default 2. gunicorn -c gunicorn.py bw:app then Gunicorn runs fine. Here is ~/flask/gunicorn.py: bind = "0.0.0.0:8080" workers = 3 backlog = 2048 worker_class = "gevent" debug = True daemon = False pidfile ="/tmp/gunicorn.pid" log_level = "debug" accesslog = "/var/log/gunicorn/access.log" errorlog = "/var/log/gunicorn/error.log" user = "btw" group = "flask" Also, /var/log/error.log doesn't show anything new when I try to start the Gunicorn service. If I start it manually, it shows that the workers have been loaded, etc. Thanks for any help / suggestions!

    Read the article

  • Nginx and Gunicorn hanging on GET requests

    - by whatWhat
    I'm using Nginx + Gunicorn which is serving my Django project. All GET requests hang for ~1 min. The content seems to be available immediately as I can see it in the Browser inspector but the browser itself looks like it's still waiting for more data. Heres my Ngnix config #allow for up to 3 connections per second. limit_req_zone $binary_remote_addr zone=one:10m rate=3r/s; server { listen 80; server_name example.com; root /var/www/example.com/example/; # serve directly - analogous for static/staticfiles location /media/ { # this changes depending on your python version root /home/example/; } location /static/ { # if asset versioning is used if ($query_string) { expires max; } root /var/www/example.com; } location / { #Allow for a burst of 50. limit_req zone=one burst=50 nodelay; proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 10; proxy_read_timeout 10; proxy_pass http://localhost:8001/; } # what to serve if upstream is not available or crashes error_page 500 502 503 504 /media/50x.html; } My Gunicorn Config: bind = "127.0.0.1:8001" workers = 3 worker_class = "gevent" Is there anything obvious that would be causing the requests to stay open for so long?

    Read the article

< Previous Page | 1 2 3  | Next Page >