How Greece Came to Belong to the Greeks
&& [ greece ] && 0 comments
I met Amalia at the Thessaloniki Pythess (Python) meetup (at which I gave one awkward english presentation) which had migrated to a lounge under the Archaeological Museum of Thessaloniki. I thought the museum looked pretty cool, so I decided I would go the next day. I propositioned the group to see if anyone else was interested in joining me, Amalia was the only one brave enough to to say so.
We spent a few good hours at the museum and various other historical points of interest around the city. While walking down some buzzing, narrow street Amalia told me a great story about how it is that Greeks came to find themselves in Greece:
After God had created the earth, he told the people that he would be at his office the next day from 7am to 5pm and that they should come by so He could assign a place for them to live. The next morning God came to his office to unlock the door and found the English already waiting for him.
God said to the English: “Since you are so early, I am giving you the best pick of land. It is a large island and you can do with it what you please.”
After God made the final arrangements he escorted the English out of his office and there He found the Germans, right on time.
To the Germans He said: “Since you are first in line, I am giving you a large piece of land. There you will have plenty of space for your industry and farming.”
And so God spent the rest of the day allocating land to the people of the earth. At last 5pm rolled around, and as God was locking his office door the Gypsies arrived.
To God they pleaded: “Please God, give us some land. You won’t believe what happened on the way here. The bus was late, Mother was sick, and there were all sorts of complications. Please, have pity on us.”
God replied to Gypsies: “I have given away all the land. I am sorry you are late but there is nothing I can do for you. From now on you will be the children of the earth. You will not have a land to call home but you will be of the world.”
Satisfied with this answer the Gypsies left God in peace. As God began his walk home, he was approached by the Greeks:
“God, wait! We are here for our land! We are sorry we are late but it’s not our fault!”
God, annoyed, replied: “I am sorry, I have given away all the land, there is none left for you.”
The Greeks would have none of it:
“But please! All these things kept us from being on time. We wanted to come earlier, but we were hungry, so we had to stop to get something to eat. And then one of the sheep got away so we had to bring it back, not to mention all the traffic!”
God, now getting angry, replied: “I am sorry. But you are late and there is nothing I can do for you. You will have no land.”
The Greeks continued, loudly, franticly gesturing with their hands: “But PLEASE! We have these pains, it keeps us from getting up early in the morning. Oh! And this weather! We could barely walk in this wind, how were we supposed to get here on time? Not to mention we wanted to do the laundry, so we could have clean clothes and–“
“Fine!” God exclaimed, exasperated but defeated. “There is one piece of land left, it is the best land in all the world and I was saving it for myself. But I will give it to you if you would please just SHUT UP!”
And so the Greeks were given the land of Greece.
An unexpected visit to Istanbul
&& [ Greece ] && 0 comments
Here I am in Istanbul (not Constantinople) the city on the Bosporus, the ribbon of land separating Europe from Asia and the Black sea from the Sea of Marmara and thus the Aegean to the East. As my plane glided downward and spiraled towards the glittering city I thought about the Golden Fleece and if it had seen a similar view on it’s journey from Greece to Turkey 3 thousand years ago.
I had hoped to connect to my flight to Thessaloniki immediately, but Turkey wanted me to stay. Late flight, missed connection, security, visas, immigration (twice) and eventually a cramped ride in an airport shuttle to some hotel somewhere in Istanbul, an unsettling 45 minutes from the airport.
So here I am typing this out at 01:00, too nervous to sleep (for fear of missing another flight) but with nothing else really to do.
Travel has gotten faster in the modern age, but I wonder if it hasn’t lost some of it’s humanity. Dysentery sucks, but if the travelers of a few hundred years ago looked upon the conditions of airline travelers today, the lines, the turnstiles and the cramped conditions they might just liken us to cattle.
Hopefully I will see Greece tomorrow.
Creating nice looking topo maps for use in GraniteMaps
&& [ cartography, code, granitemaps ] && 0 comments
The goal of GraniteMaps is to provide accurate and educational maps for people participating in outdoor activities, so a large part of the project is creating maps that are pleasing to the eye.
The map displayed in granitemaps is actually two layers: the “base map” and the trail layer. The base map is is responsible for displaying the details of the map’s area such as land boundaries, rivers/lakes, major roads and elevation. The trail layer is an overlay of the actual trails and points of interest.
Currently GraniteMaps uses The National Map provided by the USGS for the base layer. It’s a good public domain map that includes major roads, hillshading, contour lines and place names. It does have it’s issues, however:
- The map is rendered without anti-aliasing which means fonts look jagged. The rest of the render just looks dated, like 90’s jpeg compression was used.
- Many of the minor roads are rendered it too low a resolution. This means that many of the “lesser used” roads, i.e the roads we care about in GraniteMaps, are rendered without enough data points. This causes roads to cut across contour lines, have harsh angles, and in general just not appear where they are supposed to.
- Not customizable. The map is provided in JPG format which you can use in slippy maps, but what you see is what you get.
For these reasons (especially #2) I concluded that The National Map would not be satisfactory for use in GraniteMaps’ next map.
The solution is to create a custom base layer for use in GraniteMaps. After a few days of getting familiarized with the GIS landscape, I set to work on creating a nice looking map using MapBox’s TileMill. A good starting point was the osm-bright project which pulls openstreetmap data from your local PostGIS database to create a fully featured street map. Elevation data is a must have, so after following this great article by Steve Bennett I loaded some data from the Shuttle Radar Topography Mission into the map to provide contours and hillshading. After that is was a matter of tweaking the CartoCSS rules to get the desired look right. The preliminary result:

The rendering isn’t perfect, but it’s a good start and already superior to The National Map. In case anyone else is interested in creating their own topo map in a similar fashion, the style files are available on github!
Keep enjoying these beautiful winter months out on the trail!
Hello World! In AngularJS
&& [ code ] && 0 comments
My coworker recently complained to me how hard it was to find a simple “Hello World” program in AngularJS. I did a google search and found that indeed, all the simplest examples still asked the user to set up a bunch of boilerplate, file structure, etc.
Here is the simplest Hello World in AngularJS I could come up with, and it still shows 2 way binding:
{{< highlight html >}}
Hello, {{world}}!
{{< / highlight >}}
Photographing the Triangulum Galaxy
&& [ astronomy ] && 0 comments

This will most likely be my last “Photographing X space thing” where X is some object we studied in Observational Astronomy at Cabrillo College. The first was Comet Jacques, a small icy object moving within our solar system. Next up was the beautiful Great Nebula in Orion, a star factory near to us in our own galaxy. Here finally we have the Triangulum Galaxy one of the closest galaxies in our local group.
It was a bit low in the sky, so the photo turned out slightly noisy. Overall, I’m again pleased with the result.
Astronomy 8A at Cabrillo was a great experience and I would recommend it to anyone with even the slightest interest in Astronomy. Hanging out with cool people 3 hours once a week, playing with telescopes, and taking photos on the big one in the dome? Yes please, will do again.
Photographing the Great Nebula in Orion
&& [ astronomy ] && 0 comments

The winter skies bring new treasures. The Great Nebula in Orion, also known as Messier 42, or just the Orion Nebula, is one of the brightest nebula in the night sky located in, you guessed it, Orion. The nebula is actually visible to the naked eye: to find it look at Orion and locate the 3 “stars” that make up his “sheath”. The middle star is not a star, it is the nebula.
Being so bright, M42 is one of the most photographed objects in the night sky so it was just a matter of waiting for it to be high enough for us to shoot at Cabrillo College. We took a series of 5 minute exposures, and after a bit of processing this is the result. It is a bit out of focus, but strikingly beautiful nonetheless.
Photographing Comet Jacques
&& [ astronomy ] && 0 comments

This is Comet Jacques. There are many photos of it online, but this one is mine.
This photo was taken on September 23rd, 2014 when the comet was about 1AU from earth, using a SBIG ST2000XCM color CCD camera mounted on a 12” Meade LX200.
It was a little late to be photographing this comet, but I couldn’t resist the opportunity to caputre it. And with all the excitement about the Rosetta mission recently, I thought it would be a great time to fix up the image. So here it is.
Building a trail map for Android using Ionic and Leaflet
&& [ code, cartography, granitemaps, featured ] && 1 comments

Edit 11/27/2014: GraniteMaps Santa Cruz is now available on the iOS store! link
It took me a while, but over the weekend I officially submitted my first app into the Google Play Store:
GraniteMaps: Santa Cruz is a digital trail map for those looking to hike, ride or trot the trails in and around Santa Cruz, CA. GraniteMaps: Santa Cruz provides an easy to read topographical map, current location, trail list, and extra information on local wildlife.
So technically, how did all this come together? Using a bunch of awesome libraries held together by dirty hacks, of course!
Ionic Framework
When starting a new project the first decision you make is which framework you want to use, if any. The decision usually depends on many factors: familiarity with the technology, maturity of the library, userbase, and of course the name. I’m a bigger fan of Doric architecture but I went with the Ionic Framework anyway because I am already familiar with web technologies. As a bonus your project gets to be “platform agnostic” - whether or not this is true I have yet to see.
Once you get past the unease of installing yet another node application globally getting started with the tooling is very easy. Ionic’s main executable can generate a basic skeleton app with a few tabs and some example code. Then it’s up to you to fill in the rest. Building and deploying to an Android device is a trivial, once you have the Android SDK installed. After bootstrapping the project the only commands I ever found myself running regularly during development were ionic serve to start the built-in development server, and ionic run android to deploy to my phone for testing.
Besides wrapping Cordova to get your webapp running in a web container on smartphones, Ionic is a collection Javascript and CSS libraries nefariously designed to deceive your users into thinking they are running a real app. It works well: your app will have native looking controls and transitions and respond to touch almost as well as native. Angular-JS is the weapon of choice to do the actual work, this should be great news to all those javascript kiddies already familiar with client side JS frameworks.
Ionic is opinionated in some areas and I’m fine with most of them but I must to complain about the choice of using ui-router instead of ng-route. ui-router is overly complex, impossible to understand and horrendously documented. Now that I think about it, so is ng-route. And pretty much the entire Angular library. So really I have nothing to complain about except everything. Moving on…
Leaflet
When it is convenient for me I like to tell Google to suck it. Luckily there exists this great library called Leaflet that is awesome for working with maps, so no Google Maps for me. Leaflet has all the features I need: custom tiles, GeoJSON support, and custom markers.
To generate awesome custom tiles, I used Mobile Atlas Creator. This lets you export a folder structure containing tiles that Leaflet can read instead of using an online source. In my case, I created tiles from USGS topographical maps.
To work with the actual GPS tracks, I used GPS Logger for Android to collect the data, and Viking to massage it into it’s final GeoJSON form.
Then it’s simply a matter of feeding the files to Leaflet. Simple, sort of. I decided to use an angular directive for leaflet instead of using the library directly so I could get some fancy two way binding and stuff. This directive turned out to be horribly buggy and I found myself using leafletData.getMap() constantly anyway to get direct access to leaflet. In hindsight I should have just saved myself the frustration and used leaflet.js directly, which was nothing but awesome.
I did start to see a performance hit as I got to adding the maximum number of trails in the app. On some older phones, it is visibly laggy. This is one of the trade offs you must make when decided to use something like Ionic instead of native. All in all though, performance was good.
Conclusion
Ionic: Good. Leaflet: Great. Actually riding: Better than both.
Building this app was an enjoyable and educational experience. With a few tweaks, I wouldn’t hesitate to use the same stack again, especially as Ionic is continually improving.
As for the app itself I admit it is rewarding to have an app in a smart phone store that you can tell your friends to install. If anyone will actually use it remains to be seen. I even managed to squeeze an easter egg in. There are trails in that map that are hidden, and only nofreds can access them with special knowledge. Good luck and thanks for reading.
Making ng-grid scroll and select naturally with arrow keys
&& [ code ] && 0 comments
The default behaviour of angular’s ng-grid library while using multiselect is a little strange.
By default using the arrow keys will select multiple rows. I was looking for behaviour that would only select rows if ctrl or shift were being held.
ng-grid also seems to have an issue with not showing the currently selected row in the viewport, causing the table not to scroll properly. The following code placed in your gridOptions object addresses both issues:
{{< highlight javascript >}} beforeSelectionChange: function(rowItem, event){ if(!event.ctrlKey && !event.shiftKey && event.type != ‘click’){ var grid = $scope.gridOptions.ngGrid; grid.$viewport.scrollTop(rowItem.offsetTop - (grid.config.rowHeight * 2)); angular.forEach($scope.myData, function(data, index){ $scope.gridOptions.selectRow(index, false); }); } return true; }, {{< / highlight >}}
Here is a plunker demonstrating how the table behaves:
Happy coding.
A Troop of Monkeys Crosses the Road
&& [ photography, featured ] && 2 comments
Over the last week in Nicaragua I’ve seen a lot of new and interesting wildlife. I spotted a fearless pygmy owl on my first day here that let me get within 10 feet while shooting photos! Last night we went to a beach to watch some sea turles lay their eggs, that was pretty cool too. But it’s hard to beat the mantled howler monkey.
These guys are abundant here in SW Nicaragua, and there are several troops alone in Balcones de Majagual. Yesterday I was fortunate enough to witness an entire troop (troop is a group of monkeys) pass me by overhead. Where the road cuts through the forest the canopy is thinned, this makes it difficult for the monkeys to cross as there are few suitable areas to do it. Lucky for me, I just happened to be directly underneath such an area.
Most of the howlers were too quick for me to catch on camera, but there were two younglings in the troop, and the adults they encumbered moved slow enogh that I was able to get some awesome photos.
The tails are amazing. Notice how the youngling’s tail wraps around the adult’s in order to fasten itself on.
If only I could have caputres the sound as well. The quiet ooh ohh ahh ahhs of encouragment spoken from the already crossed howlers to the ones still working up the courage to make the jump were priceless.
Check out this animated gif of an adult howler making the crossing, but oh no! She’s left something behind!

But the youngling must get to the other side and so she does. Not without taking a second to check me out on the way!
