Search Results

Search found 523 results on 21 pages for 'lat'.

Page 7/21 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • iPhone JSON Object

    - by Cosizzle
    Hello, I'm trying to create a application that will retrieve JSON data from an HTTP request, send it to a the application main controller as a JSON object then from there do further processing with it. Where I'm stick is actually creating a class that will serve as a JSON class in which will take a URL, grab the data, and return that object. Alone, im able to make this class work, however I can not get the class to store the object for my main controller to retrieve it. Because im fairly new to Objective-C itself, my thoughts are that im messing up within my init call: -initWithURL:(NSString *) value { responseData = [[NSMutableData data] retain]; NSString *theURL = value; NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:theURL]]; [[NSURLConnection alloc] initWithRequest:request delegate:self]; return self; } The processing of the JSON object takes place here: - (void)connectionDidFinishLoading:(NSURLConnection *)connection { [connection release]; NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; [responseData release]; NSError *jsonError; SBJSON *json = [[SBJSON new] autorelease]; NSDictionary *parsedJSON = [json objectWithString:responseString error:&jsonError]; // NSArray object. listings = [parsedJSON objectForKey:@"posts"]; NSEnumerator *enumerator = [listings objectEnumerator]; NSDictionary* item; // to prove that it does work. while (item = (NSDictionary*)[enumerator nextObject]) { NSLog(@"posts:id = %@", [item objectForKey:@"id"]); NSLog(@"posts:address = %@", [item objectForKey:@"address"]); NSLog(@"posts:lat = %@", [item objectForKey:@"lat"]); NSLog(@"posts:lng = %@", [item objectForKey:@"lng"]); } [responseString release]; } Now when calling the object within the main controller I have this bit of code in the viewDidLoad method call: - (void)viewDidLoad { [super viewDidLoad]; JSON_model *jsonObj = [[JSON_model alloc] initWithURL:@"http://localhost/json/faith_json.php?user=1&format=json"]; NSEnumerator *enumerator = [[jsonObj listings] objectEnumerator]; NSDictionary* item; // while (item = (NSDictionary*)[enumerator nextObject]) { NSLog(@"posts:id = %@", [item objectForKey:@"id"]); NSLog(@"posts:address = %@", [item objectForKey:@"address"]); NSLog(@"posts:lat = %@", [item objectForKey:@"lat"]); NSLog(@"posts:lng = %@", [item objectForKey:@"lng"]); } }

    Read the article

  • launching mapview from main activity (button)

    - by arc
    Hi all. Going round in circles here i think. I have an activity called Locate; public class Locate extends Activity { public static String lat; public static String lon; public static String number; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.locate); final Button buttonMaps = (Button) findViewById(R.id.ButtonMaps); buttonMaps.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Toast.makeText(getBaseContext(), "Button Pressed", Toast.LENGTH_SHORT).show(); try { Intent i = new Intent(getBaseContext(), displayMap.class); i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(i); } catch (ActivityNotFoundException e) { Toast.makeText(getBaseContext(), "Activity Not Found", Toast.LENGTH_SHORT).show(); } }}); // Toast.makeText(getBaseContext(), "lat: " + lat + " long: " + lon + " from: " + testname, Toast.LENGTH_LONG).show(); } If I make the displayMap class into a normal Activity, and just have display a toast message confirming it has loaded - then it works fine. If i do this though; public class displayMap extends MapActivity { /** Called when the activity is first created. */ public void onCreate() { setContentView(R.layout.displaymap); Toast.makeText(getBaseContext(), "Display Map", Toast.LENGTH_SHORT).show(); } @Override protected boolean isRouteDisplayed() { // TODO Auto-generated method stub return false; } } Then as soon as I click the Button, I get a force close. I have the correct 'uses-library' tag in my manifest; <application android:icon="@drawable/icon" android:label="@string/app_name"> <uses-library android:name="com.google.android.maps" /> I don't get what it just force closes everytime i try and load it. If I make this my onClick handler then it will fire up a working googlemaps/default mapview public void onClick(View v) { Toast.makeText(getBaseContext(), "Button Pressed", Toast.LENGTH_SHORT).show(); Uri uri=Uri.parse("geo:"+Locate.lat+","+Locate.lon); StartActivity(new Intent(Intent.ACTION_VIEW, uri)); } But that is not what I am trying to do, I want my own - so that I can add overlays etc to it. But it does prove that the permission are set correctly and that the lib is there. The logcat error when the app FCs is a Unexpected DEX error. Can anyone point in the right direction here?

    Read the article

  • Regex negative lookahead

    - by Alyn
    I need to modify this regex href=\"(.*)\" which matches this... href="./pothole_locator_map.aspx?lang=en-gb&lat=53.153977&lng=-3.533306" To NOT match this... href="./pothole_locator_map.aspx?lang=en-gb&lat=53.153977&lng=-3.533306&returnurl=AbandonedVehicles.aspx" Tried this, but with no luck href=\"(.*)\"(?!&returnurl=AbandonedVehicles.aspx) Any help would be much appreciated. Thanks, Al.

    Read the article

  • How to update Geo-Location in fireeagle

    - by Ganesh
    Hi Every One, I am developing an application on fireeagle, there i need to update the users exact location, with out asking any information from the user (i.e) lat, long e.t.c., If it is not possible using yahoo fireeagle, please let me know if there exists any other api's other than yahoo fireeagle. If they can get the exact location of web user in 'Lat' and 'Long', either from 'Pc' or from 'Mobile' browser. Thanks in advance.

    Read the article

  • solr range query errors

    - by mquinsland
    http://localhost:8983/solr/select?wt=json&q=lat:[35%20to%2038] results in **org.apache.lucene.queryParser.ParseException: Cannot parse 'lat:[35 to 38]': Encountered " "38 "" at line 1, column 11. Was expecting: "]" This is a pretty basic range query and this error will prevent us from using SOLR for our projects

    Read the article

  • how to use window.onload?

    - by Patrick
    I'm refactoring a website using MVC. What was a set of huge pages with javascript, php, html etc etc is becoming a series of controllers and views. I'm trying to do it in a modular way so views are split in 'modules' that I can reuse in other pages when needed eg. "view/searchform displays only one div with the searchform "view/display_events displays a list of events and so on. One of the old pages was supposed to load a google map with a marker on it. Amongst the rest of the code, I can identify the relevant bits as follows <head> <script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=blablabla" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); var point = new GLatLng(<?php echo ($info->lat && $info->lng) ? $info->lat .",". $info->lng : "51.502759,-0.126171"; ?>); map.setCenter(new GLatLng(<?php echo ($info->lat && $info->lng) ? $info->lat .",". $info->lng : "51.502759,-0.126171"; ?>), 15); map.addControl(new GLargeMapControl()); map.addControl(new GScaleControl()); map.addOverlay(new GMarker(point)); var marker = createMarker(point,GIcon(),"CIAO"); map.addOverlay(marker); } } //]]> </script> </head> ...then <body onload="load()" onunload="GUnload()"> ...and finally this div where the map should be displayed <div id="map" style="width: 440px; height: 300px"> </div> Don't know much about js, but my understanding is that a) I have to include the scripts in the view module I'm writing (directly in the HTML? I would prefer to load a separate script) b) I have to trigger that function using the equivalent of body onload... (obviously there's no body tag in my view. In my ignorance I've tried div onload=.... but didn't seem to be working :) What do you suggest I do? I've read about window.onload but don't know what's the correct syntax for that. please keep in mind that other parts of the page include other js functions (eg, google adsense) that are called after the footer.

    Read the article

  • How to do server-side validation using Jqgrid?

    - by Eoghan
    Hi, I'm using jqgrid to display a list of sites and I want to do some server side validation when a site is added or edited. (Form editing rather than inline. Validation needs to be server side for various reasons I won't go into.) I thought the best way would be to check the data via an ajax request when the beforeSubmit event is triggered. However this only seems to work when I'm editing an existing row in the grid - the function isn't called when I add a new row. Have I got my beforeSubmit in the wrong place? Thanks for your help. $("#sites-grid").jqGrid({ url:'/json/sites', datatype: "json", mtype: 'GET', colNames:['Code', 'Name', 'Area', 'Cluster', 'Date Live', 'Status', 'Lat', 'Lng'], colModel :[ {name:'code', index:'code', width:80, align:'left', editable:true}, {name:'name', index:'name', width:250, align:'left', editrules:{required:true}, editable:true}, {name:'area', index:'area', width:60, align:'left', editable:true}, {name:'cluster_id', index:'cluster_id', width:80, align:'right', editrules:{required:true, integer:true}, editable:true, edittype:"select", editoptions:{value:"<?php echo $cluster_options; ?>"}}, {name:'estimated_live_date', index:'estimated_live_date', width:120, align:'left', editable:true, editrules:{required:true}, edittype:"select", editoptions:{value:"<?php echo $this->month_options; ?>"}}, {name:'status', index:'status', width:80, align:'left', editable:true, edittype:"select", editoptions:{value:"Live:Live;Plan:Plan;"}}, {name:'lat', index:'lat', width:140, align:'right', editrules:{required:true}, editable:true}, {name:'lng', index:'lng', width:140, align:'right', editrules:{required:true}, editable:true}, ], height: '300', pager: '#pager-sites', rowNum:30, rowList:[10,30,90], sortname: 'cluster_id', sortorder: 'desc', viewrecords: true, multiselect: false, caption: 'Sites', editurl: '/json/sites' }); $("#sites-grid").jqGrid('navGrid','#pager-sites',{edit:true,add:true,del:true, beforeSubmit : function(postdata, formid) { $.ajax({ url : 'json/validate-site/', data : postdata, dataType : 'json', type : 'post', success : function(data) { alert(data.message); return[data.result, data.message]; } }); }});

    Read the article

  • google maps api v3 - loop through overlays - overlayview methods

    - by user317005
    what's wrong with the code below? when i execute it, the map doesn't even show up. but when i put the overlayview methods outside the for-loop and manually assign a lat/lng then it magically works?! but does anyone know how i can loop through an array of lats/lngs (=items) using the overlayview methods? i hope this makes sense, just don't know how else to explain it. and unfortunately, i run my code on my localhost var overlay; OverlayTest.prototype = new google.maps.OverlayView(); [taken out: options] var map = new google.maps.Map(document.getElementById('map_canvas'), options); var items = [ ['lat','lng'],['lat','lng'] ]; for (var i = 0; i < items.length; i++) { var latlng = new google.maps.LatLng(items[i][0], items[i][1]); var bounds = new google.maps.LatLngBounds(latlng); overlay = new OverlayTest(map, bounds); function OverlayTest(map, bounds) { [taken out: not important] this.setMap(map); } OverlayTest.prototype.onAdd = function() { [taken out: not important] } OverlayTest.prototype.draw = function() { [taken out: not important] } }

    Read the article

  • AJAX Callback and Javascript class variables assignments

    - by Gianluca
    I am trying to build a little javascript class for geocoding addresses trough Google Maps API. I am learning Javascript and AJAX and I still can't figure out how can I initialize class variables trough a callback: // Here is the Location class, it takes an address and // initialize a GClientGeocoder. this.coord[] is where we'll store lat/lng function Location(address) { this.geo = new GClientGeocoder(); this.address = address; this.coord = []; } // This is the geoCode function, it geocodes object.address and // need a callback to handle the response from Google Location.prototype.geoCode = function(geoCallback) { this.geo.getLocations(this.address, geoCallback); } // Here we go: the callback. // I made it a member of the class so it would be able // to handle class variable like coord[]. Obviously it don't work. Location.prototype.geoCallback = function(result) { this.coord[0] = result.Placemark[0].Point.coordinates[1]; this.coord[1] = result.Placemark[0].Point.coordinates[0]; window.alert("Callback lat: " + this.coord[0] + "; lon: " + this.coord[1]); } // Main function initialize() { var Place = new Location("Tokyo, Japan"); Place.geoCode(Place.geoCallback); window.alert("Main lat: " + Place.coord[0] + " lon: " + Place.coord[1]); } google.setOnLoadCallback(initialize); Thank you for helping me out!

    Read the article

  • Heroku taps push weirdness...

    - by holden
    I have the strangest experience using taps to move data between my machine and heroku. It works fine except that it seems to loose 0s directly behind the decimal place for my geo coordinates. Ie 50.0519322 for some reason gets set to 50.519322... no idea why. When I pull the data from the remote location ie. heroku db:pull... it works fine, all decimal places intact on my machine, however, when i push it back to the remote server it loses these zeros. Especially directly behind the decimal place, though I haven't noticed it elsewhere yet. At first I was storing the lat and lng as simply numeric but refined it to: change_column :places, :lat, :numeric, :precision => 15, :scale => 10 change_column :places, :lng, :numeric, :precision => 15, :scale => 10 With no result, any ideas what's going on? From the console on the remote server i get the lat as being: #<BigDecimal:2aebcc5967c0,'0.50519322E2',18(18)> and my machine as: #<BigDecimal:10232f7c8,'0.50519322E2',12(16)> which is also odd, the second one because it shows up as 50.0519322 when i edit it thru my view but when i do to_f via console it gives me 50.519322

    Read the article

  • Cant get a location

    - by user1891806
    Iam trying to get a location (latitute and longitude), I cant figure out what Im doing wrong but my location keeps returning null. Anybody knows what I am doing wrong? public class ParseJSON extends Activity implements LocationListener { private TextView latituteField; private TextView longitudeField; LocationManager lm; String provider; int lat; int lon; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.test); lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria crit = new Criteria(); provider = lm.getBestProvider(crit, false); Location location = lm.getLastKnownLocation(provider); if (location != null){ lat = (int) location.getLatitude(); lon = (int) location.getLongitude(); latituteField = (TextView) findViewById(R.id.lattest); longitudeField = (TextView) findViewById(R.id.lontest); latituteField.setText(lat); longitudeField.setText(String.valueOf(lon)); } else { Toast.makeText(ParseJSON.this, "Couldnt get location", Toast.LENGTH_SHORT); } String readWeatherFeed = readWeatherFeed(); try { JSONArray jsonArray = new JSONArray(readWeatherFeed); Log.i(ParseJSON.class.getName(), "Number of entries " + jsonArray.length()); for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); Log.i(ParseJSON.class.getName(), jsonObject.getString("text")); } } catch (Exception e) { e.printStackTrace(); } } I dont have a clue, thanks in advance

    Read the article

  • Cursor while loop returning every value but the last

    - by LordSnoutimus
    Hello, I am using a while loop to iterate through a cursor and then outputing the longitude and latitude values of every point within the database. For some reason it is not returning the last (or first depending on if I use Cursor.MoveToLast) set of longitude and latitude values in the cursor. Here is my code: public void loadTrack() { SQLiteDatabase db1 = waypoints.getWritableDatabase(); Cursor trackCursor = db1.query(TABLE_NAME, FROM, "trackidfk=1", null, null, null,ORDER_BY); trackCursor.moveToFirst(); while (trackCursor.moveToNext()) { Double lat = trackCursor.getDouble(2); Double lon = trackCursor.getDouble(1); //overlay.addGeoPoint( new GeoPoint( (int)(lat*1E6), (int)(lon*1E6))); System.out.println(lon); System.out.println(lat); } } From this I am getting: 04-02 15:39:07.416: INFO/System.out(10551): 3.0 04-02 15:39:07.416: INFO/System.out(10551): 5.0 04-02 15:39:07.416: INFO/System.out(10551): 4.0 04-02 15:39:07.416: INFO/System.out(10551): 5.0 04-02 15:39:07.416: INFO/System.out(10551): 5.0 04-02 15:39:07.416: INFO/System.out(10551): 5.0 04-02 15:39:07.416: INFO/System.out(10551): 4.0 04-02 15:39:07.416: INFO/System.out(10551): 4.0 04-02 15:39:07.416: INFO/System.out(10551): 3.0 04-02 15:39:07.416: INFO/System.out(10551): 3.0 04-02 15:39:07.416: INFO/System.out(10551): 2.0 04-02 15:39:07.416: INFO/System.out(10551): 2.0 04-02 15:39:07.493: INFO/System.out(10551): 1.0 04-02 15:39:07.493: INFO/System.out(10551): 1.0 7 Sets of values, where I should be getting 8 sets. Thanks.

    Read the article

  • Reformat SQLGeography polygons to JSON

    - by James
    I am building a web service that serves geographic boundary data in JSON format. The geographic data is stored in an SQL Server 2008 R2 database using the geography type in a table. I use [ColumnName].ToString() method to return the polygon data as text. Example output: POLYGON ((-6.1646509904325884 56.435153006374627, ... -6.1606079906751 56.4338050060666)) MULTIPOLYGON (((-6.1646509904325884 56.435153006374627 0 0, ... -6.1606079906751 56.4338050060666 0 0))) Geographic definitions can take the form of either an array of lat/long pairs defining a polygon or in the case of multiple definitions, an array or polygons (multipolygon). I have the following regex that converts the output to JSON objects contained in multi-dimensional arrays depending on the output. Regex latlngMatch = new Regex(@"(-?[0-9]{1}\.\d*)\s(\d{2}.\d*)(?:\s0\s0,?)?", RegexOptions.Compiled); private string ConvertPolysToJson(string polysIn) { return this.latlngMatch.Replace(polysIn.Remove(0, polysIn.IndexOf("(")) // remove POLYGON or MULTIPOLYGON .Replace("(", "[") // convert to JSON array syntax .Replace(")", "]"), // same as above "{lng:$1,lat:$2},"); // reformat lat/lng pairs to JSON objects } This is actually working pretty well and converts the DB output to JSON on the fly in response to an operation call. However I am no regex master and the calls to String.Replace() also seem inefficient to me. Does anyone have any suggestions/comments about performance of this?

    Read the article

  • Ruby on Rails script/console printing more than expected

    - by Lloyd
    I have a simple model setup in my Ruby on Rails app. (User {name, username, lat, lon}) and am writing a basic extension to the model. I would like the method to return users within a certain distance. It all works just fine in the page view, but as I am debugging I would like to work through some testing using the script/console. My question: It seems to be printing to the screen the entire result set when I run it from the command line and script/console. My model: class User < ActiveRecord::Base def distance_from(aLat, aLon) Math.sqrt((69.1*(aLat - self.lat))**2 + (49*(aLon - self.lon))**2 ) end def distance_from_user(aUser) distance_from(aUser.lat, aUser.lon) end def users_within(distance) close_users = [] users = User.find(:all) users.each do |u| close_users << u if u.distance_from_user(self) < distance end return close_users end end and from the command line I am running >> u = User.find_by_username("someuser") >> print u.users_within(1) So, I guess I would like to know why it's printing the whole result set, and if there is a way to suppress it so as to only print what I want?

    Read the article

  • How do I utilize REST to post GPS data from an Android device into a Ruby on Rails application?

    - by joecan
    I am a student in the process a building an Android app that can post a GPS track into a Rails application. I would like to do things the "Rails" way and take advantage of the REST. My rails application basically has 3 models at this point: users, tracks, and points. A user has_many tracks and a track has_many points. A track also has a total distance. Points have a latitude and longitude. I have successfully been able to create an empty track with: curl -i -X POST -H 'Content-Type: application/xml' -d '<track><distance>100</distance></track>' http://localhost:3000/users/1/tracks Whoo hoo! That is pretty cool. I am really impressed that rails do this. Just to see what would happen I tried the following: curl -i -X POST -H 'Content-Type: application/xml -d '<track><distance>100</distance><points><point><lat>3</lat><lng>2</lng></point></points></track>' http://localhost:3000/users/1/tracks Fail! The server spits back: Processing TracksController#create (for 127.0.0.1 at 2010-04-14 00:03:25) [POST] Parameters: {"track"={"points"={"point"={"lng"="2", "lat"="3"}}, "distance"="100"}, "user_id"="1"} User Load (0.6ms) SELECT * FROM "users" WHERE ("users"."id" = 1) ActiveRecord::AssociationTypeMismatch (Point(#-620976268) expected, got Array(#-607740138)): app/controllers/tracks_controller.rb:47:in `create' It seems my tracks_controller doesn't like or understand what it's getting from the params object in my tracks_controller.rb: def create @track = @user.tracks.build(params[:track]) My xml might be wrong, but at least Rails seems to be expecting a Point from it. Is there anyway I can fix TracksController.create so that it will be able to parse xml of a track with nested multiple points? Or is there another way I should be doing this entirely?

    Read the article

  • CLLocationManagerDelegate method not calling in iPodTouch

    - by Siddharth
    HI all, I was using a sample code which uses CLLocationManager class to determine the current location of user. when i run this app on iPad i am getting the correct location but when i run the same app on iPod Touch i am getting a blank label i.e nothing is displayed on the label .although wi-fi signal strength is good in both iPod and iPad.The code looks like... - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ int degrees = newLocation.coordinate.latitude; double decimal = fabs(newLocation.coordinate.latitude - degrees); int minutes = decimal * 60; double seconds = decimal * 3600 - minutes * 60; NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds]; latLabel.text = lat; [latLocationArray addObject:lat]; degrees = newLocation.coordinate.longitude; decimal = fabs(newLocation.coordinate.longitude - degrees); minutes = decimal * 60; seconds = decimal * 3600 - minutes * 60; NSString *longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds]; longLabel.text = longt; [longLocationArray addObject:longt]; }

    Read the article

  • postgres - ERROR: operator does not exist

    - by cino21122
    Again, I have a function that works fine locally, but moving it online yields a big fat error... Taking a cue from a response in which someone had pointed out the number of arguments I was passing wasn't accurate, I double-checked in this situation to be certain that I am passing 5 arguments to the function itself... Query failed: ERROR: operator does not exist: point <@> point HINT: No operator matches the given name and argument type(s). You may need to add explicit type casts. The query is this: BEGIN; SELECT zip_proximity_sum('zc', (SELECT g.lat FROM geocoded g LEFT JOIN masterfile m ON g.recordid = m.id WHERE m.zip = '10050' ORDER BY m.id LIMIT 1), (SELECT g.lon FROM geocoded g LEFT JOIN masterfile m ON g.recordid = m.id WHERE m.zip = '10050' ORDER BY m.id LIMIT 1), (SELECT m.zip FROM geocoded g LEFT JOIN masterfile m ON g.recordid = m.id WHERE m.zip = '10050' ORDER BY m.id LIMIT 1) ,10); The PG function is this: CREATE OR REPLACE FUNCTION zip_proximity_sum(refcursor, numeric, numeric, character, numeric) RETURNS refcursor AS $BODY$ BEGIN OPEN $1 FOR SELECT r.zip, point($2,$3) <@> point(g.lat, g.lon) AS distance FROM geocoded g LEFT JOIN masterfile r ON g.recordid = r.id WHERE (geo_distance( point($2,$3),point(g.lat,g.lon)) < $5) ORDER BY r.zip, distance; RETURN $1; END; $BODY$ LANGUAGE 'plpgsql' VOLATILE COST 100;

    Read the article

  • Hibernate design to speed up querying of large dataset

    - by paddydub
    I currently have the below tables representing a bus network mapped in hibernate, accessed from a Spring MVC based bus route planner I'm trying to make my route planner application perform faster, I load all the above tables into Lists to perform the route planner logic. I would appreciate if anyone has any ideas of how to speed my performace Or any suggestions of another method to approach this problem of handling a large set of data Coordinate Connections Table (INT,INT,INT, DOUBLE)( Containing 50,000 Coordinate Connections) ID, FROMCOORDID, TOCOORDID, DISTANCE 1 1 2 0.383657 2 1 17 0.173201 3 1 63 0.258781 4 1 64 0.013726 5 1 65 0.459829 6 1 95 0.458769 Coordinate Table (INT,DECIMAL, DECIMAL) (Containing 4700 Coordinates) ID , LAT, LNG 0 59.352669 -7.264341 1 59.352669 -7.264341 2 59.350012 -7.260653 3 59.337585 -7.189798 4 59.339221 -7.193582 5 59.341408 -7.205888 Bus Stop Table (INT, INT, INT)(Containing 15000 Stops) StopID RouteID COORDINATEID 1000100001 100 17 1000100002 100 18 1000100003 100 19 1000100004 100 20 1000100005 100 21 1000100006 100 22 1000100007 100 23 This is how long it takes to load all the data from each table: stop.findAll = 148ms, stops.size: 15670 Hibernate: select coordinate0_.COORDINATEID as COORDINA1_2_, coordinate0_.LAT as LAT2_, coordinate0_.LNG as LNG2_ from COORDINATES coordinate0_ coord.findAll = 51ms , coordinates.size: 4704 Hibernate: select coordconne0_.COORDCONNECTIONID as COORDCON1_3_, coordconne0_.DISTANCE as DISTANCE3_, coordconne0_.FROMCOORDID as FROMCOOR3_3_, coordconne0_.TOCOORDID as TOCOORDID3_ from COORDCONNECTIONS coordconne0_ coordinateConnectionDao.findAll = 238ms ; coordConnectioninates.size:48132 Hibernate Annotations @Entity @Table(name = "STOPS") public class Stop implements Serializable { @Id @GeneratedValue(strategy = GenerationType.AUTO) @Column(name = "STOPID") private int stopID; @Column(name = "ROUTEID", nullable = false) private int routeID; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "COORDINATEID", nullable = false) private Coordinate coordinate; } @Table(name = "COORDINATES") public class Coordinate { @Id @GeneratedValue @Column(name = "COORDINATEID") private int CoordinateID; @Column(name = "LAT") private double latitude; @Column(name = "LNG") private double longitude; } @Entity @Table(name = "COORDCONNECTIONS") public class CoordConnection { @Id @GeneratedValue @Column(name = "COORDCONNECTIONID") private int CoordinateID; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "FROMCOORDID", nullable = false) private Coordinate fromCoordID; @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "TOCOORDID", nullable = false) private Coordinate toCoordID; @Column(name = "DISTANCE", nullable = false) private double distance; }

    Read the article

  • CLLocationManager class method not calling in iPodTouch

    - by Siddharth
    HI all, I was using a sample code which uses CLLocationManager class to determine the current location of user. when i run this app on iPad i am getting the correct location but when i run the same app on iPod Touch i am getting a blank label i.e nothing is displayed on the label .although wi-fi signal strength is good in both iPod and iPad.The code looks like... - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{ int degrees = newLocation.coordinate.latitude; double decimal = fabs(newLocation.coordinate.latitude - degrees); int minutes = decimal * 60; double seconds = decimal * 3600 - minutes * 60; NSString *lat = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds]; latLabel.text = lat; [latLocationArray addObject:lat]; degrees = newLocation.coordinate.longitude; decimal = fabs(newLocation.coordinate.longitude - degrees); minutes = decimal * 60; seconds = decimal * 3600 - minutes * 60; NSString *longt = [NSString stringWithFormat:@"%d° %d' %1.4f\"", degrees, minutes, seconds]; longLabel.text = longt; [longLocationArray addObject:longt]; }

    Read the article

  • Scheme: what are the benefits of letrec?

    - by Ixmatus
    While reading "The Seasoned Schemer" I've begun to learn about letrec. I understand what it does (can be duplicated with a Y-Combinator) but the book is using it in lieu of recurring on the already defined function operating on arguments that remain static. An example of an old function using the defined function recurring on itself (nothing special): (define (substitute new old lat) (cond ((null? l) '()) ((eq? (car l) old) (cons new (substitute new old (cdr l)))) (else (cons (car l) (substitute new old (cdr l)))))) Now for an example of that same function but using letrec: (define (substitute new old lat) (letrec ((replace (lambda (l) (cond ((null? l) '()) ((eq? (car l) old) (cons new (replace (cdr l)))) (else (cons (car l) (replace (cdr l)))))))) (replace lat))) Aside from being slightly longer and more difficult to read I don't know why they are rewriting functions in the book to use letrec. Is there a speed enhancement when recurring over a static variable this way because you don't keep passing it?? Is this standard practice for functions with arguments that remain static but one argument that is reduced (such as recurring down the elements of a list)? Some input from more experienced Schemers/LISPers would help!

    Read the article

  • MySQL 1064 error, works in command line and phpMyAdmin; not in app

    - by hundleyj
    Here is my query: select * from (select *, 3956 * 2 * ASIN(SQRT(POWER(SIN(RADIANS(45.5200077 - lat)/ 2), 2) + COS(RADIANS(45.5200077)) * COS(RADIANS(lat)) * POWER(SIN(RADIANS(-122.6942014 - lng)/2),2))) AS distance from stops order by distance, route asc) as p group by route, dir order by distance asc limit 10 This works fine at the command line and in PHPMyAdmin. I'm using Dbslayer to connect to MySQL via my JavaScript backend, and the request is returning a 1064 error. Here is the encoded DBSlayer request string: http://localhost:9090/db?{%22SQL%22:%22select%20*%20from%20%28select%20*,%203956%20*%202%20*%20ASIN%28SQRT%28POWER%28SIN%28RADIANS%2845.5200077%20-%20lat%29/%202%29,%202%29%20+%20COS%28RADIANS%2845.5200077%29%29%20*%20COS%28RADIANS%28lat%29%29%20*%20POWER%28SIN%28RADIANS%28-122.6942014%20-%20lng%29/2%29,2%29%29%29%20AS%20distance%20from%20%60stops%60%20order%20by%20%60distance%60,%20%60route%60%20asc%29%20as%20p%20group%20by%20%60route%60,%20%60dir%60%20order%20by%20%60distance%60%20asc%20limit%2010%22} And the response: {"MYSQL_ERRNO" : 1064 , "MYSQL_ERROR" : "You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(RADIANS(45.5200077)) * COS(RADIANS(lat)) * POWER(SIN(RADIANS(-122.6942014 - lng' at line 1" , "SERVER" : "trimet"} Thanks!

    Read the article

  • Unable to pass variables from one view to another

    - by jerincbus
    I have a detail view that includes three UIButtons, each of which pushes a different view on to the stack. One of the buttons is connected to a MKMapView. When that button is pushed I need to send the latitude and longitude variables from the detail view to the map view. I'm trying to add the string declaration in the IBAction: - (IBAction)goToMapView { MapViewController *mapController = [[MapViewController alloc] initWithNibName:@"MapViewController" bundle:nil]; mapController.address = self.address; mapController.Title = self.Title; mapController.lat = self.lat; mapController.lng = self.lng; //Push the new view on the stack [[self navigationController] pushViewController:mapController animated:YES]; [mapController release]; mapController = nil; } But I get this when I try to build: 'error: incompatible types in assignment' for both lat and lng variables. So my questions are am I going about passing the variables from one view to another the right way? And does the MKMapView accept latitude and longitude as a string or a number?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >