Search Results

Search found 16637 results on 666 pages for 'lat long'.

Page 38/666 | < Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >

  • how do I filter RoutingErrors and their long stack trace out of my log? rails

    - by codeman73
    I am seeing several strange requests like this, with urls like /sitemap/, /google_sitemap.xml.gz, /sitemap.xml.gz, /google_sitemap.xml, /cgi-bin/awstat/awstats.pl, etc. The default rails behavior dumps these long stack traces into my log, like the following: ActionController::RoutingError (No route matches "/rails/info/properties" with {:method=>:get}): /dh/passenger/lib/phusion_passenger/rack/request_handler.rb:92:in `process_request' /dh/passenger/lib/phusion_passenger/abstract_request_handler.rb:207:in `main_loop' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:400:in `start_request_handler' /dh/passenger/lib/phusion_passenger/railz/application_spawner.rb:351:in `handle_spawn_application' /dh/passenger/lib/phusion_passenger/utils.rb:184:in `safe_fork' etc. Is there any way to stop these long stack traces? I wouldn't mind the first line, the ActionController::RoutingError with the message and the url, but I'd like to get rid of the long stack of passenger stuff.

    Read the article

  • Why does casting a NaN to a long yeild a valid result?

    - by brainimus
    In the sample code below I am dividing by zero which when I step through it with the debugger the (dividend / divisor) yeilds an Infinity or NaN (if the divisor is zero). When I cast this result to a long I get a valid result, usually something like -9223372036854775808. Why is this cast valid? Why doesn't it stop executing (throw an exception for example) rather than assign an arbitrary value? double divisor = 0; double dividend = 7; long result = (long)(dividend / divisor);

    Read the article

  • Why does casting a NaN to a long yield a valid result?

    - by brainimus
    In the sample code below I am dividing by zero which when I step through it with the debugger the (dividend / divisor) yields an Infinity or NaN (if the divisor is zero). When I cast this result to a long I get a valid result, usually something like -9223372036854775808. Why is this cast valid? Why doesn't it stop executing (throw an exception for example) rather than assign an arbitrary value? double divisor = 0; double dividend = 7; long result = (long)(dividend / divisor);

    Read the article

  • How long people take to learn a new programming language?

    - by Cawas
    In general aspects, this might be a good reference for everyone. Having an idea of how long people take in average for properly learning how to code can give a very good idea on how dense or long is the path. Someone who never programmed should take weeks or months, even years maybe while someone who's already experienced in the area and know at least 2 different languages might take days, hours or even minutes to start coding. But other than being able to write code that runs, there are ways to write the same program, and it's much harder to get deep knowledge on that than actually being able to program. And sometimes languages differ a lot from one to another on that aspect as well. For instance, we should never have to worry with code-injection in JavaScript like we do in C. So, is there any place we can see some good numbers for how long it takes to learn a language, maybe divided into level of knowledge categories, languages and paradigms, etc?

    Read the article

  • What is a long-term strategy to deal with CPU fan dust in my home office?

    - by PaulG
    There are numerous discussions of CPU overheating and how sometimes this can be corrected by removing the dust from the CPU fan. I have read many of these, but I can't find anyone expressing a long-term strategy to deal with this problem. There are some suggestions here, for example, about how often the inside of the computer should be dusted. But I find this generally unsatisfactory. As it stands, in my rather dusty house (heated by a wood stove, with no central air circulation), I need to vacuum out the CPU fan every 3 to 4 months. At high CPU load, this can make a difference between 65C and 100C. I'm tired of hauling out the vacuum every time I anticipate high CPU load. What steps can I take to deal with this systematically in the long-term? Moving my high CPU load computing to the cloud is not a realistic option. Neither is vacuuming my home office more than once a week! (Details: my computer is on the floor in a Cooler Master HAF922 case, and uses an Intel CPU fan on an i7 chip) EDIT: While this would definitely solve the problem (submerging motherboard in mineral oil), it is a bit of an expensive solution.

    Read the article

  • Android Location Error

    - by Christopher
    I've singled out my problem to a few lines of code lm = (LocationManager)getSystemService(Context.LOCATION_SERVICE); Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 5.0f, this); lat = location.getLatitude(); lng = location.getLongitude(); //lat = new Double(40.431682); //lng = new Double(-74.2021819); pLocation = new GeoPoint((int)(lat * 1000000), (int)(lng * 1000000)); My onLocationChanged if you were wondering public void onLocationChanged(Location location) { if (location != null) { lat = location.getLatitude(); lng = location.getLongitude(); pLocation = new GeoPoint((int)(lat * 1000000), (int)(lng * 1000000)); } } My application crashes if I try to get the LastKnownLocation But it works fine if I feed it a Location manually I have no idea currently whats wrong

    Read the article

  • Elapsed time of running a C program

    - by yCalleecharan
    Hi, I would like to know what lines of C code to add to a program so that it tells me the total time that the program takes to run. I guess there should be counter initialization near the beginning of main and one after the main function ends. Is the right header clock.h? Thanks a lot... Update I have a Win Xp machine. Is it just adding clock() at the beginning and another clock() at the end of the program? Then I can estimate the time difference. Yes, you're right it's time.h. Here's my code: #include <stdio.h> #include <stdlib.h> #include <math.h> #include <share.h> #include <time.h> void f(long double fb[], long double fA, long double fB); int main() { clock_t start, end; start = clock(); const int ARRAY_SIZE = 11; long double* z = (long double*) malloc(sizeof (long double) * ARRAY_SIZE); int i; long double A, B; if (z == NULL) { printf("Out of memory\n"); exit(-1); } A = 0.5; B = 2; for (i = 0; i < ARRAY_SIZE; i++) { z[i] = 0; } z[1] = 5; f(z, A, B); for (i = 0; i < ARRAY_SIZE; i++) printf("z is %.16Le\n", z[i]); free(z); z = NULL; end = clock(); printf("Took %ld ticks\n", end-start); printf("Took %f seconds\n", (double)(end-start)/CLOCKS_PER_SEC); return 0; } void f(long double fb[], long double fA, long double fB) { fb[0] = fb[1]* fA; fb[1] = fb[1] - 1; return; } Some errors with MVS2008: testim.c(16) : error C2143: syntax error : missing ';' before 'const' testim.c(18) :error C2143: syntax error : missing ';' before 'type' testim.c(20) :error C2143: syntax error : missing ';' before 'type' testim.c(21) :error C2143: syntax error : missing ';' before 'type' testim.c(23) :error C2065: 'z' : undeclared identifier testim.c(23) :warning C4047: '==' : 'int' differs in levels of indirection from 'void *' testim.c(28) : error C2065: 'A' : undeclared identifier testim.c(28) : warning C4244: '=' : conversion from 'double' to 'int', possible loss of data and it goes to 28 errors. Note that I don't have any errors/warnings without your clock codes. LATEST NEWS: I unfortunately didn't get a good reply here. But after a search on Google, the code is working. Here it is: #include <stdio.h> #include <stdlib.h> #include <math.h> #include <share.h> #include <time.h> void f(long double fb[], long double fA, long double fB); int main() { clock_t start = clock(); const int ARRAY_SIZE = 11; long double* z = (long double*) malloc(sizeof (long double) * ARRAY_SIZE); int i; long double A, B; if (z == NULL) { printf("Out of memory\n"); exit(-1); } A = 0.5; B = 2; for (i = 0; i < ARRAY_SIZE; i++) { z[i] = 0; } z[1] = 5; f(z, A, B); for (i = 0; i < ARRAY_SIZE; i++) printf("z is %.16Le\n", z[i]); free(z); z = NULL; printf("Took %f seconds\n", ((double)clock()-start)/CLOCKS_PER_SEC); return 0; } void f(long double fb[], long double fA, long double fB) { fb[0] = fb[1]* fA; fb[1] = fb[1] - 1; return; } Cheers

    Read the article

  • What is an efficient way to erase substrings?

    - by Legend
    I have a long string and a set of <end-index, string> list like the following: long_sentence = "This is a long long long long sentence" indices = [[6, "is"], [8, "is a"], [18, "long"], [23, "long"]] An element 6, "is" indicates that 6 is the end index of the word "is" in the string. I want to get the following string in the end: >> print long_sentence This .... long ......... long sentence" I tried an approach like this: temp = long_sentence for i in indices: temp = temp[:int(i[0]) - len(i[1])] + '.'*(len(i[1])+1) + temp[i[0]+1:] While this seems to be working, it is taking exceptionally long time (more than 6 hours on 5000 strings inside a 300 MB file). Is there a way to speed this up?

    Read the article

  • Variable scope in javascript

    - by Rich Bradshaw
    This is a simple question, but I can't work it out. The specifics aren't important, but here's the gist. I have some code like this: var lat = 0; var lon = 0; if (navigator.geolocation) { navigator.geolocation.getCurrentPosition(function(position) { lat = position.coords.latitude; lon = position.coords.longitude; }); } What I think it's doing is: Set lat and lon to 0 If the browser has geolocation, overwrite those variables with real values However, at the end of that chunk, lat and lon are still 0. I've tried adding vars, passing lat and lon to the function etc but with no success... How do I make this work?

    Read the article

  • .NET 3.5SP1 64-bit memory model vs. 32-bit memory model

    - by James Dunne
    As I understand it, the .NET memory model on a 32-bit machine guarantees 32-bit word writes and reads to be atomic operations but does not provide this guarantee on 64-bit words. I have written a quick tool to demonstrate this effect on a Windows XP 32-bit OS and am getting results consistent with that memory model description. However, I have taken this same tool's executable and run it on a Windows 7 Enterprise 64-bit OS and am getting wildly different results. Both the machines are identical specs just with different OSes installed. I would have expected that the .NET memory model would guarantee writes and reads to BOTH 32-bit and 64-bit words to be atomic on a 64-bit OS. I find results completely contrary to BOTH assumptions. 32-bit reads and writes are not demonstrated to be atomic on this OS. Can someone explain to me why this fails on a 64-bit OS? Tool code: using System; using System.Threading; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { var th = new Thread(new ThreadStart(RunThread)); var th2 = new Thread(new ThreadStart(RunThread)); int lastRecordedInt = 0; long lastRecordedLong = 0L; th.Start(); th2.Start(); while (!done) { int newIntValue = intValue; long newLongValue = longValue; if (lastRecordedInt > newIntValue) Console.WriteLine("BING(int)! {0} > {1}, {2}", lastRecordedInt, newIntValue, (lastRecordedInt - newIntValue)); if (lastRecordedLong > newLongValue) Console.WriteLine("BING(long)! {0} > {1}, {2}", lastRecordedLong, newLongValue, (lastRecordedLong - newLongValue)); lastRecordedInt = newIntValue; lastRecordedLong = newLongValue; } th.Join(); th2.Join(); Console.WriteLine("{0} =? {2}, {1} =? {3}", intValue, longValue, Int32.MaxValue / 2, (long)Int32.MaxValue + (Int32.MaxValue / 2)); } private static long longValue = Int32.MaxValue; private static int intValue; private static bool done = false; static void RunThread() { for (int i = 0; i < Int32.MaxValue / 4; ++i) { ++longValue; ++intValue; } done = true; } } } Results on Windows XP 32-bit: Windows XP 32-bit Intel Core2 Duo P8700 @ 2.53GHz BING(long)! 2161093208 > 2161092246, 962 BING(long)! 2162448397 > 2161273312, 1175085 BING(long)! 2270110050 > 2270109040, 1010 BING(long)! 2270115061 > 2270110059, 5002 BING(long)! 2558052223 > 2557528157, 524066 BING(long)! 2571660540 > 2571659563, 977 BING(long)! 2646433569 > 2646432557, 1012 BING(long)! 2660841714 > 2660840732, 982 BING(long)! 2661795522 > 2660841715, 953807 BING(long)! 2712855281 > 2712854239, 1042 BING(long)! 2737627472 > 2735210929, 2416543 1025780885 =? 1073741823, 3168207035 =? 3221225470 Notice how BING(int) is never written and demonstrates that 32-bit reads/writes are atomic on this 32-bit OS. Results on Windows 7 Enterprise 64-bit: Windows 7 Enterprise 64-bit Intel Core2 Duo P8700 @ 2.53GHz BING(long)! 2208482159 > 2208121217, 360942 BING(int)! 280292777 > 279704627, 588150 BING(int)! 308158865 > 308131694, 27171 BING(long)! 2549116628 > 2548884894, 231734 BING(int)! 534815527 > 534708027, 107500 BING(int)! 545113548 > 544270063, 843485 BING(long)! 2710030799 > 2709941968, 88831 BING(int)! 668662394 > 667539649, 1122745 1006355562 =? 1073741823, 3154727581 =? 3221225470 Notice that BING(long) AND BING(int) are both displayed! Why are the 32-bit operations failing, let alone the 64-bit ones?

    Read the article

  • How can I adjust the CommandTImeout in DbFit for long running queries?

    - by Ben Farmer
    Is there any way to increase the CommandTimeout for DbFit queries? I have a long running stored procedure that times out when running it in a DbFit Test. It's possible for the procedure to run for a really long time (processing millions of records) and would like to have DbFit wait until it's completed, even if it takes several minutes. We are using the latest version of FitSharp (downloaded it yesterday) and use the version of DbFit that is included with FitSharp.

    Read the article

  • What happens if you kill a long-running alter query?

    - by B T
    What happens if you kill a long-running alter query? Will the alter query simply revert? How long could that take (as a proportion of the time it has already been running)? What if that query is being replicated onto another server? Will killing the process on the other server revert the original server's alter query? We're running mysql

    Read the article

  • How to encrypt/decrypt a long string in PHP?

    - by jodeci
    I doubt if this is encryption but I can't find a better phrase. I need to pass a long query string like this: http://test.com/test.php?key=[some_very_loooooooooooooooooooooooong_query_string] The query string contains NO sensitive information so I'm not really concerned about security in this case. It's just...well, too long and ugly. Is there a library function that can let me encode/encrypt/compress the query string into something similar to the result of a md5() (similar as in, always a 32 character string), but decode/decrypt/decompress-able?

    Read the article

  • How to compress/decompress a long query string in PHP?

    - by jodeci
    I doubt if this is encryption but I can't find a better phrase. I need to pass a long query string like this: http://test.com/test.php?key=[some_very_loooooooooooooooooooooooong_query_string] The query string contains NO sensitive information so I'm not really concerned about security in this case. It's just...well, too long and ugly. Is there a library function that can let me encode/encrypt/compress the query string into something similar to the result of a md5() (similar as in, always a 32 character string), but decode/decrypt/decompress-able?

    Read the article

  • How do I bit shift a long by more than 32 bits?

    - by mach7
    It seems like I should be able to perform bit shift in C/C++ by more than 32 bits provided the left operand of the shift is a long. But this doesn't seem to work, at least with the g++ compiler. Example: unsigned long A = (1L << 37) gives A = 0 which isn't what I want. Am I missing something or is this just not possible? -J

    Read the article

  • Is it better to create methods with a long list of parameters or wrap the parameters into an object?

    - by GigaPr
    Hi, Is it better(what is the best practice) to create methods with a long list of parameters or wrap the parameters into an object? I mean lets say i have a Client data type with a long list of properties and i want to update all the properties at once. is it better to do something like public int Update(int id, string name, string surname, string streetAddress, string streetAddress2, string postcode, string town, string city, string nationality, string age, string gender,string job){ } or wrap all the properties in a object and do something like public int Update(Client client){} thanks

    Read the article

  • Passing XML markers to Google Map

    - by djmadscribbler
    I've been creating a V3 Google map based on this example from Mike Williams http://www.geocodezip.com/v3_MW_example_map3.html I've run into a bit of a problem though. If I have no parameters in my URL then I get the error "id is undefined idmarkers [id.toLowerCase()] = marker;" in Firebug and only one marker will show up. If I have a parameter (?id=105 for example) then all the sidebar links say 105 (or whatever the parameter in the URL was) instead of their respective label as listed in the XML file and a random infowindow will be opened instead of the window for the id in the URL. Here is my javascript: var map = null; var lastmarker = null; // ========== Read paramaters that have been passed in ========== // Before we go looking for the passed parameters, set some defaults // in case there are no parameters var id; var index = -1; // these set the initial center, zoom and maptype for the map // if it is not specified in the query string var lat = 42.194741; var lng = -121.700301; var zoom = 18; var maptype = google.maps.MapTypeId.HYBRID; function MapTypeId2UrlValue(maptype) { var urlValue = 'm'; switch (maptype) { case google.maps.MapTypeId.HYBRID: urlValue = 'h'; break; case google.maps.MapTypeId.SATELLITE: urlValue = 'k'; break; case google.maps.MapTypeId.TERRAIN: urlValue = 't'; break; default: case google.maps.MapTypeId.ROADMAP: urlValue = 'm'; break; } return urlValue; } // If there are any parameters at eh end of the URL, they will be in location.search // looking something like "?marker=3" // skip the first character, we are not interested in the "?" var query = location.search.substring(1); // split the rest at each "&" character to give a list of "argname=value" pairs var pairs = query.split("&"); for (var i = 0; i < pairs.length; i++) { // break each pair at the first "=" to obtain the argname and value var pos = pairs[i].indexOf("="); var argname = pairs[i].substring(0, pos).toLowerCase(); var value = pairs[i].substring(pos + 1).toLowerCase(); // process each possible argname - use unescape() if theres any chance of spaces if (argname == "id") { id = unescape(value); } if (argname == "marker") { index = parseFloat(value); } if (argname == "lat") { lat = parseFloat(value); } if (argname == "lng") { lng = parseFloat(value); } if (argname == "zoom") { zoom = parseInt(value); } if (argname == "type") { // from the v3 documentation 8/24/2010 // HYBRID This map type displays a transparent layer of major streets on satellite images. // ROADMAP This map type displays a normal street map. // SATELLITE This map type displays satellite images. // TERRAIN This map type displays maps with physical features such as terrain and vegetation. if (value == "m") { maptype = google.maps.MapTypeId.ROADMAP; } if (value == "k") { maptype = google.maps.MapTypeId.SATELLITE; } if (value == "h") { maptype = google.maps.MapTypeId.HYBRID; } if (value == "t") { maptype = google.maps.MapTypeId.TERRAIN; } } } // this variable will collect the html which will eventually be placed in the side_bar var side_bar_html = ""; // arrays to hold copies of the markers and html used by the side_bar // because the function closure trick doesnt work there var gmarkers = []; var idmarkers = []; // global "map" variable var map = null; // A function to create the marker and set up the event window function function createMarker(point, icon, label, html) { var contentString = html; var marker = new google.maps.Marker({ position: point, map: map, title: label, icon: icon, zIndex: Math.round(point.lat() * -100000) << 5 }); marker.id = id; marker.index = gmarkers.length; google.maps.event.addListener(marker, 'click', function () { lastmarker = new Object; lastmarker.id = marker.id; lastmarker.index = marker.index; infowindow.setContent(contentString); infowindow.open(map, marker); }); // save the info we need to use later for the side_bar gmarkers.push(marker); idmarkers[id.toLowerCase()] = marker; // add a line to the side_bar html side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length - 1) + ')">' + id + '<\/a><br>'; } // This function picks up the click and opens the corresponding info window function myclick(i) { google.maps.event.trigger(gmarkers[i], "click"); } function makeLink() { var mapinfo = "lat=" + map.getCenter().lat().toFixed(6) + "&lng=" + map.getCenter().lng().toFixed(6) + "&zoom=" + map.getZoom() + "&type=" + MapTypeId2UrlValue(map.getMapTypeId()); if (lastmarker) { var a = "/about/map/default.aspx?id=" + lastmarker.id + "&" + mapinfo; var b = "/about/map/default.aspx?marker=" + lastmarker.index + "&" + mapinfo; } else { var a = "/about/map/default.aspx?" + mapinfo; var b = a; } document.getElementById("idlink").innerHTML = '<a href="' + a + '" id=url target=_new>- Link directly to this page by id</a> (id in xml file also entry &quot;name&quot; in sidebar menu)'; document.getElementById("indexlink").innerHTML = '<a href="' + b + '" id=url target=_new>- Link directly to this page by index</a> (position in gmarkers array)'; } function initialize() { // create the map var myOptions = { zoom: zoom, center: new google.maps.LatLng(lat, lng), mapTypeId: maptype, mapTypeControlOptions: { style: google.maps.MapTypeControlStyle.DROPDOWN_MENU }, navigationControl: true, mapTypeId: google.maps.MapTypeId.HYBRID }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var stylesarray = [ { featureType: "poi", elementType: "labels", stylers: [ { visibility: "off" } ] }, { featureType: "landscape.man_made", elementType: "labels", stylers: [ { visibility: "off" } ] } ]; var options = map.setOptions({ styles: stylesarray }); // Make the link the first time when the page opens makeLink(); // Make the link again whenever the map changes google.maps.event.addListener(map, 'maptypeid_changed', makeLink); google.maps.event.addListener(map, 'center_changed', makeLink); google.maps.event.addListener(map, 'bounds_changed', makeLink); google.maps.event.addListener(map, 'zoom_changed', makeLink); google.maps.event.addListener(map, 'click', function () { lastmarker = null; makeLink(); infowindow.close(); }); // Read the data from example.xml downloadUrl("example.xml", function (doc) { var xmlDoc = xmlParse(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 google.maps.LatLng(lat, lng); var html = markers[i].getAttribute("html"); var label = markers[i].getAttribute("label"); var icon = markers[i].getAttribute("icon"); // create the marker var marker = createMarker(point, icon, label, html); } // put the assembled side_bar_html contents into the side_bar div document.getElementById("side_bar").innerHTML = side_bar_html; // ========= If a parameter was passed, open the info window ========== if (id) { if (idmarkers[id]) { google.maps.event.trigger(idmarkers[id], "click"); } else { alert("id " + id + " does not match any marker"); } } if (index > -1) { if (index < gmarkers.length) { google.maps.event.trigger(gmarkers[index], "click"); } else { alert("marker " + index + " does not exist"); } } }); } var infowindow = new google.maps.InfoWindow( { size: new google.maps.Size(150, 50) }); google.maps.event.addDomListener(window, "load", initialize); And here is an example of my XML formatting <marker lat="42.196175" lng="-121.699224" html="This is the information about 104" iconimage="/about/map/images/104.png" label="104" />

    Read the article

  • How long does it take Google to update all links from R 301 ?

    - by romant
    I just changed the location of my blog, and have done the appropriate redirects. Does anyone have knowledge or experience for the delay in updating all the links across Google? Reason I ask, I wish to change the A record. So this will eliminate the .htaccess file, and thus null and void the redirect. How long must I wait prior to the undertaking? Thank you.

    Read the article

  • How long does it take Google to update all links from R 301 ?

    - by romant
    I just changed the location of my blog, and have done the appropriate redirects. Does anyone have knowledge or experience for the delay in updating all the links across Google? Reason I ask, I wish to change the A record. So this will eliminate the .htaccess file, and thus null and void the redirect. How long must I wait prior to the undertaking? Thank you.

    Read the article

< Previous Page | 34 35 36 37 38 39 40 41 42 43 44 45  | Next Page >