// pad our map by 10% around the farthest annotations
#define MAP_PADDING 1.1
// we'll make sure that our minimum vertical span is about a kilometer
// there are ~111km to a degree of latitude. regionThatFits will take care of
// longitude, which is more complicated, anyway.
#define MINIMUM_VISIBLE_LATITUDE 0.01
- (void)mapZoom
{
CLLocationDegrees minLatitude = 90.0;
CLLocationDegrees maxLatitude = -90.0;
CLLocationDegrees minLongitude = 180.0;
CLLocationDegrees maxLongitude = -180.0;
for (MapPoint *p in [self.mapView annotations]) {
if (p.coordinate.latitude < minLatitude)
minLatitude = p.coordinate.latitude;
if (p.coordinate.latitude > maxLatitude)
maxLatitude = p.coordinate.latitude;
if (p.coordinate.longitude < minLongitude)
minLongitude = p.coordinate.longitude;
if (p.coordinate.longitude > maxLongitude)
maxLongitude = p.coordinate.longitude;
}
MKCoordinateRegion region;
region.center.latitude = (minLatitude + maxLatitude) / 2;
region.center.longitude = (minLongitude + maxLongitude) / 2;
region.span.latitudeDelta = (maxLatitude - minLatitude) * MAP_PADDING;
region.span.latitudeDelta = (region.span.latitudeDelta < MINIMUM_VISIBLE_LATITUDE) ? MINIMUM_VISIBLE_LATITUDE : region.span.latitudeDelta;
region.span.longitudeDelta = (maxLongitude - minLongitude) * MAP_PADDING;
MKCoordinateRegion scaledRegion = [self.mapView regionThatFits:region];
[self.mapView setRegion:scaledRegion animated:YES];
}
0
MKMapView zoom to markers bounds
‘SVN: Warning Cannot Set LC_CTYPE Locale’ Solution
If you get this error:
svn: warning: cannot set LC_CTYPE locale svn: warning: environment variable LANG is en_US svn: warning: please check that your locale name is correct
try this:
export LC_ALL=C
Note: This only works on a one-time basis. If you want it to be permanent, you will have to add it to your login script.
Using ssh keys with Capistrano (ex: EC2 images)
add this to your config/deploy.rb
ssh_options[:keys] = [File.join(ENV["HOME"], ".ssh", "key.pem")]
How to install mysql gem on Ubuntu
sudo apt-get install libmysqlclient15-dev sudo gem install mysql
