Forráskód Böngészése

Move site generator to hugo

Thomas Dy 9 éve
szülő
commit
cdb04a6eb5
100 módosított fájl, 5903 hozzáadás és 7189 törlés
  1. 0 13
      Guardfile
  2. 11 0
      Makefile
  3. 0 616
      conf.py
  4. 15 0
      config.toml
  5. 37 40
      content/posts/cloudflare-shenanigans.md
  6. 31 27
      content/posts/console-keymap-switching.md
  7. 10 10
      content/posts/elevation-data-in-otp.md
  8. 12 10
      content/posts/fare-data.md
  9. 6 8
      content/posts/geocoding-services.md
  10. 7 9
      content/posts/graphserver.md
  11. 209 0
      content/posts/gtfs-editor.md
  12. 10 10
      content/posts/highways-in-otp.md
  13. 6 10
      content/posts/is-my-terminal-window-active.md
  14. 15 15
      content/posts/jeep-and-bus-schedules.md
  15. 7 9
      content/posts/jeepney-and-bus-routes.md
  16. 7 9
      content/posts/one-bus-or-maybe-jeep-away.md
  17. 7 9
      content/posts/open-trip-planner.md
  18. 7 9
      content/posts/philippine-transit-app-challenge.md
  19. 7 9
      content/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.md
  20. 45 37
      content/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.md
  21. 6 8
      content/posts/transit-wand.md
  22. 0 9
      files/assets/css/custom.css
  23. 0 103
      output/2013/index.html
  24. 0 70
      output/2015/index.html
  25. 0 0
      output/404.html
  26. 0 67
      output/archive.html
  27. 0 65
      output/assets/css/code.css
  28. 0 9
      output/assets/css/custom.css
  29. 0 1
      output/assets/css/rst.css
  30. 15 6
      output/assets/css/theme.css
  31. 0 67
      output/categories/cloudflare.html
  32. 0 41
      output/categories/cloudflare.xml
  33. 0 69
      output/categories/index.html
  34. 0 67
      output/categories/lets-debug.html
  35. 0 178
      output/categories/lets-debug.xml
  36. 0 100
      output/categories/philippine-transit-app.html
  37. 0 321
      output/categories/philippine-transit-app.xml
  38. 0 103
      output/categories/programming.html
  39. 0 324
      output/categories/programming.xml
  40. 0 76
      output/categories/sysadmin.html
  41. 0 168
      output/categories/sysadmin.xml
  42. 0 67
      output/categories/systemd.html
  43. 0 49
      output/categories/systemd.xml
  44. 0 67
      output/categories/tiddlywiki.html
  45. 0 77
      output/categories/tiddlywiki.xml
  46. 0 64
      output/galleries/index.html
  47. 0 2
      output/galleries/rss.xml
  48. BIN
      output/galleries/transit/gtfs_preview.thumbnail.jpg
  49. 0 100
      output/galleries/transit/index.html
  50. BIN
      output/galleries/transit/onebusaway1.thumbnail.png
  51. BIN
      output/galleries/transit/onebusaway2.thumbnail.png
  52. BIN
      output/galleries/transit/onebusaway3.thumbnail.png
  53. BIN
      output/galleries/transit/otp1.thumbnail.png
  54. BIN
      output/galleries/transit/otp2.thumbnail.png
  55. BIN
      output/galleries/transit/otpelevation.thumbnail.png
  56. BIN
      output/galleries/transit/otproundabout.thumbnail.png
  57. 0 1
      output/galleries/transit/rss.xml
  58. BIN
      output/galleries/transit/upkatipunan.jpg
  59. BIN
      output/galleries/transit/upkatipunan.thumbnail.jpg
  60. 0 354
      output/index-1.html
  61. 0 227
      output/index-2.html
  62. 0 125
      output/index-3.html
  63. 310 263
      output/index.html
  64. 1 0
      output/page/1.html
  65. 239 0
      output/page/2.html
  66. 505 0
      output/page/3.html
  67. 136 0
      output/page/4.html
  68. 162 0
      output/posts.html
  69. 140 123
      output/posts/cloudflare-shenanigans.html
  70. 153 151
      output/posts/console-keymap-switching.html
  71. 0 50
      output/posts/console-keymap-switching.md
  72. 127 112
      output/posts/elevation-data-in-otp.html
  73. 163 135
      output/posts/fare-data.html
  74. 128 110
      output/posts/geocoding-services.html
  75. 0 22
      output/posts/geocoding-services.md
  76. 126 110
      output/posts/graphserver.html
  77. 0 20
      output/posts/graphserver.md
  78. 247 218
      output/posts/gtfs-editor.html
  79. 0 206
      output/posts/gtfs-editor.md
  80. 131 116
      output/posts/highways-in-otp.html
  81. 144 118
      output/posts/is-my-terminal-window-active.html
  82. 136 119
      output/posts/jeep-and-bus-schedules.html
  83. 130 112
      output/posts/jeepney-and-bus-routes.html
  84. 0 22
      output/posts/jeepney-and-bus-routes.md
  85. 137 116
      output/posts/one-bus-or-maybe-jeep-away.html
  86. 156 125
      output/posts/open-trip-planner.html
  87. 0 48
      output/posts/open-trip-planner.md
  88. 121 105
      output/posts/philippine-transit-app-challenge.html
  89. 124 109
      output/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html
  90. 784 0
      output/posts/rss.xml
  91. 177 157
      output/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html
  92. 0 91
      output/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.md
  93. 135 115
      output/posts/transit-wand.html
  94. 0 28
      output/posts/transit-wand.md
  95. 0 4
      output/robots.txt
  96. 727 175
      output/rss.xml
  97. 94 143
      output/sitemap.xml
  98. 0 52
      output/sitemapindex.xml
  99. 0 57
      posts/cloudflare-shenanigans.md
  100. 0 22
      posts/elevation-data-in-otp.md

+ 0 - 13
Guardfile

@@ -1,13 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-from livereload.task import Task
-import json
-import subprocess
-
-def f():
-    subprocess.call(("nikola", "build"))
-
-fdata = json.loads('''["conf.py", "themes", "templates", "galleries", "posts", "posts", "stories", "stories", ""]''')
-
-for watch in fdata:
-    Task.add(watch, f)

+ 11 - 0
Makefile

@@ -0,0 +1,11 @@
+PHONY: server build deploy
+
+server:
+	hugo server --baseURL="http://pleasantprogrammer.com" --appendPort=false --buildDrafts
+
+build:
+	hugo
+
+deploy: build
+	git commit-tree -p master -m "updated" source:output | xargs git update-ref refs/heads/master
+	git push

+ 0 - 616
conf.py

@@ -1,616 +0,0 @@
-## -*- coding: utf-8 -*-
-# -*- coding: utf-8 -*-
-
-from __future__ import unicode_literals
-import time
-
-##############################################
-# Configuration, please edit
-##############################################
-
-# Data about this site
-BLOG_AUTHOR = "Thomas Dy"
-BLOG_TITLE = "Pleasant Programmer"
-# This is the main URL for your site. It will be used
-# in a prominent link
-SITE_URL = "http://pleasantprogrammer.com/"
-# This is the URL where nikola's output will be deployed.
-# If not set, defaults to SITE_URL
-# BASE_URL = "${SITE_URL}"
-BLOG_EMAIL = ""
-BLOG_DESCRIPTION = ""
-
-# Nikola is multilingual!
-#
-# Currently supported languages are:
-# bg     Bulgarian
-# ca     Catalan
-# de     German
-# el     Greek [NOT gr!]
-# en     English
-# eo     Esperanto
-# es     Spanish
-# fa     Persian
-# fr     French
-# hr     Croatian
-# it     Italian
-# jp     Japanese
-# nl     Dutch
-# pt_br  Portuguese (Brasil)
-# pl     Polish
-# ru     Russian
-# tr_tr  Turkish (Turkey)
-# zh_cn  Chinese (Simplified)
-#
-# If you want to use Nikola with a non-supported language you have to provide
-# a module containing the necessary translations
-# (p.e. look at the modules at: ./nikola/data/themes/default/messages/fr.py).
-# If a specific post is not translated to a language, then the version
-# in the default language will be shown instead.
-
-# What is the default language?
-DEFAULT_LANG = "en"
-
-# What other languages do you have?
-# The format is {"translationcode" : "path/to/translation" }
-# the path will be used as a prefix for the generated pages location
-TRANSLATIONS = {
-    DEFAULT_LANG: "",
-    # Example for another language:
-    # "es": "./es",
-}
-
-# Links for the sidebar / navigation bar.
-# You should provide a key-value pair for each used language.
-NAVIGATION_LINKS = {
-    DEFAULT_LANG: (
-        ('/archive.html', 'Archives'),
-        ('/categories/index.html', 'Tags'),
-        ('/rss.xml', 'RSS'),
-    ),
-}
-
-USE_BUNDLES = False
-WRITE_TAG_CLOUD = False
-
-##############################################
-# Below this point, everything is optional
-##############################################
-
-# POSTS and PAGES contains (wildcard, destination, template) tuples.
-#
-# The wildcard is used to generate a list of reSt source files
-# (whatever/thing.txt).
-#
-# That fragment could have an associated metadata file (whatever/thing.meta),
-# and opcionally translated files (example for spanish, with code "es"):
-#     whatever/thing.txt.es and whatever/thing.meta.es
-#
-# From those files, a set of HTML fragment files will be generated:
-# cache/whatever/thing.html (and maybe cache/whatever/thing.html.es)
-#
-# These files are combinated with the template to produce rendered
-# pages, which will be placed at
-# output / TRANSLATIONS[lang] / destination / pagename.html
-#
-# where "pagename" is the "slug" specified in the metadata file.
-#
-# The difference between POSTS and PAGES is that POSTS are added
-# to feeds and are considered part of a blog, while PAGES are
-# just independent HTML pages.
-#
-
-POSTS = (
-    ("posts/*.md", "posts", "post.tmpl"),
-    ("posts/*.txt", "posts", "post.tmpl")
-)
-PAGES = (
-    ("stories/*.md", "stories", "story.tmpl"),
-    ("stories/*.txt", "stories", "story.tmpl")
-)
-
-# One or more folders containing files to be copied as-is into the output.
-# The format is a dictionary of "source" "relative destination".
-# Default is:
-# FILES_FOLDERS = {'files': '' }
-# Which means copy 'files' into 'output'
-
-# A mapping of languages to file-extensions that represent that language.
-# Feel free to add or delete extensions to any list, but don't add any new
-# compilers unless you write the interface for it yourself.
-#
-# 'rest' is reStructuredText
-# 'markdown' is MarkDown
-# 'html' assumes the file is html and just copies it
-COMPILERS = {
-    "markdown": ('.md', '.mdown', '.markdown')
-}
-
-# Create by default posts in one file format?
-# Set to False for two-file posts, with separate metadata.
-# ONE_FILE_POSTS = True
-
-# If this is set to True, then posts that are not translated to a language
-# LANG will not be visible at all in the pages in that language.
-# If set to False, the DEFAULT_LANG version will be displayed for
-# untranslated posts.
-# HIDE_UNTRANSLATED_POSTS = False
-
-# Paths for different autogenerated bits. These are combined with the
-# translation paths.
-
-# Final locations are:
-# output / TRANSLATION[lang] / TAG_PATH / index.html (list of tags)
-# output / TRANSLATION[lang] / TAG_PATH / tag.html (list of posts for a tag)
-# output / TRANSLATION[lang] / TAG_PATH / tag.xml (RSS feed for a tag)
-# TAG_PATH = "categories"
-
-# If TAG_PAGES_ARE_INDEXES is set to True, each tag's page will contain
-# the posts themselves. If set to False, it will be just a list of links.
-# TAG_PAGES_ARE_INDEXES = True
-
-# Final location is output / TRANSLATION[lang] / INDEX_PATH / index-*.html
-# INDEX_PATH = ""
-
-# Create per-month archives instead of per-year
-# CREATE_MONTHLY_ARCHIVE = False
-# Final locations for the archives are:
-# output / TRANSLATION[lang] / ARCHIVE_PATH / ARCHIVE_FILENAME
-# output / TRANSLATION[lang] / ARCHIVE_PATH / YEAR / index.html
-# output / TRANSLATION[lang] / ARCHIVE_PATH / YEAR / MONTH / index.html
-# ARCHIVE_PATH = ""
-# ARCHIVE_FILENAME = "archive.html"
-
-# Final locations are:
-# output / TRANSLATION[lang] / RSS_PATH / rss.xml
-# RSS_PATH = ""
-
-# Number of posts in RSS feeds
-# FEED_LENGTH = 10
-
-# Slug the Tag URL easier for users to type, special characters are
-# often removed or replaced as well.
-# SLUG_TAG_PATH = True
-
-# A list of redirection tuples, [("foo/from.html", "/bar/to.html")].
-#
-# A HTML file will be created in output/foo/from.html that redirects
-# to the "/bar/to.html" URL. notice that the "from" side MUST be a
-# relative URL.
-#
-# If you don't need any of these, just set to []
-# REDIRECTIONS = ${REDIRECTIONS}
-
-# Commands to execute to deploy. Can be anything, for example,
-# you may use rsync:
-# "rsync -rav output/* joe@my.site:/srv/www/site"
-# And then do a backup, or ping pingomatic.
-# To do manual deployment, set it to []
-DEPLOY_COMMANDS = {
-    'default': [
-        'git commit-tree -p master -m "updated" source:output | xargs git update-ref refs/heads/master',
-        'git push'
-    ]
-}
-
-# Where the output site should be located
-# If you don't use an absolute path, it will be considered as relative
-# to the location of conf.py
-# OUTPUT_FOLDER = 'output'
-
-# where the "cache" of partial generated content should be located
-# default: 'cache'
-# CACHE_FOLDER = 'cache'
-
-# Filters to apply to the output.
-# A directory where the keys are either: a file extensions, or
-# a tuple of file extensions.
-#
-# And the value is a list of commands to be applied in order.
-#
-# Each command must be either:
-#
-# A string containing a '%s' which will
-# be replaced with a filename. The command *must* produce output
-# in place.
-#
-# Or:
-#
-# A python callable, which will be called with the filename as
-# argument.
-#
-# By default, there are no filters.
-#
-# Many filters are shipped with Nikola.  A list is available in the manual:
-# <http://getnikola.com/handbook.html#post-processing-filters>
-# FILTERS = {
-#    ".jpg": ["jpegoptim --strip-all -m75 -v %s"],
-# }
-
-# Create a gzipped copy of each generated file. Cheap server-side optimization.
-# GZIP_FILES = False
-# File extensions that will be compressed
-# GZIP_EXTENSIONS = ('.txt', '.htm', '.html', '.css', '.js', '.json')
-# Use an external gzip command? None means no.
-# Example: GZIP_COMMAND = "pigz -k {filename}"
-# GZIP_COMMAND = None
-
-# #############################################################################
-# Image Gallery Options
-# #############################################################################
-
-# Galleries are folders in galleries/
-# Final location of galleries will be output / GALLERY_PATH / gallery_name
-# GALLERY_PATH = "galleries"
-# THUMBNAIL_SIZE = 180
-# MAX_IMAGE_SIZE = 1280
-# USE_FILENAME_AS_TITLE = True
-#
-# If set to False, it will sort by filename instead. Defaults to True
-# GALLERY_SORT_BY_DATE = True
-
-# #############################################################################
-# HTML fragments and diverse things that are used by the templates
-# #############################################################################
-
-# Data about post-per-page indexes
-# INDEXES_TITLE = ""  # If this is empty, the default is BLOG_TITLE
-# INDEXES_PAGES = ""  # If this is empty, the default is 'old posts page %d'
-# translated
-
-# Name of the theme to use.
-THEME = "pleasant3"
-
-# Color scheme to be used for code blocks. If your theme provides
-# "assets/css/code.css" this is ignored.
-# Can be any of autumn borland bw colorful default emacs friendly fruity manni
-# monokai murphy native pastie perldoc rrt tango trac vim vs
-# CODE_COLOR_SCHEME = 'default'
-
-# If you use 'site-reveal' theme you can select several subthemes
-# THEME_REVEAL_CONFIG_SUBTHEME = 'sky'
-# You can also use: beige/serif/simple/night/default
-
-# Again, if you use 'site-reveal' theme you can select several transitions
-# between the slides
-# THEME_REVEAL_CONFIG_TRANSITION = 'cube'
-# You can also use: page/concave/linear/none/default
-
-# date format used to display post dates.
-# (str used by datetime.datetime.strftime)
-# DATE_FORMAT = '%Y-%m-%d %H:%M'
-
-# FAVICONS contains (name, file, size) tuples.
-# Used for create favicon link like this:
-# <link rel="name" href="file" sizes="size"/>
-# For creating favicons, take a look at:
-# http://www.netmagazine.com/features/create-perfect-favicon
-# FAVICONS = {
-#     ("icon", "/favicon.ico", "16x16"),
-#     ("icon", "/icon_128x128.png", "128x128"),
-# }
-
-# Show only teasers in the index pages? Defaults to False.
-# INDEX_TEASERS = False
-
-# A HTML fragment with the Read more... link.
-# The following tags exist and are replaced for you:
-# {link}        A link to the full post page.
-# {read_more}   The string “Read more” in the current language.
-# {{            A literal { (U+007B LEFT CURLY BRACKET)
-# }}            A literal } (U+007D RIGHT CURLY BRACKET)
-# READ_MORE_LINK = '<p class="more"><a href="{link}">{read_more}…</a></p>'
-
-# A HTML fragment describing the license, for the sidebar.
-LICENSE = """
-<a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.5/ar/">
-<img alt="Creative Commons License BY-NC-SA"
-style="border-width:0; margin-bottom:12px;"
-src="http://i.creativecommons.org/l/by-nc-sa/2.5/ar/88x31.png"></a>"""
-# I recommend using the Creative Commons' wizard:
-# http://creativecommons.org/choose/
-# LICENSE = """
-# <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/2.5/ar/">
-# <img alt="Creative Commons License BY-NC-SA"
-# style="border-width:0; margin-bottom:12px;"
-# src="http://i.creativecommons.org/l/by-nc-sa/2.5/ar/88x31.png"></a>"""
-
-# A small copyright notice for the page footer (in HTML).
-# Default is ''
-CONTENT_FOOTER = '<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png" /></a> &copy; {date} {author} - Powered by <a href="http://getnikola.com">Nikola</a>'
-CONTENT_FOOTER = CONTENT_FOOTER.format(email=BLOG_EMAIL,
-                                       author=BLOG_AUTHOR,
-                                       date=time.gmtime().tm_year)
-
-# To use comments, you can choose between different third party comment
-# systems, one of "disqus", "livefyre", "intensedebate", "moot",
-#                 "googleplus" or "facebook"
-COMMENT_SYSTEM = "disqus"
-# And you also need to add your COMMENT_SYSTEM_ID which
-# depends on what comment system you use. The default is
-# "nikolademo" which is a test account for Disqus. More information
-# is in the manual.
-COMMENT_SYSTEM_ID = "pleasantprog"
-
-# Enable annotations using annotateit.org?
-# If set to False, you can still enable them for individual posts and pages
-# setting the "annotations" metadata.
-# If set to True, you can disable them for individual posts and pages using
-# the "noannotations" metadata.
-# ANNOTATIONS = False
-
-# Create index.html for story folders?
-# STORY_INDEX = False
-# Enable comments on story pages?
-# COMMENTS_IN_STORIES = False
-# Enable comments on picture gallery pages?
-# COMMENTS_IN_GALLERIES = False
-
-# What file should be used for directory indexes?
-# Defaults to index.html
-# Common other alternatives: default.html for IIS, index.php
-# INDEX_FILE = "index.html"
-
-# If a link ends in /index.html,  drop the index.html part.
-# http://mysite/foo/bar/index.html => http://mysite/foo/bar/
-# (Uses the INDEX_FILE setting, so if that is, say, default.html,
-# it will instead /foo/default.html => /foo)
-# (Note: This was briefly STRIP_INDEX_HTML in v 5.4.3 and 5.4.4)
-# Default = False
-# STRIP_INDEXES = False
-
-# Should the sitemap list directories which only include other directories
-# and no files.
-# Default to True
-# If this is False
-# e.g. /2012 includes only /01, /02, /03, /04, ...: don't add it to the sitemap
-# if /2012 includes any files (including index.html)... add it to the sitemap
-# SITEMAP_INCLUDE_FILELESS_DIRS = True
-
-# Instead of putting files in <slug>.html, put them in
-# <slug>/index.html. Also enables STRIP_INDEXES
-# This can be disabled on a per-page/post basis by adding
-#    .. pretty_url: False
-# to the metadata
-# PRETTY_URLS = False
-
-# If True, publish future dated posts right away instead of scheduling them.
-# Defaults to False.
-# FUTURE_IS_NOW = False
-
-# If True, future dated posts are allowed in deployed output
-# Only the individual posts are published/deployed; not in indexes/sitemap
-# Generally, you want FUTURE_IS_NOW and DEPLOY_FUTURE to be the same value.
-# DEPLOY_FUTURE = False
-# If False, draft posts will not be deployed
-# DEPLOY_DRAFTS = True
-
-# Allows scheduling of posts using the rule specified here (new_post -s)
-# Specify an iCal Recurrence Rule: http://www.kanzaki.com/docs/ical/rrule.html
-# SCHEDULE_RULE = ''
-# If True, use the scheduling rule to all posts by default
-# SCHEDULE_ALL = False
-# If True, schedules post to today if possible, even if scheduled hour is over
-# SCHEDULE_FORCE_TODAY = False
-
-# Do you want a add a Mathjax config file?
-# MATHJAX_CONFIG = ""
-
-# If you are using the compile-ipynb plugin, just add this one:
-#MATHJAX_CONFIG = """
-#<script type="text/x-mathjax-config">
-#MathJax.Hub.Config({
-#    tex2jax: {
-#        inlineMath: [ ['$','$'], ["\\\(","\\\)"] ],
-#        displayMath: [ ['$$','$$'], ["\\\[","\\\]"] ]
-#    },
-#    displayAlign: 'left', // Change this to 'center' to center equations.
-#    "HTML-CSS": {
-#        styles: {'.MathJax_Display': {"margin": 0}}
-#    }
-#});
-#</script>
-#"""
-
-# Do you want to customize the nbconversion of your IPython notebook?
-# IPYNB_CONFIG = {}
-# With the following example configuracion you can use a custom jinja template
-# called `toggle.tpl` which has to be located in your site/blog main folder:
-# IPYNB_CONFIG = {'Exporter':{'template_file': 'toggle'}}
-
-# What MarkDown extensions to enable?
-# You will also get gist, nikola and podcast because those are
-# done in the code, hope you don't mind ;-)
-# MARKDOWN_EXTENSIONS = ['fenced_code', 'codehilite']
-
-# Social buttons. This is sample code for AddThis (which was the default for a
-# long time). Insert anything you want here, or even make it empty.
-# SOCIAL_BUTTONS_CODE = """
-# <!-- Social buttons -->
-# <div id="addthisbox" class="addthis_toolbox addthis_peekaboo_style addthis_default_style addthis_label_style addthis_32x32_style">
-# <a class="addthis_button_more">Share</a>
-# <ul><li><a class="addthis_button_facebook"></a>
-# <li><a class="addthis_button_google_plusone_share"></a>
-# <li><a class="addthis_button_linkedin"></a>
-# <li><a class="addthis_button_twitter"></a>
-# </ul>
-# </div>
-# <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4f7088a56bb93798"></script>
-# <!-- End of social buttons -->
-# """
-SOCIAL_BUTTONS_CODE = ""
-
-# Hide link to source for the posts?
-# HIDE_SOURCELINK = False
-# Copy the source files for your pages?
-# Setting it to False implies HIDE_SOURCELINK = True
-# COPY_SOURCES = True
-
-# Modify the number of Post per Index Page
-# Defaults to 10
-INDEX_DISPLAY_POST_COUNT = 5
-
-# RSS_LINK is a HTML fragment to link the RSS or Atom feeds. If set to None,
-# the base.tmpl will use the feed Nikola generates. However, you may want to
-# change it for a feedburner feed or something else.
-# RSS_LINK = None
-
-# Show only teasers in the RSS feed? Default to True
-# RSS_TEASERS = True
-
-# A search form to search this site, for the sidebar. You can use a google
-# custom search (http://www.google.com/cse/)
-# Or a duckduckgo search: https://duckduckgo.com/search_box.html
-# Default is no search form.
-# SEARCH_FORM = ""
-#
-# This search form works for any site and looks good in the "site" theme where
-# it appears on the navigation bar:
-#
-#SEARCH_FORM = """
-#<!-- Custom search -->
-#<form method="get" id="search" action="http://duckduckgo.com/"
-# class="navbar-form pull-left">
-#<input type="hidden" name="sites" value="%s"/>
-#<input type="hidden" name="k8" value="#444444"/>
-#<input type="hidden" name="k9" value="#D51920"/>
-#<input type="hidden" name="kt" value="h"/>
-#<input type="text" name="q" maxlength="255"
-# placeholder="Search&hellip;" class="span2" style="margin-top: 4px;"/>
-#<input type="submit" value="DuckDuckGo Search" style="visibility: hidden;" />
-#</form>
-#<!-- End of custom search -->
-#""" % SITE_URL
-#
-# If you prefer a google search form, here's an example that should just work:
-#SEARCH_FORM = """
-#<!-- Custom search with google-->
-#<form id="search" action="http://google.com/search" method="get" class="navbar-form pull-left">
-#<input type="hidden" name="q" value="site:%s" />
-#<input type="text" name="q" maxlength="255" results="0" placeholder="Search"/>
-#</form>
-#<!-- End of custom search -->
-#""" % SITE_URL
-
-# Also, there is a local search plugin you can use, based on Tipue, but it requires setting several
-# options:
-
-# SEARCH_FORM = """
-# <span class="navbar-form pull-left">
-# <input type="text" id="tipue_search_input">
-# </span>"""
-#
-# BODY_END = """
-# <script type="text/javascript" src="/assets/js/tipuesearch_set.js"></script>
-# <script type="text/javascript" src="/assets/js/tipuesearch.js"></script>
-# <script type="text/javascript">
-# $(document).ready(function() {
-    # $('#tipue_search_input').tipuesearch({
-        # 'mode': 'json',
-        # 'contentLocation': '/assets/js/tipuesearch_content.json',
-        # 'showUrl': false
-    # });
-# });
-# </script>
-# """
-
-# EXTRA_HEAD_DATA = """
-# <link rel="stylesheet" type="text/css" href="/assets/css/tipuesearch.css">
-# <div id="tipue_search_content" style="margin-left: auto; margin-right: auto; padding: 20px;"></div>
-# """
-# ENABLED_EXTRAS = ['local_search']
-#
-###### End of local search example
-
-
-# Use content distribution networks for jquery and twitter-bootstrap css and js
-# If this is True, jquery is served from the Google CDN and twitter-bootstrap
-# is served from the NetDNA CDN
-# Set this to False if you want to host your site without requiring access to
-# external resources.
-# USE_CDN = False
-
-# Extra things you want in the pages HEAD tag. This will be added right
-# before </HEAD>
-# EXTRA_HEAD_DATA = ""
-# Google analytics or whatever else you use. Added to the bottom of <body>
-# in the default template (base.tmpl).
-# BODY_END = ""
-
-# The possibility to extract metadata from the filename by using a
-# regular expression.
-# To make it work you need to name parts of your regular expression.
-# The following names will be used to extract metadata:
-# - title
-# - slug
-# - date
-# - tags
-# - link
-# - description
-#
-# An example re is the following:
-# '(?P<date>\d{4}-\d{2}-\d{2})-(?P<slug>.*)-(?P<title>.*)\.md'
-# FILE_METADATA_REGEXP = None
-
-# Additional metadata that is added to a post when creating a new_post
-# ADDITIONAL_METADATA = {}
-
-# Nikola supports Twitter Card summaries / Open Graph.
-# Twitter cards make it possible for you to attach media to Tweets
-# that link to your content.
-#
-# IMPORTANT:
-# Please note, that you need to opt-in for using Twitter Cards!
-# To do this please visit
-# https://dev.twitter.com/form/participate-twitter-cards
-#
-# Uncomment and modify to following lines to match your accounts.
-# Specifying the id for either 'site' or 'creator' will be preferred
-# over the cleartext username. Specifying an ID is not necessary.
-# Displaying images is currently not supported.
-# TWITTER_CARD = {
-#     # 'use_twitter_cards': True,  # enable Twitter Cards / Open Graph
-#     # 'site': '@website',  # twitter nick for the website
-#     # 'site:id': 123456,  # Same as site, but the website's Twitter user ID
-#                           # instead.
-#     # 'creator': '@username',  # Username for the content creator / author.
-#     # 'creator:id': 654321,  # Same as creator, but the Twitter user's ID.
-# }
-
-
-# Post's dates are considered in GMT by default, if you want to use
-# another timezone, please set TIMEZONE to match. Check the available
-# list from Wikipedia:
-# http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
-# Also, if you want to use a different timezone in some of your posts,
-# you can use W3C-DTF Format (ex. 2012-03-30T23:00:00+02:00)
-#
-TIMEZONE = 'Asia/Manila'
-
-# If webassets is installed, bundle JS and CSS to make site loading faster
-# USE_BUNDLES = True
-
-# Plugins you don't want to use. Be careful :-)
-# DISABLED_PLUGINS = ["render_galleries"]
-
-# Experimental plugins - use at your own risk.
-# They probably need some manual adjustments - please see their respective
-# readme.
-# ENABLED_EXTRAS = [
-#     'planetoid',
-#     'ipynb',
-#     'local_search',
-#     'render_mustache',
-# ]
-
-# List of regular expressions, links matching them will always be considered
-# valid by "nikola check -l"
-# LINK_CHECK_WHITELIST = []
-
-# If set to True, enable optional hyphenation in your posts (requires pyphen)
-# HYPHENATE = False
-
-# Put in global_context things you want available on all your templates.
-# It can be anything, data, functions, modules, etc.
-
-GLOBAL_CONTEXT = {}

+ 15 - 0
config.toml

@@ -0,0 +1,15 @@
+baseurl = "http://pleasantprogrammer.com"
+rssuri = "rss.xml"
+theme = "pleasant"
+publishdir = "output"
+languageCode = "en-us"
+title = "Pleasant Programmer"
+uglyUrls = true
+pygmentsStyle = "default"
+pygmentsCodeFences = true
+disqusShortname = "pleasantprog"
+
+paginate = 5
+
+[taxonomies]
+tag = "tags"

+ 37 - 40
output/posts/cloudflare-shenanigans.md → content/posts/cloudflare-shenanigans.md

@@ -1,13 +1,9 @@
-<!--
-.. title: Cloudflare Shenanigans
-.. slug: cloudflare-shenanigans
-.. date: 2015-12-25 14:13:26 UTC+08:00
-.. tags: sysadmin, cloudflare
-.. category:
-.. link:
-.. description:
-.. type: text
--->
++++
+title = "Cloudflare Shenanigans"
+slug = "cloudflare-shenanigans"
+date = "2015-12-25"
+tags = [ "sysadmin", "cloudflare" ]
++++
 
 An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.
 
@@ -21,36 +17,37 @@ Since Cloudflare was essentially just a giant reverse proxy, theoretically there
 
 After more testing, we figured out that you could actually use any Cloudflare backed domain so long as we properly set the Host header. We just needed to find one still in the old range. Coincidentally, 4chan.org was. Which led to this wonderful commit
 
-    :::diff
-    commit 123456789abcdef
-    Author: ~~~~~~
-    Date:   ~~~~~~
-
-        4chan hack
-
-    diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java
-    --- a/src/com/client/common/Util.java
-    +++ b/src/com/client/common/Util.java
-    @@ -210,7 +210,8 @@ public class Util {
-            }
-
-            public static String getServerAddress(Context context) {
-    -               String address = "https://backend.client.com";
-    +               // String address = "https://backend.client.com";
-    +               String address = "https://4chan.org";
-                    if(!isDebug(context)) return address;
-                    try {
-    diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java
-    --- a/src/com/client/common/logging/APIClient.java
-    +++ b/src/com/client/common/logging/APIClient.java
-    @@ -101,6 +101,7 @@ public class APIClient {
-            private HttpResponse postInternal(String url, List<NameValuePair> data, boolean forRegistration) throws ClientProtocolException, IOException {
-                    HttpPost request = new HttpPost(Util.getServerAddress(mContext)+"/api/"+url);
-                    request.setHeader("X-API-VERSION", apiVersion);
-    +               request.setHeader("Host", "backend.client.com");
-
-                    if(data == null) {
-                            data = new ArrayList<NameValuePair>();
+```diff
+commit 123456789abcdef
+Author: ~~~~~~
+Date:   ~~~~~~
+
+    4chan hack
+
+diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java
+--- a/src/com/client/common/Util.java
++++ b/src/com/client/common/Util.java
+@@ -210,7 +210,8 @@ public class Util {
+        }
+
+        public static String getServerAddress(Context context) {
+-               String address = "https://backend.client.com";
++               // String address = "https://backend.client.com";
++               String address = "https://4chan.org";
+                if(!isDebug(context)) return address;
+                try {
+diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java
+--- a/src/com/client/common/logging/APIClient.java
++++ b/src/com/client/common/logging/APIClient.java
+@@ -101,6 +101,7 @@ public class APIClient {
+        private HttpResponse postInternal(String url, List<NameValuePair> data, boolean forRegistration) throws ClientProtocolException, IOException {
+                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+"/api/"+url);
+                request.setHeader("X-API-VERSION", apiVersion);
++               request.setHeader("Host", "backend.client.com");
+
+                if(data == null) {
+                        data = new ArrayList<NameValuePair>();
+```
 
 Eventually, we did decide to just abandon Cloudflare for the server. We probably weren't going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.
 

+ 31 - 27
posts/console-keymap-switching.md → content/posts/console-keymap-switching.md

@@ -1,11 +1,9 @@
-<!--
-.. link:
-.. description:
-.. tags: sysadmin, systemd
-.. date: 2013/10/29 20:02:06
-.. title: Console Keymap Switching
-.. slug: console-keymap-switching
--->
++++
+tags = [ "sysadmin", "systemd" ]
+date = "2013-10-29"
+title = "Console Keymap Switching"
+slug = "console-keymap-switching"
++++
 
 At the office, we have some people who use DVORAK. Normally, this isn't a problem. To each his own after all. It does become a bit problematic though, when we're dealing with the servers around the office.
 
@@ -19,32 +17,38 @@ After some further searching, I found [something close to what I wanted](http://
 
 In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. `kbrequest.target` is normally aliased to run the rescue service though, so you have to manually create the file in `/etc/systemd/system/kbrequest.target` and fill it with a description:
 
-    [Unit]
-    Description=kbrequest target
+```ini
+[Unit]
+Description=kbrequest target
+```
 
 We can then add a service to be run whenever the target is called. Something like `/etc/systemd/system/keymap-switch.service`:
 
-    [Unit]
-    Description=Keymap Switch Service
+```ini
+[Unit]
+Description=Keymap Switch Service
 
-    [Service]
-    Type=oneshot
-    ExecStart=/usr/local/bin/keymap-switch
+[Service]
+Type=oneshot
+ExecStart=/usr/local/bin/keymap-switch
 
-    [Install]
-    WantedBy=kbrequest.target
+[Install]
+WantedBy=kbrequest.target
+```
 
 After enabling said service, we only need the actual keymap switcher, `/usr/local/bin/keymap-switch`. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we're using SystemD, we can use that instead for managing which keymap we're actually using. It stores the current settings inside `/etc/vconsole.conf`. We can also then switch keymaps by using `localectl set-keymap`.
 
-    #!/bin/sh
-    source /etc/vconsole.conf
-
-    if [ "$TERM" = "dumb" ]; then
-      if [ "$KEYMAP" = "dvorak" ]; then
-        localectl set-keymap us
-      else
-        localectl set-keymap dvorak
-      fi
-    fi
+```sh
+#!/bin/sh
+source /etc/vconsole.conf
+
+if [ "$TERM" = "dumb" ]; then
+  if [ "$KEYMAP" = "dvorak" ]; then
+    localectl set-keymap us
+  else
+    localectl set-keymap dvorak
+  fi
+fi
+```
 
 After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.

+ 10 - 10
output/posts/elevation-data-in-otp.md → content/posts/elevation-data-in-otp.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/23 18:23:00
-.. title: Elevation Data in OTP
-.. slug: elevation-data-in-otp
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-23"
+title = "Elevation Data in OTP"
+slug = "elevation-data-in-otp"
++++
 
 ![OpenTripPlanner showing elevation data](../galleries/transit/otpelevation.png)
 
@@ -15,8 +13,10 @@ The [5 minute tutorial](https://github.com/openplans/OpenTripPlanner/wiki/FiveMi
 
 I don't know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use [GDAL](http://www.gdal.org/) for this. You'd just then run,
 
-     gdal_translate srtm41_90m_phl.img phil.tiff
+```text
+gdal_translate srtm41_90m_phl.img phil.tiff
+```
 
 Afterwards, it's just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you're running on limited RAM.
 
-I've actually hosted a [working example](http://maps.pleasantprogrammer.com). It's pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don't abuse it though.
+I've actually hosted a [working example](http://maps.pleasantprogrammer.com). It's pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don't abuse it though.

+ 12 - 10
output/posts/fare-data.md → content/posts/fare-data.md

@@ -1,15 +1,15 @@
-<!--
-.. link:
-.. description:
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/13 21:15:09
-.. title: Fare Data
-.. slug: fare-data
--->
++++
+title = "Fare Data"
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-13"
+slug = "fare-data"
++++
 
 As part of the data released by the DOTC, we also have the [fare matrix](http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/) for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the [LTFRB website](http://ltfrb.gov.ph/main/farerates). Generally, the fare scheme is represented as "pay *X* pesos for the first *Y* kilometers, pay *Z* for every succeeding kilometer." Instead of a table, we can simply represent this as a formula instead,
 
-    base_fare + (distance - initial) * per_km
+```text
+base_fare + (distance - initial) * per_km
+```
 
 The relevant values for the three services are:
 
@@ -46,7 +46,9 @@ The relevant values for the three services are:
 
 It isn't as simple as that though. Fares are also rounded to the nearest 25 centavos. So we'd need to round them off correctly. This can be achieved by doing,
 
-    round(calculated_fare * 4.0)/4.0
+```text
+round(calculated_fare * 4.0)/4.0
+```
 
 There's also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.
 

+ 6 - 8
posts/geocoding-services.md → content/posts/geocoding-services.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/09/25 12:26:59
-.. title: Geocoding Services
-.. slug: geocoding-services
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-09-25"
+title = "Geocoding Services"
+slug = "geocoding-services"
++++
 
 A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don't know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.
 

+ 7 - 9
posts/graphserver.md → content/posts/graphserver.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/23 14:48:29
-.. title: GraphServer
-.. slug: graphserver
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-23"
+title = "GraphServer"
+slug = "graphserver"
++++
 
 Link: [http://graphserver.github.io/graphserver/](http://graphserver.github.io/graphserver/)
 
@@ -17,4 +15,4 @@ A nice suggestion from the GraphServer instructions was to crop the OSM data to
 
 The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn't provide any alternate routes aside from that one. I'm not sure if it's a limitation of the provided routeserver, but I didn't bother checking if it supported parameters which might provide better routes.
 
-I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.
+I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.

+ 209 - 0
content/posts/gtfs-editor.md

@@ -0,0 +1,209 @@
++++
+tags = [ "philippine-transit-app", "programming", "lets-debug" ]
+date = "2013-07-10"
+title = "GTFS Editor"
+slug = "gtfs-editor"
++++
+
+Link: [https://github.com/conveyal/gtfs-editor](https://github.com/conveyal/gtfs-editor)
+
+**TL;DR** they really meant under development
+
+When I first saw the source of GTFS Editor, I was ecstatic. They used [Play framework](http://playframework.com/)!!! Not only that, they're targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.
+
+Getting it to actually run though, wasn't very pleasant. The initial setup was easy enough. Get [Play 1.2.5](http://www.playframework.com/download), install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that's necessary. Wonderful. Then, run play, open a browser, go to [http://localhost:9000](http://localhost:9000), compilation error. Fantastic.
+
+If you don't want to go through the technical details, you can just jump to the [conclusion](#conclusion).
+
+## Let's Debug!
+
+I'll be splitting the next section up into 2 parts. In the first pass, I'll talk about what I did to just get the app to run but I won't try hard to fix any bugs. This generally is what I do when I try to get apps to run. I'll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I'll explain what the problems were and how I fixed them.
+
+### First Pass
+
+A thing to note about Play (and one of the reasons it's a lovely Java framework) is that you don't need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that's what I saw, `Error: type Check already defined`
+
+```java
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.METHOD, ElementType.TYPE})
+public @interface Check { // error here
+
+    String[] value();
+}
+```
+
+You also know that typical behavior among programmers where your program doesn't compile, but you keep trying to compile it anyway hoping that it will magically just work. That's what I did, and it actually ran. I couldn't really just let this pass, so I decided to try deleting `Check.java`. I got another compilation error, `Error: type Secure already defined`
+
+```java
+public class Secure extends Controller { // error here
+
+    @Before(unless={"login", "authenticate", "logout"})
+
+    static void checkAccess() throws Throwable {
+```
+
+At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put `Check.java` back in and proceeded to just refresh until it compiled and ran.
+
+The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the `account` table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn't work.
+
+Another note regarding Play 1.x, it provides the [secure module](http://www.playframework.com/documentation/1.2.5/secure) which handles logins and keeping state, you simply need to implement the method `boolean authenticate(String username, String password)`. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return `true` and then any login would work. No need to actually set the password. Excellent.
+
+And we're logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, `IndexOutOfBoundsException occured : Index: 0, Size: 0`
+
+```java
+if(session.get("agencyId") == null) {
+
+    Agency agency = agencies.get(0); // error here
+
+    session.put("agencyId", agency.id);
+    session.put("agencyName", agency.name);
+```
+
+Apparently, we need to have an agency. That's generally simple enough. You just manually insert an agency into the `agency` table. After that's done, we finally have a view of the actual application. It's very Bootstrap-y, but that's just fine. The workflow though, is not perfectly intuitive, but I'll talk about that some other day.
+
+That's not the end of it though, we still have to fix these bugs. The developer obviously didn't have to put up with this when they were working, so what happened? Also, the log is showing some weird things,
+
+```text
+~        _            _
+~  _ __ | | __ _ _  _| |
+~ | '_ \| |/ _' | || |_|
+~ |  __/|_|\____|\__ (_)
+~ |_|            |__/
+~
+~ play! 1.2.5, http://www.playframework.org
+~
+~ Ctrl+C to stop
+~
+CompilerOracle: exclude jregex/Pretokenizer.next
+Listening for transport dt_socket at address: 8000
+23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
+23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
+23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
+23:32:15,830 WARN  ~ You're running Play! in DEV mode
+23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
+23:32:28,792 ERROR ~
+
+@6f02fa9dd
+Internal Server Error (500) for request GET /
+
+Compilation error (In /app/controllers/Check.java around line 10)
+The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
+
+play.exceptions.CompilationException: The type Check is already defined
+	at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
+	at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
+	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
+	at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
+	at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
+	at play.Play.start(Play.java:516)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at Invocation.HTTP Request(Play!)
+23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
+SLF4J: Class path contains multiple SLF4J bindings.
+SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
+23:32:32,490 INFO  ~ Initializing HBSpatialExtension
+23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
+23:32:32,494 INFO  ~ Checking for default configuration file.
+23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
+23:32:34,077 INFO  ~ Application 'gtfs-editor' is now started !
+23:32:34,151 INFO  ~ Bootstrapping Database...
+23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
+play.exceptions.UnexpectedException: Unexpected Error
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
+	at play.templates.TemplateLoader.load(TemplateLoader.java:78)
+	at play.test.Fixtures.loadModels(Fixtures.java:174)
+	at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
+	at play.jobs.Job.doJobWithResult(Job.java:50)
+	at play.jobs.Job.call(Job.java:146)
+	at play.jobs.Job.run(Job.java:132)
+	at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
+	at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
+	at play.Play.start(Play.java:547)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
+	at play.Invoker$Invocation.run(Invoker.java:276)
+	at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
+	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
+	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
+	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
+	at java.lang.Thread.run(Thread.java:680)
+Caused by: play.exceptions.UnexpectedException: Unexpected Error
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
+	... 22 more
+Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
+	at java.io.FileInputStream.open(Native Method)
+	at java.io.FileInputStream.<init>(FileInputStream.java:120)
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
+	... 23 more
+23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
+23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
+23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
+23:32:40,999 DEBUG ~ select nextval ('hibernate_sequence')
+23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
+23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
+23:32:41,175 ERROR ~
+
+@6f02fa9dg
+Internal Server Error (500) for request GET /
+
+Execution exception (In /app/controllers/Application.java around line 57)
+IndexOutOfBoundsException occured : Index: 0, Size: 0
+
+play.exceptions.JavaExecutionException: Index: 0, Size: 0
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
+	at Invocation.HTTP Request(Play!)
+Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
+	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
+	at java.util.ArrayList.get(ArrayList.java:322)
+	at controllers.Application.initSession(Application.java:57)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
+	at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
+	... 1 more
+```
+
+After `23:32:34` is when I get the login page. `23:32:40` is after I've logged in.
+
+### Second Pass
+
+So how did you do? First, the error that `type Check already defined` usually does mean that `Check` was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It's the only one there that was `Check.java`. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, `Check.java`. Doing a diff shows nothing was changed. So the solution really was just simply delete `Check.java` and also `Secure.java`. No more compilation errors!
+
+The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,
+
+```java
+if(Security.isConnected()) {
+    ...
+    Account account = Account.find("username = ?", Security.connected()).first();
+    ...
+    if(account == null && Account.count() == 0) {
+        account = new Account("admin", "admin", "admin@test.com", true, null);
+        account.save();
+    }
+    ...
+}
+```
+
+You can actually see this in action at `23:32:41,051` in the log. So what's wrong with all of this? The account creation happened after I've already logged in. In fact, `Security.isConnected()` checks whether the user is already logged in or not. How does this even make sense?
+
+Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we're missing a file called `initial-agencies-data.yml`. Ok, apparently it's a [fixture](http://www.playframework.com/documentation/1.2.5/test#fixtures) like you would use for testing. It's easy enough to infer what the file's contents should be. We just copy it over from the GTFS data.
+
+But then where do you put the file? If you look at the log, it says `/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml` but that doesn't look right. That's in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the `test/` directory? No, that doesn't work either since we're not running a test.
+
+What I ended up doing was just looking at the sources for `Fixtures.load`. If you follow the stack trace, you end up finding `Play.javaPath` which sort of works like PATH for Fixtures and some other things. So where can we put the file? `app/` and `conf/`. And with that, we're done.
+
+<h3 id="conclusion">Conclusion</h3>
+
+GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone [my branch](https://github.com/thatsmydoing/gtfs-editor) as I've fixed the issues discussed earlier. The default login is `admin:admin`.
+
+Even after getting it to run, it's still not quite usable. Not in the UX sense, but you really can't do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don't have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.

+ 10 - 10
output/posts/highways-in-otp.md → content/posts/highways-in-otp.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/24 23:15:57
-.. title: Highways in OTP
-.. slug: highways-in-otp
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-24"
+title = "Highways in OTP"
+slug = "highways-in-otp"
++++
 
 One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP's suggested route for walking from UP to Ateneo:
 
@@ -17,10 +15,12 @@ OTP couldn't possibly be that dumb though, so there must be something we're doin
 
 Apparently, by default OTP will consider roads of type `trunk` to be non-walkable and non-bikable. This is documented in the [OpenStreetMap wiki](http://wiki.openstreetmap.org/wiki/OpenTripPlanner) and the [OTP wiki](https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety) as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.
 
-    sed -i .bak s/trunk/primary/g manila.osm
+```text
+sed -i .bak s/trunk/primary/g manila.osm
+```
 
 And rebuild the graph. It doesn't really matter much because the OSM data isn't used to render the maps. It's just used to build the routing data. This is actually what I did for [maps.pleasantprogrammer.com](http://maps.pleasantprogrammer.com).
 
 It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on `highway=trunk` we could allow that. This is not much better than the `sed` solution though. It's better since you keep the weighting done by OTP, but you're still saying that all trunks are walkable which might not be the case.
 
-The most correct way to actually fix this is to go through each of the trunks and specifying `foot=yes` and `bicycle=yes` for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I'm not sure on the particulars with updating OSM though.
+The most correct way to actually fix this is to go through each of the trunks and specifying `foot=yes` and `bicycle=yes` for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I'm not sure on the particulars with updating OSM though.

+ 6 - 10
output/posts/is-my-terminal-window-active.md → content/posts/is-my-terminal-window-active.md

@@ -1,13 +1,9 @@
-<!--
-.. title: Is My Terminal Window Active?
-.. slug: is-my-terminal-window-active
-.. date: 2015-06-07 16:20:45 UTC+08:00
-.. tags: programming
-.. category:
-.. link:
-.. description:
-.. type: text
--->
++++
+title = "Is My Terminal Window Active?"
+slug = "is-my-terminal-window-active"
+date = "2015-06-07"
+tags = [ "programming" ]
++++
 
 I've been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is [zsh-notify](https://github.com/marzocchi/zsh-notify). It's a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.
 

+ 15 - 15
output/posts/jeep-and-bus-schedules.md → content/posts/jeep-and-bus-schedules.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/28 16:26:31
-.. title: Jeep and Bus Schedules
-.. slug: jeep-and-bus-schedules
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-28"
+title = "Jeep and Bus Schedules"
+slug = "jeep-and-bus-schedules"
++++
 
 Wouldn't it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist's paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn't worry. I can assure you, it's still a death sentence.
 
@@ -21,16 +19,18 @@ The current GTFS data does define these trip schedules. We assume that jeeps and
 
 While there might be jeeps who change routes or don't operate on weekends, I'm pretty sure that jeeps and buses run on weekends. We'll have to fix it ourselves temporarily since there's no central GTFS feed yet.
 
-    :::sh
-    # 724594 seems to be the service id used by jeeps and buses
-    sed -i .bak '/^724594/ s/0,0/1,1/' calendar.txt
+```sh
+# 724594 seems to be the service id used by jeeps and buses
+sed -i .bak '/^724594/ s/0,0/1,1/' calendar.txt
+```
 
 Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you're sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.
 
 If we set the frequency to one minute, it *might* give better routes by eliminating the timing issue. Or not, it's kind of hard to tell.
 
-    :::sh
-    # jeep and bus route ids tend to start with 72
-    sed -i .bak '/^72/ s/,600/,60/' frequencies.txt
+```sh
+# jeep and bus route ids tend to start with 72
+sed -i .bak '/^72/ s/,600/,60/' frequencies.txt
+```
 
-Overall, the problems we're having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don't need to do hackish things for it to fit the GTFS, but that's still a dream. For now, all we can really do is fit a triangle into a square hole.
+Overall, the problems we're having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don't need to do hackish things for it to fit the GTFS, but that's still a dream. For now, all we can really do is fit a triangle into a square hole.

+ 7 - 9
posts/jeepney-and-bus-routes.md → content/posts/jeepney-and-bus-routes.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/07 10:32:36
-.. title: Jeepney and Bus Routes
-.. slug: jeepney-and-bus-routes
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-07"
+title = "Jeepney and Bus Routes"
+slug = "jeepney-and-bus-routes"
++++
 
 In the [last post](philippine-transit-app-challenge.html), I talked about how we now have data about jeepney and bus routes in the Philippines. The data is actually in the [GTFS format](https://developers.google.com/transit/gtfs/), which is the format the Google Maps consumes transit data. Apparently, the government will be submitting the GTFS data later this year. Transit directions for Metro Manila in Google Maps would be wonderful. That said, it definitely raises the bar for the app challenge people.
 
@@ -19,4 +17,4 @@ From what I've seen of the data, they handled the first problem well enough. Sto
 
 The problem isn't that bad though. The agencies could still add the shapes later on. Or maybe an app challenge participant could make an app around fixing the routes via crowd-sourcing or similar. The shape itself isn't that important for a rudimentary directions app, but if we want better apps, we will need better data.
 
-There were also some minor issues with the data itself. Some of the files had extra columns. This normally isn't an issue, but it caused problems for [GTFS SQL importer](https://github.com/harrisony/gtfs_SQL_importer). There were also problems with matching the shape data with the stops when I tried it with [OneBusAway](http://onebusaway.org). They could probably be [fixed](https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching) but that's for another day.
+There were also some minor issues with the data itself. Some of the files had extra columns. This normally isn't an issue, but it caused problems for [GTFS SQL importer](https://github.com/harrisony/gtfs_SQL_importer). There were also problems with matching the shape data with the stops when I tried it with [OneBusAway](http://onebusaway.org). They could probably be [fixed](https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching) but that's for another day.

+ 7 - 9
output/posts/one-bus-or-maybe-jeep-away.md → content/posts/one-bus-or-maybe-jeep-away.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/09 01:53:59
-.. title: One Bus (or maybe Jeep) Away
-.. slug: one-bus-or-maybe-jeep-away
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-09"
+title = "One Bus (or maybe Jeep) Away"
+slug = "one-bus-or-maybe-jeep-away"
++++
 
 Link: [http://onebusaway.org/](http://onebusaway.org/)
 
@@ -29,4 +27,4 @@ If you also noticed, there are usually 2 of each route. This is how the jeepney
 
 [![OneBusAway](../galleries/transit/onebusaway2.png)](../galleries/transit/onebusaway2.png)
 
-[![OneBusAway](../galleries/transit/onebusaway3.png)](../galleries/transit/onebusaway3.png)
+[![OneBusAway](../galleries/transit/onebusaway3.png)](../galleries/transit/onebusaway3.png)

+ 7 - 9
posts/open-trip-planner.md → content/posts/open-trip-planner.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/09 23:16:12
-.. title: Open Trip Planner
-.. slug: open-trip-planner
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-09"
+title = "Open Trip Planner"
+slug = "open-trip-planner"
++++
 
 Link: [http://www.opentripplanner.org](http://www.opentripplanner.org)
 
@@ -45,4 +43,4 @@ From what they said during the launch, most of the route data was collected by g
 
 ### Conclusion
 
-Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There's also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.
+Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There's also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.

+ 7 - 9
output/posts/philippine-transit-app-challenge.md → content/posts/philippine-transit-app-challenge.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/07 00:17:37
-.. title: Philippine Transit App Challenge
-.. slug: philippine-transit-app-challenge
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-07"
+title = "Philippine Transit App Challenge"
+slug = "philippine-transit-app-challenge"
++++
 
 Last week, the DOTC launched the [Philippine Transit App Challenge](http://philippine-transit.hackathome.com). It's a competition to build something great using the newly available 1) jeepney/bus/rail routes and 2) traffic incident data in Metro Manila and Cebu.
 
@@ -15,4 +13,4 @@ During the launch, they also presented how CITOM (the Cebu MMDA) is pilot-testin
 
 The [route data](http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/) are already available, as well as the [Cebu](http://philippine-transit.hackathome.com/dataset-citom-traffic-alert-platform/) and [Metro Manila](http://philippine-transit.hackathome.com/dataset-mmda-traffic-alert-platform/) incident data. You do have to register to access them though. Right now, they're just one-off dumps of the data but the various agencies have promised to provide consistently updated data. This will be provided via ASTI later in the year.
 
-I've just started looking at the route data and playing around with it. The quality could be better, but I'm glad we at least have something to work with.
+I've just started looking at the route data and playing around with it. The quality could be better, but I'm glad we at least have something to work with.

+ 7 - 9
output/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.md → content/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.md

@@ -1,11 +1,9 @@
-<!--
-.. link:
-.. description:
-.. tags: sysadmin
-.. date: 2013/11/27 10:12:31
-.. title: Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU
-.. slug: removing-pldtmydslbiz-from-the-zyxel-p-2612hnu
--->
++++
+tags = [ "sysadmin" ]
+date = "2013-11-27"
+title = "Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU"
+slug = "removing-pldtmydslbiz-from-the-zyxel-p-2612hnu"
++++
 
 I've always thought that people were just too lazy to change their SSIDs when I see "PLDTMyDSLBizCafeJapan". It became apparent when we got our own PLDT line that it was because the bundled router/modem *does not* allow you to remove the prefix.
 
@@ -17,4 +15,4 @@ We did still try the firebug/inspector tricks, but it seems that there is a serv
 
 The backup is actually just an XML file. You can search for SSID and change the parameter there. It's a bit annoying because the router has to restart after restoring the configuration, but it works!
 
-A minor note, the router doesn't seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.
+A minor note, the router doesn't seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.

+ 45 - 37
posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.md → content/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.md

@@ -1,13 +1,9 @@
-<!--
-.. title: TiddlyWiki in the Sky (or TiddlyWeb for TW5)
-.. slug: tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5
-.. date: 2015-12-24 14:48:20 UTC+08:00
-.. tags: sysadmin, tiddlywiki
-.. category:
-.. link:
-.. description:
-.. type: text
--->
++++
+title = "TiddlyWiki in the Sky (or TiddlyWeb for TW5)"
+slug = "tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5"
+date = "2015-12-24"
+tags = [ "sysadmin", "tiddlywiki" ]
++++
 
 I've always liked [TiddlyWiki](http://tiddlywiki.com). Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new HTML file with all your posts inside. I've used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.
 
@@ -21,11 +17,15 @@ To support TiddlyWiki5, we'll need a version of the wiki which has the TiddlyWeb
 
 TiddlyWiki5 provides a command line tool via `npm` that allows building custom versions of the wiki. In fact, it comes with templates, called "editions", that we can use for our setup. Assuming you already have it installed, create the wiki using
 
-    tiddlywiki mywiki --init tw5tank          # create wiki from template
+```sh
+tiddlywiki mywiki --init tw5tank          # create wiki from template
+```
 
 This creates a wiki intended for use with [Tank](https://tank.peermore.com/), which is built on top of TiddlyWeb. From here, you should look in `mywiki/tiddlers/system` which contain the entries for `SiteTitle`, `SiteSubtitle`, `DefaultTiddlers`, and `tiddlyweb-host`. The first 3 should be configured however you want. These are necessary because they're needed before the wiki can load them from the server. `tiddlyweb-host` contains the location of the TiddlyWeb server, this should be `http://localhost:8080/` if you're just testing locally. With everything configured, you can build the new wiki by running
 
-    tiddlywiki mywiki --build
+```sh
+tiddlywiki mywiki --build
+```
 
 This will output the wiki to `mywiki/output/tw5tank.html`. You can now serve it using your favorite local webserver, like `python -m http.server`.
 
@@ -33,30 +33,34 @@ This will output the wiki to `mywiki/output/tw5tank.html`. You can now serve it
 
 The TiddlyWeb tutorial recommends using `tiddlywebwiki` which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren't really needed, so we won't go with that. So first, we'll need to install TiddlyWeb and any plugins we might want to use.
 
-    pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
+```sh
+pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
+```
 
 Next, we'll need the tiddlyweb configuration in `tiddlywebconfig.py`
 
-    # A basic configuration.
-    # `pydoc tiddlyweb.config` for details on configuration items.
+```python
+# A basic configuration.
+# `pydoc tiddlyweb.config` for details on configuration items.
 
-    import tiddlywebplugins.status
+import tiddlywebplugins.status
 
-    config = {
-        'system_plugins': ['tiddlywebplugins.status', 'tiddlywebplugins.cors'],
-        'secret': '36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0',
-        'wsgi_server': 'tiddlywebplugins.cherrypy',
-        'cors.enable_non_simple': True
-    }
+config = {
+    'system_plugins': ['tiddlywebplugins.status', 'tiddlywebplugins.cors'],
+    'secret': '36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0',
+    'wsgi_server': 'tiddlywebplugins.cherrypy',
+    'cors.enable_non_simple': True
+}
 
-    original_gather_data = tiddlywebplugins.status._gather_data
+original_gather_data = tiddlywebplugins.status._gather_data
 
-    def _status_gather_data(environ):
-        data = original_gather_data(environ)
-        data['space'] = {'recipe': 'default'}
-        return data
+def _status_gather_data(environ):
+    data = original_gather_data(environ)
+    data['space'] = {'recipe': 'default'}
+    return data
 
-    tiddlywebplugins.status._gather_data = _status_gather_data
+tiddlywebplugins.status._gather_data = _status_gather_data
+```
 
 The tweaks involved are:
 
@@ -67,20 +71,24 @@ The tweaks involved are:
 
 With that, we just need to create the store that will hold our data
 
-    twanager recipe default <<EOF
-    desc: standard TiddlyWebWiki environment
-    policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
+```sh
+twanager recipe default <<EOF
+desc: standard TiddlyWebWiki environment
+policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
 
-    /bags/default/tiddlers
-    EOF
+/bags/default/tiddlers
+EOF
 
-    twanager bag default <<EOF
-    {"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
-    EOF
+twanager bag default <<EOF
+{"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
+EOF
+```
 
 Finally, we can start the TiddlyWeb server
 
-    twanager server
+```sh
+twanager server
+```
 
 ## Putting it all together
 

+ 6 - 8
posts/transit-wand.md → content/posts/transit-wand.md

@@ -1,11 +1,9 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/15 22:45:20
-.. title: Transit Wand
-.. slug: transit-wand
--->
++++
+tags = [ "philippine-transit-app", "programming" ]
+date = "2013-07-15"
+title = "Transit Wand"
+slug = "transit-wand"
++++
 
 Link: [http://transitwand.com](https://play.google.com/store/apps/details?id=com.conveyal.transitwand)
 

+ 0 - 9
files/assets/css/custom.css

@@ -1,9 +0,0 @@
-h1 {
-  font-size: 36px;
-}
-
-h1 small {
-  font-size: 16px;
-  display: block;
-  margin-top: 8px;
-}

+ 0 - 103
output/2013/index.html

@@ -1,103 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts for year 2013 | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/2013/index.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="listpage"><header><h1>Posts for year 2013</h1>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" class="listtitle">Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</a> <time class="listdate" datetime="2013-11-27T10:12:31+08:00" title="2013-11-27 10:12">2013-11-27 10:12</time>
-</li>
-        <li>
-<a href="../posts/console-keymap-switching.html" class="listtitle">Console Keymap Switching</a> <time class="listdate" datetime="2013-10-29T20:02:06+08:00" title="2013-10-29 20:02">2013-10-29 20:02</time>
-</li>
-        <li>
-<a href="../posts/geocoding-services.html" class="listtitle">Geocoding Services</a> <time class="listdate" datetime="2013-09-25T12:26:59+08:00" title="2013-09-25 12:26">2013-09-25 12:26</time>
-</li>
-        <li>
-<a href="../posts/jeep-and-bus-schedules.html" class="listtitle">Jeep and Bus Schedules</a> <time class="listdate" datetime="2013-07-28T16:26:31+08:00" title="2013-07-28 16:26">2013-07-28 16:26</time>
-</li>
-        <li>
-<a href="../posts/highways-in-otp.html" class="listtitle">Highways in OTP</a> <time class="listdate" datetime="2013-07-24T23:15:57+08:00" title="2013-07-24 23:15">2013-07-24 23:15</time>
-</li>
-        <li>
-<a href="../posts/elevation-data-in-otp.html" class="listtitle">Elevation Data in OTP</a> <time class="listdate" datetime="2013-07-23T18:23:00+08:00" title="2013-07-23 18:23">2013-07-23 18:23</time>
-</li>
-        <li>
-<a href="../posts/graphserver.html" class="listtitle">GraphServer</a> <time class="listdate" datetime="2013-07-23T14:48:29+08:00" title="2013-07-23 14:48">2013-07-23 14:48</time>
-</li>
-        <li>
-<a href="../posts/transit-wand.html" class="listtitle">Transit Wand</a> <time class="listdate" datetime="2013-07-15T22:45:20+08:00" title="2013-07-15 22:45">2013-07-15 22:45</time>
-</li>
-        <li>
-<a href="../posts/fare-data.html" class="listtitle">Fare Data</a> <time class="listdate" datetime="2013-07-13T21:15:09+08:00" title="2013-07-13 21:15">2013-07-13 21:15</time>
-</li>
-        <li>
-<a href="../posts/gtfs-editor.html" class="listtitle">GTFS Editor</a> <time class="listdate" datetime="2013-07-10T11:30:01+08:00" title="2013-07-10 11:30">2013-07-10 11:30</time>
-</li>
-        <li>
-<a href="../posts/open-trip-planner.html" class="listtitle">Open Trip Planner</a> <time class="listdate" datetime="2013-07-09T23:16:12+08:00" title="2013-07-09 23:16">2013-07-09 23:16</time>
-</li>
-        <li>
-<a href="../posts/one-bus-or-maybe-jeep-away.html" class="listtitle">One Bus (or maybe Jeep) Away</a> <time class="listdate" datetime="2013-07-09T01:53:59+08:00" title="2013-07-09 01:53">2013-07-09 01:53</time>
-</li>
-        <li>
-<a href="../posts/jeepney-and-bus-routes.html" class="listtitle">Jeepney and Bus Routes</a> <time class="listdate" datetime="2013-07-07T10:32:36+08:00" title="2013-07-07 10:32">2013-07-07 10:32</time>
-</li>
-        <li>
-<a href="../posts/philippine-transit-app-challenge.html" class="listtitle">Philippine Transit App Challenge</a> <time class="listdate" datetime="2013-07-07T00:17:37+08:00" title="2013-07-07 00:17">2013-07-07 00:17</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 70
output/2015/index.html

@@ -1,70 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts for year 2015 | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/2015/index.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="listpage"><header><h1>Posts for year 2015</h1>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/cloudflare-shenanigans.html" class="listtitle">Cloudflare Shenanigans</a> <time class="listdate" datetime="2015-12-25T14:13:26+08:00" title="2015-12-25 14:13">2015-12-25 14:13</time>
-</li>
-        <li>
-<a href="../posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" class="listtitle">TiddlyWiki in the Sky (or TiddlyWeb for TW5)</a> <time class="listdate" datetime="2015-12-24T14:48:20+08:00" title="2015-12-24 14:48">2015-12-24 14:48</time>
-</li>
-        <li>
-<a href="../posts/is-my-terminal-window-active.html" class="listtitle">Is My Terminal Window Active?</a> <time class="listdate" datetime="2015-06-07T16:20:45+08:00" title="2015-06-07 16:20">2015-06-07 16:20</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 0
output/404.html


+ 0 - 67
output/archive.html

@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Archive | Pleasant Programmer</title>
-<link href="assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/archive.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li class="active"><a href="#">Archives</a></li>
-                <li><a href="categories/index.html">Tags</a></li>
-                <li><a href="rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="listpage"><header><h1>Archive</h1>
-    </header><ul class="postlist">
-<li>
-<a href="2015/index.html">2015 (3)</a>
-        </li>
-<li>
-<a href="2013/index.html">2013 (14)</a>
-    </li>
-</ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 65
output/assets/css/code.css

@@ -1,65 +0,0 @@
-/* code.css file generated by Nikola */
-pre.code .hll { background-color: #ffffcc }
-pre.code  { background: #f8f8f8; }
-pre.code .c { color: #408080; font-style: italic } /* Comment */
-pre.code .err { border: 1px solid #FF0000 } /* Error */
-pre.code .k { color: #008000; font-weight: bold } /* Keyword */
-pre.code .o { color: #666666 } /* Operator */
-pre.code .cm { color: #408080; font-style: italic } /* Comment.Multiline */
-pre.code .cp { color: #BC7A00 } /* Comment.Preproc */
-pre.code .c1 { color: #408080; font-style: italic } /* Comment.Single */
-pre.code .cs { color: #408080; font-style: italic } /* Comment.Special */
-pre.code .gd { color: #A00000 } /* Generic.Deleted */
-pre.code .ge { font-style: italic } /* Generic.Emph */
-pre.code .gr { color: #FF0000 } /* Generic.Error */
-pre.code .gh { color: #000080; font-weight: bold } /* Generic.Heading */
-pre.code .gi { color: #00A000 } /* Generic.Inserted */
-pre.code .go { color: #888888 } /* Generic.Output */
-pre.code .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
-pre.code .gs { font-weight: bold } /* Generic.Strong */
-pre.code .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
-pre.code .gt { color: #0044DD } /* Generic.Traceback */
-pre.code .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
-pre.code .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
-pre.code .kn { color: #008000; font-weight: bold } /* Keyword.Namespace */
-pre.code .kp { color: #008000 } /* Keyword.Pseudo */
-pre.code .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
-pre.code .kt { color: #B00040 } /* Keyword.Type */
-pre.code .m { color: #666666 } /* Literal.Number */
-pre.code .s { color: #BA2121 } /* Literal.String */
-pre.code .na { color: #7D9029 } /* Name.Attribute */
-pre.code .nb { color: #008000 } /* Name.Builtin */
-pre.code .nc { color: #0000FF; font-weight: bold } /* Name.Class */
-pre.code .no { color: #880000 } /* Name.Constant */
-pre.code .nd { color: #AA22FF } /* Name.Decorator */
-pre.code .ni { color: #999999; font-weight: bold } /* Name.Entity */
-pre.code .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
-pre.code .nf { color: #0000FF } /* Name.Function */
-pre.code .nl { color: #A0A000 } /* Name.Label */
-pre.code .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
-pre.code .nt { color: #008000; font-weight: bold } /* Name.Tag */
-pre.code .nv { color: #19177C } /* Name.Variable */
-pre.code .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
-pre.code .w { color: #bbbbbb } /* Text.Whitespace */
-pre.code .mb { color: #666666 } /* Literal.Number.Bin */
-pre.code .mf { color: #666666 } /* Literal.Number.Float */
-pre.code .mh { color: #666666 } /* Literal.Number.Hex */
-pre.code .mi { color: #666666 } /* Literal.Number.Integer */
-pre.code .mo { color: #666666 } /* Literal.Number.Oct */
-pre.code .sb { color: #BA2121 } /* Literal.String.Backtick */
-pre.code .sc { color: #BA2121 } /* Literal.String.Char */
-pre.code .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
-pre.code .s2 { color: #BA2121 } /* Literal.String.Double */
-pre.code .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
-pre.code .sh { color: #BA2121 } /* Literal.String.Heredoc */
-pre.code .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
-pre.code .sx { color: #008000 } /* Literal.String.Other */
-pre.code .sr { color: #BB6688 } /* Literal.String.Regex */
-pre.code .s1 { color: #BA2121 } /* Literal.String.Single */
-pre.code .ss { color: #19177C } /* Literal.String.Symbol */
-pre.code .bp { color: #008000 } /* Name.Builtin.Pseudo */
-pre.code .vc { color: #19177C } /* Name.Variable.Class */
-pre.code .vg { color: #19177C } /* Name.Variable.Global */
-pre.code .vi { color: #19177C } /* Name.Variable.Instance */
-pre.code .il { color: #666666 } /* Literal.Number.Integer.Long */
-table.codetable { width: 100%;} td.linenos {text-align: right; width: 4em;}

+ 0 - 9
output/assets/css/custom.css

@@ -1,9 +0,0 @@
-h1 {
-  font-size: 36px;
-}
-
-h1 small {
-  font-size: 16px;
-  display: block;
-  margin-top: 8px;
-}

+ 0 - 1
output/assets/css/rst.css

@@ -1 +0,0 @@
-../../../default/assets/css/rst.css

+ 15 - 6
output/assets/css/theme.css

@@ -57,12 +57,12 @@ code {
 	border-radius: 0.25em;
 }
 
-.code {
+.highlight, .code {
 	padding: 0em 0.5em;
 	border-radius: 0.25em;
 }
 
-pre.code {
+.highlight pre {
 	padding: 0.25em 0.5em;
 	overflow-x: auto;
 }
@@ -268,7 +268,7 @@ header {
 			perspective: 800;
 }
 
-.thomas {
+#thomas {
 	position: relative;
 	display: inline-block;
 	-webkit-transform-style: preserve-3d;
@@ -281,20 +281,20 @@ header {
 			transition: all 0.4s;
 }
 
-.thomas.whoa {
+#thomas.whoa {
 	-webkit-transform: rotateY(180deg);
 	   -moz-transform: rotateY(180deg);
 		-ms-transform: rotateY(180deg);
 			transform: rotateY(180deg);
 }
 
-.thomas img:nth-child(2) {
+#thomas img:nth-child(2) {
 	position: relative;
 	-webkit-backface-visibility: hidden;
 			backface-visibility: hidden;
 }
 
-.thomas img:nth-child(1) {
+#thomas img:nth-child(1) {
 	position: absolute;
 	top: 0;
 	left: 0;
@@ -327,3 +327,12 @@ header {
 	clip: auto;
 }
 
+h1 {
+  font-size: 36px;
+}
+
+h1 small {
+  font-size: 16px;
+  display: block;
+  margin-top: 8px;
+}

+ 0 - 67
output/categories/cloudflare.html

@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts about cloudflare | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/categories/cloudflare.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><link rel="alternate" type="application/rss+xml" title="RSS for tag cloudflare" href="cloudflare.xml">
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="tagpage"><header><h1>Posts about cloudflare</h1>
-        <div class="metadata">
-                <p class="feedlink"><a href="cloudflare.xml" type="application/rss+xml">RSS feed</a></p>
-        </div>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/cloudflare-shenanigans.html" class="listtitle">Cloudflare Shenanigans</a> <time class="listdate" datetime="2015-12-25T14:13:26+08:00" title="2015-12-25 14:13">2015-12-25 14:13</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 41
output/categories/cloudflare.xml

@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer (cloudflare)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/categories/cloudflare.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Cloudflare Shenanigans</title><link>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.&lt;/p&gt;
-&lt;p&gt;Now the problem is that Cloudflare can put you behind &lt;a href="https://www.cloudflare.com/ips/"&gt;any IP they own&lt;/a&gt;, which is a huge range. There's no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.&lt;/p&gt;
-&lt;p&gt;We never actually empirically tested whether other sites hosted on Cloudflare were also actually zero-rated. But I like to think that we saved a lot of people on their data costs from browsing Reddit and 4chan. But alas, good things must come to an end.&lt;/p&gt;
-&lt;p&gt;A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn't want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn't really afford that, so we looked for other options.&lt;/p&gt;
-&lt;p&gt;Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn't have its own certificate.&lt;/p&gt;
-&lt;p&gt;After more testing, we figured out that you could actually use any Cloudflare backed domain so long as we properly set the Host header. We just needed to find one still in the old range. Coincidentally, 4chan.org was. Which led to this wonderful commit&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;commit 123456789abcdef
-Author: ~~~~~~
-Date:   ~~~~~~
-
-    4chan hack
-
-&lt;span class="gh"&gt;diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gd"&gt;--- a/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gi"&gt;+++ b/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gu"&gt;@@ -210,7 +210,8 @@ public class Util {&lt;/span&gt;
-        }
-
-        public static String getServerAddress(Context context) {
-&lt;span class="gd"&gt;-               String address = "https://backend.client.com";&lt;/span&gt;
-&lt;span class="gi"&gt;+               // String address = "https://backend.client.com";&lt;/span&gt;
-&lt;span class="gi"&gt;+               String address = "https://4chan.org";&lt;/span&gt;
-                if(!isDebug(context)) return address;
-                try {
-&lt;span class="gh"&gt;diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gd"&gt;--- a/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gi"&gt;+++ b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gu"&gt;@@ -101,6 +101,7 @@ public class APIClient {&lt;/span&gt;
-        private HttpResponse postInternal(String url, List&amp;lt;NameValuePair&amp;gt; data, boolean forRegistration) throws ClientProtocolException, IOException {
-                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+"/api/"+url);
-                request.setHeader("X-API-VERSION", apiVersion);
-&lt;span class="gi"&gt;+               request.setHeader("Host", "backend.client.com");&lt;/span&gt;
-
-                if(data == null) {
-                        data = new ArrayList&amp;lt;NameValuePair&amp;gt;();
-&lt;/pre&gt;
-
-
-&lt;p&gt;Eventually, we did decide to just abandon Cloudflare for the server. We probably weren't going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.&lt;/p&gt;
-&lt;p&gt;I just still find it funny we were making people's phones go to 4chan.org everyday for more than a year.&lt;/p&gt;&lt;/div&gt;</description><category>cloudflare</category><category>sysadmin</category><guid>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</guid><pubDate>Fri, 25 Dec 2015 06:13:26 GMT</pubDate></item></channel></rss>

+ 0 - 69
output/categories/index.html

@@ -1,69 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="description" content="Tags">
-<meta name="viewport" content="width=device-width">
-<title>Tags | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/categories/index.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li class="active"><a href="#">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="tagindex"><header><h1>Tags</h1>
-    </header><ul class="postlist">
-<li><a class="reference listtitle" href="cloudflare.html">cloudflare</a></li>
-            <li><a class="reference listtitle" href="lets-debug.html">lets-debug</a></li>
-            <li><a class="reference listtitle" href="philippine-transit-app.html">philippine-transit-app</a></li>
-            <li><a class="reference listtitle" href="programming.html">programming</a></li>
-            <li><a class="reference listtitle" href="sysadmin.html">sysadmin</a></li>
-            <li><a class="reference listtitle" href="systemd.html">systemd</a></li>
-            <li><a class="reference listtitle" href="tiddlywiki.html">tiddlywiki</a></li>
-        </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 67
output/categories/lets-debug.html

@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts about lets-debug | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/categories/lets-debug.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><link rel="alternate" type="application/rss+xml" title="RSS for tag lets-debug" href="lets-debug.xml">
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="tagpage"><header><h1>Posts about lets-debug</h1>
-        <div class="metadata">
-                <p class="feedlink"><a href="lets-debug.xml" type="application/rss+xml">RSS feed</a></p>
-        </div>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/gtfs-editor.html" class="listtitle">GTFS Editor</a> <time class="listdate" datetime="2013-07-10T11:30:01+08:00" title="2013-07-10 11:30">2013-07-10 11:30</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 178
output/categories/lets-debug.xml

@@ -1,178 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer (lets-debug)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/categories/lets-debug.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>GTFS Editor</title><link>http://pleasantprogrammer.com/posts/gtfs-editor.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="https://github.com/conveyal/gtfs-editor"&gt;https://github.com/conveyal/gtfs-editor&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; they really meant under development&lt;/p&gt;
-&lt;p&gt;When I first saw the source of GTFS Editor, I was ecstatic. They used &lt;a href="http://playframework.com/"&gt;Play framework&lt;/a&gt;!!! Not only that, they're targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.&lt;/p&gt;
-&lt;p&gt;Getting it to actually run though, wasn't very pleasant. The initial setup was easy enough. Get &lt;a href="http://www.playframework.com/download"&gt;Play 1.2.5&lt;/a&gt;, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that's necessary. Wonderful. Then, run play, open a browser, go to &lt;a href="http://localhost:9000"&gt;http://localhost:9000&lt;/a&gt;, compilation error. Fantastic.&lt;/p&gt;
-&lt;p&gt;If you don't want to go through the technical details, you can just jump to the &lt;a href="http://pleasantprogrammer.com/posts/gtfs-editor.html#conclusion"&gt;conclusion&lt;/a&gt;.&lt;/p&gt;
-&lt;h3&gt;Let's Debug!&lt;/h3&gt;
-&lt;p&gt;I'll be splitting the next section up into 2 parts. In the first pass, I'll talk about what I did to just get the app to run but I won't try hard to fix any bugs. This generally is what I do when I try to get apps to run. I'll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I'll explain what the problems were and how I fixed them.&lt;/p&gt;
-&lt;h4&gt;First Pass&lt;/h4&gt;
-&lt;p&gt;A thing to note about Play (and one of the reasons it's a lovely Java framework) is that you don't need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that's what I saw, &lt;code&gt;Error: type Check already defined&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="nd"&gt;@Retention&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;RetentionPolicy&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;RUNTIME&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
-&lt;span class="nd"&gt;@Target&lt;/span&gt;&lt;span class="o"&gt;({&lt;/span&gt;&lt;span class="n"&gt;ElementType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;METHOD&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ElementType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;TYPE&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
-&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nd"&gt;@interface&lt;/span&gt; &lt;span class="n"&gt;Check&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="nf"&gt;value&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-&lt;span class="o"&gt;}&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;You also know that typical behavior among programmers where your program doesn't compile, but you keep trying to compile it anyway hoping that it will magically just work. That's what I did, and it actually ran. I couldn't really just let this pass, so I decided to try deleting &lt;code&gt;Check.java&lt;/code&gt;. I got another compilation error, &lt;code&gt;Error: type Secure already defined&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Secure&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Controller&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="nd"&gt;@Before&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unless&lt;/span&gt;&lt;span class="o"&gt;={&lt;/span&gt;&lt;span class="s"&gt;"login"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"authenticate"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"logout"&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
-
-    &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;checkAccess&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="n"&gt;Throwable&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put &lt;code&gt;Check.java&lt;/code&gt; back in and proceeded to just refresh until it compiled and ran.&lt;/p&gt;
-&lt;p&gt;The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the &lt;code&gt;account&lt;/code&gt; table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn't work.&lt;/p&gt;
-&lt;p&gt;Another note regarding Play 1.x, it provides the &lt;a href="http://www.playframework.com/documentation/1.2.5/secure"&gt;secure module&lt;/a&gt; which handles logins and keeping state, you simply need to implement the method &lt;code&gt;boolean authenticate(String username, String password)&lt;/code&gt;. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return &lt;code&gt;true&lt;/code&gt; and then any login would work. No need to actually set the password. Excellent.&lt;/p&gt;
-&lt;p&gt;And we're logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, &lt;code&gt;IndexOutOfBoundsException occured : Index: 0, Size: 0&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyId"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-
-    &lt;span class="n"&gt;Agency&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;agencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyId"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-    &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyName"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;Apparently, we need to have an agency. That's generally simple enough. You just manually insert an agency into the &lt;code&gt;agency&lt;/code&gt; table. After that's done, we finally have a view of the actual application. It's very Bootstrap-y, but that's just fine. The workflow though, is not perfectly intuitive, but I'll talk about that some other day.&lt;/p&gt;
-&lt;p&gt;That's not the end of it though, we still have to fix these bugs. The developer obviously didn't have to put up with this when they were working, so what happened? Also, the log is showing some weird things,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;~        _            _
-~  _ __ | | __ _ _  _| |
-~ | '_ \| |/ _' | || |_|
-~ |  __/|_|\____|\__ (_)
-~ |_|            |__/
-~
-~ play! 1.2.5, http://www.playframework.org
-~
-~ Ctrl+C to stop
-~
-CompilerOracle: exclude jregex/Pretokenizer.next
-Listening for transport dt_socket at address: 8000
-23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
-23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
-23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
-23:32:15,830 WARN  ~ You're running Play! in DEV mode
-23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
-23:32:28,792 ERROR ~
-
-@6f02fa9dd
-Internal Server Error (500) for request GET /
-
-Compilation error (In /app/controllers/Check.java around line 10)
-The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
-
-play.exceptions.CompilationException: The type Check is already defined
-    at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
-    at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
-    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
-    at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
-    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
-    at play.Play.start(Play.java:516)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at Invocation.HTTP Request(Play!)
-23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
-SLF4J: Class path contains multiple SLF4J bindings.
-SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
-23:32:32,490 INFO  ~ Initializing HBSpatialExtension
-23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
-23:32:32,494 INFO  ~ Checking for default configuration file.
-23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
-23:32:34,077 INFO  ~ Application 'gtfs-editor' is now started !
-23:32:34,151 INFO  ~ Bootstrapping Database...
-23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
-play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
-    at play.templates.TemplateLoader.load(TemplateLoader.java:78)
-    at play.test.Fixtures.loadModels(Fixtures.java:174)
-    at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
-    at play.jobs.Job.doJobWithResult(Job.java:50)
-    at play.jobs.Job.call(Job.java:146)
-    at play.jobs.Job.run(Job.java:132)
-    at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
-    at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
-    at play.Play.start(Play.java:547)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
-    at play.Invoker$Invocation.run(Invoker.java:276)
-    at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
-    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
-    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
-    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
-    at java.lang.Thread.run(Thread.java:680)
-Caused by: play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
-    ... 22 more
-Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
-    at java.io.FileInputStream.open(Native Method)
-    at java.io.FileInputStream.&amp;lt;init&amp;gt;(FileInputStream.java:120)
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
-    ... 23 more
-23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
-23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
-23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
-23:32:40,999 DEBUG ~ select nextval ('hibernate_sequence')
-23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
-23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
-23:32:41,175 ERROR ~
-
-@6f02fa9dg
-Internal Server Error (500) for request GET /
-
-Execution exception (In /app/controllers/Application.java around line 57)
-IndexOutOfBoundsException occured : Index: 0, Size: 0
-
-play.exceptions.JavaExecutionException: Index: 0, Size: 0
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
-    at Invocation.HTTP Request(Play!)
-Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
-    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
-    at java.util.ArrayList.get(ArrayList.java:322)
-    at controllers.Application.initSession(Application.java:57)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
-    at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
-    ... 1 more
-&lt;/pre&gt;
-
-
-&lt;p&gt;After &lt;code&gt;23:32:34&lt;/code&gt; is when I get the login page. &lt;code&gt;23:32:40&lt;/code&gt; is after I've logged in.&lt;/p&gt;
-&lt;h4&gt;Second Pass&lt;/h4&gt;
-&lt;p&gt;So how did you do? First, the error that &lt;code&gt;type Check already defined&lt;/code&gt; usually does mean that &lt;code&gt;Check&lt;/code&gt; was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It's the only one there that was &lt;code&gt;Check.java&lt;/code&gt;. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, &lt;code&gt;Check.java&lt;/code&gt;. Doing a diff shows nothing was changed. So the solution really was just simply delete &lt;code&gt;Check.java&lt;/code&gt; and also &lt;code&gt;Secure.java&lt;/code&gt;. No more compilation errors!&lt;/p&gt;
-&lt;p&gt;The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Security&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isConnected&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-    &lt;span class="n"&gt;Account&lt;/span&gt; &lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;find&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"username = ?"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Security&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;connected&lt;/span&gt;&lt;span class="o"&gt;()).&lt;/span&gt;&lt;span class="na"&gt;first&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-        &lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"admin"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"admin"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"admin@test.com"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-        &lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;save&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-    &lt;span class="o"&gt;}&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-&lt;span class="o"&gt;}&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;You can actually see this in action at &lt;code&gt;23:32:41,051&lt;/code&gt; in the log. So what's wrong with all of this? The account creation happened after I've already logged in. In fact, &lt;code&gt;Security.isConnected()&lt;/code&gt; checks whether the user is already logged in or not. How does this even make sense?&lt;/p&gt;
-&lt;p&gt;Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we're missing a file called &lt;code&gt;initial-agencies-data.yml&lt;/code&gt;. Ok, apparently it's a &lt;a href="http://www.playframework.com/documentation/1.2.5/test#fixtures"&gt;fixture&lt;/a&gt; like you would use for testing. It's easy enough to infer what the file's contents should be. We just copy it over from the GTFS data.&lt;/p&gt;
-&lt;p&gt;But then where do you put the file? If you look at the log, it says &lt;code&gt;/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml&lt;/code&gt; but that doesn't look right. That's in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the &lt;code&gt;test/&lt;/code&gt; directory? No, that doesn't work either since we're not running a test.&lt;/p&gt;
-&lt;p&gt;What I ended up doing was just looking at the sources for &lt;code&gt;Fixtures.load&lt;/code&gt;. If you follow the stack trace, you end up finding &lt;code&gt;Play.javaPath&lt;/code&gt; which sort of works like PATH for Fixtures and some other things. So where can we put the file? &lt;code&gt;app/&lt;/code&gt; and &lt;code&gt;conf/&lt;/code&gt;. And with that, we're done.&lt;/p&gt;
-&lt;h4 id="conclusion"&gt;Conclusion&lt;/h4&gt;
-
-&lt;p&gt;GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone &lt;a href="https://github.com/thatsmydoing/gtfs-editor"&gt;my branch&lt;/a&gt; as I've fixed the issues discussed earlier. The default login is &lt;code&gt;admin:admin&lt;/code&gt;.&lt;/p&gt;
-&lt;p&gt;Even after getting it to run, it's still not quite usable. Not in the UX sense, but you really can't do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don't have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.&lt;/p&gt;&lt;/div&gt;</description><category>lets-debug</category><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/gtfs-editor.html</guid><pubDate>Wed, 10 Jul 2013 03:30:01 GMT</pubDate></item></channel></rss>

+ 0 - 100
output/categories/philippine-transit-app.html

@@ -1,100 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts about philippine-transit-app | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/categories/philippine-transit-app.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><link rel="alternate" type="application/rss+xml" title="RSS for tag philippine-transit-app" href="philippine-transit-app.xml">
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="tagpage"><header><h1>Posts about philippine-transit-app</h1>
-        <div class="metadata">
-                <p class="feedlink"><a href="philippine-transit-app.xml" type="application/rss+xml">RSS feed</a></p>
-        </div>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/geocoding-services.html" class="listtitle">Geocoding Services</a> <time class="listdate" datetime="2013-09-25T12:26:59+08:00" title="2013-09-25 12:26">2013-09-25 12:26</time>
-</li>
-        <li>
-<a href="../posts/jeep-and-bus-schedules.html" class="listtitle">Jeep and Bus Schedules</a> <time class="listdate" datetime="2013-07-28T16:26:31+08:00" title="2013-07-28 16:26">2013-07-28 16:26</time>
-</li>
-        <li>
-<a href="../posts/highways-in-otp.html" class="listtitle">Highways in OTP</a> <time class="listdate" datetime="2013-07-24T23:15:57+08:00" title="2013-07-24 23:15">2013-07-24 23:15</time>
-</li>
-        <li>
-<a href="../posts/elevation-data-in-otp.html" class="listtitle">Elevation Data in OTP</a> <time class="listdate" datetime="2013-07-23T18:23:00+08:00" title="2013-07-23 18:23">2013-07-23 18:23</time>
-</li>
-        <li>
-<a href="../posts/graphserver.html" class="listtitle">GraphServer</a> <time class="listdate" datetime="2013-07-23T14:48:29+08:00" title="2013-07-23 14:48">2013-07-23 14:48</time>
-</li>
-        <li>
-<a href="../posts/transit-wand.html" class="listtitle">Transit Wand</a> <time class="listdate" datetime="2013-07-15T22:45:20+08:00" title="2013-07-15 22:45">2013-07-15 22:45</time>
-</li>
-        <li>
-<a href="../posts/fare-data.html" class="listtitle">Fare Data</a> <time class="listdate" datetime="2013-07-13T21:15:09+08:00" title="2013-07-13 21:15">2013-07-13 21:15</time>
-</li>
-        <li>
-<a href="../posts/gtfs-editor.html" class="listtitle">GTFS Editor</a> <time class="listdate" datetime="2013-07-10T11:30:01+08:00" title="2013-07-10 11:30">2013-07-10 11:30</time>
-</li>
-        <li>
-<a href="../posts/open-trip-planner.html" class="listtitle">Open Trip Planner</a> <time class="listdate" datetime="2013-07-09T23:16:12+08:00" title="2013-07-09 23:16">2013-07-09 23:16</time>
-</li>
-        <li>
-<a href="../posts/one-bus-or-maybe-jeep-away.html" class="listtitle">One Bus (or maybe Jeep) Away</a> <time class="listdate" datetime="2013-07-09T01:53:59+08:00" title="2013-07-09 01:53">2013-07-09 01:53</time>
-</li>
-        <li>
-<a href="../posts/jeepney-and-bus-routes.html" class="listtitle">Jeepney and Bus Routes</a> <time class="listdate" datetime="2013-07-07T10:32:36+08:00" title="2013-07-07 10:32">2013-07-07 10:32</time>
-</li>
-        <li>
-<a href="../posts/philippine-transit-app-challenge.html" class="listtitle">Philippine Transit App Challenge</a> <time class="listdate" datetime="2013-07-07T00:17:37+08:00" title="2013-07-07 00:17">2013-07-07 00:17</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 321
output/categories/philippine-transit-app.xml

@@ -1,321 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer (philippine-transit-app)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/categories/philippine-transit-app.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Geocoding Services</title><link>http://pleasantprogrammer.com/posts/geocoding-services.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don't know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.&lt;/p&gt;
-&lt;p&gt;The gold standard for doing geocoding right now is Google Maps. It's hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn't be &lt;em&gt;that&lt;/em&gt; much you could do for the competition.&lt;/p&gt;
-&lt;p&gt;When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called &lt;a href="http://nominatim.openstreetmap.org"&gt;Nominatim&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.&lt;/p&gt;
-&lt;p&gt;Given a typical mapping app, you might type in "ateneo" and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google's &lt;a href="https://developers.google.com/maps/documentation/javascript/geocoding"&gt;geocoding API&lt;/a&gt;, you probably won't get any result for this. What you want to use is the &lt;a href="https://developers.google.com/maps/documentation/javascript/places"&gt;Places API&lt;/a&gt; which provides an autocomplete search box. Using it, when you type in "ateneo", it automatically suggests in the dropdown, "Ateneo de Manila University".&lt;/p&gt;
-&lt;p&gt;A downside to using the Places API is that it's against the terms of service to use it with something that isn't Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap's data will probably be a better long term solution.&lt;/p&gt;
-&lt;p&gt;For now, since the competition's deadline is just a few days away, I'll be using Google Maps.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/geocoding-services.html</guid><pubDate>Wed, 25 Sep 2013 04:26:59 GMT</pubDate></item><item><title>Jeep and Bus Schedules</title><link>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Wouldn't it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist's paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn't worry. I can assure you, it's still a death sentence.&lt;/p&gt;
-&lt;p&gt;The GTFS spec defines 2 ways of statically specifying trip schedules. You can define the exact times that a service will arrive at a stop. You can also specify between what times the service is active and how often a new bus or jeep leaves the first stop. You also define which days those rules apply. You could say every MWF, the bus operates from 9:00AM to 9:00PM and every TTH, the bus services from 3:00AM to 11:00PM.&lt;/p&gt;
-&lt;p&gt;This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there's another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.&lt;/p&gt;
-&lt;p&gt;Like much everything else about the Philippine transit system, there aren't really any "schedules" to speak of. It's generally whenever the buses or jeeps feel like it. So we have no static schedules. We don't have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.&lt;/p&gt;
-&lt;p&gt;Ideally, we shouldn't bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn't work without it. So we have to add a reasonable trip schedule for jeeps and buses.&lt;/p&gt;
-&lt;p&gt;The current GTFS data does define these trip schedules. We assume that jeeps and buses operate between 6:00AM and 11:00PM and a new jeep passes by every 10 minutes. Also, jeeps and buses are defined to only operate on weekdays.&lt;/p&gt;
-&lt;p&gt;While there might be jeeps who change routes or don't operate on weekends, I'm pretty sure that jeeps and buses run on weekends. We'll have to fix it ourselves temporarily since there's no central GTFS feed yet.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# 724594 seems to be the service id used by jeeps and buses&lt;/span&gt;
-sed -i .bak &lt;span class="s1"&gt;'/^724594/ s/0,0/1,1/'&lt;/span&gt; calendar.txt
-&lt;/pre&gt;
-
-
-&lt;p&gt;Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you're sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.&lt;/p&gt;
-&lt;p&gt;If we set the frequency to one minute, it &lt;em&gt;might&lt;/em&gt; give better routes by eliminating the timing issue. Or not, it's kind of hard to tell.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# jeep and bus route ids tend to start with 72&lt;/span&gt;
-sed -i .bak &lt;span class="s1"&gt;'/^72/ s/,600/,60/'&lt;/span&gt; frequencies.txt
-&lt;/pre&gt;
-
-
-&lt;p&gt;Overall, the problems we're having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don't need to do hackish things for it to fit the GTFS, but that's still a dream. For now, all we can really do is fit a triangle into a square hole.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</guid><pubDate>Sun, 28 Jul 2013 08:26:31 GMT</pubDate></item><item><title>Highways in OTP</title><link>http://pleasantprogrammer.com/posts/highways-in-otp.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP's suggested route for walking from UP to Ateneo:&lt;/p&gt;
-&lt;p&gt;&lt;img alt="Roundabout route from UP to Ateneo" src="http://pleasantprogrammer.com/galleries/transit/otproundabout.png"&gt;&lt;/p&gt;
-&lt;p&gt;This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.&lt;/p&gt;
-&lt;p&gt;OTP couldn't possibly be that dumb though, so there must be something we're doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the "road type" designated to Katipunan.&lt;/p&gt;
-&lt;p&gt;Apparently, by default OTP will consider roads of type &lt;code&gt;trunk&lt;/code&gt; to be non-walkable and non-bikable. This is documented in the &lt;a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner"&gt;OpenStreetMap wiki&lt;/a&gt; and the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety"&gt;OTP wiki&lt;/a&gt; as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;sed -i .bak s/trunk/primary/g manila.osm
-&lt;/pre&gt;
-
-
-&lt;p&gt;And rebuild the graph. It doesn't really matter much because the OSM data isn't used to render the maps. It's just used to build the routing data. This is actually what I did for &lt;a href="http://maps.pleasantprogrammer.com"&gt;maps.pleasantprogrammer.com&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on &lt;code&gt;highway=trunk&lt;/code&gt; we could allow that. This is not much better than the &lt;code&gt;sed&lt;/code&gt; solution though. It's better since you keep the weighting done by OTP, but you're still saying that all trunks are walkable which might not be the case.&lt;/p&gt;
-&lt;p&gt;The most correct way to actually fix this is to go through each of the trunks and specifying &lt;code&gt;foot=yes&lt;/code&gt; and &lt;code&gt;bicycle=yes&lt;/code&gt; for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I'm not sure on the particulars with updating OSM though.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/highways-in-otp.html</guid><pubDate>Wed, 24 Jul 2013 15:15:57 GMT</pubDate></item><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="http://pleasantprogrammer.com/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
-&lt;p&gt;One thing I hadn't tested out last time was OTP's support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.&lt;/p&gt;
-&lt;p&gt;The &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes"&gt;5 minute tutorial&lt;/a&gt; actually discusses the elevation data briefly, but a more in-depth thing you can look at is the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data"&gt;GraphBuilder documentation&lt;/a&gt;. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the &lt;a href="http://www.philgis.org/freegisdata.htm"&gt;PhilGIS website&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;I don't know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use &lt;a href="http://www.gdal.org/"&gt;GDAL&lt;/a&gt; for this. You'd just then run,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt; gdal_translate srtm41_90m_phl.img phil.tiff
-&lt;/pre&gt;
-
-
-&lt;p&gt;Afterwards, it's just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you're running on limited RAM.&lt;/p&gt;
-&lt;p&gt;I've actually hosted a &lt;a href="http://maps.pleasantprogrammer.com"&gt;working example&lt;/a&gt;. It's pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don't abuse it though.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</guid><pubDate>Tue, 23 Jul 2013 10:23:00 GMT</pubDate></item><item><title>GraphServer</title><link>http://pleasantprogrammer.com/posts/graphserver.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="http://graphserver.github.io/graphserver/"&gt;http://graphserver.github.io/graphserver/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;One other routing webapp I saw was GraphServer. It's actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It's also based off python and C instead of Java, so it feels a lot less heavy.&lt;/p&gt;
-&lt;p&gt;The instructions on the website are already pretty good. There are just some minor errors with it. Where it says &lt;code&gt;gs_gtfsdb_build&lt;/code&gt;, you should actually use &lt;code&gt;gs_gtfsdb_compile&lt;/code&gt;. Also, when running &lt;code&gt;gs_osmdb_compile&lt;/code&gt; you might need to use &lt;code&gt;-t&lt;/code&gt; for tolerant in case you follow the instructions on chopping up the original OSM data.&lt;/p&gt;
-&lt;p&gt;A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn't support 64-bit ids. The &lt;a href="http://wiki.openstreetmap.org/wiki/Osmosis"&gt;latest version of Osmosis&lt;/a&gt; easily did the job though.&lt;/p&gt;
-&lt;p&gt;The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn't provide any alternate routes aside from that one. I'm not sure if it's a limitation of the provided routeserver, but I didn't bother checking if it supported parameters which might provide better routes.&lt;/p&gt;
-&lt;p&gt;I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/graphserver.html</guid><pubDate>Tue, 23 Jul 2013 06:48:29 GMT</pubDate></item><item><title>Transit Wand</title><link>http://pleasantprogrammer.com/posts/transit-wand.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand"&gt;http://transitwand.com&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;Overall, this was the simplest of the &lt;a href="http://philippine-transit.hackathome.com/use-this-code/"&gt;open-source transit tools&lt;/a&gt; to actually get up and running. There's already a deployed instance of the server, and you can easily download the phone app via the &lt;a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand"&gt;Play Store&lt;/a&gt;. Even running the server by yourself didn't have any of the hiccups I had with GTFS Editor.&lt;/p&gt;
-&lt;p&gt;The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.&lt;/p&gt;
-&lt;p&gt;After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it's free and you don't even actually need to put in a username or anything. It simply registers the phone's IMEI on the server and gives you a 6-digit identifier.&lt;/p&gt;
-&lt;p&gt;You can then use the 6-digit identifier to view the data on Transit Wand's server, which is good since uploading any data automatically deletes it from the phone. There really isn't much else you can do with it though. It just allows you to view the data, and export it as a &lt;a href="https://en.wikipedia.org/wiki/Shapefile"&gt;Shapefile&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There's also no way to extract the ridership information from the server yet. This isn't to say that the data won't eventually go public though.&lt;/p&gt;
-&lt;p&gt;An interesting thing you &lt;em&gt;can&lt;/em&gt; do with the Transit Wand data is import it into GTFS Editor to make a new route. You don't even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you've captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.&lt;/p&gt;
-&lt;p&gt;I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don't understand is why the shape data isn't present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can't easily move stops, you have to input coordinates to change the position.&lt;/p&gt;
-&lt;p&gt;It &lt;em&gt;might&lt;/em&gt; also be possible that when the DOTC was still collecting the data, the route collection or editing features weren't present yet. That would just be lame and depressing though.&lt;/p&gt;
-&lt;p&gt;Overall, Transit Wand does what it's supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/transit-wand.html</guid><pubDate>Mon, 15 Jul 2013 14:45:20 GMT</pubDate></item><item><title>Fare Data</title><link>http://pleasantprogrammer.com/posts/fare-data.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;As part of the data released by the DOTC, we also have the &lt;a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/"&gt;fare matrix&lt;/a&gt; for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the &lt;a href="http://ltfrb.gov.ph/main/farerates"&gt;LTFRB website&lt;/a&gt;. Generally, the fare scheme is represented as "pay &lt;em&gt;X&lt;/em&gt; pesos for the first &lt;em&gt;Y&lt;/em&gt; kilometers, pay &lt;em&gt;Z&lt;/em&gt; for every succeeding kilometer." Instead of a table, we can simply represent this as a formula instead,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;base_fare + (distance - initial) * per_km
-&lt;/pre&gt;
-
-
-&lt;p&gt;The relevant values for the three services are:&lt;/p&gt;
-&lt;table&gt;
-&lt;thead&gt;
-  &lt;tr&gt;
-    &lt;td&gt;type&lt;/td&gt;
-    &lt;td&gt;base_fare&lt;/td&gt;
-    &lt;td&gt;initial&lt;/td&gt;
-    &lt;td&gt;per_km&lt;/td&gt;
-  &lt;/tr&gt;
-&lt;/thead&gt;
-&lt;tbody&gt;
-  &lt;tr&gt;
-    &lt;td&gt;bus aircon&lt;/td&gt;
-    &lt;td&gt;12.00&lt;/td&gt;
-    &lt;td&gt;5 km&lt;/td&gt;
-    &lt;td&gt;2.20&lt;/td&gt;
-  &lt;/tr&gt;
-  &lt;tr&gt;
-    &lt;td&gt;bus ordinary&lt;/td&gt;
-    &lt;td&gt;10.00&lt;/td&gt;
-    &lt;td&gt;5 km&lt;/td&gt;
-    &lt;td&gt;1.85&lt;/td&gt;
-  &lt;/tr&gt;
-  &lt;tr&gt;
-    &lt;td&gt;jeep aircon&lt;/td&gt;
-    &lt;td&gt;8.00&lt;/td&gt;
-    &lt;td&gt;4 km&lt;/td&gt;
-    &lt;td&gt;1.40&lt;/td&gt;
-  &lt;/tr&gt;
-&lt;/tbody&gt;
-&lt;/table&gt;
-
-&lt;p&gt;It isn't as simple as that though. Fares are also rounded to the nearest 25 centavos. So we'd need to round them off correctly. This can be achieved by doing,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;round(calculated_fare * 4.0)/4.0
-&lt;/pre&gt;
-
-
-&lt;p&gt;There's also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.&lt;/p&gt;
-&lt;p&gt;Doing just this, we actually do get the same results as the fare matrices in the image for the most part. There are some discrepancies with the discounted jeep fares. I've tried to resolve it by tweaking around with the formulas, but it really doesn't make sense in any way. I presume these were manually adjusted for one reason or another.&lt;/p&gt;
-&lt;p&gt;Here's a &lt;a href="http://pleasantprogrammer.com/uploads/farematrix.rb"&gt;script&lt;/a&gt; that generates CSVs of all the three fare matrices. If you're too lazy to run it, here are links to the &lt;a href="http://pleasantprogrammer.com/uploads/pub_aircon.csv"&gt;aircon bus&lt;/a&gt;, &lt;a href="http://pleasantprogrammer.com/uploads/pub_ordinary.csv"&gt;ordinary bus&lt;/a&gt; and &lt;a href="http://pleasantprogrammer.com/uploads/puj.csv"&gt;jeep&lt;/a&gt; fare matrices.&lt;/p&gt;
-&lt;h4&gt;GTFS compatibility&lt;/h4&gt;
-&lt;p&gt;As is, the provided GTFS data does not have any fare data. I imagine this is because the existing spec doesn't have good support for distance-based fares like we have in the Philippines. Judging from the &lt;a href="https://code.google.com/p/googletransitdatafeed/wiki/FareExamples"&gt;fare examples&lt;/a&gt;, the only reasonable way we could implement distance-based fares is following example 6. This would involve setting a fare for each possible pair of stops based on the distance between them. This isn't exactly ideal. In fact, the people originally working on the DOTC project have voiced &lt;a href="https://groups.google.com/forum/#!topic/gtfs-fare-wg/V63xRSnQJGw"&gt;issues&lt;/a&gt; and made &lt;a href="https://groups.google.com/forum/#!msg/gtfs-changes/uybrAokZ9Cg/rqlzXdMypUgJ"&gt;proposals&lt;/a&gt; for having distance-based fares included into GTFS.&lt;/p&gt;
-&lt;p&gt;Apparently, public transit fares are a really complicated thing. You have fares based on distance, number of stops passed through, and transfers which may or may not cost extra. Not only that, you might have discounted fares, or first-class vs economy fares. The community will want to get it right before it's formally included in the spec. You can see the current state of the consolidated &lt;a href="https://docs.google.com/document/d/1mK3--o5g4-3cCXaqmch92U63JTwChh0L2VCmcDViIlM/edit"&gt;GTFS fare proposal here&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;Even in it's proposal form though, we might have hope of being able to see these being used. There's currently a &lt;a href="https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/30"&gt;pull request&lt;/a&gt; for supporting the distance-based fare scheme into the OneBusAway libraries. The libraries actually used by GTFS Editor and OpenTripPlanner for working with GTFS data.&lt;/p&gt;
-&lt;h4&gt;Remaining Problems&lt;/h4&gt;
-&lt;p&gt;Given all that, it would probably still be a long way before this allows us to make a really good routing app. We still don't have shape data, so the distance estimates would really be rough estimates at best. There's no support for rounding to the nearest centavo. I realize that's just nitpicking, but if we want something truly polished, even that has to be taken care of.&lt;/p&gt;
-&lt;p&gt;We also don't know if the jeeps or buses strictly follow the distance-based scheme. After all, if you can get on and off anywhere, you can't really measure distance that exactly. I assume they generally work off the notion of "zones" than actual distance travelled. In that sense, they work more similarly to the LRT which has fares based on how many stops you pass. For jeeps and buses, your fare is probably based more on how many "zones" you pass through.&lt;/p&gt;
-&lt;h4&gt;Conclusion&lt;/h4&gt;
-&lt;p&gt;Philip, a co-worker of mine at By Implication, had suggested that we might want to use a different model than what the GTFS proposes. I have to agree with him. At this point, the GTFS doesn't really fit with our system. But I do think that open data and standards are great. In fact, I applaud the developers who made proposals for the fare system, as those are great first steps towards making the GTFS a more universal standard.&lt;/p&gt;
-&lt;p&gt;Side note: I'd also actually really like to hear about the DOTC developers' experience with the project. It would be nice if they had a devblog.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/fare-data.html</guid><pubDate>Sat, 13 Jul 2013 13:15:09 GMT</pubDate></item><item><title>GTFS Editor</title><link>http://pleasantprogrammer.com/posts/gtfs-editor.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="https://github.com/conveyal/gtfs-editor"&gt;https://github.com/conveyal/gtfs-editor&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; they really meant under development&lt;/p&gt;
-&lt;p&gt;When I first saw the source of GTFS Editor, I was ecstatic. They used &lt;a href="http://playframework.com/"&gt;Play framework&lt;/a&gt;!!! Not only that, they're targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.&lt;/p&gt;
-&lt;p&gt;Getting it to actually run though, wasn't very pleasant. The initial setup was easy enough. Get &lt;a href="http://www.playframework.com/download"&gt;Play 1.2.5&lt;/a&gt;, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that's necessary. Wonderful. Then, run play, open a browser, go to &lt;a href="http://localhost:9000"&gt;http://localhost:9000&lt;/a&gt;, compilation error. Fantastic.&lt;/p&gt;
-&lt;p&gt;If you don't want to go through the technical details, you can just jump to the &lt;a href="http://pleasantprogrammer.com/posts/gtfs-editor.html#conclusion"&gt;conclusion&lt;/a&gt;.&lt;/p&gt;
-&lt;h3&gt;Let's Debug!&lt;/h3&gt;
-&lt;p&gt;I'll be splitting the next section up into 2 parts. In the first pass, I'll talk about what I did to just get the app to run but I won't try hard to fix any bugs. This generally is what I do when I try to get apps to run. I'll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I'll explain what the problems were and how I fixed them.&lt;/p&gt;
-&lt;h4&gt;First Pass&lt;/h4&gt;
-&lt;p&gt;A thing to note about Play (and one of the reasons it's a lovely Java framework) is that you don't need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that's what I saw, &lt;code&gt;Error: type Check already defined&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="nd"&gt;@Retention&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;RetentionPolicy&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;RUNTIME&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
-&lt;span class="nd"&gt;@Target&lt;/span&gt;&lt;span class="o"&gt;({&lt;/span&gt;&lt;span class="n"&gt;ElementType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;METHOD&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ElementType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;TYPE&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
-&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nd"&gt;@interface&lt;/span&gt; &lt;span class="n"&gt;Check&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="nf"&gt;value&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-&lt;span class="o"&gt;}&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;You also know that typical behavior among programmers where your program doesn't compile, but you keep trying to compile it anyway hoping that it will magically just work. That's what I did, and it actually ran. I couldn't really just let this pass, so I decided to try deleting &lt;code&gt;Check.java&lt;/code&gt;. I got another compilation error, &lt;code&gt;Error: type Secure already defined&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Secure&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Controller&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="nd"&gt;@Before&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unless&lt;/span&gt;&lt;span class="o"&gt;={&lt;/span&gt;&lt;span class="s"&gt;"login"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"authenticate"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"logout"&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
-
-    &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;checkAccess&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="n"&gt;Throwable&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put &lt;code&gt;Check.java&lt;/code&gt; back in and proceeded to just refresh until it compiled and ran.&lt;/p&gt;
-&lt;p&gt;The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the &lt;code&gt;account&lt;/code&gt; table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn't work.&lt;/p&gt;
-&lt;p&gt;Another note regarding Play 1.x, it provides the &lt;a href="http://www.playframework.com/documentation/1.2.5/secure"&gt;secure module&lt;/a&gt; which handles logins and keeping state, you simply need to implement the method &lt;code&gt;boolean authenticate(String username, String password)&lt;/code&gt;. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return &lt;code&gt;true&lt;/code&gt; and then any login would work. No need to actually set the password. Excellent.&lt;/p&gt;
-&lt;p&gt;And we're logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, &lt;code&gt;IndexOutOfBoundsException occured : Index: 0, Size: 0&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyId"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-
-    &lt;span class="n"&gt;Agency&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;agencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyId"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-    &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyName"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;Apparently, we need to have an agency. That's generally simple enough. You just manually insert an agency into the &lt;code&gt;agency&lt;/code&gt; table. After that's done, we finally have a view of the actual application. It's very Bootstrap-y, but that's just fine. The workflow though, is not perfectly intuitive, but I'll talk about that some other day.&lt;/p&gt;
-&lt;p&gt;That's not the end of it though, we still have to fix these bugs. The developer obviously didn't have to put up with this when they were working, so what happened? Also, the log is showing some weird things,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;~        _            _
-~  _ __ | | __ _ _  _| |
-~ | '_ \| |/ _' | || |_|
-~ |  __/|_|\____|\__ (_)
-~ |_|            |__/
-~
-~ play! 1.2.5, http://www.playframework.org
-~
-~ Ctrl+C to stop
-~
-CompilerOracle: exclude jregex/Pretokenizer.next
-Listening for transport dt_socket at address: 8000
-23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
-23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
-23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
-23:32:15,830 WARN  ~ You're running Play! in DEV mode
-23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
-23:32:28,792 ERROR ~
-
-@6f02fa9dd
-Internal Server Error (500) for request GET /
-
-Compilation error (In /app/controllers/Check.java around line 10)
-The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
-
-play.exceptions.CompilationException: The type Check is already defined
-    at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
-    at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
-    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
-    at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
-    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
-    at play.Play.start(Play.java:516)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at Invocation.HTTP Request(Play!)
-23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
-SLF4J: Class path contains multiple SLF4J bindings.
-SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
-23:32:32,490 INFO  ~ Initializing HBSpatialExtension
-23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
-23:32:32,494 INFO  ~ Checking for default configuration file.
-23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
-23:32:34,077 INFO  ~ Application 'gtfs-editor' is now started !
-23:32:34,151 INFO  ~ Bootstrapping Database...
-23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
-play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
-    at play.templates.TemplateLoader.load(TemplateLoader.java:78)
-    at play.test.Fixtures.loadModels(Fixtures.java:174)
-    at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
-    at play.jobs.Job.doJobWithResult(Job.java:50)
-    at play.jobs.Job.call(Job.java:146)
-    at play.jobs.Job.run(Job.java:132)
-    at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
-    at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
-    at play.Play.start(Play.java:547)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
-    at play.Invoker$Invocation.run(Invoker.java:276)
-    at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
-    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
-    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
-    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
-    at java.lang.Thread.run(Thread.java:680)
-Caused by: play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
-    ... 22 more
-Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
-    at java.io.FileInputStream.open(Native Method)
-    at java.io.FileInputStream.&amp;lt;init&amp;gt;(FileInputStream.java:120)
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
-    ... 23 more
-23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
-23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
-23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
-23:32:40,999 DEBUG ~ select nextval ('hibernate_sequence')
-23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
-23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
-23:32:41,175 ERROR ~
-
-@6f02fa9dg
-Internal Server Error (500) for request GET /
-
-Execution exception (In /app/controllers/Application.java around line 57)
-IndexOutOfBoundsException occured : Index: 0, Size: 0
-
-play.exceptions.JavaExecutionException: Index: 0, Size: 0
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
-    at Invocation.HTTP Request(Play!)
-Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
-    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
-    at java.util.ArrayList.get(ArrayList.java:322)
-    at controllers.Application.initSession(Application.java:57)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
-    at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
-    ... 1 more
-&lt;/pre&gt;
-
-
-&lt;p&gt;After &lt;code&gt;23:32:34&lt;/code&gt; is when I get the login page. &lt;code&gt;23:32:40&lt;/code&gt; is after I've logged in.&lt;/p&gt;
-&lt;h4&gt;Second Pass&lt;/h4&gt;
-&lt;p&gt;So how did you do? First, the error that &lt;code&gt;type Check already defined&lt;/code&gt; usually does mean that &lt;code&gt;Check&lt;/code&gt; was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It's the only one there that was &lt;code&gt;Check.java&lt;/code&gt;. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, &lt;code&gt;Check.java&lt;/code&gt;. Doing a diff shows nothing was changed. So the solution really was just simply delete &lt;code&gt;Check.java&lt;/code&gt; and also &lt;code&gt;Secure.java&lt;/code&gt;. No more compilation errors!&lt;/p&gt;
-&lt;p&gt;The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Security&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isConnected&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-    &lt;span class="n"&gt;Account&lt;/span&gt; &lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;find&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"username = ?"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Security&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;connected&lt;/span&gt;&lt;span class="o"&gt;()).&lt;/span&gt;&lt;span class="na"&gt;first&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-        &lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"admin"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"admin"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"admin@test.com"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-        &lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;save&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-    &lt;span class="o"&gt;}&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-&lt;span class="o"&gt;}&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;You can actually see this in action at &lt;code&gt;23:32:41,051&lt;/code&gt; in the log. So what's wrong with all of this? The account creation happened after I've already logged in. In fact, &lt;code&gt;Security.isConnected()&lt;/code&gt; checks whether the user is already logged in or not. How does this even make sense?&lt;/p&gt;
-&lt;p&gt;Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we're missing a file called &lt;code&gt;initial-agencies-data.yml&lt;/code&gt;. Ok, apparently it's a &lt;a href="http://www.playframework.com/documentation/1.2.5/test#fixtures"&gt;fixture&lt;/a&gt; like you would use for testing. It's easy enough to infer what the file's contents should be. We just copy it over from the GTFS data.&lt;/p&gt;
-&lt;p&gt;But then where do you put the file? If you look at the log, it says &lt;code&gt;/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml&lt;/code&gt; but that doesn't look right. That's in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the &lt;code&gt;test/&lt;/code&gt; directory? No, that doesn't work either since we're not running a test.&lt;/p&gt;
-&lt;p&gt;What I ended up doing was just looking at the sources for &lt;code&gt;Fixtures.load&lt;/code&gt;. If you follow the stack trace, you end up finding &lt;code&gt;Play.javaPath&lt;/code&gt; which sort of works like PATH for Fixtures and some other things. So where can we put the file? &lt;code&gt;app/&lt;/code&gt; and &lt;code&gt;conf/&lt;/code&gt;. And with that, we're done.&lt;/p&gt;
-&lt;h4 id="conclusion"&gt;Conclusion&lt;/h4&gt;
-
-&lt;p&gt;GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone &lt;a href="https://github.com/thatsmydoing/gtfs-editor"&gt;my branch&lt;/a&gt; as I've fixed the issues discussed earlier. The default login is &lt;code&gt;admin:admin&lt;/code&gt;.&lt;/p&gt;
-&lt;p&gt;Even after getting it to run, it's still not quite usable. Not in the UX sense, but you really can't do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don't have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.&lt;/p&gt;&lt;/div&gt;</description><category>lets-debug</category><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/gtfs-editor.html</guid><pubDate>Wed, 10 Jul 2013 03:30:01 GMT</pubDate></item><item><title>Open Trip Planner</title><link>http://pleasantprogrammer.com/posts/open-trip-planner.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="http://www.opentripplanner.org"&gt;http://www.opentripplanner.org&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; routes pretty well; data might cause weird issues&lt;/p&gt;
-&lt;p&gt;OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you're willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.&lt;/p&gt;
-&lt;p&gt;It's actually in general use by the &lt;a href="http://maps.trimet.org/"&gt;Trimet&lt;/a&gt;, Portland's public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner's support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn't have. This actually just screams &lt;a href="http://philippine-transit.hackathome.com/prizes/"&gt;Inclusive Technology Award&lt;/a&gt;.&lt;/p&gt;
-&lt;h4&gt;Setup&lt;/h4&gt;
-&lt;p&gt;Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I'd suggest going through the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes"&gt;5-minute introduction&lt;/a&gt; if you want to actually work with the Philippine data. You will also need to download the &lt;a href="http://download.geofabrik.de/asia/philippines.html"&gt;Philippine data dump&lt;/a&gt; from OSM. You will want the &lt;code&gt;osm.bz2&lt;/code&gt; one (WARNING: 900MB unzipped).&lt;/p&gt;
-&lt;p&gt;Once you get the webapp running, you'll notice the map tiles won't load correctly. This is because the default tileset used is from Mapbox which doesn't provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.&lt;/p&gt;
-&lt;h4&gt;Issues&lt;/h4&gt;
-&lt;p&gt;The next thing you'll notice is that you can't search for a place. You can only just pick points on the map and route between those. I'm still not exactly sure if it's supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn't be too difficult.&lt;/p&gt;
-&lt;p&gt;Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet's implementation isn't as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.&lt;/p&gt;
-&lt;p&gt;There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a "stop" in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the "stop" to Arguilla.&lt;/p&gt;
-&lt;p&gt;&lt;img alt="OpenTripPlanner disconnected route" src="http://pleasantprogrammer.com/galleries/transit/otp1.png"&gt;&lt;/p&gt;
-&lt;p&gt;I can't say this isn't a bug. After all, OpenTripPlanner couldn't have magically known there really was a street there. If it did, it wouldn't just teleport you to the corner. I'm more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.&lt;/p&gt;
-&lt;p&gt;Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won't give you the best route because it thinks you have to loop around to get to where you want to be. I don't really know how common this issue pops up though. It's highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.&lt;/p&gt;
-&lt;p&gt;&lt;img alt="OpenTripPlanner loopy route" src="http://pleasantprogrammer.com/galleries/transit/otp2.png"&gt;&lt;/p&gt;
-&lt;p&gt;Much like the earlier problem, I can't tell if this is a bug or it's a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren't even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.&lt;/p&gt;
-&lt;p&gt;&lt;img alt="UP Katipunan Route" src="http://pleasantprogrammer.com/galleries/transit/upkatipunan.jpg"&gt;&lt;/p&gt;
-&lt;p&gt;From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren't that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.&lt;/p&gt;
-&lt;h4&gt;Conclusion&lt;/h4&gt;
-&lt;p&gt;Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There's also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/open-trip-planner.html</guid><pubDate>Tue, 09 Jul 2013 15:16:12 GMT</pubDate></item><item><title>One Bus (or maybe Jeep) Away</title><link>http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="http://onebusaway.org/"&gt;http://onebusaway.org/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; no routing; useless in Philippines&lt;/p&gt;
-&lt;p&gt;OneBusAway is a transit information app. It provides data on what bus stops are near you, which buses pass by. You can also get schedules and the route of a particular bus given the number. It can also provide realtime updates like how many minutes until the next bus arrives. It does not, however, provide routing. There is no support for providing directions to get from point A to point B.&lt;/p&gt;
-&lt;p&gt;It's comparable to what you get in some bus stops abroad. You'd get a vicinity map and a list of buses passing through the stop. You might also get the times when the next buses will pass. It's useful for locals who already know how to get around, and want to avoid waiting for the bus. But it's not particularly good for people who want to know how to get around the city.&lt;/p&gt;
-&lt;p&gt;OneBusAway is quite comprehensive in its platform support though. There is a webapp, apps for iOS, Android and Windows Phone, as well as SMS and Voice support. This would all be nice but we don't have the necessary infrastructure yet in the Philippines. We don't have bus or jeepney stops. We also wouldn't have realtime data to make the app particularly useful.&lt;/p&gt;
-&lt;p&gt;You can try it out for yourself by following their &lt;a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/OneBusAway-Quickstart-Guide"&gt;Quickstart Guide&lt;/a&gt;. One caveat is you will have to add &lt;code&gt;-P tripEntriesFactory.throwExceptionOnInvalidStopToShapeMappingException=false&lt;/code&gt; when building the bundle. This has to do with the OneBusAway having difficulty matching the &lt;a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching"&gt;stops to the shape data&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;Here's some screenshots of the app with the Philippine data. Notice how you only see the stops but there isn't a line for the route. This is a problem with our GTFS data. Also, at some points it's hard to tell where the jeep is going to pass since there isn't any indication of order either. This is more of a OneBusAway problem. It usually expects there to be shape data available.&lt;/p&gt;
-&lt;p&gt;&lt;a href="http://pleasantprogrammer.com/galleries/transit/onebusaway1.png"&gt;&lt;img alt="OneBusAway" src="http://pleasantprogrammer.com/galleries/transit/onebusaway1.png" title="All the stops along Katipunan Avenue are named Katipunan Avenue."&gt;&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;It doesn't really handle too many routes passing through a stop. The list just overflows past the bubble. You can still actually read it by panning the map. It's just a bit weird though.&lt;/p&gt;
-&lt;p&gt;If you also noticed, there are usually 2 of each route. This is how the jeepney data was modeled as jeep routes might be different going one way and going back. This isn't the case for all jeeps though, so it might also be an implementation issue with the GTFS editor.&lt;/p&gt;
-&lt;p&gt;&lt;a href="http://pleasantprogrammer.com/galleries/transit/onebusaway2.png"&gt;&lt;img alt="OneBusAway" src="http://pleasantprogrammer.com/galleries/transit/onebusaway2.png"&gt;&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;a href="http://pleasantprogrammer.com/galleries/transit/onebusaway3.png"&gt;&lt;img alt="OneBusAway" src="http://pleasantprogrammer.com/galleries/transit/onebusaway3.png"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html</guid><pubDate>Mon, 08 Jul 2013 17:53:59 GMT</pubDate></item></channel></rss>

+ 0 - 103
output/categories/programming.html

@@ -1,103 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts about programming | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/categories/programming.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><link rel="alternate" type="application/rss+xml" title="RSS for tag programming" href="programming.xml">
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="tagpage"><header><h1>Posts about programming</h1>
-        <div class="metadata">
-                <p class="feedlink"><a href="programming.xml" type="application/rss+xml">RSS feed</a></p>
-        </div>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/is-my-terminal-window-active.html" class="listtitle">Is My Terminal Window Active?</a> <time class="listdate" datetime="2015-06-07T16:20:45+08:00" title="2015-06-07 16:20">2015-06-07 16:20</time>
-</li>
-        <li>
-<a href="../posts/geocoding-services.html" class="listtitle">Geocoding Services</a> <time class="listdate" datetime="2013-09-25T12:26:59+08:00" title="2013-09-25 12:26">2013-09-25 12:26</time>
-</li>
-        <li>
-<a href="../posts/jeep-and-bus-schedules.html" class="listtitle">Jeep and Bus Schedules</a> <time class="listdate" datetime="2013-07-28T16:26:31+08:00" title="2013-07-28 16:26">2013-07-28 16:26</time>
-</li>
-        <li>
-<a href="../posts/highways-in-otp.html" class="listtitle">Highways in OTP</a> <time class="listdate" datetime="2013-07-24T23:15:57+08:00" title="2013-07-24 23:15">2013-07-24 23:15</time>
-</li>
-        <li>
-<a href="../posts/elevation-data-in-otp.html" class="listtitle">Elevation Data in OTP</a> <time class="listdate" datetime="2013-07-23T18:23:00+08:00" title="2013-07-23 18:23">2013-07-23 18:23</time>
-</li>
-        <li>
-<a href="../posts/graphserver.html" class="listtitle">GraphServer</a> <time class="listdate" datetime="2013-07-23T14:48:29+08:00" title="2013-07-23 14:48">2013-07-23 14:48</time>
-</li>
-        <li>
-<a href="../posts/transit-wand.html" class="listtitle">Transit Wand</a> <time class="listdate" datetime="2013-07-15T22:45:20+08:00" title="2013-07-15 22:45">2013-07-15 22:45</time>
-</li>
-        <li>
-<a href="../posts/fare-data.html" class="listtitle">Fare Data</a> <time class="listdate" datetime="2013-07-13T21:15:09+08:00" title="2013-07-13 21:15">2013-07-13 21:15</time>
-</li>
-        <li>
-<a href="../posts/gtfs-editor.html" class="listtitle">GTFS Editor</a> <time class="listdate" datetime="2013-07-10T11:30:01+08:00" title="2013-07-10 11:30">2013-07-10 11:30</time>
-</li>
-        <li>
-<a href="../posts/open-trip-planner.html" class="listtitle">Open Trip Planner</a> <time class="listdate" datetime="2013-07-09T23:16:12+08:00" title="2013-07-09 23:16">2013-07-09 23:16</time>
-</li>
-        <li>
-<a href="../posts/one-bus-or-maybe-jeep-away.html" class="listtitle">One Bus (or maybe Jeep) Away</a> <time class="listdate" datetime="2013-07-09T01:53:59+08:00" title="2013-07-09 01:53">2013-07-09 01:53</time>
-</li>
-        <li>
-<a href="../posts/jeepney-and-bus-routes.html" class="listtitle">Jeepney and Bus Routes</a> <time class="listdate" datetime="2013-07-07T10:32:36+08:00" title="2013-07-07 10:32">2013-07-07 10:32</time>
-</li>
-        <li>
-<a href="../posts/philippine-transit-app-challenge.html" class="listtitle">Philippine Transit App Challenge</a> <time class="listdate" datetime="2013-07-07T00:17:37+08:00" title="2013-07-07 00:17">2013-07-07 00:17</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 324
output/categories/programming.xml

@@ -1,324 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer (programming)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/categories/programming.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Is My Terminal Window Active?</title><link>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;I've been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is &lt;a href="https://github.com/marzocchi/zsh-notify"&gt;zsh-notify&lt;/a&gt;. It's a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.&lt;/p&gt;
-&lt;p&gt;It's pretty convenient when you're compiling something and then go on to browse reddit while waiting. Usually, I spend too much time just reading and forget about the compilation entirely. With the plugin, I get the notification and maybe go back to work.&lt;/p&gt;
-&lt;p&gt;One nice feature it has is that if you're currently looking at the terminal window of the job that just finished, it won't notify you. It only notifies on windows that aren't currently in focus. To do this, it has to actually talk to Terminal.app or iTerm2 to see if the window and tab are active.&lt;/p&gt;
-&lt;p&gt;This is alright in OSX since those 2 are the generally most used terminal emulators. On Linux though, everyone has their own favorite terminal. Given that, I figured I could probably rely on talking to X to see if the window is active instead of each single terminal emulator. X can't tell if the tab is active though, but I don't use tabs in my current setup so it should still be good.&lt;/p&gt;
-&lt;h3&gt;xdotool&lt;/h3&gt;
-&lt;p&gt;&lt;a href="http://superuser.com/questions/382616/detecting-currently-active-window"&gt;Preliminary research&lt;/a&gt; reveals that we can easily get what the active window is with xdotool. &lt;code&gt;xdotool getactivewindow&lt;/code&gt; gives us the X window id of the active one. Now all we need is a way to get the window id of the terminal we're in.&lt;/p&gt;
-&lt;h3&gt;First Attempt: $WINDOWID&lt;/h3&gt;
-&lt;p&gt;Apparently, xterm and similar terminal emulators define an environment variable called &lt;code&gt;$WINDOWID&lt;/code&gt; with the window id of the terminal. Obviously, this is too good to be true. In xterm and konsole the &lt;code&gt;$WINDOWID&lt;/code&gt; was correct, but in VTE-based terminal emulators, &lt;code&gt;$WINDOWID&lt;/code&gt; had the wrong value. In terminology, it didn't define &lt;code&gt;$WINDOWID&lt;/code&gt; altogether. So &lt;code&gt;$WINDOWID&lt;/code&gt; wasn't going to work.&lt;/p&gt;
-&lt;h3&gt;Second Attempt: xdotool search $MAGIC&lt;/h3&gt;
-&lt;p&gt;My second idea was that you can use zsh to change the window title to a magic number and then just check if the active window is the same one as the window with the magic number. This sort of worked for most terminals, except konsole which does whatever it wants with the window title. There's also the problem of some zsh configs automatically settings the window title to the current command.&lt;/p&gt;
-&lt;p&gt;In hindsight, I could probably have just done &lt;code&gt;xdotool search --name xdotool&lt;/code&gt; since in most cases, when you run the search, zsh or konsole will set the window name to the current command. Maybe that's another option I can explore some day.&lt;/p&gt;
-&lt;h3&gt;Third Attempt: $PPID&lt;/h3&gt;
-&lt;p&gt;My third idea was another environment variable called &lt;code&gt;$PPID&lt;/code&gt;, which is the process id of the parent of the shell. As it happens, the parent is the window containing the zsh instance. This is actually pretty consistent across most terminals. The only problem was if you launched zsh from another shell since your new zsh's parent will now be another zsh instance instead of an X window.&lt;/p&gt;
-&lt;p&gt;At first glance, launching zsh within zsh doesn't seem like something most people would do, but this is what happens when you run screen or tmux. To work around this, we can actually just save the original &lt;code&gt;$PPID&lt;/code&gt; in a different variable and use that instead.&lt;/p&gt;
-&lt;p&gt;Now that we have the PID of the window from zsh, we can once again use xdotool to get the PID of the current active window with &lt;code&gt;xdotool getactivewindow getwindowpid&lt;/code&gt;. We just simply compare that with our &lt;code&gt;$PPID&lt;/code&gt; and we can tell if we're in an active window or not. Overall, this approach worked surprisingly well so that's the final solution I went with.&lt;/p&gt;&lt;/div&gt;</description><category>programming</category><guid>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</guid><pubDate>Sun, 07 Jun 2015 08:20:45 GMT</pubDate></item><item><title>Geocoding Services</title><link>http://pleasantprogrammer.com/posts/geocoding-services.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don't know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.&lt;/p&gt;
-&lt;p&gt;The gold standard for doing geocoding right now is Google Maps. It's hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn't be &lt;em&gt;that&lt;/em&gt; much you could do for the competition.&lt;/p&gt;
-&lt;p&gt;When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called &lt;a href="http://nominatim.openstreetmap.org"&gt;Nominatim&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.&lt;/p&gt;
-&lt;p&gt;Given a typical mapping app, you might type in "ateneo" and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google's &lt;a href="https://developers.google.com/maps/documentation/javascript/geocoding"&gt;geocoding API&lt;/a&gt;, you probably won't get any result for this. What you want to use is the &lt;a href="https://developers.google.com/maps/documentation/javascript/places"&gt;Places API&lt;/a&gt; which provides an autocomplete search box. Using it, when you type in "ateneo", it automatically suggests in the dropdown, "Ateneo de Manila University".&lt;/p&gt;
-&lt;p&gt;A downside to using the Places API is that it's against the terms of service to use it with something that isn't Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap's data will probably be a better long term solution.&lt;/p&gt;
-&lt;p&gt;For now, since the competition's deadline is just a few days away, I'll be using Google Maps.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/geocoding-services.html</guid><pubDate>Wed, 25 Sep 2013 04:26:59 GMT</pubDate></item><item><title>Jeep and Bus Schedules</title><link>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Wouldn't it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist's paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn't worry. I can assure you, it's still a death sentence.&lt;/p&gt;
-&lt;p&gt;The GTFS spec defines 2 ways of statically specifying trip schedules. You can define the exact times that a service will arrive at a stop. You can also specify between what times the service is active and how often a new bus or jeep leaves the first stop. You also define which days those rules apply. You could say every MWF, the bus operates from 9:00AM to 9:00PM and every TTH, the bus services from 3:00AM to 11:00PM.&lt;/p&gt;
-&lt;p&gt;This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there's another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.&lt;/p&gt;
-&lt;p&gt;Like much everything else about the Philippine transit system, there aren't really any "schedules" to speak of. It's generally whenever the buses or jeeps feel like it. So we have no static schedules. We don't have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.&lt;/p&gt;
-&lt;p&gt;Ideally, we shouldn't bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn't work without it. So we have to add a reasonable trip schedule for jeeps and buses.&lt;/p&gt;
-&lt;p&gt;The current GTFS data does define these trip schedules. We assume that jeeps and buses operate between 6:00AM and 11:00PM and a new jeep passes by every 10 minutes. Also, jeeps and buses are defined to only operate on weekdays.&lt;/p&gt;
-&lt;p&gt;While there might be jeeps who change routes or don't operate on weekends, I'm pretty sure that jeeps and buses run on weekends. We'll have to fix it ourselves temporarily since there's no central GTFS feed yet.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# 724594 seems to be the service id used by jeeps and buses&lt;/span&gt;
-sed -i .bak &lt;span class="s1"&gt;'/^724594/ s/0,0/1,1/'&lt;/span&gt; calendar.txt
-&lt;/pre&gt;
-
-
-&lt;p&gt;Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you're sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.&lt;/p&gt;
-&lt;p&gt;If we set the frequency to one minute, it &lt;em&gt;might&lt;/em&gt; give better routes by eliminating the timing issue. Or not, it's kind of hard to tell.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# jeep and bus route ids tend to start with 72&lt;/span&gt;
-sed -i .bak &lt;span class="s1"&gt;'/^72/ s/,600/,60/'&lt;/span&gt; frequencies.txt
-&lt;/pre&gt;
-
-
-&lt;p&gt;Overall, the problems we're having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don't need to do hackish things for it to fit the GTFS, but that's still a dream. For now, all we can really do is fit a triangle into a square hole.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</guid><pubDate>Sun, 28 Jul 2013 08:26:31 GMT</pubDate></item><item><title>Highways in OTP</title><link>http://pleasantprogrammer.com/posts/highways-in-otp.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP's suggested route for walking from UP to Ateneo:&lt;/p&gt;
-&lt;p&gt;&lt;img alt="Roundabout route from UP to Ateneo" src="http://pleasantprogrammer.com/galleries/transit/otproundabout.png"&gt;&lt;/p&gt;
-&lt;p&gt;This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.&lt;/p&gt;
-&lt;p&gt;OTP couldn't possibly be that dumb though, so there must be something we're doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the "road type" designated to Katipunan.&lt;/p&gt;
-&lt;p&gt;Apparently, by default OTP will consider roads of type &lt;code&gt;trunk&lt;/code&gt; to be non-walkable and non-bikable. This is documented in the &lt;a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner"&gt;OpenStreetMap wiki&lt;/a&gt; and the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety"&gt;OTP wiki&lt;/a&gt; as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;sed -i .bak s/trunk/primary/g manila.osm
-&lt;/pre&gt;
-
-
-&lt;p&gt;And rebuild the graph. It doesn't really matter much because the OSM data isn't used to render the maps. It's just used to build the routing data. This is actually what I did for &lt;a href="http://maps.pleasantprogrammer.com"&gt;maps.pleasantprogrammer.com&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on &lt;code&gt;highway=trunk&lt;/code&gt; we could allow that. This is not much better than the &lt;code&gt;sed&lt;/code&gt; solution though. It's better since you keep the weighting done by OTP, but you're still saying that all trunks are walkable which might not be the case.&lt;/p&gt;
-&lt;p&gt;The most correct way to actually fix this is to go through each of the trunks and specifying &lt;code&gt;foot=yes&lt;/code&gt; and &lt;code&gt;bicycle=yes&lt;/code&gt; for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I'm not sure on the particulars with updating OSM though.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/highways-in-otp.html</guid><pubDate>Wed, 24 Jul 2013 15:15:57 GMT</pubDate></item><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="http://pleasantprogrammer.com/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
-&lt;p&gt;One thing I hadn't tested out last time was OTP's support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.&lt;/p&gt;
-&lt;p&gt;The &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes"&gt;5 minute tutorial&lt;/a&gt; actually discusses the elevation data briefly, but a more in-depth thing you can look at is the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data"&gt;GraphBuilder documentation&lt;/a&gt;. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the &lt;a href="http://www.philgis.org/freegisdata.htm"&gt;PhilGIS website&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;I don't know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use &lt;a href="http://www.gdal.org/"&gt;GDAL&lt;/a&gt; for this. You'd just then run,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt; gdal_translate srtm41_90m_phl.img phil.tiff
-&lt;/pre&gt;
-
-
-&lt;p&gt;Afterwards, it's just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you're running on limited RAM.&lt;/p&gt;
-&lt;p&gt;I've actually hosted a &lt;a href="http://maps.pleasantprogrammer.com"&gt;working example&lt;/a&gt;. It's pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don't abuse it though.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</guid><pubDate>Tue, 23 Jul 2013 10:23:00 GMT</pubDate></item><item><title>GraphServer</title><link>http://pleasantprogrammer.com/posts/graphserver.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="http://graphserver.github.io/graphserver/"&gt;http://graphserver.github.io/graphserver/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;One other routing webapp I saw was GraphServer. It's actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It's also based off python and C instead of Java, so it feels a lot less heavy.&lt;/p&gt;
-&lt;p&gt;The instructions on the website are already pretty good. There are just some minor errors with it. Where it says &lt;code&gt;gs_gtfsdb_build&lt;/code&gt;, you should actually use &lt;code&gt;gs_gtfsdb_compile&lt;/code&gt;. Also, when running &lt;code&gt;gs_osmdb_compile&lt;/code&gt; you might need to use &lt;code&gt;-t&lt;/code&gt; for tolerant in case you follow the instructions on chopping up the original OSM data.&lt;/p&gt;
-&lt;p&gt;A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn't support 64-bit ids. The &lt;a href="http://wiki.openstreetmap.org/wiki/Osmosis"&gt;latest version of Osmosis&lt;/a&gt; easily did the job though.&lt;/p&gt;
-&lt;p&gt;The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn't provide any alternate routes aside from that one. I'm not sure if it's a limitation of the provided routeserver, but I didn't bother checking if it supported parameters which might provide better routes.&lt;/p&gt;
-&lt;p&gt;I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/graphserver.html</guid><pubDate>Tue, 23 Jul 2013 06:48:29 GMT</pubDate></item><item><title>Transit Wand</title><link>http://pleasantprogrammer.com/posts/transit-wand.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand"&gt;http://transitwand.com&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;Overall, this was the simplest of the &lt;a href="http://philippine-transit.hackathome.com/use-this-code/"&gt;open-source transit tools&lt;/a&gt; to actually get up and running. There's already a deployed instance of the server, and you can easily download the phone app via the &lt;a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand"&gt;Play Store&lt;/a&gt;. Even running the server by yourself didn't have any of the hiccups I had with GTFS Editor.&lt;/p&gt;
-&lt;p&gt;The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.&lt;/p&gt;
-&lt;p&gt;After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it's free and you don't even actually need to put in a username or anything. It simply registers the phone's IMEI on the server and gives you a 6-digit identifier.&lt;/p&gt;
-&lt;p&gt;You can then use the 6-digit identifier to view the data on Transit Wand's server, which is good since uploading any data automatically deletes it from the phone. There really isn't much else you can do with it though. It just allows you to view the data, and export it as a &lt;a href="https://en.wikipedia.org/wiki/Shapefile"&gt;Shapefile&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There's also no way to extract the ridership information from the server yet. This isn't to say that the data won't eventually go public though.&lt;/p&gt;
-&lt;p&gt;An interesting thing you &lt;em&gt;can&lt;/em&gt; do with the Transit Wand data is import it into GTFS Editor to make a new route. You don't even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you've captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.&lt;/p&gt;
-&lt;p&gt;I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don't understand is why the shape data isn't present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can't easily move stops, you have to input coordinates to change the position.&lt;/p&gt;
-&lt;p&gt;It &lt;em&gt;might&lt;/em&gt; also be possible that when the DOTC was still collecting the data, the route collection or editing features weren't present yet. That would just be lame and depressing though.&lt;/p&gt;
-&lt;p&gt;Overall, Transit Wand does what it's supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/transit-wand.html</guid><pubDate>Mon, 15 Jul 2013 14:45:20 GMT</pubDate></item><item><title>Fare Data</title><link>http://pleasantprogrammer.com/posts/fare-data.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;As part of the data released by the DOTC, we also have the &lt;a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/"&gt;fare matrix&lt;/a&gt; for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the &lt;a href="http://ltfrb.gov.ph/main/farerates"&gt;LTFRB website&lt;/a&gt;. Generally, the fare scheme is represented as "pay &lt;em&gt;X&lt;/em&gt; pesos for the first &lt;em&gt;Y&lt;/em&gt; kilometers, pay &lt;em&gt;Z&lt;/em&gt; for every succeeding kilometer." Instead of a table, we can simply represent this as a formula instead,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;base_fare + (distance - initial) * per_km
-&lt;/pre&gt;
-
-
-&lt;p&gt;The relevant values for the three services are:&lt;/p&gt;
-&lt;table&gt;
-&lt;thead&gt;
-  &lt;tr&gt;
-    &lt;td&gt;type&lt;/td&gt;
-    &lt;td&gt;base_fare&lt;/td&gt;
-    &lt;td&gt;initial&lt;/td&gt;
-    &lt;td&gt;per_km&lt;/td&gt;
-  &lt;/tr&gt;
-&lt;/thead&gt;
-&lt;tbody&gt;
-  &lt;tr&gt;
-    &lt;td&gt;bus aircon&lt;/td&gt;
-    &lt;td&gt;12.00&lt;/td&gt;
-    &lt;td&gt;5 km&lt;/td&gt;
-    &lt;td&gt;2.20&lt;/td&gt;
-  &lt;/tr&gt;
-  &lt;tr&gt;
-    &lt;td&gt;bus ordinary&lt;/td&gt;
-    &lt;td&gt;10.00&lt;/td&gt;
-    &lt;td&gt;5 km&lt;/td&gt;
-    &lt;td&gt;1.85&lt;/td&gt;
-  &lt;/tr&gt;
-  &lt;tr&gt;
-    &lt;td&gt;jeep aircon&lt;/td&gt;
-    &lt;td&gt;8.00&lt;/td&gt;
-    &lt;td&gt;4 km&lt;/td&gt;
-    &lt;td&gt;1.40&lt;/td&gt;
-  &lt;/tr&gt;
-&lt;/tbody&gt;
-&lt;/table&gt;
-
-&lt;p&gt;It isn't as simple as that though. Fares are also rounded to the nearest 25 centavos. So we'd need to round them off correctly. This can be achieved by doing,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;round(calculated_fare * 4.0)/4.0
-&lt;/pre&gt;
-
-
-&lt;p&gt;There's also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.&lt;/p&gt;
-&lt;p&gt;Doing just this, we actually do get the same results as the fare matrices in the image for the most part. There are some discrepancies with the discounted jeep fares. I've tried to resolve it by tweaking around with the formulas, but it really doesn't make sense in any way. I presume these were manually adjusted for one reason or another.&lt;/p&gt;
-&lt;p&gt;Here's a &lt;a href="http://pleasantprogrammer.com/uploads/farematrix.rb"&gt;script&lt;/a&gt; that generates CSVs of all the three fare matrices. If you're too lazy to run it, here are links to the &lt;a href="http://pleasantprogrammer.com/uploads/pub_aircon.csv"&gt;aircon bus&lt;/a&gt;, &lt;a href="http://pleasantprogrammer.com/uploads/pub_ordinary.csv"&gt;ordinary bus&lt;/a&gt; and &lt;a href="http://pleasantprogrammer.com/uploads/puj.csv"&gt;jeep&lt;/a&gt; fare matrices.&lt;/p&gt;
-&lt;h4&gt;GTFS compatibility&lt;/h4&gt;
-&lt;p&gt;As is, the provided GTFS data does not have any fare data. I imagine this is because the existing spec doesn't have good support for distance-based fares like we have in the Philippines. Judging from the &lt;a href="https://code.google.com/p/googletransitdatafeed/wiki/FareExamples"&gt;fare examples&lt;/a&gt;, the only reasonable way we could implement distance-based fares is following example 6. This would involve setting a fare for each possible pair of stops based on the distance between them. This isn't exactly ideal. In fact, the people originally working on the DOTC project have voiced &lt;a href="https://groups.google.com/forum/#!topic/gtfs-fare-wg/V63xRSnQJGw"&gt;issues&lt;/a&gt; and made &lt;a href="https://groups.google.com/forum/#!msg/gtfs-changes/uybrAokZ9Cg/rqlzXdMypUgJ"&gt;proposals&lt;/a&gt; for having distance-based fares included into GTFS.&lt;/p&gt;
-&lt;p&gt;Apparently, public transit fares are a really complicated thing. You have fares based on distance, number of stops passed through, and transfers which may or may not cost extra. Not only that, you might have discounted fares, or first-class vs economy fares. The community will want to get it right before it's formally included in the spec. You can see the current state of the consolidated &lt;a href="https://docs.google.com/document/d/1mK3--o5g4-3cCXaqmch92U63JTwChh0L2VCmcDViIlM/edit"&gt;GTFS fare proposal here&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;Even in it's proposal form though, we might have hope of being able to see these being used. There's currently a &lt;a href="https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/30"&gt;pull request&lt;/a&gt; for supporting the distance-based fare scheme into the OneBusAway libraries. The libraries actually used by GTFS Editor and OpenTripPlanner for working with GTFS data.&lt;/p&gt;
-&lt;h4&gt;Remaining Problems&lt;/h4&gt;
-&lt;p&gt;Given all that, it would probably still be a long way before this allows us to make a really good routing app. We still don't have shape data, so the distance estimates would really be rough estimates at best. There's no support for rounding to the nearest centavo. I realize that's just nitpicking, but if we want something truly polished, even that has to be taken care of.&lt;/p&gt;
-&lt;p&gt;We also don't know if the jeeps or buses strictly follow the distance-based scheme. After all, if you can get on and off anywhere, you can't really measure distance that exactly. I assume they generally work off the notion of "zones" than actual distance travelled. In that sense, they work more similarly to the LRT which has fares based on how many stops you pass. For jeeps and buses, your fare is probably based more on how many "zones" you pass through.&lt;/p&gt;
-&lt;h4&gt;Conclusion&lt;/h4&gt;
-&lt;p&gt;Philip, a co-worker of mine at By Implication, had suggested that we might want to use a different model than what the GTFS proposes. I have to agree with him. At this point, the GTFS doesn't really fit with our system. But I do think that open data and standards are great. In fact, I applaud the developers who made proposals for the fare system, as those are great first steps towards making the GTFS a more universal standard.&lt;/p&gt;
-&lt;p&gt;Side note: I'd also actually really like to hear about the DOTC developers' experience with the project. It would be nice if they had a devblog.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/fare-data.html</guid><pubDate>Sat, 13 Jul 2013 13:15:09 GMT</pubDate></item><item><title>GTFS Editor</title><link>http://pleasantprogrammer.com/posts/gtfs-editor.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="https://github.com/conveyal/gtfs-editor"&gt;https://github.com/conveyal/gtfs-editor&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; they really meant under development&lt;/p&gt;
-&lt;p&gt;When I first saw the source of GTFS Editor, I was ecstatic. They used &lt;a href="http://playframework.com/"&gt;Play framework&lt;/a&gt;!!! Not only that, they're targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.&lt;/p&gt;
-&lt;p&gt;Getting it to actually run though, wasn't very pleasant. The initial setup was easy enough. Get &lt;a href="http://www.playframework.com/download"&gt;Play 1.2.5&lt;/a&gt;, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that's necessary. Wonderful. Then, run play, open a browser, go to &lt;a href="http://localhost:9000"&gt;http://localhost:9000&lt;/a&gt;, compilation error. Fantastic.&lt;/p&gt;
-&lt;p&gt;If you don't want to go through the technical details, you can just jump to the &lt;a href="http://pleasantprogrammer.com/posts/gtfs-editor.html#conclusion"&gt;conclusion&lt;/a&gt;.&lt;/p&gt;
-&lt;h3&gt;Let's Debug!&lt;/h3&gt;
-&lt;p&gt;I'll be splitting the next section up into 2 parts. In the first pass, I'll talk about what I did to just get the app to run but I won't try hard to fix any bugs. This generally is what I do when I try to get apps to run. I'll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I'll explain what the problems were and how I fixed them.&lt;/p&gt;
-&lt;h4&gt;First Pass&lt;/h4&gt;
-&lt;p&gt;A thing to note about Play (and one of the reasons it's a lovely Java framework) is that you don't need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that's what I saw, &lt;code&gt;Error: type Check already defined&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="nd"&gt;@Retention&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;RetentionPolicy&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;RUNTIME&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
-&lt;span class="nd"&gt;@Target&lt;/span&gt;&lt;span class="o"&gt;({&lt;/span&gt;&lt;span class="n"&gt;ElementType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;METHOD&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ElementType&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;TYPE&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
-&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nd"&gt;@interface&lt;/span&gt; &lt;span class="n"&gt;Check&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="o"&gt;[]&lt;/span&gt; &lt;span class="nf"&gt;value&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-&lt;span class="o"&gt;}&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;You also know that typical behavior among programmers where your program doesn't compile, but you keep trying to compile it anyway hoping that it will magically just work. That's what I did, and it actually ran. I couldn't really just let this pass, so I decided to try deleting &lt;code&gt;Check.java&lt;/code&gt;. I got another compilation error, &lt;code&gt;Error: type Secure already defined&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Secure&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="n"&gt;Controller&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="nd"&gt;@Before&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;unless&lt;/span&gt;&lt;span class="o"&gt;={&lt;/span&gt;&lt;span class="s"&gt;"login"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"authenticate"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"logout"&lt;/span&gt;&lt;span class="o"&gt;})&lt;/span&gt;
-
-    &lt;span class="kd"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;checkAccess&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="kd"&gt;throws&lt;/span&gt; &lt;span class="n"&gt;Throwable&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put &lt;code&gt;Check.java&lt;/code&gt; back in and proceeded to just refresh until it compiled and ran.&lt;/p&gt;
-&lt;p&gt;The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the &lt;code&gt;account&lt;/code&gt; table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn't work.&lt;/p&gt;
-&lt;p&gt;Another note regarding Play 1.x, it provides the &lt;a href="http://www.playframework.com/documentation/1.2.5/secure"&gt;secure module&lt;/a&gt; which handles logins and keeping state, you simply need to implement the method &lt;code&gt;boolean authenticate(String username, String password)&lt;/code&gt;. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return &lt;code&gt;true&lt;/code&gt; and then any login would work. No need to actually set the password. Excellent.&lt;/p&gt;
-&lt;p&gt;And we're logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, &lt;code&gt;IndexOutOfBoundsException occured : Index: 0, Size: 0&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyId"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-
-    &lt;span class="n"&gt;Agency&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;agencies&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;get&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// error here&lt;/span&gt;
-
-    &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyId"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-    &lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;put&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"agencyName"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;agency&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;Apparently, we need to have an agency. That's generally simple enough. You just manually insert an agency into the &lt;code&gt;agency&lt;/code&gt; table. After that's done, we finally have a view of the actual application. It's very Bootstrap-y, but that's just fine. The workflow though, is not perfectly intuitive, but I'll talk about that some other day.&lt;/p&gt;
-&lt;p&gt;That's not the end of it though, we still have to fix these bugs. The developer obviously didn't have to put up with this when they were working, so what happened? Also, the log is showing some weird things,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;~        _            _
-~  _ __ | | __ _ _  _| |
-~ | '_ \| |/ _' | || |_|
-~ |  __/|_|\____|\__ (_)
-~ |_|            |__/
-~
-~ play! 1.2.5, http://www.playframework.org
-~
-~ Ctrl+C to stop
-~
-CompilerOracle: exclude jregex/Pretokenizer.next
-Listening for transport dt_socket at address: 8000
-23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
-23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
-23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
-23:32:15,830 WARN  ~ You're running Play! in DEV mode
-23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
-23:32:28,792 ERROR ~
-
-@6f02fa9dd
-Internal Server Error (500) for request GET /
-
-Compilation error (In /app/controllers/Check.java around line 10)
-The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
-
-play.exceptions.CompilationException: The type Check is already defined
-    at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
-    at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
-    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
-    at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
-    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
-    at play.Play.start(Play.java:516)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at Invocation.HTTP Request(Play!)
-23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
-SLF4J: Class path contains multiple SLF4J bindings.
-SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
-23:32:32,490 INFO  ~ Initializing HBSpatialExtension
-23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
-23:32:32,494 INFO  ~ Checking for default configuration file.
-23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
-23:32:34,077 INFO  ~ Application 'gtfs-editor' is now started !
-23:32:34,151 INFO  ~ Bootstrapping Database...
-23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
-play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
-    at play.templates.TemplateLoader.load(TemplateLoader.java:78)
-    at play.test.Fixtures.loadModels(Fixtures.java:174)
-    at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
-    at play.jobs.Job.doJobWithResult(Job.java:50)
-    at play.jobs.Job.call(Job.java:146)
-    at play.jobs.Job.run(Job.java:132)
-    at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
-    at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
-    at play.Play.start(Play.java:547)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
-    at play.Invoker$Invocation.run(Invoker.java:276)
-    at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
-    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
-    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
-    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
-    at java.lang.Thread.run(Thread.java:680)
-Caused by: play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
-    ... 22 more
-Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
-    at java.io.FileInputStream.open(Native Method)
-    at java.io.FileInputStream.&amp;lt;init&amp;gt;(FileInputStream.java:120)
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
-    ... 23 more
-23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
-23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
-23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
-23:32:40,999 DEBUG ~ select nextval ('hibernate_sequence')
-23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
-23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
-23:32:41,175 ERROR ~
-
-@6f02fa9dg
-Internal Server Error (500) for request GET /
-
-Execution exception (In /app/controllers/Application.java around line 57)
-IndexOutOfBoundsException occured : Index: 0, Size: 0
-
-play.exceptions.JavaExecutionException: Index: 0, Size: 0
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
-    at Invocation.HTTP Request(Play!)
-Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
-    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
-    at java.util.ArrayList.get(ArrayList.java:322)
-    at controllers.Application.initSession(Application.java:57)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
-    at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
-    ... 1 more
-&lt;/pre&gt;
-
-
-&lt;p&gt;After &lt;code&gt;23:32:34&lt;/code&gt; is when I get the login page. &lt;code&gt;23:32:40&lt;/code&gt; is after I've logged in.&lt;/p&gt;
-&lt;h4&gt;Second Pass&lt;/h4&gt;
-&lt;p&gt;So how did you do? First, the error that &lt;code&gt;type Check already defined&lt;/code&gt; usually does mean that &lt;code&gt;Check&lt;/code&gt; was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It's the only one there that was &lt;code&gt;Check.java&lt;/code&gt;. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, &lt;code&gt;Check.java&lt;/code&gt;. Doing a diff shows nothing was changed. So the solution really was just simply delete &lt;code&gt;Check.java&lt;/code&gt; and also &lt;code&gt;Secure.java&lt;/code&gt;. No more compilation errors!&lt;/p&gt;
-&lt;p&gt;The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Security&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isConnected&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-    &lt;span class="n"&gt;Account&lt;/span&gt; &lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;find&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"username = ?"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Security&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;connected&lt;/span&gt;&lt;span class="o"&gt;()).&lt;/span&gt;&lt;span class="na"&gt;first&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-    &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
-        &lt;span class="n"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;Account&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"admin"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"admin"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"admin@test.com"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
-        &lt;span class="n"&gt;account&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;save&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
-    &lt;span class="o"&gt;}&lt;/span&gt;
-    &lt;span class="o"&gt;...&lt;/span&gt;
-&lt;span class="o"&gt;}&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;You can actually see this in action at &lt;code&gt;23:32:41,051&lt;/code&gt; in the log. So what's wrong with all of this? The account creation happened after I've already logged in. In fact, &lt;code&gt;Security.isConnected()&lt;/code&gt; checks whether the user is already logged in or not. How does this even make sense?&lt;/p&gt;
-&lt;p&gt;Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we're missing a file called &lt;code&gt;initial-agencies-data.yml&lt;/code&gt;. Ok, apparently it's a &lt;a href="http://www.playframework.com/documentation/1.2.5/test#fixtures"&gt;fixture&lt;/a&gt; like you would use for testing. It's easy enough to infer what the file's contents should be. We just copy it over from the GTFS data.&lt;/p&gt;
-&lt;p&gt;But then where do you put the file? If you look at the log, it says &lt;code&gt;/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml&lt;/code&gt; but that doesn't look right. That's in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the &lt;code&gt;test/&lt;/code&gt; directory? No, that doesn't work either since we're not running a test.&lt;/p&gt;
-&lt;p&gt;What I ended up doing was just looking at the sources for &lt;code&gt;Fixtures.load&lt;/code&gt;. If you follow the stack trace, you end up finding &lt;code&gt;Play.javaPath&lt;/code&gt; which sort of works like PATH for Fixtures and some other things. So where can we put the file? &lt;code&gt;app/&lt;/code&gt; and &lt;code&gt;conf/&lt;/code&gt;. And with that, we're done.&lt;/p&gt;
-&lt;h4 id="conclusion"&gt;Conclusion&lt;/h4&gt;
-
-&lt;p&gt;GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone &lt;a href="https://github.com/thatsmydoing/gtfs-editor"&gt;my branch&lt;/a&gt; as I've fixed the issues discussed earlier. The default login is &lt;code&gt;admin:admin&lt;/code&gt;.&lt;/p&gt;
-&lt;p&gt;Even after getting it to run, it's still not quite usable. Not in the UX sense, but you really can't do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don't have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.&lt;/p&gt;&lt;/div&gt;</description><category>lets-debug</category><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/gtfs-editor.html</guid><pubDate>Wed, 10 Jul 2013 03:30:01 GMT</pubDate></item><item><title>Open Trip Planner</title><link>http://pleasantprogrammer.com/posts/open-trip-planner.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="http://www.opentripplanner.org"&gt;http://www.opentripplanner.org&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; routes pretty well; data might cause weird issues&lt;/p&gt;
-&lt;p&gt;OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you're willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.&lt;/p&gt;
-&lt;p&gt;It's actually in general use by the &lt;a href="http://maps.trimet.org/"&gt;Trimet&lt;/a&gt;, Portland's public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner's support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn't have. This actually just screams &lt;a href="http://philippine-transit.hackathome.com/prizes/"&gt;Inclusive Technology Award&lt;/a&gt;.&lt;/p&gt;
-&lt;h4&gt;Setup&lt;/h4&gt;
-&lt;p&gt;Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I'd suggest going through the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes"&gt;5-minute introduction&lt;/a&gt; if you want to actually work with the Philippine data. You will also need to download the &lt;a href="http://download.geofabrik.de/asia/philippines.html"&gt;Philippine data dump&lt;/a&gt; from OSM. You will want the &lt;code&gt;osm.bz2&lt;/code&gt; one (WARNING: 900MB unzipped).&lt;/p&gt;
-&lt;p&gt;Once you get the webapp running, you'll notice the map tiles won't load correctly. This is because the default tileset used is from Mapbox which doesn't provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.&lt;/p&gt;
-&lt;h4&gt;Issues&lt;/h4&gt;
-&lt;p&gt;The next thing you'll notice is that you can't search for a place. You can only just pick points on the map and route between those. I'm still not exactly sure if it's supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn't be too difficult.&lt;/p&gt;
-&lt;p&gt;Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet's implementation isn't as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.&lt;/p&gt;
-&lt;p&gt;There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a "stop" in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the "stop" to Arguilla.&lt;/p&gt;
-&lt;p&gt;&lt;img alt="OpenTripPlanner disconnected route" src="http://pleasantprogrammer.com/galleries/transit/otp1.png"&gt;&lt;/p&gt;
-&lt;p&gt;I can't say this isn't a bug. After all, OpenTripPlanner couldn't have magically known there really was a street there. If it did, it wouldn't just teleport you to the corner. I'm more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.&lt;/p&gt;
-&lt;p&gt;Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won't give you the best route because it thinks you have to loop around to get to where you want to be. I don't really know how common this issue pops up though. It's highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.&lt;/p&gt;
-&lt;p&gt;&lt;img alt="OpenTripPlanner loopy route" src="http://pleasantprogrammer.com/galleries/transit/otp2.png"&gt;&lt;/p&gt;
-&lt;p&gt;Much like the earlier problem, I can't tell if this is a bug or it's a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren't even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.&lt;/p&gt;
-&lt;p&gt;&lt;img alt="UP Katipunan Route" src="http://pleasantprogrammer.com/galleries/transit/upkatipunan.jpg"&gt;&lt;/p&gt;
-&lt;p&gt;From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren't that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.&lt;/p&gt;
-&lt;h4&gt;Conclusion&lt;/h4&gt;
-&lt;p&gt;Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There's also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/open-trip-planner.html</guid><pubDate>Tue, 09 Jul 2013 15:16:12 GMT</pubDate></item></channel></rss>

+ 0 - 76
output/categories/sysadmin.html

@@ -1,76 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts about sysadmin | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/categories/sysadmin.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><link rel="alternate" type="application/rss+xml" title="RSS for tag sysadmin" href="sysadmin.xml">
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="tagpage"><header><h1>Posts about sysadmin</h1>
-        <div class="metadata">
-                <p class="feedlink"><a href="sysadmin.xml" type="application/rss+xml">RSS feed</a></p>
-        </div>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/cloudflare-shenanigans.html" class="listtitle">Cloudflare Shenanigans</a> <time class="listdate" datetime="2015-12-25T14:13:26+08:00" title="2015-12-25 14:13">2015-12-25 14:13</time>
-</li>
-        <li>
-<a href="../posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" class="listtitle">TiddlyWiki in the Sky (or TiddlyWeb for TW5)</a> <time class="listdate" datetime="2015-12-24T14:48:20+08:00" title="2015-12-24 14:48">2015-12-24 14:48</time>
-</li>
-        <li>
-<a href="../posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" class="listtitle">Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</a> <time class="listdate" datetime="2013-11-27T10:12:31+08:00" title="2013-11-27 10:12">2013-11-27 10:12</time>
-</li>
-        <li>
-<a href="../posts/console-keymap-switching.html" class="listtitle">Console Keymap Switching</a> <time class="listdate" datetime="2013-10-29T20:02:06+08:00" title="2013-10-29 20:02">2013-10-29 20:02</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 168
output/categories/sysadmin.xml

@@ -1,168 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer (sysadmin)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/categories/sysadmin.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Cloudflare Shenanigans</title><link>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.&lt;/p&gt;
-&lt;p&gt;Now the problem is that Cloudflare can put you behind &lt;a href="https://www.cloudflare.com/ips/"&gt;any IP they own&lt;/a&gt;, which is a huge range. There's no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.&lt;/p&gt;
-&lt;p&gt;We never actually empirically tested whether other sites hosted on Cloudflare were also actually zero-rated. But I like to think that we saved a lot of people on their data costs from browsing Reddit and 4chan. But alas, good things must come to an end.&lt;/p&gt;
-&lt;p&gt;A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn't want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn't really afford that, so we looked for other options.&lt;/p&gt;
-&lt;p&gt;Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn't have its own certificate.&lt;/p&gt;
-&lt;p&gt;After more testing, we figured out that you could actually use any Cloudflare backed domain so long as we properly set the Host header. We just needed to find one still in the old range. Coincidentally, 4chan.org was. Which led to this wonderful commit&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;commit 123456789abcdef
-Author: ~~~~~~
-Date:   ~~~~~~
-
-    4chan hack
-
-&lt;span class="gh"&gt;diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gd"&gt;--- a/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gi"&gt;+++ b/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gu"&gt;@@ -210,7 +210,8 @@ public class Util {&lt;/span&gt;
-        }
-
-        public static String getServerAddress(Context context) {
-&lt;span class="gd"&gt;-               String address = "https://backend.client.com";&lt;/span&gt;
-&lt;span class="gi"&gt;+               // String address = "https://backend.client.com";&lt;/span&gt;
-&lt;span class="gi"&gt;+               String address = "https://4chan.org";&lt;/span&gt;
-                if(!isDebug(context)) return address;
-                try {
-&lt;span class="gh"&gt;diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gd"&gt;--- a/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gi"&gt;+++ b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gu"&gt;@@ -101,6 +101,7 @@ public class APIClient {&lt;/span&gt;
-        private HttpResponse postInternal(String url, List&amp;lt;NameValuePair&amp;gt; data, boolean forRegistration) throws ClientProtocolException, IOException {
-                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+"/api/"+url);
-                request.setHeader("X-API-VERSION", apiVersion);
-&lt;span class="gi"&gt;+               request.setHeader("Host", "backend.client.com");&lt;/span&gt;
-
-                if(data == null) {
-                        data = new ArrayList&amp;lt;NameValuePair&amp;gt;();
-&lt;/pre&gt;
-
-
-&lt;p&gt;Eventually, we did decide to just abandon Cloudflare for the server. We probably weren't going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.&lt;/p&gt;
-&lt;p&gt;I just still find it funny we were making people's phones go to 4chan.org everyday for more than a year.&lt;/p&gt;&lt;/div&gt;</description><category>cloudflare</category><category>sysadmin</category><guid>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</guid><pubDate>Fri, 25 Dec 2015 06:13:26 GMT</pubDate></item><item><title>TiddlyWiki in the Sky (or TiddlyWeb for TW5)</title><link>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;I've always liked &lt;a href="http://tiddlywiki.com"&gt;TiddlyWiki&lt;/a&gt;. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new HTML file with all your posts inside. I've used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.&lt;/p&gt;
-&lt;p&gt;Now, there's TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.&lt;/p&gt;
-&lt;p&gt;If you're just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There's plenty of documentation on the site. But if you're looking for more advanced features (like storing your posts in git or a database), then you'll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.&lt;/p&gt;
-&lt;p&gt;To support TiddlyWiki5, we'll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.&lt;/p&gt;
-&lt;h3&gt;Setting Up TiddlyWiki&lt;/h3&gt;
-&lt;p&gt;TiddlyWiki5 provides a command line tool via &lt;code&gt;npm&lt;/code&gt; that allows building custom versions of the wiki. In fact, it comes with templates, called "editions", that we can use for our setup. Assuming you already have it installed, create the wiki using&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;tiddlywiki mywiki --init tw5tank          # create wiki from template
-&lt;/pre&gt;
-
-
-&lt;p&gt;This creates a wiki intended for use with &lt;a href="https://tank.peermore.com/"&gt;Tank&lt;/a&gt;, which is built on top of TiddlyWeb. From here, you should look in &lt;code&gt;mywiki/tiddlers/system&lt;/code&gt; which contain the entries for &lt;code&gt;SiteTitle&lt;/code&gt;, &lt;code&gt;SiteSubtitle&lt;/code&gt;, &lt;code&gt;DefaultTiddlers&lt;/code&gt;, and &lt;code&gt;tiddlyweb-host&lt;/code&gt;. The first 3 should be configured however you want. These are necessary because they're needed before the wiki can load them from the server. &lt;code&gt;tiddlyweb-host&lt;/code&gt; contains the location of the TiddlyWeb server, this should be &lt;code&gt;http://localhost:8080/&lt;/code&gt; if you're just testing locally. With everything configured, you can build the new wiki by running&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;tiddlywiki mywiki --build
-&lt;/pre&gt;
-
-
-&lt;p&gt;This will output the wiki to &lt;code&gt;mywiki/output/tw5tank.html&lt;/code&gt;. You can now serve it using your favorite local webserver, like &lt;code&gt;python -m http.server&lt;/code&gt;.&lt;/p&gt;
-&lt;h3&gt;Setting Up TiddlyWeb&lt;/h3&gt;
-&lt;p&gt;The TiddlyWeb tutorial recommends using &lt;code&gt;tiddlywebwiki&lt;/code&gt; which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren't really needed, so we won't go with that. So first, we'll need to install TiddlyWeb and any plugins we might want to use.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
-&lt;/pre&gt;
-
-
-&lt;p&gt;Next, we'll need the tiddlyweb configuration in &lt;code&gt;tiddlywebconfig.py&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# A basic configuration.&lt;/span&gt;
-&lt;span class="c"&gt;# `pydoc tiddlyweb.config` for details on configuration items.&lt;/span&gt;
-
-&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;tiddlywebplugins.status&lt;/span&gt;
-
-&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
-    &lt;span class="s"&gt;'system_plugins'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'tiddlywebplugins.status'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'tiddlywebplugins.cors'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
-    &lt;span class="s"&gt;'secret'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
-    &lt;span class="s"&gt;'wsgi_server'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'tiddlywebplugins.cherrypy'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
-    &lt;span class="s"&gt;'cors.enable_non_simple'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
-&lt;span class="p"&gt;}&lt;/span&gt;
-
-&lt;span class="n"&gt;original_gather_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tiddlywebplugins&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_gather_data&lt;/span&gt;
-
-&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_status_gather_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
-    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;original_gather_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
-    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'space'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;'recipe'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'default'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
-    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;
-
-&lt;span class="n"&gt;tiddlywebplugins&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_gather_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_status_gather_data&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;The tweaks involved are:&lt;/p&gt;
-&lt;ul&gt;
-&lt;li&gt;using the status plugin which the wiki requires&lt;/li&gt;
-&lt;li&gt;monkeypatching the status plugin for the wiki to use the correct "recipe"&lt;/li&gt;
-&lt;li&gt;using cherrypy server instead of the buggy default one&lt;/li&gt;
-&lt;li&gt;using cors since we're not hosting the wiki itself on the same server&lt;/li&gt;
-&lt;/ul&gt;
-&lt;p&gt;With that, we just need to create the store that will hold our data&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;twanager recipe default &amp;lt;&amp;lt;EOF
-desc: standard TiddlyWebWiki environment
-policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
-
-/bags/default/tiddlers
-EOF
-
-twanager bag default &amp;lt;&amp;lt;EOF
-{"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
-EOF
-&lt;/pre&gt;
-
-
-&lt;p&gt;Finally, we can start the TiddlyWeb server&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;twanager server
-&lt;/pre&gt;
-
-
-&lt;h3&gt;Putting it all together&lt;/h3&gt;
-&lt;p&gt;Once you have the TiddlyWeb server running, you can just go to wherever you're hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that's done it's saved. You can refresh your browser and your posts should still be there.&lt;/p&gt;
-&lt;p&gt;At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won't need CORS anymore.&lt;/p&gt;
-&lt;p&gt;TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.&lt;/p&gt;&lt;/div&gt;</description><category>sysadmin</category><category>tiddlywiki</category><guid>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</guid><pubDate>Thu, 24 Dec 2015 06:48:20 GMT</pubDate></item><item><title>Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</title><link>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;I've always thought that people were just too lazy to change their SSIDs when I see "PLDTMyDSLBizCafeJapan". It became apparent when we got our own PLDT line that it was because the bundled router/modem &lt;em&gt;does not&lt;/em&gt; allow you to remove the prefix.&lt;/p&gt;
-&lt;p&gt;This is not the kind of thing you expect as a business customer. Even for home customers, I feel it's still a bit dishonest. I'd be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.&lt;/p&gt;
-&lt;p&gt;Of course, we couldn't just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the &lt;a href="http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html"&gt;Prolink H5004N&lt;/a&gt; or the &lt;a href="http://www.symbianize.com/showthread.php?t=730091"&gt;ZyXEL P-660HN-T1A&lt;/a&gt; but not for the one we got which was the ZyXEL P-2612HNU-F1F.&lt;/p&gt;
-&lt;p&gt;We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the "PLDTMyDSLBiz". We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.&lt;/p&gt;
-&lt;p&gt;The backup is actually just an XML file. You can search for SSID and change the parameter there. It's a bit annoying because the router has to restart after restoring the configuration, but it works!&lt;/p&gt;
-&lt;p&gt;A minor note, the router doesn't seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.&lt;/p&gt;&lt;/div&gt;</description><category>sysadmin</category><guid>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</guid><pubDate>Wed, 27 Nov 2013 02:12:31 GMT</pubDate></item><item><title>Console Keymap Switching</title><link>http://pleasantprogrammer.com/posts/console-keymap-switching.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;At the office, we have some people who use DVORAK. Normally, this isn't a problem. To each his own after all. It does become a bit problematic though, when we're dealing with the servers around the office.&lt;/p&gt;
-&lt;p&gt;We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it's apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.&lt;/p&gt;
-&lt;p&gt;For the console, they'd typically do &lt;code&gt;sudo loadkeys dvorak&lt;/code&gt; after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can't even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn't a readily available thing for the console.&lt;/p&gt;
-&lt;p&gt;I googled around for solutions and came across &lt;a href="http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux"&gt;a nice idea&lt;/a&gt;. You could alias &lt;code&gt;asdf&lt;/code&gt; to load the DVORAK mapping and &lt;code&gt;aoeu&lt;/code&gt; (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don't really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.&lt;/p&gt;
-&lt;p&gt;After some further searching, I found &lt;a href="http://unix.stackexchange.com/questions/2884/toggle-between-dvorak-and-qwerty"&gt;something close to what I wanted&lt;/a&gt;. Apparently, Alt+Up sends a KeyboardSignal keycode to the init process, which can act on that. It also works anywhere, even before being logged in. For SysVinit systems, you can just add a line to your inittab for a command to be run when Alt+Up is pressed.&lt;/p&gt;
-&lt;p&gt;In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. &lt;code&gt;kbrequest.target&lt;/code&gt; is normally aliased to run the rescue service though, so you have to manually create the file in &lt;code&gt;/etc/systemd/system/kbrequest.target&lt;/code&gt; and fill it with a description:&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
-&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;kbrequest target&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;We can then add a service to be run whenever the target is called. Something like &lt;code&gt;/etc/systemd/system/keymap-switch.service&lt;/code&gt;:&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
-&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Keymap Switch Service&lt;/span&gt;
-
-&lt;span class="k"&gt;[Service]&lt;/span&gt;
-&lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;oneshot&lt;/span&gt;
-&lt;span class="na"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/usr/local/bin/keymap-switch&lt;/span&gt;
-
-&lt;span class="k"&gt;[Install]&lt;/span&gt;
-&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;kbrequest.target&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;After enabling said service, we only need the actual keymap switcher, &lt;code&gt;/usr/local/bin/keymap-switch&lt;/code&gt;. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we're using SystemD, we can use that instead for managing which keymap we're actually using. It stores the current settings inside &lt;code&gt;/etc/vconsole.conf&lt;/code&gt;. We can also then switch keymaps by using &lt;code&gt;localectl set-keymap&lt;/code&gt;.&lt;/p&gt;
-&lt;table class="codehilitetable"&gt;&lt;tr&gt;&lt;td class="linenos"&gt;&lt;div class="linenodiv"&gt;&lt;pre&gt; 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10&lt;/pre&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;#!/bin/sh&lt;/span&gt;
-&lt;span class="nb"&gt;source&lt;/span&gt; /etc/vconsole.conf
-
-&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$TERM&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"dumb"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
-  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$KEYMAP&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"dvorak"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
-    localectl &lt;span class="nb"&gt;set&lt;/span&gt;-keymap us
-  &lt;span class="k"&gt;else&lt;/span&gt;
-    localectl &lt;span class="nb"&gt;set&lt;/span&gt;-keymap dvorak
-  &lt;span class="k"&gt;fi&lt;/span&gt;
-&lt;span class="k"&gt;fi&lt;/span&gt;
-&lt;/pre&gt;
-&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
-
-&lt;p&gt;After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.&lt;/p&gt;&lt;/div&gt;</description><category>sysadmin</category><category>systemd</category><guid>http://pleasantprogrammer.com/posts/console-keymap-switching.html</guid><pubDate>Tue, 29 Oct 2013 12:02:06 GMT</pubDate></item></channel></rss>

+ 0 - 67
output/categories/systemd.html

@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts about systemd | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/categories/systemd.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><link rel="alternate" type="application/rss+xml" title="RSS for tag systemd" href="systemd.xml">
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="tagpage"><header><h1>Posts about systemd</h1>
-        <div class="metadata">
-                <p class="feedlink"><a href="systemd.xml" type="application/rss+xml">RSS feed</a></p>
-        </div>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/console-keymap-switching.html" class="listtitle">Console Keymap Switching</a> <time class="listdate" datetime="2013-10-29T20:02:06+08:00" title="2013-10-29 20:02">2013-10-29 20:02</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 49
output/categories/systemd.xml

@@ -1,49 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer (systemd)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/categories/systemd.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Console Keymap Switching</title><link>http://pleasantprogrammer.com/posts/console-keymap-switching.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;At the office, we have some people who use DVORAK. Normally, this isn't a problem. To each his own after all. It does become a bit problematic though, when we're dealing with the servers around the office.&lt;/p&gt;
-&lt;p&gt;We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it's apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.&lt;/p&gt;
-&lt;p&gt;For the console, they'd typically do &lt;code&gt;sudo loadkeys dvorak&lt;/code&gt; after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can't even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn't a readily available thing for the console.&lt;/p&gt;
-&lt;p&gt;I googled around for solutions and came across &lt;a href="http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux"&gt;a nice idea&lt;/a&gt;. You could alias &lt;code&gt;asdf&lt;/code&gt; to load the DVORAK mapping and &lt;code&gt;aoeu&lt;/code&gt; (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don't really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.&lt;/p&gt;
-&lt;p&gt;After some further searching, I found &lt;a href="http://unix.stackexchange.com/questions/2884/toggle-between-dvorak-and-qwerty"&gt;something close to what I wanted&lt;/a&gt;. Apparently, Alt+Up sends a KeyboardSignal keycode to the init process, which can act on that. It also works anywhere, even before being logged in. For SysVinit systems, you can just add a line to your inittab for a command to be run when Alt+Up is pressed.&lt;/p&gt;
-&lt;p&gt;In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. &lt;code&gt;kbrequest.target&lt;/code&gt; is normally aliased to run the rescue service though, so you have to manually create the file in &lt;code&gt;/etc/systemd/system/kbrequest.target&lt;/code&gt; and fill it with a description:&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
-&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;kbrequest target&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;We can then add a service to be run whenever the target is called. Something like &lt;code&gt;/etc/systemd/system/keymap-switch.service&lt;/code&gt;:&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
-&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Keymap Switch Service&lt;/span&gt;
-
-&lt;span class="k"&gt;[Service]&lt;/span&gt;
-&lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;oneshot&lt;/span&gt;
-&lt;span class="na"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/usr/local/bin/keymap-switch&lt;/span&gt;
-
-&lt;span class="k"&gt;[Install]&lt;/span&gt;
-&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;kbrequest.target&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;After enabling said service, we only need the actual keymap switcher, &lt;code&gt;/usr/local/bin/keymap-switch&lt;/code&gt;. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we're using SystemD, we can use that instead for managing which keymap we're actually using. It stores the current settings inside &lt;code&gt;/etc/vconsole.conf&lt;/code&gt;. We can also then switch keymaps by using &lt;code&gt;localectl set-keymap&lt;/code&gt;.&lt;/p&gt;
-&lt;table class="codehilitetable"&gt;&lt;tr&gt;&lt;td class="linenos"&gt;&lt;div class="linenodiv"&gt;&lt;pre&gt; 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10&lt;/pre&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;#!/bin/sh&lt;/span&gt;
-&lt;span class="nb"&gt;source&lt;/span&gt; /etc/vconsole.conf
-
-&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$TERM&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"dumb"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
-  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$KEYMAP&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"dvorak"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
-    localectl &lt;span class="nb"&gt;set&lt;/span&gt;-keymap us
-  &lt;span class="k"&gt;else&lt;/span&gt;
-    localectl &lt;span class="nb"&gt;set&lt;/span&gt;-keymap dvorak
-  &lt;span class="k"&gt;fi&lt;/span&gt;
-&lt;span class="k"&gt;fi&lt;/span&gt;
-&lt;/pre&gt;
-&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
-
-&lt;p&gt;After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.&lt;/p&gt;&lt;/div&gt;</description><category>sysadmin</category><category>systemd</category><guid>http://pleasantprogrammer.com/posts/console-keymap-switching.html</guid><pubDate>Tue, 29 Oct 2013 12:02:06 GMT</pubDate></item></channel></rss>

+ 0 - 67
output/categories/tiddlywiki.html

@@ -1,67 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Posts about tiddlywiki | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/categories/tiddlywiki.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><link rel="alternate" type="application/rss+xml" title="RSS for tag tiddlywiki" href="tiddlywiki.xml">
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="tagpage"><header><h1>Posts about tiddlywiki</h1>
-        <div class="metadata">
-                <p class="feedlink"><a href="tiddlywiki.xml" type="application/rss+xml">RSS feed</a></p>
-        </div>
-    </header><ul class="postlist">
-<li>
-<a href="../posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" class="listtitle">TiddlyWiki in the Sky (or TiddlyWeb for TW5)</a> <time class="listdate" datetime="2015-12-24T14:48:20+08:00" title="2015-12-24 14:48">2015-12-24 14:48</time>
-</li>
-    </ul></article></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 77
output/categories/tiddlywiki.xml

@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/xsl" href="../assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer (tiddlywiki)</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/categories/tiddlywiki.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>TiddlyWiki in the Sky (or TiddlyWeb for TW5)</title><link>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;I've always liked &lt;a href="http://tiddlywiki.com"&gt;TiddlyWiki&lt;/a&gt;. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new HTML file with all your posts inside. I've used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.&lt;/p&gt;
-&lt;p&gt;Now, there's TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.&lt;/p&gt;
-&lt;p&gt;If you're just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There's plenty of documentation on the site. But if you're looking for more advanced features (like storing your posts in git or a database), then you'll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.&lt;/p&gt;
-&lt;p&gt;To support TiddlyWiki5, we'll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.&lt;/p&gt;
-&lt;h3&gt;Setting Up TiddlyWiki&lt;/h3&gt;
-&lt;p&gt;TiddlyWiki5 provides a command line tool via &lt;code&gt;npm&lt;/code&gt; that allows building custom versions of the wiki. In fact, it comes with templates, called "editions", that we can use for our setup. Assuming you already have it installed, create the wiki using&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;tiddlywiki mywiki --init tw5tank          # create wiki from template
-&lt;/pre&gt;
-
-
-&lt;p&gt;This creates a wiki intended for use with &lt;a href="https://tank.peermore.com/"&gt;Tank&lt;/a&gt;, which is built on top of TiddlyWeb. From here, you should look in &lt;code&gt;mywiki/tiddlers/system&lt;/code&gt; which contain the entries for &lt;code&gt;SiteTitle&lt;/code&gt;, &lt;code&gt;SiteSubtitle&lt;/code&gt;, &lt;code&gt;DefaultTiddlers&lt;/code&gt;, and &lt;code&gt;tiddlyweb-host&lt;/code&gt;. The first 3 should be configured however you want. These are necessary because they're needed before the wiki can load them from the server. &lt;code&gt;tiddlyweb-host&lt;/code&gt; contains the location of the TiddlyWeb server, this should be &lt;code&gt;http://localhost:8080/&lt;/code&gt; if you're just testing locally. With everything configured, you can build the new wiki by running&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;tiddlywiki mywiki --build
-&lt;/pre&gt;
-
-
-&lt;p&gt;This will output the wiki to &lt;code&gt;mywiki/output/tw5tank.html&lt;/code&gt;. You can now serve it using your favorite local webserver, like &lt;code&gt;python -m http.server&lt;/code&gt;.&lt;/p&gt;
-&lt;h3&gt;Setting Up TiddlyWeb&lt;/h3&gt;
-&lt;p&gt;The TiddlyWeb tutorial recommends using &lt;code&gt;tiddlywebwiki&lt;/code&gt; which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren't really needed, so we won't go with that. So first, we'll need to install TiddlyWeb and any plugins we might want to use.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
-&lt;/pre&gt;
-
-
-&lt;p&gt;Next, we'll need the tiddlyweb configuration in &lt;code&gt;tiddlywebconfig.py&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# A basic configuration.&lt;/span&gt;
-&lt;span class="c"&gt;# `pydoc tiddlyweb.config` for details on configuration items.&lt;/span&gt;
-
-&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;tiddlywebplugins.status&lt;/span&gt;
-
-&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
-    &lt;span class="s"&gt;'system_plugins'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'tiddlywebplugins.status'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'tiddlywebplugins.cors'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
-    &lt;span class="s"&gt;'secret'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
-    &lt;span class="s"&gt;'wsgi_server'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'tiddlywebplugins.cherrypy'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
-    &lt;span class="s"&gt;'cors.enable_non_simple'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
-&lt;span class="p"&gt;}&lt;/span&gt;
-
-&lt;span class="n"&gt;original_gather_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tiddlywebplugins&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_gather_data&lt;/span&gt;
-
-&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_status_gather_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
-    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;original_gather_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
-    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'space'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;'recipe'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'default'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
-    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;
-
-&lt;span class="n"&gt;tiddlywebplugins&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_gather_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_status_gather_data&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;The tweaks involved are:&lt;/p&gt;
-&lt;ul&gt;
-&lt;li&gt;using the status plugin which the wiki requires&lt;/li&gt;
-&lt;li&gt;monkeypatching the status plugin for the wiki to use the correct "recipe"&lt;/li&gt;
-&lt;li&gt;using cherrypy server instead of the buggy default one&lt;/li&gt;
-&lt;li&gt;using cors since we're not hosting the wiki itself on the same server&lt;/li&gt;
-&lt;/ul&gt;
-&lt;p&gt;With that, we just need to create the store that will hold our data&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;twanager recipe default &amp;lt;&amp;lt;EOF
-desc: standard TiddlyWebWiki environment
-policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
-
-/bags/default/tiddlers
-EOF
-
-twanager bag default &amp;lt;&amp;lt;EOF
-{"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
-EOF
-&lt;/pre&gt;
-
-
-&lt;p&gt;Finally, we can start the TiddlyWeb server&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;twanager server
-&lt;/pre&gt;
-
-
-&lt;h3&gt;Putting it all together&lt;/h3&gt;
-&lt;p&gt;Once you have the TiddlyWeb server running, you can just go to wherever you're hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that's done it's saved. You can refresh your browser and your posts should still be there.&lt;/p&gt;
-&lt;p&gt;At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won't need CORS anymore.&lt;/p&gt;
-&lt;p&gt;TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.&lt;/p&gt;&lt;/div&gt;</description><category>sysadmin</category><category>tiddlywiki</category><guid>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</guid><pubDate>Thu, 24 Dec 2015 06:48:20 GMT</pubDate></item></channel></rss>

+ 0 - 64
output/galleries/index.html

@@ -1,64 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>galleries | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/galleries/index.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><nav class="breadcrumbs"><ul class="breadcrumb">
-<li><a href="#">galleries</a></li>
-</ul></nav><h1>galleries</h1>
-    <ul>
-<li><a href="transit/"><i class="icon-folder-open"></i> transit</a></li>
-    </ul></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 2
output/galleries/rss.xml

@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>galleries</title><link>http://pleasantprogrammer.com/galleries/rss.xml</link><description></description><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs></channel></rss>

BIN
output/galleries/transit/gtfs_preview.thumbnail.jpg


+ 0 - 100
output/galleries/transit/index.html

@@ -1,100 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>transit | Pleasant Programmer</title>
-<link href="../../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/galleries/transit/index.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../../assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../../archive.html">Archives</a></li>
-                <li><a href="../../categories/index.html">Tags</a></li>
-                <li><a href="../../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><nav class="breadcrumbs"><ul class="breadcrumb">
-<li><a href="../">galleries</a></li>
-        <li><a href="#">transit</a></li>
-</ul></nav><h1>transit</h1>
-    <ul class="thumbnails">
-<li>
-<a href="onebusaway1.png" class="thumbnail image-reference" title="Onebusaway1">
-                <img src="onebusaway1.thumbnail.png" alt="Onebusaway1"></a>
-            </li>
-<li>
-<a href="gtfs_preview.jpg" class="thumbnail image-reference" title="Gtfs preview">
-                <img src="gtfs_preview.thumbnail.jpg" alt="Gtfs preview"></a>
-            </li>
-<li>
-<a href="onebusaway3.png" class="thumbnail image-reference" title="Onebusaway3">
-                <img src="onebusaway3.thumbnail.png" alt="Onebusaway3"></a>
-            </li>
-<li>
-<a href="otp1.png" class="thumbnail image-reference" title="Otp1">
-                <img src="otp1.thumbnail.png" alt="Otp1"></a>
-            </li>
-<li>
-<a href="otp2.png" class="thumbnail image-reference" title="Otp2">
-                <img src="otp2.thumbnail.png" alt="Otp2"></a>
-            </li>
-<li>
-<a href="onebusaway2.png" class="thumbnail image-reference" title="Onebusaway2">
-                <img src="onebusaway2.thumbnail.png" alt="Onebusaway2"></a>
-            </li>
-<li>
-<a href="otproundabout.png" class="thumbnail image-reference" title="Otproundabout">
-                <img src="otproundabout.thumbnail.png" alt="Otproundabout"></a>
-            </li>
-<li>
-<a href="otpelevation.png" class="thumbnail image-reference" title="Otpelevation">
-                <img src="otpelevation.thumbnail.png" alt="Otpelevation"></a>
-            </li>
-<li>
-<a href="upkatipunan.jpg" class="thumbnail image-reference" title="Upkatipunan">
-                <img src="upkatipunan.thumbnail.jpg" alt="Upkatipunan"></a>
-    </li>
-</ul></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

BIN
output/galleries/transit/onebusaway1.thumbnail.png


BIN
output/galleries/transit/onebusaway2.thumbnail.png


BIN
output/galleries/transit/onebusaway3.thumbnail.png


BIN
output/galleries/transit/otp1.thumbnail.png


BIN
output/galleries/transit/otp2.thumbnail.png


BIN
output/galleries/transit/otpelevation.thumbnail.png


BIN
output/galleries/transit/otproundabout.thumbnail.png


A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 1
output/galleries/transit/rss.xml


BIN
output/galleries/transit/upkatipunan.jpg


BIN
output/galleries/transit/upkatipunan.thumbnail.jpg


+ 0 - 354
output/index-1.html

@@ -1,354 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Pleasant Programmer (old posts, page 1) | Pleasant Programmer</title>
-<link href="assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/index-1.html">
-<link rel="prev" href="index-2.html" type="text/html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="archive.html">Archives</a></li>
-                <li><a href="categories/index.html">Tags</a></li>
-                <li><a href="rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><div class="postindex">
-    <article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/gtfs-editor.html" class="u-url">GTFS Editor</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>Link: <a href="https://github.com/conveyal/gtfs-editor">https://github.com/conveyal/gtfs-editor</a></p>
-<p><strong>TL;DR</strong> they really meant under development</p>
-<p>When I first saw the source of GTFS Editor, I was ecstatic. They used <a href="http://playframework.com/">Play framework</a>!!! Not only that, they're targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.</p>
-<p>Getting it to actually run though, wasn't very pleasant. The initial setup was easy enough. Get <a href="http://www.playframework.com/download">Play 1.2.5</a>, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that's necessary. Wonderful. Then, run play, open a browser, go to <a href="http://localhost:9000">http://localhost:9000</a>, compilation error. Fantastic.</p>
-<p>If you don't want to go through the technical details, you can just jump to the <a href="posts/gtfs-editor.html#conclusion">conclusion</a>.</p>
-<h3>Let's Debug!</h3>
-<p>I'll be splitting the next section up into 2 parts. In the first pass, I'll talk about what I did to just get the app to run but I won't try hard to fix any bugs. This generally is what I do when I try to get apps to run. I'll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I'll explain what the problems were and how I fixed them.</p>
-<h4>First Pass</h4>
-<p>A thing to note about Play (and one of the reasons it's a lovely Java framework) is that you don't need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that's what I saw, <code>Error: type Check already defined</code></p>
-<pre class="code literal-block"><span class="nd">@Retention</span><span class="o">(</span><span class="n">RetentionPolicy</span><span class="o">.</span><span class="na">RUNTIME</span><span class="o">)</span>
-<span class="nd">@Target</span><span class="o">({</span><span class="n">ElementType</span><span class="o">.</span><span class="na">METHOD</span><span class="o">,</span> <span class="n">ElementType</span><span class="o">.</span><span class="na">TYPE</span><span class="o">})</span>
-<span class="kd">public</span> <span class="nd">@interface</span> <span class="n">Check</span> <span class="o">{</span> <span class="c1">// error here</span>
-
-    <span class="n">String</span><span class="o">[]</span> <span class="nf">value</span><span class="o">();</span>
-<span class="o">}</span>
-</pre>
-
-
-<p>You also know that typical behavior among programmers where your program doesn't compile, but you keep trying to compile it anyway hoping that it will magically just work. That's what I did, and it actually ran. I couldn't really just let this pass, so I decided to try deleting <code>Check.java</code>. I got another compilation error, <code>Error: type Secure already defined</code></p>
-<pre class="code literal-block"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Secure</span> <span class="kd">extends</span> <span class="n">Controller</span> <span class="o">{</span> <span class="c1">// error here</span>
-
-    <span class="nd">@Before</span><span class="o">(</span><span class="n">unless</span><span class="o">={</span><span class="s">"login"</span><span class="o">,</span> <span class="s">"authenticate"</span><span class="o">,</span> <span class="s">"logout"</span><span class="o">})</span>
-
-    <span class="kd">static</span> <span class="kt">void</span> <span class="nf">checkAccess</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Throwable</span> <span class="o">{</span>
-</pre>
-
-
-<p>At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put <code>Check.java</code> back in and proceeded to just refresh until it compiled and ran.</p>
-<p>The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the <code>account</code> table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn't work.</p>
-<p>Another note regarding Play 1.x, it provides the <a href="http://www.playframework.com/documentation/1.2.5/secure">secure module</a> which handles logins and keeping state, you simply need to implement the method <code>boolean authenticate(String username, String password)</code>. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return <code>true</code> and then any login would work. No need to actually set the password. Excellent.</p>
-<p>And we're logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, <code>IndexOutOfBoundsException occured : Index: 0, Size: 0</code></p>
-<pre class="code literal-block"><span class="k">if</span><span class="o">(</span><span class="n">session</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="s">"agencyId"</span><span class="o">)</span> <span class="o">==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
-
-    <span class="n">Agency</span> <span class="n">agency</span> <span class="o">=</span> <span class="n">agencies</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">);</span> <span class="c1">// error here</span>
-
-    <span class="n">session</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"agencyId"</span><span class="o">,</span> <span class="n">agency</span><span class="o">.</span><span class="na">id</span><span class="o">);</span>
-    <span class="n">session</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"agencyName"</span><span class="o">,</span> <span class="n">agency</span><span class="o">.</span><span class="na">name</span><span class="o">);</span>
-</pre>
-
-
-<p>Apparently, we need to have an agency. That's generally simple enough. You just manually insert an agency into the <code>agency</code> table. After that's done, we finally have a view of the actual application. It's very Bootstrap-y, but that's just fine. The workflow though, is not perfectly intuitive, but I'll talk about that some other day.</p>
-<p>That's not the end of it though, we still have to fix these bugs. The developer obviously didn't have to put up with this when they were working, so what happened? Also, the log is showing some weird things,</p>
-<pre class="code literal-block">~        _            _
-~  _ __ | | __ _ _  _| |
-~ | '_ \| |/ _' | || |_|
-~ |  __/|_|\____|\__ (_)
-~ |_|            |__/
-~
-~ play! 1.2.5, http://www.playframework.org
-~
-~ Ctrl+C to stop
-~
-CompilerOracle: exclude jregex/Pretokenizer.next
-Listening for transport dt_socket at address: 8000
-23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
-23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
-23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
-23:32:15,830 WARN  ~ You're running Play! in DEV mode
-23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
-23:32:28,792 ERROR ~
-
-@6f02fa9dd
-Internal Server Error (500) for request GET /
-
-Compilation error (In /app/controllers/Check.java around line 10)
-The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
-
-play.exceptions.CompilationException: The type Check is already defined
-    at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
-    at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
-    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
-    at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
-    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
-    at play.Play.start(Play.java:516)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at Invocation.HTTP Request(Play!)
-23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
-SLF4J: Class path contains multiple SLF4J bindings.
-SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
-23:32:32,490 INFO  ~ Initializing HBSpatialExtension
-23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
-23:32:32,494 INFO  ~ Checking for default configuration file.
-23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
-23:32:34,077 INFO  ~ Application 'gtfs-editor' is now started !
-23:32:34,151 INFO  ~ Bootstrapping Database...
-23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
-play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
-    at play.templates.TemplateLoader.load(TemplateLoader.java:78)
-    at play.test.Fixtures.loadModels(Fixtures.java:174)
-    at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
-    at play.jobs.Job.doJobWithResult(Job.java:50)
-    at play.jobs.Job.call(Job.java:146)
-    at play.jobs.Job.run(Job.java:132)
-    at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
-    at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
-    at play.Play.start(Play.java:547)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
-    at play.Invoker$Invocation.run(Invoker.java:276)
-    at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
-    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
-    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
-    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
-    at java.lang.Thread.run(Thread.java:680)
-Caused by: play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
-    ... 22 more
-Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
-    at java.io.FileInputStream.open(Native Method)
-    at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120)
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
-    ... 23 more
-23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
-23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
-23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
-23:32:40,999 DEBUG ~ select nextval ('hibernate_sequence')
-23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
-23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
-23:32:41,175 ERROR ~
-
-@6f02fa9dg
-Internal Server Error (500) for request GET /
-
-Execution exception (In /app/controllers/Application.java around line 57)
-IndexOutOfBoundsException occured : Index: 0, Size: 0
-
-play.exceptions.JavaExecutionException: Index: 0, Size: 0
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
-    at Invocation.HTTP Request(Play!)
-Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
-    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
-    at java.util.ArrayList.get(ArrayList.java:322)
-    at controllers.Application.initSession(Application.java:57)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
-    at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
-    ... 1 more
-</pre>
-
-
-<p>After <code>23:32:34</code> is when I get the login page. <code>23:32:40</code> is after I've logged in.</p>
-<h4>Second Pass</h4>
-<p>So how did you do? First, the error that <code>type Check already defined</code> usually does mean that <code>Check</code> was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It's the only one there that was <code>Check.java</code>. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, <code>Check.java</code>. Doing a diff shows nothing was changed. So the solution really was just simply delete <code>Check.java</code> and also <code>Secure.java</code>. No more compilation errors!</p>
-<p>The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,</p>
-<pre class="code literal-block"><span class="k">if</span><span class="o">(</span><span class="n">Security</span><span class="o">.</span><span class="na">isConnected</span><span class="o">())</span> <span class="o">{</span>
-    <span class="o">...</span>
-    <span class="n">Account</span> <span class="n">account</span> <span class="o">=</span> <span class="n">Account</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="s">"username = ?"</span><span class="o">,</span> <span class="n">Security</span><span class="o">.</span><span class="na">connected</span><span class="o">()).</span><span class="na">first</span><span class="o">();</span>
-    <span class="o">...</span>
-    <span class="k">if</span><span class="o">(</span><span class="n">account</span> <span class="o">==</span> <span class="kc">null</span> <span class="o">&amp;&amp;</span> <span class="n">Account</span><span class="o">.</span><span class="na">count</span><span class="o">()</span> <span class="o">==</span> <span class="mi">0</span><span class="o">)</span> <span class="o">{</span>
-        <span class="n">account</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Account</span><span class="o">(</span><span class="s">"admin"</span><span class="o">,</span> <span class="s">"admin"</span><span class="o">,</span> <span class="s">"admin@test.com"</span><span class="o">,</span> <span class="kc">true</span><span class="o">,</span> <span class="kc">null</span><span class="o">);</span>
-        <span class="n">account</span><span class="o">.</span><span class="na">save</span><span class="o">();</span>
-    <span class="o">}</span>
-    <span class="o">...</span>
-<span class="o">}</span>
-</pre>
-
-
-<p>You can actually see this in action at <code>23:32:41,051</code> in the log. So what's wrong with all of this? The account creation happened after I've already logged in. In fact, <code>Security.isConnected()</code> checks whether the user is already logged in or not. How does this even make sense?</p>
-<p>Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we're missing a file called <code>initial-agencies-data.yml</code>. Ok, apparently it's a <a href="http://www.playframework.com/documentation/1.2.5/test#fixtures">fixture</a> like you would use for testing. It's easy enough to infer what the file's contents should be. We just copy it over from the GTFS data.</p>
-<p>But then where do you put the file? If you look at the log, it says <code>/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml</code> but that doesn't look right. That's in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the <code>test/</code> directory? No, that doesn't work either since we're not running a test.</p>
-<p>What I ended up doing was just looking at the sources for <code>Fixtures.load</code>. If you follow the stack trace, you end up finding <code>Play.javaPath</code> which sort of works like PATH for Fixtures and some other things. So where can we put the file? <code>app/</code> and <code>conf/</code>. And with that, we're done.</p>
-<h4 id="conclusion">Conclusion</h4>
-
-<p>GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone <a href="https://github.com/thatsmydoing/gtfs-editor">my branch</a> as I've fixed the issues discussed earlier. The default login is <code>admin:admin</code>.</p>
-<p>Even after getting it to run, it's still not quite usable. Not in the UX sense, but you really can't do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don't have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-10T11:30:01+08:00" title="2013-07-10 11:30">2013-07-10 11:30</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/gtfs-editor.html#disqus_thread" data-disqus-identifier="cache/posts/gtfs-editor.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/open-trip-planner.html" class="u-url">Open Trip Planner</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>Link: <a href="http://www.opentripplanner.org">http://www.opentripplanner.org</a></p>
-<p><strong>TL;DR</strong> routes pretty well; data might cause weird issues</p>
-<p>OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you're willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.</p>
-<p>It's actually in general use by the <a href="http://maps.trimet.org/">Trimet</a>, Portland's public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner's support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn't have. This actually just screams <a href="http://philippine-transit.hackathome.com/prizes/">Inclusive Technology Award</a>.</p>
-<h4>Setup</h4>
-<p>Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I'd suggest going through the <a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes">5-minute introduction</a> if you want to actually work with the Philippine data. You will also need to download the <a href="http://download.geofabrik.de/asia/philippines.html">Philippine data dump</a> from OSM. You will want the <code>osm.bz2</code> one (WARNING: 900MB unzipped).</p>
-<p>Once you get the webapp running, you'll notice the map tiles won't load correctly. This is because the default tileset used is from Mapbox which doesn't provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.</p>
-<h4>Issues</h4>
-<p>The next thing you'll notice is that you can't search for a place. You can only just pick points on the map and route between those. I'm still not exactly sure if it's supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn't be too difficult.</p>
-<p>Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet's implementation isn't as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.</p>
-<p>There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a "stop" in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the "stop" to Arguilla.</p>
-<p><img alt="OpenTripPlanner disconnected route" src="galleries/transit/otp1.png"></p>
-<p>I can't say this isn't a bug. After all, OpenTripPlanner couldn't have magically known there really was a street there. If it did, it wouldn't just teleport you to the corner. I'm more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.</p>
-<p>Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won't give you the best route because it thinks you have to loop around to get to where you want to be. I don't really know how common this issue pops up though. It's highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.</p>
-<p><img alt="OpenTripPlanner loopy route" src="galleries/transit/otp2.png"></p>
-<p>Much like the earlier problem, I can't tell if this is a bug or it's a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren't even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.</p>
-<p><img alt="UP Katipunan Route" src="galleries/transit/upkatipunan.jpg"></p>
-<p>From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren't that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.</p>
-<h4>Conclusion</h4>
-<p>Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There's also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-09T23:16:12+08:00" title="2013-07-09 23:16">2013-07-09 23:16</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/open-trip-planner.html#disqus_thread" data-disqus-identifier="cache/posts/open-trip-planner.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/one-bus-or-maybe-jeep-away.html" class="u-url">One Bus (or maybe Jeep) Away</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>Link: <a href="http://onebusaway.org/">http://onebusaway.org/</a></p>
-<p><strong>TL;DR</strong> no routing; useless in Philippines</p>
-<p>OneBusAway is a transit information app. It provides data on what bus stops are near you, which buses pass by. You can also get schedules and the route of a particular bus given the number. It can also provide realtime updates like how many minutes until the next bus arrives. It does not, however, provide routing. There is no support for providing directions to get from point A to point B.</p>
-<p>It's comparable to what you get in some bus stops abroad. You'd get a vicinity map and a list of buses passing through the stop. You might also get the times when the next buses will pass. It's useful for locals who already know how to get around, and want to avoid waiting for the bus. But it's not particularly good for people who want to know how to get around the city.</p>
-<p>OneBusAway is quite comprehensive in its platform support though. There is a webapp, apps for iOS, Android and Windows Phone, as well as SMS and Voice support. This would all be nice but we don't have the necessary infrastructure yet in the Philippines. We don't have bus or jeepney stops. We also wouldn't have realtime data to make the app particularly useful.</p>
-<p>You can try it out for yourself by following their <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/OneBusAway-Quickstart-Guide">Quickstart Guide</a>. One caveat is you will have to add <code>-P tripEntriesFactory.throwExceptionOnInvalidStopToShapeMappingException=false</code> when building the bundle. This has to do with the OneBusAway having difficulty matching the <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching">stops to the shape data</a>.</p>
-<p>Here's some screenshots of the app with the Philippine data. Notice how you only see the stops but there isn't a line for the route. This is a problem with our GTFS data. Also, at some points it's hard to tell where the jeep is going to pass since there isn't any indication of order either. This is more of a OneBusAway problem. It usually expects there to be shape data available.</p>
-<p><a href="galleries/transit/onebusaway1.png"><img alt="OneBusAway" src="galleries/transit/onebusaway1.png" title="All the stops along Katipunan Avenue are named Katipunan Avenue."></a></p>
-<p>It doesn't really handle too many routes passing through a stop. The list just overflows past the bubble. You can still actually read it by panning the map. It's just a bit weird though.</p>
-<p>If you also noticed, there are usually 2 of each route. This is how the jeepney data was modeled as jeep routes might be different going one way and going back. This isn't the case for all jeeps though, so it might also be an implementation issue with the GTFS editor.</p>
-<p><a href="galleries/transit/onebusaway2.png"><img alt="OneBusAway" src="galleries/transit/onebusaway2.png"></a></p>
-<p><a href="galleries/transit/onebusaway3.png"><img alt="OneBusAway" src="galleries/transit/onebusaway3.png"></a></p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-09T01:53:59+08:00" title="2013-07-09 01:53">2013-07-09 01:53</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/one-bus-or-maybe-jeep-away.html#disqus_thread" data-disqus-identifier="cache/posts/one-bus-or-maybe-jeep-away.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/jeepney-and-bus-routes.html" class="u-url">Jeepney and Bus Routes</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>In the <a href="posts/philippine-transit-app-challenge.html">last post</a>, I talked about how we now have data about jeepney and bus routes in the Philippines. The data is actually in the <a href="https://developers.google.com/transit/gtfs/">GTFS format</a>, which is the format the Google Maps consumes transit data. Apparently, the government will be submitting the GTFS data later this year. Transit directions for Metro Manila in Google Maps would be wonderful. That said, it definitely raises the bar for the app challenge people.</p>
-<p>In the last post, I mentioned the quality of the data isn't quite good. Even before seeing the data, I was already a bit unsure of it. The key problem is how you model the routes. The GTFS format was inherently designed for more well developed and organized transit agencies which isn't exactly what we have in the Philippines now.</p>
-<p>One potential problem is the nature of the jeeps and buses. GTFS routes are a collection of trips which are a sequence of stops. However, we don't have jeepney stops, and even if we did they still just stop anywhere. There are also times where jeeps will take a shortcut if no passengers need to get dropped off along their normal route.</p>
-<p>From what I've seen of the data, they handled the first problem well enough. Stops are defined as where people typically get on the jeep or bus. This is good, but they didn't define a shape for the routes. There is no information as to which exact roads they pass through. All we have to go by are the stops to show the route on a map.</p>
-<p><img alt="sample route" src="http://i.imgur.com/NSVlryE.jpg"></p>
-<p>The problem isn't that bad though. The agencies could still add the shapes later on. Or maybe an app challenge participant could make an app around fixing the routes via crowd-sourcing or similar. The shape itself isn't that important for a rudimentary directions app, but if we want better apps, we will need better data.</p>
-<p>There were also some minor issues with the data itself. Some of the files had extra columns. This normally isn't an issue, but it caused problems for <a href="https://github.com/harrisony/gtfs_SQL_importer">GTFS SQL importer</a>. There were also problems with matching the shape data with the stops when I tried it with <a href="http://onebusaway.org">OneBusAway</a>. They could probably be <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching">fixed</a> but that's for another day.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-07T10:32:36+08:00" title="2013-07-07 10:32">2013-07-07 10:32</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/jeepney-and-bus-routes.html#disqus_thread" data-disqus-identifier="cache/posts/jeepney-and-bus-routes.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/philippine-transit-app-challenge.html" class="u-url">Philippine Transit App Challenge</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>Last week, the DOTC launched the <a href="http://philippine-transit.hackathome.com">Philippine Transit App Challenge</a>. It's a competition to build something great using the newly available 1) jeepney/bus/rail routes and 2) traffic incident data in Metro Manila and Cebu.</p>
-<p>I'm actually quite excited about this as it's not everyday our government does wonderful things. Many people have been waiting for this kind of data to be available. Before, the only way to figure out which jeeps to ride to get from A to B is by asking other people. The website of the LTFRB used to just have a list of jeepney routes, but nothing else, no maps or list of stops.</p>
-<p>During the launch, they also presented how CITOM (the Cebu MMDA) is pilot-testing a <a href="http://cebutraffic.org/">traffic tracking system</a>. What they did was supply Android phones to taxi drivers. The phones send GPS data which can then be aggregated to see what the average speeds along streets are. This also benefits the taxi company as it provides easy tracking of their taxis compared to their old telephone/radio with pen-and-paper process.</p>
-<p>The <a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/">route data</a> are already available, as well as the <a href="http://philippine-transit.hackathome.com/dataset-citom-traffic-alert-platform/">Cebu</a> and <a href="http://philippine-transit.hackathome.com/dataset-mmda-traffic-alert-platform/">Metro Manila</a> incident data. You do have to register to access them though. Right now, they're just one-off dumps of the data but the various agencies have promised to provide consistently updated data. This will be provided via ASTI later in the year.</p>
-<p>I've just started looking at the route data and playing around with it. The quality could be better, but I'm glad we at least have something to work with.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-07T00:17:37+08:00" title="2013-07-07 00:17">2013-07-07 00:17</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/philippine-transit-app-challenge.html#disqus_thread" data-disqus-identifier="cache/posts/philippine-transit-app-challenge.html">Comments</a>
-
-</small>
-    </article>
-</div>
-
-        <nav class="postindexpager"><ul class="pager clearfix">
-<li class="previous">
-                <a href="index-2.html" rel="prev">← Newer posts</a>
-            </li>
-        </ul></nav><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 227
output/index-2.html

@@ -1,227 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Pleasant Programmer (old posts, page 2) | Pleasant Programmer</title>
-<link href="assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/index-2.html">
-<link rel="prev" href="index-3.html" type="text/html">
-<link rel="next" href="index-1.html" type="text/html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="archive.html">Archives</a></li>
-                <li><a href="categories/index.html">Tags</a></li>
-                <li><a href="rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><div class="postindex">
-    <article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/highways-in-otp.html" class="u-url">Highways in OTP</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP's suggested route for walking from UP to Ateneo:</p>
-<p><img alt="Roundabout route from UP to Ateneo" src="galleries/transit/otproundabout.png"></p>
-<p>This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.</p>
-<p>OTP couldn't possibly be that dumb though, so there must be something we're doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the "road type" designated to Katipunan.</p>
-<p>Apparently, by default OTP will consider roads of type <code>trunk</code> to be non-walkable and non-bikable. This is documented in the <a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner">OpenStreetMap wiki</a> and the <a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety">OTP wiki</a> as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.</p>
-<pre class="code literal-block">sed -i .bak s/trunk/primary/g manila.osm
-</pre>
-
-
-<p>And rebuild the graph. It doesn't really matter much because the OSM data isn't used to render the maps. It's just used to build the routing data. This is actually what I did for <a href="http://maps.pleasantprogrammer.com">maps.pleasantprogrammer.com</a>.</p>
-<p>It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on <code>highway=trunk</code> we could allow that. This is not much better than the <code>sed</code> solution though. It's better since you keep the weighting done by OTP, but you're still saying that all trunks are walkable which might not be the case.</p>
-<p>The most correct way to actually fix this is to go through each of the trunks and specifying <code>foot=yes</code> and <code>bicycle=yes</code> for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I'm not sure on the particulars with updating OSM though.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-24T23:15:57+08:00" title="2013-07-24 23:15">2013-07-24 23:15</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/highways-in-otp.html#disqus_thread" data-disqus-identifier="cache/posts/highways-in-otp.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/elevation-data-in-otp.html" class="u-url">Elevation Data in OTP</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p><img alt="OpenTripPlanner showing elevation data" src="galleries/transit/otpelevation.png"></p>
-<p>One thing I hadn't tested out last time was OTP's support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.</p>
-<p>The <a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes">5 minute tutorial</a> actually discusses the elevation data briefly, but a more in-depth thing you can look at is the <a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data">GraphBuilder documentation</a>. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the <a href="http://www.philgis.org/freegisdata.htm">PhilGIS website</a>.</p>
-<p>I don't know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use <a href="http://www.gdal.org/">GDAL</a> for this. You'd just then run,</p>
-<pre class="code literal-block"> gdal_translate srtm41_90m_phl.img phil.tiff
-</pre>
-
-
-<p>Afterwards, it's just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you're running on limited RAM.</p>
-<p>I've actually hosted a <a href="http://maps.pleasantprogrammer.com">working example</a>. It's pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don't abuse it though.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-23T18:23:00+08:00" title="2013-07-23 18:23">2013-07-23 18:23</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/elevation-data-in-otp.html#disqus_thread" data-disqus-identifier="cache/posts/elevation-data-in-otp.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/graphserver.html" class="u-url">GraphServer</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>Link: <a href="http://graphserver.github.io/graphserver/">http://graphserver.github.io/graphserver/</a></p>
-<p>One other routing webapp I saw was GraphServer. It's actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It's also based off python and C instead of Java, so it feels a lot less heavy.</p>
-<p>The instructions on the website are already pretty good. There are just some minor errors with it. Where it says <code>gs_gtfsdb_build</code>, you should actually use <code>gs_gtfsdb_compile</code>. Also, when running <code>gs_osmdb_compile</code> you might need to use <code>-t</code> for tolerant in case you follow the instructions on chopping up the original OSM data.</p>
-<p>A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn't support 64-bit ids. The <a href="http://wiki.openstreetmap.org/wiki/Osmosis">latest version of Osmosis</a> easily did the job though.</p>
-<p>The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn't provide any alternate routes aside from that one. I'm not sure if it's a limitation of the provided routeserver, but I didn't bother checking if it supported parameters which might provide better routes.</p>
-<p>I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-23T14:48:29+08:00" title="2013-07-23 14:48">2013-07-23 14:48</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/graphserver.html#disqus_thread" data-disqus-identifier="cache/posts/graphserver.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/transit-wand.html" class="u-url">Transit Wand</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>Link: <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">http://transitwand.com</a></p>
-<p>Overall, this was the simplest of the <a href="http://philippine-transit.hackathome.com/use-this-code/">open-source transit tools</a> to actually get up and running. There's already a deployed instance of the server, and you can easily download the phone app via the <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">Play Store</a>. Even running the server by yourself didn't have any of the hiccups I had with GTFS Editor.</p>
-<p>The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.</p>
-<p>After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it's free and you don't even actually need to put in a username or anything. It simply registers the phone's IMEI on the server and gives you a 6-digit identifier.</p>
-<p>You can then use the 6-digit identifier to view the data on Transit Wand's server, which is good since uploading any data automatically deletes it from the phone. There really isn't much else you can do with it though. It just allows you to view the data, and export it as a <a href="https://en.wikipedia.org/wiki/Shapefile">Shapefile</a>.</p>
-<p>As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There's also no way to extract the ridership information from the server yet. This isn't to say that the data won't eventually go public though.</p>
-<p>An interesting thing you <em>can</em> do with the Transit Wand data is import it into GTFS Editor to make a new route. You don't even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you've captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.</p>
-<p>I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don't understand is why the shape data isn't present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can't easily move stops, you have to input coordinates to change the position.</p>
-<p>It <em>might</em> also be possible that when the DOTC was still collecting the data, the route collection or editing features weren't present yet. That would just be lame and depressing though.</p>
-<p>Overall, Transit Wand does what it's supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-15T22:45:20+08:00" title="2013-07-15 22:45">2013-07-15 22:45</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/transit-wand.html#disqus_thread" data-disqus-identifier="cache/posts/transit-wand.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/fare-data.html" class="u-url">Fare Data</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>As part of the data released by the DOTC, we also have the <a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/">fare matrix</a> for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the <a href="http://ltfrb.gov.ph/main/farerates">LTFRB website</a>. Generally, the fare scheme is represented as "pay <em>X</em> pesos for the first <em>Y</em> kilometers, pay <em>Z</em> for every succeeding kilometer." Instead of a table, we can simply represent this as a formula instead,</p>
-<pre class="code literal-block">base_fare + (distance - initial) * per_km
-</pre>
-
-
-<p>The relevant values for the three services are:</p>
-<table>
-<thead><tr>
-<td>type</td>
-    <td>base_fare</td>
-    <td>initial</td>
-    <td>per_km</td>
-  </tr></thead>
-<tbody>
-<tr>
-<td>bus aircon</td>
-    <td>12.00</td>
-    <td>5 km</td>
-    <td>2.20</td>
-  </tr>
-<tr>
-<td>bus ordinary</td>
-    <td>10.00</td>
-    <td>5 km</td>
-    <td>1.85</td>
-  </tr>
-<tr>
-<td>jeep aircon</td>
-    <td>8.00</td>
-    <td>4 km</td>
-    <td>1.40</td>
-  </tr>
-</tbody>
-</table>
-<p>It isn't as simple as that though. Fares are also rounded to the nearest 25 centavos. So we'd need to round them off correctly. This can be achieved by doing,</p>
-<pre class="code literal-block">round(calculated_fare * 4.0)/4.0
-</pre>
-
-
-<p>There's also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.</p>
-<p>Doing just this, we actually do get the same results as the fare matrices in the image for the most part. There are some discrepancies with the discounted jeep fares. I've tried to resolve it by tweaking around with the formulas, but it really doesn't make sense in any way. I presume these were manually adjusted for one reason or another.</p>
-<p>Here's a <a href="uploads/farematrix.rb">script</a> that generates CSVs of all the three fare matrices. If you're too lazy to run it, here are links to the <a href="uploads/pub_aircon.csv">aircon bus</a>, <a href="uploads/pub_ordinary.csv">ordinary bus</a> and <a href="uploads/puj.csv">jeep</a> fare matrices.</p>
-<h4>GTFS compatibility</h4>
-<p>As is, the provided GTFS data does not have any fare data. I imagine this is because the existing spec doesn't have good support for distance-based fares like we have in the Philippines. Judging from the <a href="https://code.google.com/p/googletransitdatafeed/wiki/FareExamples">fare examples</a>, the only reasonable way we could implement distance-based fares is following example 6. This would involve setting a fare for each possible pair of stops based on the distance between them. This isn't exactly ideal. In fact, the people originally working on the DOTC project have voiced <a href="https://groups.google.com/forum/#!topic/gtfs-fare-wg/V63xRSnQJGw">issues</a> and made <a href="https://groups.google.com/forum/#!msg/gtfs-changes/uybrAokZ9Cg/rqlzXdMypUgJ">proposals</a> for having distance-based fares included into GTFS.</p>
-<p>Apparently, public transit fares are a really complicated thing. You have fares based on distance, number of stops passed through, and transfers which may or may not cost extra. Not only that, you might have discounted fares, or first-class vs economy fares. The community will want to get it right before it's formally included in the spec. You can see the current state of the consolidated <a href="https://docs.google.com/document/d/1mK3--o5g4-3cCXaqmch92U63JTwChh0L2VCmcDViIlM/edit">GTFS fare proposal here</a>.</p>
-<p>Even in it's proposal form though, we might have hope of being able to see these being used. There's currently a <a href="https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/30">pull request</a> for supporting the distance-based fare scheme into the OneBusAway libraries. The libraries actually used by GTFS Editor and OpenTripPlanner for working with GTFS data.</p>
-<h4>Remaining Problems</h4>
-<p>Given all that, it would probably still be a long way before this allows us to make a really good routing app. We still don't have shape data, so the distance estimates would really be rough estimates at best. There's no support for rounding to the nearest centavo. I realize that's just nitpicking, but if we want something truly polished, even that has to be taken care of.</p>
-<p>We also don't know if the jeeps or buses strictly follow the distance-based scheme. After all, if you can get on and off anywhere, you can't really measure distance that exactly. I assume they generally work off the notion of "zones" than actual distance travelled. In that sense, they work more similarly to the LRT which has fares based on how many stops you pass. For jeeps and buses, your fare is probably based more on how many "zones" you pass through.</p>
-<h4>Conclusion</h4>
-<p>Philip, a co-worker of mine at By Implication, had suggested that we might want to use a different model than what the GTFS proposes. I have to agree with him. At this point, the GTFS doesn't really fit with our system. But I do think that open data and standards are great. In fact, I applaud the developers who made proposals for the fare system, as those are great first steps towards making the GTFS a more universal standard.</p>
-<p>Side note: I'd also actually really like to hear about the DOTC developers' experience with the project. It would be nice if they had a devblog.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-13T21:15:09+08:00" title="2013-07-13 21:15">2013-07-13 21:15</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/fare-data.html#disqus_thread" data-disqus-identifier="cache/posts/fare-data.html">Comments</a>
-
-</small>
-    </article>
-</div>
-
-        <nav class="postindexpager"><ul class="pager clearfix">
-<li class="previous">
-                <a href="index-3.html" rel="prev">← Newer posts</a>
-            </li>
-            <li class="next">
-                <a href="index-1.html" rel="next">Older posts →</a>
-            </li>
-        </ul></nav><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 0 - 125
output/index-3.html

@@ -1,125 +0,0 @@
-<!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
-<head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Pleasant Programmer (old posts, page 3) | Pleasant Programmer</title>
-<link href="assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/index-3.html">
-<link rel="prev" href="index.html" type="text/html">
-<link rel="next" href="index-2.html" type="text/html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="assets/js/html5.js"></script><![endif]-->
-</head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="archive.html">Archives</a></li>
-                <li><a href="categories/index.html">Tags</a></li>
-                <li><a href="rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><div class="postindex">
-    <article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/geocoding-services.html" class="u-url">Geocoding Services</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don't know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.</p>
-<p>The gold standard for doing geocoding right now is Google Maps. It's hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn't be <em>that</em> much you could do for the competition.</p>
-<p>When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called <a href="http://nominatim.openstreetmap.org">Nominatim</a>.</p>
-<p>Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.</p>
-<p>Given a typical mapping app, you might type in "ateneo" and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google's <a href="https://developers.google.com/maps/documentation/javascript/geocoding">geocoding API</a>, you probably won't get any result for this. What you want to use is the <a href="https://developers.google.com/maps/documentation/javascript/places">Places API</a> which provides an autocomplete search box. Using it, when you type in "ateneo", it automatically suggests in the dropdown, "Ateneo de Manila University".</p>
-<p>A downside to using the Places API is that it's against the terms of service to use it with something that isn't Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap's data will probably be a better long term solution.</p>
-<p>For now, since the competition's deadline is just a few days away, I'll be using Google Maps.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-09-25T12:26:59+08:00" title="2013-09-25 12:26">2013-09-25 12:26</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/geocoding-services.html#disqus_thread" data-disqus-identifier="cache/posts/geocoding-services.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/jeep-and-bus-schedules.html" class="u-url">Jeep and Bus Schedules</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>Wouldn't it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist's paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn't worry. I can assure you, it's still a death sentence.</p>
-<p>The GTFS spec defines 2 ways of statically specifying trip schedules. You can define the exact times that a service will arrive at a stop. You can also specify between what times the service is active and how often a new bus or jeep leaves the first stop. You also define which days those rules apply. You could say every MWF, the bus operates from 9:00AM to 9:00PM and every TTH, the bus services from 3:00AM to 11:00PM.</p>
-<p>This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there's another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.</p>
-<p>Like much everything else about the Philippine transit system, there aren't really any "schedules" to speak of. It's generally whenever the buses or jeeps feel like it. So we have no static schedules. We don't have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.</p>
-<p>Ideally, we shouldn't bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn't work without it. So we have to add a reasonable trip schedule for jeeps and buses.</p>
-<p>The current GTFS data does define these trip schedules. We assume that jeeps and buses operate between 6:00AM and 11:00PM and a new jeep passes by every 10 minutes. Also, jeeps and buses are defined to only operate on weekdays.</p>
-<p>While there might be jeeps who change routes or don't operate on weekends, I'm pretty sure that jeeps and buses run on weekends. We'll have to fix it ourselves temporarily since there's no central GTFS feed yet.</p>
-<pre class="code literal-block"><span class="c"># 724594 seems to be the service id used by jeeps and buses</span>
-sed -i .bak <span class="s1">'/^724594/ s/0,0/1,1/'</span> calendar.txt
-</pre>
-
-
-<p>Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you're sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.</p>
-<p>If we set the frequency to one minute, it <em>might</em> give better routes by eliminating the timing issue. Or not, it's kind of hard to tell.</p>
-<pre class="code literal-block"><span class="c"># jeep and bus route ids tend to start with 72</span>
-sed -i .bak <span class="s1">'/^72/ s/,600/,60/'</span> frequencies.txt
-</pre>
-
-
-<p>Overall, the problems we're having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don't need to do hackish things for it to fit the GTFS, but that's still a dream. For now, all we can really do is fit a triangle into a square hole.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-07-28T16:26:31+08:00" title="2013-07-28 16:26">2013-07-28 16:26</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/jeep-and-bus-schedules.html#disqus_thread" data-disqus-identifier="cache/posts/jeep-and-bus-schedules.html">Comments</a>
-
-</small>
-    </article>
-</div>
-
-        <nav class="postindexpager"><ul class="pager clearfix">
-<li class="previous">
-                <a href="index.html" rel="prev">← Newer posts</a>
-            </li>
-            <li class="next">
-                <a href="index-2.html" rel="next">Older posts →</a>
-            </li>
-        </ul></nav><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
-</body>
-</html>

+ 310 - 263
output/index.html

@@ -1,321 +1,368 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Pleasant Programmer | Pleasant Programmer</title>
-<link href="assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/index.html">
-<link rel="next" href="index-3.html" type="text/html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="assets/js/html5.js"></script><![endif]-->
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="archive.html">Archives</a></li>
-                <li><a href="categories/index.html">Tags</a></li>
-                <li><a href="rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><div class="postindex">
-    <article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/cloudflare-shenanigans.html" class="u-url">Cloudflare Shenanigans</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.</p>
-<p>Now the problem is that Cloudflare can put you behind <a href="https://www.cloudflare.com/ips/">any IP they own</a>, which is a huge range. There's no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<div class="postindex">
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/cloudflare-shenanigans.html" class="u-url">Cloudflare Shenanigans</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.</p>
+
+<p>Now the problem is that Cloudflare can put you behind <a href="https://www.cloudflare.com/ips/">any IP they own</a>, which is a huge range. There&rsquo;s no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.</p>
+
 <p>We never actually empirically tested whether other sites hosted on Cloudflare were also actually zero-rated. But I like to think that we saved a lot of people on their data costs from browsing Reddit and 4chan. But alas, good things must come to an end.</p>
-<p>A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn't want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn't really afford that, so we looked for other options.</p>
-<p>Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn't have its own certificate.</p>
+
+<p>A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn&rsquo;t want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn&rsquo;t really afford that, so we looked for other options.</p>
+
+<p>Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn&rsquo;t have its own certificate.</p>
+
 <p>After more testing, we figured out that you could actually use any Cloudflare backed domain so long as we properly set the Host header. We just needed to find one still in the old range. Coincidentally, 4chan.org was. Which led to this wonderful commit</p>
-<pre class="code literal-block">commit 123456789abcdef
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">commit 123456789abcdef
 Author: ~~~~~~
 Date:   ~~~~~~
 
     4chan hack
 
-<span class="gh">diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java</span>
-<span class="gd">--- a/src/com/client/common/Util.java</span>
-<span class="gi">+++ b/src/com/client/common/Util.java</span>
-<span class="gu">@@ -210,7 +210,8 @@ public class Util {</span>
+<span style="color: #000080; font-weight: bold">diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java</span>
+<span style="color: #A00000">--- a/src/com/client/common/Util.java</span>
+<span style="color: #00A000">+++ b/src/com/client/common/Util.java</span>
+<span style="color: #800080; font-weight: bold">@@ -210,7 +210,8 @@ public class Util {</span>
         }
 
         public static String getServerAddress(Context context) {
-<span class="gd">-               String address = "https://backend.client.com";</span>
-<span class="gi">+               // String address = "https://backend.client.com";</span>
-<span class="gi">+               String address = "https://4chan.org";</span>
+<span style="color: #A00000">-               String address = &quot;https://backend.client.com&quot;;</span>
+<span style="color: #00A000">+               // String address = &quot;https://backend.client.com&quot;;</span>
+<span style="color: #00A000">+               String address = &quot;https://4chan.org&quot;;</span>
                 if(!isDebug(context)) return address;
                 try {
-<span class="gh">diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java</span>
-<span class="gd">--- a/src/com/client/common/logging/APIClient.java</span>
-<span class="gi">+++ b/src/com/client/common/logging/APIClient.java</span>
-<span class="gu">@@ -101,6 +101,7 @@ public class APIClient {</span>
+<span style="color: #000080; font-weight: bold">diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java</span>
+<span style="color: #A00000">--- a/src/com/client/common/logging/APIClient.java</span>
+<span style="color: #00A000">+++ b/src/com/client/common/logging/APIClient.java</span>
+<span style="color: #800080; font-weight: bold">@@ -101,6 +101,7 @@ public class APIClient {</span>
         private HttpResponse postInternal(String url, List&lt;NameValuePair&gt; data, boolean forRegistration) throws ClientProtocolException, IOException {
-                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+"/api/"+url);
-                request.setHeader("X-API-VERSION", apiVersion);
-<span class="gi">+               request.setHeader("Host", "backend.client.com");</span>
+                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+&quot;/api/&quot;+url);
+                request.setHeader(&quot;X-API-VERSION&quot;, apiVersion);
+<span style="color: #00A000">+               request.setHeader(&quot;Host&quot;, &quot;backend.client.com&quot;);</span>
 
                 if(data == null) {
                         data = new ArrayList&lt;NameValuePair&gt;();
-</pre>
+</pre></div>
 
+<p>Eventually, we did decide to just abandon Cloudflare for the server. We probably weren&rsquo;t going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.</p>
 
-<p>Eventually, we did decide to just abandon Cloudflare for the server. We probably weren't going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.</p>
-<p>I just still find it funny we were making people's phones go to 4chan.org everyday for more than a year.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2015-12-25T14:13:26+08:00" title="2015-12-25 14:13">2015-12-25 14:13</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/cloudflare-shenanigans.html#disqus_thread" data-disqus-identifier="cache/posts/cloudflare-shenanigans.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" class="u-url">TiddlyWiki in the Sky (or TiddlyWeb for TW5)</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>I've always liked <a href="http://tiddlywiki.com">TiddlyWiki</a>. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new HTML file with all your posts inside. I've used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.</p>
-<p>Now, there's TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.</p>
-<p>If you're just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There's plenty of documentation on the site. But if you're looking for more advanced features (like storing your posts in git or a database), then you'll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.</p>
-<p>To support TiddlyWiki5, we'll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.</p>
-<h3>Setting Up TiddlyWiki</h3>
-<p>TiddlyWiki5 provides a command line tool via <code>npm</code> that allows building custom versions of the wiki. In fact, it comes with templates, called "editions", that we can use for our setup. Assuming you already have it installed, create the wiki using</p>
-<pre class="code literal-block">tiddlywiki mywiki --init tw5tank          # create wiki from template
-</pre>
-
-
-<p>This creates a wiki intended for use with <a href="https://tank.peermore.com/">Tank</a>, which is built on top of TiddlyWeb. From here, you should look in <code>mywiki/tiddlers/system</code> which contain the entries for <code>SiteTitle</code>, <code>SiteSubtitle</code>, <code>DefaultTiddlers</code>, and <code>tiddlyweb-host</code>. The first 3 should be configured however you want. These are necessary because they're needed before the wiki can load them from the server. <code>tiddlyweb-host</code> contains the location of the TiddlyWeb server, this should be <code>http://localhost:8080/</code> if you're just testing locally. With everything configured, you can build the new wiki by running</p>
-<pre class="code literal-block">tiddlywiki mywiki --build
-</pre>
+<p>I just still find it funny we were making people&rsquo;s phones go to 4chan.org everyday for more than a year.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2015-12-25">2015-12-25</time></small>
+		| <small class="commentline"><a href="/posts/cloudflare-shenanigans.html#disqus_thread" data-disqus-identifier="cache/posts/cloudflare-shenanigans.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" class="u-url">TiddlyWiki in the Sky (or TiddlyWeb for TW5)</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			
 
+<p>I&rsquo;ve always liked <a href="http://tiddlywiki.com">TiddlyWiki</a>. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn&rsquo;t need a backend, it would just save itself as an all new HTML file with all your posts inside. I&rsquo;ve used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.</p>
+
+<p>Now, there&rsquo;s TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.</p>
+
+<p>If you&rsquo;re just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There&rsquo;s plenty of documentation on the site. But if you&rsquo;re looking for more advanced features (like storing your posts in git or a database), then you&rsquo;ll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.</p>
+
+<p>To support TiddlyWiki5, we&rsquo;ll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.</p>
+
+<h2 id="setting-up-tiddlywiki:1f502be524b8b2be2ec53e61b7c9a5cf">Setting Up TiddlyWiki</h2>
+
+<p>TiddlyWiki5 provides a command line tool via <code>npm</code> that allows building custom versions of the wiki. In fact, it comes with templates, called &ldquo;editions&rdquo;, that we can use for our setup. Assuming you already have it installed, create the wiki using</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">tiddlywiki mywiki --init tw5tank          <span style="color: #408080; font-style: italic"># create wiki from template</span>
+</pre></div>
+
+<p>This creates a wiki intended for use with <a href="https://tank.peermore.com/">Tank</a>, which is built on top of TiddlyWeb. From here, you should look in <code>mywiki/tiddlers/system</code> which contain the entries for <code>SiteTitle</code>, <code>SiteSubtitle</code>, <code>DefaultTiddlers</code>, and <code>tiddlyweb-host</code>. The first 3 should be configured however you want. These are necessary because they&rsquo;re needed before the wiki can load them from the server. <code>tiddlyweb-host</code> contains the location of the TiddlyWeb server, this should be <code>http://localhost:8080/</code> if you&rsquo;re just testing locally. With everything configured, you can build the new wiki by running</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">tiddlywiki mywiki --build
+</pre></div>
 
 <p>This will output the wiki to <code>mywiki/output/tw5tank.html</code>. You can now serve it using your favorite local webserver, like <code>python -m http.server</code>.</p>
-<h3>Setting Up TiddlyWeb</h3>
-<p>The TiddlyWeb tutorial recommends using <code>tiddlywebwiki</code> which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren't really needed, so we won't go with that. So first, we'll need to install TiddlyWeb and any plugins we might want to use.</p>
-<pre class="code literal-block">pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
-</pre>
 
+<h2 id="setting-up-tiddlyweb:1f502be524b8b2be2ec53e61b7c9a5cf">Setting Up TiddlyWeb</h2>
 
-<p>Next, we'll need the tiddlyweb configuration in <code>tiddlywebconfig.py</code></p>
-<pre class="code literal-block"><span class="c"># A basic configuration.</span>
-<span class="c"># `pydoc tiddlyweb.config` for details on configuration items.</span>
+<p>The TiddlyWeb tutorial recommends using <code>tiddlywebwiki</code> which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren&rsquo;t really needed, so we won&rsquo;t go with that. So first, we&rsquo;ll need to install TiddlyWeb and any plugins we might want to use.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
+</pre></div>
 
-<span class="kn">import</span> <span class="nn">tiddlywebplugins.status</span>
+<p>Next, we&rsquo;ll need the tiddlyweb configuration in <code>tiddlywebconfig.py</code></p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic"># A basic configuration.</span>
+<span style="color: #408080; font-style: italic"># `pydoc tiddlyweb.config` for details on configuration items.</span>
 
-<span class="n">config</span> <span class="o">=</span> <span class="p">{</span>
-    <span class="s">'system_plugins'</span><span class="p">:</span> <span class="p">[</span><span class="s">'tiddlywebplugins.status'</span><span class="p">,</span> <span class="s">'tiddlywebplugins.cors'</span><span class="p">],</span>
-    <span class="s">'secret'</span><span class="p">:</span> <span class="s">'36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0'</span><span class="p">,</span>
-    <span class="s">'wsgi_server'</span><span class="p">:</span> <span class="s">'tiddlywebplugins.cherrypy'</span><span class="p">,</span>
-    <span class="s">'cors.enable_non_simple'</span><span class="p">:</span> <span class="bp">True</span>
-<span class="p">}</span>
+<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">tiddlywebplugins.status</span>
 
-<span class="n">original_gather_data</span> <span class="o">=</span> <span class="n">tiddlywebplugins</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="n">_gather_data</span>
+config <span style="color: #666666">=</span> {
+    <span style="color: #BA2121">&#39;system_plugins&#39;</span>: [<span style="color: #BA2121">&#39;tiddlywebplugins.status&#39;</span>, <span style="color: #BA2121">&#39;tiddlywebplugins.cors&#39;</span>],
+    <span style="color: #BA2121">&#39;secret&#39;</span>: <span style="color: #BA2121">&#39;36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0&#39;</span>,
+    <span style="color: #BA2121">&#39;wsgi_server&#39;</span>: <span style="color: #BA2121">&#39;tiddlywebplugins.cherrypy&#39;</span>,
+    <span style="color: #BA2121">&#39;cors.enable_non_simple&#39;</span>: <span style="color: #008000">True</span>
+}
 
-<span class="k">def</span> <span class="nf">_status_gather_data</span><span class="p">(</span><span class="n">environ</span><span class="p">):</span>
-    <span class="n">data</span> <span class="o">=</span> <span class="n">original_gather_data</span><span class="p">(</span><span class="n">environ</span><span class="p">)</span>
-    <span class="n">data</span><span class="p">[</span><span class="s">'space'</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">'recipe'</span><span class="p">:</span> <span class="s">'default'</span><span class="p">}</span>
-    <span class="k">return</span> <span class="n">data</span>
+original_gather_data <span style="color: #666666">=</span> tiddlywebplugins<span style="color: #666666">.</span>status<span style="color: #666666">.</span>_gather_data
 
-<span class="n">tiddlywebplugins</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="n">_gather_data</span> <span class="o">=</span> <span class="n">_status_gather_data</span>
-</pre>
+<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">_status_gather_data</span>(environ):
+    data <span style="color: #666666">=</span> original_gather_data(environ)
+    data[<span style="color: #BA2121">&#39;space&#39;</span>] <span style="color: #666666">=</span> {<span style="color: #BA2121">&#39;recipe&#39;</span>: <span style="color: #BA2121">&#39;default&#39;</span>}
+    <span style="color: #008000; font-weight: bold">return</span> data
 
+tiddlywebplugins<span style="color: #666666">.</span>status<span style="color: #666666">.</span>_gather_data <span style="color: #666666">=</span> _status_gather_data
+</pre></div>
 
 <p>The tweaks involved are:</p>
+
 <ul>
 <li>using the status plugin which the wiki requires</li>
-<li>monkeypatching the status plugin for the wiki to use the correct "recipe"</li>
+<li>monkeypatching the status plugin for the wiki to use the correct &ldquo;recipe&rdquo;</li>
 <li>using cherrypy server instead of the buggy default one</li>
-<li>using cors since we're not hosting the wiki itself on the same server</li>
+<li>using cors since we&rsquo;re not hosting the wiki itself on the same server</li>
 </ul>
-<p>With that, we just need to create the store that will hold our data</p>
-<pre class="code literal-block">twanager recipe default &lt;&lt;EOF
-desc: standard TiddlyWebWiki environment
-policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
 
-/bags/default/tiddlers
-EOF
+<p>With that, we just need to create the store that will hold our data</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">twanager recipe default <span style="color: #BA2121">&lt;&lt;EOF</span>
+<span style="color: #BA2121">desc: standard TiddlyWebWiki environment</span>
+<span style="color: #BA2121">policy: {&quot;read&quot;: [], &quot;create&quot;: [], &quot;manage&quot;: [&quot;R:ADMIN&quot;], &quot;accept&quot;: [], &quot;write&quot;: [&quot;R:ADMIN&quot;], &quot;owner&quot;: &quot;administrator&quot;, &quot;delete&quot;: [&quot;R:ADMIN&quot;]}</span>
 
-twanager bag default &lt;&lt;EOF
-{"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
-EOF
-</pre>
+<span style="color: #BA2121">/bags/default/tiddlers</span>
+<span style="color: #BA2121">EOF</span>
 
+twanager bag default <span style="color: #BA2121">&lt;&lt;EOF</span>
+<span style="color: #BA2121">{&quot;policy&quot;: {&quot;read&quot;: [], &quot;create&quot;: [], &quot;manage&quot;: [&quot;R:ADMIN&quot;], &quot;accept&quot;: [], &quot;write&quot;: [], &quot;owner&quot;: &quot;administrator&quot;, &quot;delete&quot;: []}}</span>
+<span style="color: #BA2121">EOF</span>
+</pre></div>
 
 <p>Finally, we can start the TiddlyWeb server</p>
-<pre class="code literal-block">twanager server
-</pre>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">twanager server
+</pre></div>
+
+<h2 id="putting-it-all-together:1f502be524b8b2be2ec53e61b7c9a5cf">Putting it all together</h2>
 
+<p>Once you have the TiddlyWeb server running, you can just go to wherever you&rsquo;re hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that&rsquo;s done it&rsquo;s saved. You can refresh your browser and your posts should still be there.</p>
+
+<p>At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won&rsquo;t need CORS anymore.</p>
 
-<h3>Putting it all together</h3>
-<p>Once you have the TiddlyWeb server running, you can just go to wherever you're hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that's done it's saved. You can refresh your browser and your posts should still be there.</p>
-<p>At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won't need CORS anymore.</p>
 <p>TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2015-12-24T14:48:20+08:00" title="2015-12-24 14:48">2015-12-24 14:48</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html#disqus_thread" data-disqus-identifier="cache/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/is-my-terminal-window-active.html" class="u-url">Is My Terminal Window Active?</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>I've been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is <a href="https://github.com/marzocchi/zsh-notify">zsh-notify</a>. It's a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.</p>
-<p>It's pretty convenient when you're compiling something and then go on to browse reddit while waiting. Usually, I spend too much time just reading and forget about the compilation entirely. With the plugin, I get the notification and maybe go back to work.</p>
-<p>One nice feature it has is that if you're currently looking at the terminal window of the job that just finished, it won't notify you. It only notifies on windows that aren't currently in focus. To do this, it has to actually talk to Terminal.app or iTerm2 to see if the window and tab are active.</p>
-<p>This is alright in OSX since those 2 are the generally most used terminal emulators. On Linux though, everyone has their own favorite terminal. Given that, I figured I could probably rely on talking to X to see if the window is active instead of each single terminal emulator. X can't tell if the tab is active though, but I don't use tabs in my current setup so it should still be good.</p>
-<h3>xdotool</h3>
-<p><a href="http://superuser.com/questions/382616/detecting-currently-active-window">Preliminary research</a> reveals that we can easily get what the active window is with xdotool. <code>xdotool getactivewindow</code> gives us the X window id of the active one. Now all we need is a way to get the window id of the terminal we're in.</p>
-<h3>First Attempt: $WINDOWID</h3>
-<p>Apparently, xterm and similar terminal emulators define an environment variable called <code>$WINDOWID</code> with the window id of the terminal. Obviously, this is too good to be true. In xterm and konsole the <code>$WINDOWID</code> was correct, but in VTE-based terminal emulators, <code>$WINDOWID</code> had the wrong value. In terminology, it didn't define <code>$WINDOWID</code> altogether. So <code>$WINDOWID</code> wasn't going to work.</p>
-<h3>Second Attempt: xdotool search $MAGIC</h3>
-<p>My second idea was that you can use zsh to change the window title to a magic number and then just check if the active window is the same one as the window with the magic number. This sort of worked for most terminals, except konsole which does whatever it wants with the window title. There's also the problem of some zsh configs automatically settings the window title to the current command.</p>
-<p>In hindsight, I could probably have just done <code>xdotool search --name xdotool</code> since in most cases, when you run the search, zsh or konsole will set the window name to the current command. Maybe that's another option I can explore some day.</p>
-<h3>Third Attempt: $PPID</h3>
-<p>My third idea was another environment variable called <code>$PPID</code>, which is the process id of the parent of the shell. As it happens, the parent is the window containing the zsh instance. This is actually pretty consistent across most terminals. The only problem was if you launched zsh from another shell since your new zsh's parent will now be another zsh instance instead of an X window.</p>
-<p>At first glance, launching zsh within zsh doesn't seem like something most people would do, but this is what happens when you run screen or tmux. To work around this, we can actually just save the original <code>$PPID</code> in a different variable and use that instead.</p>
-<p>Now that we have the PID of the window from zsh, we can once again use xdotool to get the PID of the current active window with <code>xdotool getactivewindow getwindowpid</code>. We just simply compare that with our <code>$PPID</code> and we can tell if we're in an active window or not. Overall, this approach worked surprisingly well so that's the final solution I went with.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2015-06-07T16:20:45+08:00" title="2015-06-07 16:20">2015-06-07 16:20</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/is-my-terminal-window-active.html#disqus_thread" data-disqus-identifier="cache/posts/is-my-terminal-window-active.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" class="u-url">Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>I've always thought that people were just too lazy to change their SSIDs when I see "PLDTMyDSLBizCafeJapan". It became apparent when we got our own PLDT line that it was because the bundled router/modem <em>does not</em> allow you to remove the prefix.</p>
-<p>This is not the kind of thing you expect as a business customer. Even for home customers, I feel it's still a bit dishonest. I'd be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.</p>
-<p>Of course, we couldn't just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the <a href="http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html">Prolink H5004N</a> or the <a href="http://www.symbianize.com/showthread.php?t=730091">ZyXEL P-660HN-T1A</a> but not for the one we got which was the ZyXEL P-2612HNU-F1F.</p>
-<p>We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the "PLDTMyDSLBiz". We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.</p>
-<p>The backup is actually just an XML file. You can search for SSID and change the parameter there. It's a bit annoying because the router has to restart after restoring the configuration, but it works!</p>
-<p>A minor note, the router doesn't seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.</p>
-</div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-11-27T10:12:31+08:00" title="2013-11-27 10:12">2013-11-27 10:12</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html#disqus_thread" data-disqus-identifier="cache/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html">Comments</a>
-
-</small>
-    </article><article class="h-entry post-text"><header><h1 class="p-name entry-title">
-            <a href="posts/console-keymap-switching.html" class="u-url">Console Keymap Switching</a>
-        </h1>
-    </header><div class="e-content entry-content">
-    <div>
-<p>At the office, we have some people who use DVORAK. Normally, this isn't a problem. To each his own after all. It does become a bit problematic though, when we're dealing with the servers around the office.</p>
-<p>We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it's apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.</p>
-<p>For the console, they'd typically do <code>sudo loadkeys dvorak</code> after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can't even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn't a readily available thing for the console.</p>
-<p>I googled around for solutions and came across <a href="http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux">a nice idea</a>. You could alias <code>asdf</code> to load the DVORAK mapping and <code>aoeu</code> (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don't really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2015-12-24">2015-12-24</time></small>
+		| <small class="commentline"><a href="/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html#disqus_thread" data-disqus-identifier="cache/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/is-my-terminal-window-active.html" class="u-url">Is My Terminal Window Active?</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			
+
+<p>I&rsquo;ve been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is <a href="https://github.com/marzocchi/zsh-notify">zsh-notify</a>. It&rsquo;s a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.</p>
+
+<p>It&rsquo;s pretty convenient when you&rsquo;re compiling something and then go on to browse reddit while waiting. Usually, I spend too much time just reading and forget about the compilation entirely. With the plugin, I get the notification and maybe go back to work.</p>
+
+<p>One nice feature it has is that if you&rsquo;re currently looking at the terminal window of the job that just finished, it won&rsquo;t notify you. It only notifies on windows that aren&rsquo;t currently in focus. To do this, it has to actually talk to Terminal.app or iTerm2 to see if the window and tab are active.</p>
+
+<p>This is alright in OSX since those 2 are the generally most used terminal emulators. On Linux though, everyone has their own favorite terminal. Given that, I figured I could probably rely on talking to X to see if the window is active instead of each single terminal emulator. X can&rsquo;t tell if the tab is active though, but I don&rsquo;t use tabs in my current setup so it should still be good.</p>
+
+<h2 id="xdotool:bfade06d39f7975f041a61de11ad4d4f">xdotool</h2>
+
+<p><a href="http://superuser.com/questions/382616/detecting-currently-active-window">Preliminary research</a> reveals that we can easily get what the active window is with xdotool. <code>xdotool getactivewindow</code> gives us the X window id of the active one. Now all we need is a way to get the window id of the terminal we&rsquo;re in.</p>
+
+<h2 id="first-attempt-windowid:bfade06d39f7975f041a61de11ad4d4f">First Attempt: $WINDOWID</h2>
+
+<p>Apparently, xterm and similar terminal emulators define an environment variable called <code>$WINDOWID</code> with the window id of the terminal. Obviously, this is too good to be true. In xterm and konsole the <code>$WINDOWID</code> was correct, but in VTE-based terminal emulators, <code>$WINDOWID</code> had the wrong value. In terminology, it didn&rsquo;t define <code>$WINDOWID</code> altogether. So <code>$WINDOWID</code> wasn&rsquo;t going to work.</p>
+
+<h2 id="second-attempt-xdotool-search-magic:bfade06d39f7975f041a61de11ad4d4f">Second Attempt: xdotool search $MAGIC</h2>
+
+<p>My second idea was that you can use zsh to change the window title to a magic number and then just check if the active window is the same one as the window with the magic number. This sort of worked for most terminals, except konsole which does whatever it wants with the window title. There&rsquo;s also the problem of some zsh configs automatically settings the window title to the current command.</p>
+
+<p>In hindsight, I could probably have just done <code>xdotool search --name xdotool</code> since in most cases, when you run the search, zsh or konsole will set the window name to the current command. Maybe that&rsquo;s another option I can explore some day.</p>
+
+<h2 id="third-attempt-ppid:bfade06d39f7975f041a61de11ad4d4f">Third Attempt: $PPID</h2>
+
+<p>My third idea was another environment variable called <code>$PPID</code>, which is the process id of the parent of the shell. As it happens, the parent is the window containing the zsh instance. This is actually pretty consistent across most terminals. The only problem was if you launched zsh from another shell since your new zsh&rsquo;s parent will now be another zsh instance instead of an X window.</p>
+
+<p>At first glance, launching zsh within zsh doesn&rsquo;t seem like something most people would do, but this is what happens when you run screen or tmux. To work around this, we can actually just save the original <code>$PPID</code> in a different variable and use that instead.</p>
+
+<p>Now that we have the PID of the window from zsh, we can once again use xdotool to get the PID of the current active window with <code>xdotool getactivewindow getwindowpid</code>. We just simply compare that with our <code>$PPID</code> and we can tell if we&rsquo;re in an active window or not. Overall, this approach worked surprisingly well so that&rsquo;s the final solution I went with.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2015-06-07">2015-06-07</time></small>
+		| <small class="commentline"><a href="/posts/is-my-terminal-window-active.html#disqus_thread" data-disqus-identifier="cache/posts/is-my-terminal-window-active.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" class="u-url">Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>I&rsquo;ve always thought that people were just too lazy to change their SSIDs when I see &ldquo;PLDTMyDSLBizCafeJapan&rdquo;. It became apparent when we got our own PLDT line that it was because the bundled router/modem <em>does not</em> allow you to remove the prefix.</p>
+
+<p>This is not the kind of thing you expect as a business customer. Even for home customers, I feel it&rsquo;s still a bit dishonest. I&rsquo;d be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.</p>
+
+<p>Of course, we couldn&rsquo;t just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the <a href="http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html">Prolink H5004N</a> or the <a href="http://www.symbianize.com/showthread.php?t=730091">ZyXEL P-660HN-T1A</a> but not for the one we got which was the ZyXEL P-2612HNU-F1F.</p>
+
+<p>We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the &ldquo;PLDTMyDSLBiz&rdquo;. We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.</p>
+
+<p>The backup is actually just an XML file. You can search for SSID and change the parameter there. It&rsquo;s a bit annoying because the router has to restart after restoring the configuration, but it works!</p>
+
+<p>A minor note, the router doesn&rsquo;t seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-11-27">2013-11-27</time></small>
+		| <small class="commentline"><a href="/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html#disqus_thread" data-disqus-identifier="cache/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/console-keymap-switching.html" class="u-url">Console Keymap Switching</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>At the office, we have some people who use DVORAK. Normally, this isn&rsquo;t a problem. To each his own after all. It does become a bit problematic though, when we&rsquo;re dealing with the servers around the office.</p>
+
+<p>We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it&rsquo;s apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.</p>
+
+<p>For the console, they&rsquo;d typically do <code>sudo loadkeys dvorak</code> after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can&rsquo;t even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn&rsquo;t a readily available thing for the console.</p>
+
+<p>I googled around for solutions and came across <a href="http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux">a nice idea</a>. You could alias <code>asdf</code> to load the DVORAK mapping and <code>aoeu</code> (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don&rsquo;t really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.</p>
+
 <p>After some further searching, I found <a href="http://unix.stackexchange.com/questions/2884/toggle-between-dvorak-and-qwerty">something close to what I wanted</a>. Apparently, Alt+Up sends a KeyboardSignal keycode to the init process, which can act on that. It also works anywhere, even before being logged in. For SysVinit systems, you can just add a line to your inittab for a command to be run when Alt+Up is pressed.</p>
-<p>In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. <code>kbrequest.target</code> is normally aliased to run the rescue service though, so you have to manually create the file in <code>/etc/systemd/system/kbrequest.target</code> and fill it with a description:</p>
-<pre class="code literal-block"><span class="k">[Unit]</span>
-<span class="na">Description</span><span class="o">=</span><span class="s">kbrequest target</span>
-</pre>
 
+<p>In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. <code>kbrequest.target</code> is normally aliased to run the rescue service though, so you have to manually create the file in <code>/etc/systemd/system/kbrequest.target</code> and fill it with a description:</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">[Unit]</span>
+<span style="color: #7D9029">Description</span><span style="color: #666666">=</span><span style="color: #BA2121">kbrequest target</span>
+</pre></div>
 
 <p>We can then add a service to be run whenever the target is called. Something like <code>/etc/systemd/system/keymap-switch.service</code>:</p>
-<pre class="code literal-block"><span class="k">[Unit]</span>
-<span class="na">Description</span><span class="o">=</span><span class="s">Keymap Switch Service</span>
-
-<span class="k">[Service]</span>
-<span class="na">Type</span><span class="o">=</span><span class="s">oneshot</span>
-<span class="na">ExecStart</span><span class="o">=</span><span class="s">/usr/local/bin/keymap-switch</span>
-
-<span class="k">[Install]</span>
-<span class="na">WantedBy</span><span class="o">=</span><span class="s">kbrequest.target</span>
-</pre>
-
-
-<p>After enabling said service, we only need the actual keymap switcher, <code>/usr/local/bin/keymap-switch</code>. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we're using SystemD, we can use that instead for managing which keymap we're actually using. It stores the current settings inside <code>/etc/vconsole.conf</code>. We can also then switch keymaps by using <code>localectl set-keymap</code>.</p>
-<table class="codehilitetable"><tr>
-<td class="linenos"><div class="linenodiv"><pre> 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10</pre></div></td>
-<td class="code">
-<pre class="code literal-block"><span class="c">#!/bin/sh</span>
-<span class="nb">source</span> /etc/vconsole.conf
-
-<span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$TERM</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"dumb"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
-  <span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$KEYMAP</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"dvorak"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
-    localectl <span class="nb">set</span>-keymap us
-  <span class="k">else</span>
-    localectl <span class="nb">set</span>-keymap dvorak
-  <span class="k">fi</span>
-<span class="k">fi</span>
-</pre>
-</td>
-</tr></table>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">[Unit]</span>
+<span style="color: #7D9029">Description</span><span style="color: #666666">=</span><span style="color: #BA2121">Keymap Switch Service</span>
+
+<span style="color: #008000; font-weight: bold">[Service]</span>
+<span style="color: #7D9029">Type</span><span style="color: #666666">=</span><span style="color: #BA2121">oneshot</span>
+<span style="color: #7D9029">ExecStart</span><span style="color: #666666">=</span><span style="color: #BA2121">/usr/local/bin/keymap-switch</span>
+
+<span style="color: #008000; font-weight: bold">[Install]</span>
+<span style="color: #7D9029">WantedBy</span><span style="color: #666666">=</span><span style="color: #BA2121">kbrequest.target</span>
+</pre></div>
+
+<p>After enabling said service, we only need the actual keymap switcher, <code>/usr/local/bin/keymap-switch</code>. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we&rsquo;re using SystemD, we can use that instead for managing which keymap we&rsquo;re actually using. It stores the current settings inside <code>/etc/vconsole.conf</code>. We can also then switch keymaps by using <code>localectl set-keymap</code>.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic">#!/bin/sh</span>
+<span style="color: #008000">source</span> /etc/vconsole.conf
+
+<span style="color: #008000; font-weight: bold">if</span> <span style="color: #666666">[</span> <span style="color: #BA2121">&quot;</span><span style="color: #19177C">$TERM</span><span style="color: #BA2121">&quot;</span> <span style="color: #666666">=</span> <span style="color: #BA2121">&quot;dumb&quot;</span> <span style="color: #666666">]</span>; <span style="color: #008000; font-weight: bold">then</span>
+  <span style="color: #008000; font-weight: bold">if</span> <span style="color: #666666">[</span> <span style="color: #BA2121">&quot;</span><span style="color: #19177C">$KEYMAP</span><span style="color: #BA2121">&quot;</span> <span style="color: #666666">=</span> <span style="color: #BA2121">&quot;dvorak&quot;</span> <span style="color: #666666">]</span>; <span style="color: #008000; font-weight: bold">then</span>
+    localectl <span style="color: #008000">set</span>-keymap us
+  <span style="color: #008000; font-weight: bold">else</span>
+    localectl <span style="color: #008000">set</span>-keymap dvorak
+  <span style="color: #008000; font-weight: bold">fi</span>
+<span style="color: #008000; font-weight: bold">fi</span>
+</pre></div>
+
 <p>After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-10-29">2013-10-29</time></small>
+		| <small class="commentline"><a href="/posts/console-keymap-switching.html#disqus_thread" data-disqus-identifier="cache/posts/console-keymap-switching.html">Comments</a></small>
+	</article>
+	</article>
+	
 </div>
-    </div>
-    <small class="dateline">Posted: <time class="published dt-published" datetime="2013-10-29T20:02:06+08:00" title="2013-10-29 20:02">2013-10-29 20:02</time></small>
-        | <small class="commentline">
-        
-    <a href="posts/console-keymap-switching.html#disqus_thread" data-disqus-identifier="cache/posts/console-keymap-switching.html">Comments</a>
-
-</small>
-    </article>
+<nav class="postindexpager">
+	<ul class="pager clearfix">
+		
+		
+		<li class="next">
+			<a href="/page/2.html">Older posts &rarr;</a>
+		</li>
+		
+	</ul>
+</nav>
+
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
 
-        <nav class="postindexpager"><ul class="pager clearfix">
-<li class="next">
-                <a href="index-3.html" rel="next">Older posts →</a>
-            </li>
-        </ul></nav><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+<script id="dsq-count-scr" type="text/javascript" src="//pleasantprog.disqus.com/count.js" async></script>
+
 
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
 </body>
 </html>
+

+ 1 - 0
output/page/1.html

@@ -0,0 +1 @@
+<!DOCTYPE html><html><head><link rel="canonical" href="http://pleasantprogrammer.com/"/><meta http-equiv="content-type" content="text/html; charset=utf-8" /><meta http-equiv="refresh" content="0;url=http://pleasantprogrammer.com/" /></head></html>

+ 239 - 0
output/page/2.html

@@ -0,0 +1,239 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Pleasant Programmer</title>
+</head>
+
+<body>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<div class="postindex">
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/geocoding-services.html" class="u-url">Geocoding Services</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don&rsquo;t know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.</p>
+
+<p>The gold standard for doing geocoding right now is Google Maps. It&rsquo;s hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn&rsquo;t be <em>that</em> much you could do for the competition.</p>
+
+<p>When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called <a href="http://nominatim.openstreetmap.org">Nominatim</a>.</p>
+
+<p>Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.</p>
+
+<p>Given a typical mapping app, you might type in &ldquo;ateneo&rdquo; and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google&rsquo;s <a href="https://developers.google.com/maps/documentation/javascript/geocoding">geocoding API</a>, you probably won&rsquo;t get any result for this. What you want to use is the <a href="https://developers.google.com/maps/documentation/javascript/places">Places API</a> which provides an autocomplete search box. Using it, when you type in &ldquo;ateneo&rdquo;, it automatically suggests in the dropdown, &ldquo;Ateneo de Manila University&rdquo;.</p>
+
+<p>A downside to using the Places API is that it&rsquo;s against the terms of service to use it with something that isn&rsquo;t Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap&rsquo;s data will probably be a better long term solution.</p>
+
+<p>For now, since the competition&rsquo;s deadline is just a few days away, I&rsquo;ll be using Google Maps.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-09-25">2013-09-25</time></small>
+		| <small class="commentline"><a href="/posts/geocoding-services.html#disqus_thread" data-disqus-identifier="cache/posts/geocoding-services.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/jeep-and-bus-schedules.html" class="u-url">Jeep and Bus Schedules</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>Wouldn&rsquo;t it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist&rsquo;s paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn&rsquo;t worry. I can assure you, it&rsquo;s still a death sentence.</p>
+
+<p>The GTFS spec defines 2 ways of statically specifying trip schedules. You can define the exact times that a service will arrive at a stop. You can also specify between what times the service is active and how often a new bus or jeep leaves the first stop. You also define which days those rules apply. You could say every MWF, the bus operates from 9:00AM to 9:00PM and every TTH, the bus services from 3:00AM to 11:00PM.</p>
+
+<p>This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there&rsquo;s another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.</p>
+
+<p>Like much everything else about the Philippine transit system, there aren&rsquo;t really any &ldquo;schedules&rdquo; to speak of. It&rsquo;s generally whenever the buses or jeeps feel like it. So we have no static schedules. We don&rsquo;t have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.</p>
+
+<p>Ideally, we shouldn&rsquo;t bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn&rsquo;t work without it. So we have to add a reasonable trip schedule for jeeps and buses.</p>
+
+<p>The current GTFS data does define these trip schedules. We assume that jeeps and buses operate between 6:00AM and 11:00PM and a new jeep passes by every 10 minutes. Also, jeeps and buses are defined to only operate on weekdays.</p>
+
+<p>While there might be jeeps who change routes or don&rsquo;t operate on weekends, I&rsquo;m pretty sure that jeeps and buses run on weekends. We&rsquo;ll have to fix it ourselves temporarily since there&rsquo;s no central GTFS feed yet.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic"># 724594 seems to be the service id used by jeeps and buses</span>
+sed -i .bak <span style="color: #BA2121">&#39;/^724594/ s/0,0/1,1/&#39;</span> calendar.txt
+</pre></div>
+
+<p>Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you&rsquo;re sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.</p>
+
+<p>If we set the frequency to one minute, it <em>might</em> give better routes by eliminating the timing issue. Or not, it&rsquo;s kind of hard to tell.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic"># jeep and bus route ids tend to start with 72</span>
+sed -i .bak <span style="color: #BA2121">&#39;/^72/ s/,600/,60/&#39;</span> frequencies.txt
+</pre></div>
+
+<p>Overall, the problems we&rsquo;re having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don&rsquo;t need to do hackish things for it to fit the GTFS, but that&rsquo;s still a dream. For now, all we can really do is fit a triangle into a square hole.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-28">2013-07-28</time></small>
+		| <small class="commentline"><a href="/posts/jeep-and-bus-schedules.html#disqus_thread" data-disqus-identifier="cache/posts/jeep-and-bus-schedules.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/highways-in-otp.html" class="u-url">Highways in OTP</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP&rsquo;s suggested route for walking from UP to Ateneo:</p>
+
+<p><img src="../galleries/transit/otproundabout.png" alt="Roundabout route from UP to Ateneo" /></p>
+
+<p>This is just so hilariously wrong. It&rsquo;s much simpler to just walk along Katipunan Avenue.</p>
+
+<p>OTP couldn&rsquo;t possibly be that dumb though, so there must be something we&rsquo;re doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the &ldquo;road type&rdquo; designated to Katipunan.</p>
+
+<p>Apparently, by default OTP will consider roads of type <code>trunk</code> to be non-walkable and non-bikable. This is documented in the <a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner">OpenStreetMap wiki</a> and the <a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety">OTP wiki</a> as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">sed -i .bak s/trunk/primary/g manila.osm
+</pre></div>
+
+<p>And rebuild the graph. It doesn&rsquo;t really matter much because the OSM data isn&rsquo;t used to render the maps. It&rsquo;s just used to build the routing data. This is actually what I did for <a href="http://maps.pleasantprogrammer.com">maps.pleasantprogrammer.com</a>.</p>
+
+<p>It&rsquo;s also possible to set the default way properties in OTP. Instead of disallowing walking and biking on <code>highway=trunk</code> we could allow that. This is not much better than the <code>sed</code> solution though. It&rsquo;s better since you keep the weighting done by OTP, but you&rsquo;re still saying that all trunks are walkable which might not be the case.</p>
+
+<p>The most correct way to actually fix this is to go through each of the trunks and specifying <code>foot=yes</code> and <code>bicycle=yes</code> for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I&rsquo;m not sure on the particulars with updating OSM though.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-24">2013-07-24</time></small>
+		| <small class="commentline"><a href="/posts/highways-in-otp.html#disqus_thread" data-disqus-identifier="cache/posts/highways-in-otp.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/elevation-data-in-otp.html" class="u-url">Elevation Data in OTP</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p><img src="../galleries/transit/otpelevation.png" alt="OpenTripPlanner showing elevation data" /></p>
+
+<p>One thing I hadn&rsquo;t tested out last time was OTP&rsquo;s support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.</p>
+
+<p>The <a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes">5 minute tutorial</a> actually discusses the elevation data briefly, but a more in-depth thing you can look at is the <a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data">GraphBuilder documentation</a>. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the <a href="http://www.philgis.org/freegisdata.htm">PhilGIS website</a>.</p>
+
+<p>I don&rsquo;t know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use <a href="http://www.gdal.org/">GDAL</a> for this. You&rsquo;d just then run,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">gdal_translate srtm41_90m_phl.img phil.tiff
+</pre></div>
+
+<p>Afterwards, it&rsquo;s just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you&rsquo;re running on limited RAM.</p>
+
+<p>I&rsquo;ve actually hosted a <a href="http://maps.pleasantprogrammer.com">working example</a>. It&rsquo;s pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don&rsquo;t abuse it though.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-23">2013-07-23</time></small>
+		| <small class="commentline"><a href="/posts/elevation-data-in-otp.html#disqus_thread" data-disqus-identifier="cache/posts/elevation-data-in-otp.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/graphserver.html" class="u-url">GraphServer</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>Link: <a href="http://graphserver.github.io/graphserver/">http://graphserver.github.io/graphserver/</a></p>
+
+<p>One other routing webapp I saw was GraphServer. It&rsquo;s actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It&rsquo;s also based off python and C instead of Java, so it feels a lot less heavy.</p>
+
+<p>The instructions on the website are already pretty good. There are just some minor errors with it. Where it says <code>gs_gtfsdb_build</code>, you should actually use <code>gs_gtfsdb_compile</code>. Also, when running <code>gs_osmdb_compile</code> you might need to use <code>-t</code> for tolerant in case you follow the instructions on chopping up the original OSM data.</p>
+
+<p>A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn&rsquo;t support 64-bit ids. The <a href="http://wiki.openstreetmap.org/wiki/Osmosis">latest version of Osmosis</a> easily did the job though.</p>
+
+<p>The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn&rsquo;t provide any alternate routes aside from that one. I&rsquo;m not sure if it&rsquo;s a limitation of the provided routeserver, but I didn&rsquo;t bother checking if it supported parameters which might provide better routes.</p>
+
+<p>I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-23">2013-07-23</time></small>
+		| <small class="commentline"><a href="/posts/graphserver.html#disqus_thread" data-disqus-identifier="cache/posts/graphserver.html">Comments</a></small>
+	</article>
+	</article>
+	
+</div>
+<nav class="postindexpager">
+	<ul class="pager clearfix">
+		
+		<li class="previous">
+			<a href="/">&larr; Newer posts</a>
+		</li>
+		
+		
+		<li class="next">
+			<a href="/page/3.html">Older posts &rarr;</a>
+		</li>
+		
+	</ul>
+</nav>
+
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
+</div>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+<script id="dsq-count-scr" type="text/javascript" src="//pleasantprog.disqus.com/count.js" async></script>
+
+
+</body>
+</html>
+

+ 505 - 0
output/page/3.html

@@ -0,0 +1,505 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Pleasant Programmer</title>
+</head>
+
+<body>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<div class="postindex">
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/transit-wand.html" class="u-url">Transit Wand</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>Link: <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">http://transitwand.com</a></p>
+
+<p>Overall, this was the simplest of the <a href="http://philippine-transit.hackathome.com/use-this-code/">open-source transit tools</a> to actually get up and running. There&rsquo;s already a deployed instance of the server, and you can easily download the phone app via the <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">Play Store</a>. Even running the server by yourself didn&rsquo;t have any of the hiccups I had with GTFS Editor.</p>
+
+<p>The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.</p>
+
+<p>After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it&rsquo;s free and you don&rsquo;t even actually need to put in a username or anything. It simply registers the phone&rsquo;s IMEI on the server and gives you a 6-digit identifier.</p>
+
+<p>You can then use the 6-digit identifier to view the data on Transit Wand&rsquo;s server, which is good since uploading any data automatically deletes it from the phone. There really isn&rsquo;t much else you can do with it though. It just allows you to view the data, and export it as a <a href="https://en.wikipedia.org/wiki/Shapefile">Shapefile</a>.</p>
+
+<p>As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There&rsquo;s also no way to extract the ridership information from the server yet. This isn&rsquo;t to say that the data won&rsquo;t eventually go public though.</p>
+
+<p>An interesting thing you <em>can</em> do with the Transit Wand data is import it into GTFS Editor to make a new route. You don&rsquo;t even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you&rsquo;ve captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.</p>
+
+<p>I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don&rsquo;t understand is why the shape data isn&rsquo;t present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can&rsquo;t easily move stops, you have to input coordinates to change the position.</p>
+
+<p>It <em>might</em> also be possible that when the DOTC was still collecting the data, the route collection or editing features weren&rsquo;t present yet. That would just be lame and depressing though.</p>
+
+<p>Overall, Transit Wand does what it&rsquo;s supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-15">2013-07-15</time></small>
+		| <small class="commentline"><a href="/posts/transit-wand.html#disqus_thread" data-disqus-identifier="cache/posts/transit-wand.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/fare-data.html" class="u-url">Fare Data</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			
+
+<p>As part of the data released by the DOTC, we also have the <a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/">fare matrix</a> for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the <a href="http://ltfrb.gov.ph/main/farerates">LTFRB website</a>. Generally, the fare scheme is represented as &ldquo;pay <em>X</em> pesos for the first <em>Y</em> kilometers, pay <em>Z</em> for every succeeding kilometer.&rdquo; Instead of a table, we can simply represent this as a formula instead,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">base_fare + (distance - initial) * per_km
+</pre></div>
+
+<p>The relevant values for the three services are:</p>
+
+<table>
+<thead>
+  <tr>
+    <td>type</td>
+    <td>base_fare</td>
+    <td>initial</td>
+    <td>per_km</td>
+  </tr>
+</thead>
+<tbody>
+  <tr>
+    <td>bus aircon</td>
+    <td>12.00</td>
+    <td>5 km</td>
+    <td>2.20</td>
+  </tr>
+  <tr>
+    <td>bus ordinary</td>
+    <td>10.00</td>
+    <td>5 km</td>
+    <td>1.85</td>
+  </tr>
+  <tr>
+    <td>jeep aircon</td>
+    <td>8.00</td>
+    <td>4 km</td>
+    <td>1.40</td>
+  </tr>
+</tbody>
+</table>
+
+<p>It isn&rsquo;t as simple as that though. Fares are also rounded to the nearest 25 centavos. So we&rsquo;d need to round them off correctly. This can be achieved by doing,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">round(calculated_fare * 4.0)/4.0
+</pre></div>
+
+<p>There&rsquo;s also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.</p>
+
+<p>Doing just this, we actually do get the same results as the fare matrices in the image for the most part. There are some discrepancies with the discounted jeep fares. I&rsquo;ve tried to resolve it by tweaking around with the formulas, but it really doesn&rsquo;t make sense in any way. I presume these were manually adjusted for one reason or another.</p>
+
+<p>Here&rsquo;s a <a href="../uploads/farematrix.rb">script</a> that generates CSVs of all the three fare matrices. If you&rsquo;re too lazy to run it, here are links to the <a href="../uploads/pub_aircon.csv">aircon bus</a>, <a href="../uploads/pub_ordinary.csv">ordinary bus</a> and <a href="../uploads/puj.csv">jeep</a> fare matrices.</p>
+
+<h3 id="gtfs-compatibility:a6ffa536f572175993ee2d6ec342ac72">GTFS compatibility</h3>
+
+<p>As is, the provided GTFS data does not have any fare data. I imagine this is because the existing spec doesn&rsquo;t have good support for distance-based fares like we have in the Philippines. Judging from the <a href="https://code.google.com/p/googletransitdatafeed/wiki/FareExamples">fare examples</a>, the only reasonable way we could implement distance-based fares is following example 6. This would involve setting a fare for each possible pair of stops based on the distance between them. This isn&rsquo;t exactly ideal. In fact, the people originally working on the DOTC project have voiced <a href="https://groups.google.com/forum/#!topic/gtfs-fare-wg/V63xRSnQJGw">issues</a> and made <a href="https://groups.google.com/forum/#!msg/gtfs-changes/uybrAokZ9Cg/rqlzXdMypUgJ">proposals</a> for having distance-based fares included into GTFS.</p>
+
+<p>Apparently, public transit fares are a really complicated thing. You have fares based on distance, number of stops passed through, and transfers which may or may not cost extra. Not only that, you might have discounted fares, or first-class vs economy fares. The community will want to get it right before it&rsquo;s formally included in the spec. You can see the current state of the consolidated <a href="https://docs.google.com/document/d/1mK3--o5g4-3cCXaqmch92U63JTwChh0L2VCmcDViIlM/edit">GTFS fare proposal here</a>.</p>
+
+<p>Even in it&rsquo;s proposal form though, we might have hope of being able to see these being used. There&rsquo;s currently a <a href="https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/30">pull request</a> for supporting the distance-based fare scheme into the OneBusAway libraries. The libraries actually used by GTFS Editor and OpenTripPlanner for working with GTFS data.</p>
+
+<h3 id="remaining-problems:a6ffa536f572175993ee2d6ec342ac72">Remaining Problems</h3>
+
+<p>Given all that, it would probably still be a long way before this allows us to make a really good routing app. We still don&rsquo;t have shape data, so the distance estimates would really be rough estimates at best. There&rsquo;s no support for rounding to the nearest centavo. I realize that&rsquo;s just nitpicking, but if we want something truly polished, even that has to be taken care of.</p>
+
+<p>We also don&rsquo;t know if the jeeps or buses strictly follow the distance-based scheme. After all, if you can get on and off anywhere, you can&rsquo;t really measure distance that exactly. I assume they generally work off the notion of &ldquo;zones&rdquo; than actual distance travelled. In that sense, they work more similarly to the LRT which has fares based on how many stops you pass. For jeeps and buses, your fare is probably based more on how many &ldquo;zones&rdquo; you pass through.</p>
+
+<h3 id="conclusion:a6ffa536f572175993ee2d6ec342ac72">Conclusion</h3>
+
+<p>Philip, a co-worker of mine at By Implication, had suggested that we might want to use a different model than what the GTFS proposes. I have to agree with him. At this point, the GTFS doesn&rsquo;t really fit with our system. But I do think that open data and standards are great. In fact, I applaud the developers who made proposals for the fare system, as those are great first steps towards making the GTFS a more universal standard.</p>
+
+<p>Side note: I&rsquo;d also actually really like to hear about the DOTC developers&rsquo; experience with the project. It would be nice if they had a devblog.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-13">2013-07-13</time></small>
+		| <small class="commentline"><a href="/posts/fare-data.html#disqus_thread" data-disqus-identifier="cache/posts/fare-data.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/gtfs-editor.html" class="u-url">GTFS Editor</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			
+
+<p>Link: <a href="https://github.com/conveyal/gtfs-editor">https://github.com/conveyal/gtfs-editor</a></p>
+
+<p><strong>TL;DR</strong> they really meant under development</p>
+
+<p>When I first saw the source of GTFS Editor, I was ecstatic. They used <a href="http://playframework.com/">Play framework</a>!!! Not only that, they&rsquo;re targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.</p>
+
+<p>Getting it to actually run though, wasn&rsquo;t very pleasant. The initial setup was easy enough. Get <a href="http://www.playframework.com/download">Play 1.2.5</a>, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that&rsquo;s necessary. Wonderful. Then, run play, open a browser, go to <a href="http://localhost:9000">http://localhost:9000</a>, compilation error. Fantastic.</p>
+
+<p>If you don&rsquo;t want to go through the technical details, you can just jump to the <a href="#conclusion">conclusion</a>.</p>
+
+<h2 id="let-s-debug:9dc7854b573f1a2be2b19d1bfe826d39">Let&rsquo;s Debug!</h2>
+
+<p>I&rsquo;ll be splitting the next section up into 2 parts. In the first pass, I&rsquo;ll talk about what I did to just get the app to run but I won&rsquo;t try hard to fix any bugs. This generally is what I do when I try to get apps to run. I&rsquo;ll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I&rsquo;ll explain what the problems were and how I fixed them.</p>
+
+<h3 id="first-pass:9dc7854b573f1a2be2b19d1bfe826d39">First Pass</h3>
+
+<p>A thing to note about Play (and one of the reasons it&rsquo;s a lovely Java framework) is that you don&rsquo;t need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that&rsquo;s what I saw, <code>Error: type Check already defined</code></p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #AA22FF">@Retention</span><span style="color: #666666">(</span>RetentionPolicy<span style="color: #666666">.</span><span style="color: #7D9029">RUNTIME</span><span style="color: #666666">)</span>
+<span style="color: #AA22FF">@Target</span><span style="color: #666666">({</span>ElementType<span style="color: #666666">.</span><span style="color: #7D9029">METHOD</span><span style="color: #666666">,</span> ElementType<span style="color: #666666">.</span><span style="color: #7D9029">TYPE</span><span style="color: #666666">})</span>
+<span style="color: #008000; font-weight: bold">public</span> <span style="color: #AA22FF">@interface</span> Check <span style="color: #666666">{</span> <span style="color: #408080; font-style: italic">// error here</span>
+
+    String<span style="color: #666666">[]</span> <span style="color: #0000FF">value</span><span style="color: #666666">();</span>
+<span style="color: #666666">}</span>
+</pre></div>
+
+<p>You also know that typical behavior among programmers where your program doesn&rsquo;t compile, but you keep trying to compile it anyway hoping that it will magically just work. That&rsquo;s what I did, and it actually ran. I couldn&rsquo;t really just let this pass, so I decided to try deleting <code>Check.java</code>. I got another compilation error, <code>Error: type Secure already defined</code></p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">public</span> <span style="color: #008000; font-weight: bold">class</span> <span style="color: #0000FF; font-weight: bold">Secure</span> <span style="color: #008000; font-weight: bold">extends</span> Controller <span style="color: #666666">{</span> <span style="color: #408080; font-style: italic">// error here</span>
+
+    <span style="color: #AA22FF">@Before</span><span style="color: #666666">(</span>unless<span style="color: #666666">={</span><span style="color: #BA2121">&quot;login&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;authenticate&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;logout&quot;</span><span style="color: #666666">})</span>
+
+    <span style="color: #008000; font-weight: bold">static</span> <span style="color: #B00040">void</span> <span style="color: #0000FF">checkAccess</span><span style="color: #666666">()</span> <span style="color: #008000; font-weight: bold">throws</span> Throwable <span style="color: #666666">{</span>
+</pre></div>
+
+<p>At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put <code>Check.java</code> back in and proceeded to just refresh until it compiled and ran.</p>
+
+<p>The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the <code>account</code> table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn&rsquo;t work.</p>
+
+<p>Another note regarding Play 1.x, it provides the <a href="http://www.playframework.com/documentation/1.2.5/secure">secure module</a> which handles logins and keeping state, you simply need to implement the method <code>boolean authenticate(String username, String password)</code>. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return <code>true</code> and then any login would work. No need to actually set the password. Excellent.</p>
+
+<p>And we&rsquo;re logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, <code>IndexOutOfBoundsException occured : Index: 0, Size: 0</code></p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">if</span><span style="color: #666666">(</span>session<span style="color: #666666">.</span><span style="color: #7D9029">get</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;agencyId&quot;</span><span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #008000; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
+
+    Agency agency <span style="color: #666666">=</span> agencies<span style="color: #666666">.</span><span style="color: #7D9029">get</span><span style="color: #666666">(0);</span> <span style="color: #408080; font-style: italic">// error here</span>
+
+    session<span style="color: #666666">.</span><span style="color: #7D9029">put</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;agencyId&quot;</span><span style="color: #666666">,</span> agency<span style="color: #666666">.</span><span style="color: #7D9029">id</span><span style="color: #666666">);</span>
+    session<span style="color: #666666">.</span><span style="color: #7D9029">put</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;agencyName&quot;</span><span style="color: #666666">,</span> agency<span style="color: #666666">.</span><span style="color: #7D9029">name</span><span style="color: #666666">);</span>
+</pre></div>
+
+<p>Apparently, we need to have an agency. That&rsquo;s generally simple enough. You just manually insert an agency into the <code>agency</code> table. After that&rsquo;s done, we finally have a view of the actual application. It&rsquo;s very Bootstrap-y, but that&rsquo;s just fine. The workflow though, is not perfectly intuitive, but I&rsquo;ll talk about that some other day.</p>
+
+<p>That&rsquo;s not the end of it though, we still have to fix these bugs. The developer obviously didn&rsquo;t have to put up with this when they were working, so what happened? Also, the log is showing some weird things,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">~        _            _
+~  _ __ | | __ _ _  _| |
+~ | &#39;_ \| |/ _&#39; | || |_|
+~ |  __/|_|\____|\__ (_)
+~ |_|            |__/
+~
+~ play! 1.2.5, http://www.playframework.org
+~
+~ Ctrl+C to stop
+~
+CompilerOracle: exclude jregex/Pretokenizer.next
+Listening for transport dt_socket at address: 8000
+23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
+23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
+23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
+23:32:15,830 WARN  ~ You&#39;re running Play! in DEV mode
+23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
+23:32:28,792 ERROR ~
+
+@6f02fa9dd
+Internal Server Error (500) for request GET /
+
+Compilation error (In /app/controllers/Check.java around line 10)
+The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
+
+play.exceptions.CompilationException: The type Check is already defined
+	at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
+	at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
+	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
+	at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
+	at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
+	at play.Play.start(Play.java:516)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at Invocation.HTTP Request(Play!)
+23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
+SLF4J: Class path contains multiple SLF4J bindings.
+SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
+23:32:32,490 INFO  ~ Initializing HBSpatialExtension
+23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
+23:32:32,494 INFO  ~ Checking for default configuration file.
+23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
+23:32:34,077 INFO  ~ Application &#39;gtfs-editor&#39; is now started !
+23:32:34,151 INFO  ~ Bootstrapping Database...
+23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
+play.exceptions.UnexpectedException: Unexpected Error
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
+	at play.templates.TemplateLoader.load(TemplateLoader.java:78)
+	at play.test.Fixtures.loadModels(Fixtures.java:174)
+	at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
+	at play.jobs.Job.doJobWithResult(Job.java:50)
+	at play.jobs.Job.call(Job.java:146)
+	at play.jobs.Job.run(Job.java:132)
+	at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
+	at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
+	at play.Play.start(Play.java:547)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
+	at play.Invoker$Invocation.run(Invoker.java:276)
+	at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
+	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
+	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
+	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
+	at java.lang.Thread.run(Thread.java:680)
+Caused by: play.exceptions.UnexpectedException: Unexpected Error
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
+	... 22 more
+Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
+	at java.io.FileInputStream.open(Native Method)
+	at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120)
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
+	... 23 more
+23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
+23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
+23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
+23:32:40,999 DEBUG ~ select nextval (&#39;hibernate_sequence&#39;)
+23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
+23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
+23:32:41,175 ERROR ~
+
+@6f02fa9dg
+Internal Server Error (500) for request GET /
+
+Execution exception (In /app/controllers/Application.java around line 57)
+IndexOutOfBoundsException occured : Index: 0, Size: 0
+
+play.exceptions.JavaExecutionException: Index: 0, Size: 0
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
+	at Invocation.HTTP Request(Play!)
+Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
+	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
+	at java.util.ArrayList.get(ArrayList.java:322)
+	at controllers.Application.initSession(Application.java:57)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
+	at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
+	... 1 more
+</pre></div>
+
+<p>After <code>23:32:34</code> is when I get the login page. <code>23:32:40</code> is after I&rsquo;ve logged in.</p>
+
+<h3 id="second-pass:9dc7854b573f1a2be2b19d1bfe826d39">Second Pass</h3>
+
+<p>So how did you do? First, the error that <code>type Check already defined</code> usually does mean that <code>Check</code> was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It&rsquo;s the only one there that was <code>Check.java</code>. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, <code>Check.java</code>. Doing a diff shows nothing was changed. So the solution really was just simply delete <code>Check.java</code> and also <code>Secure.java</code>. No more compilation errors!</p>
+
+<p>The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">if</span><span style="color: #666666">(</span>Security<span style="color: #666666">.</span><span style="color: #7D9029">isConnected</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
+    <span style="color: #666666">...</span>
+    Account account <span style="color: #666666">=</span> Account<span style="color: #666666">.</span><span style="color: #7D9029">find</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;username = ?&quot;</span><span style="color: #666666">,</span> Security<span style="color: #666666">.</span><span style="color: #7D9029">connected</span><span style="color: #666666">()).</span><span style="color: #7D9029">first</span><span style="color: #666666">();</span>
+    <span style="color: #666666">...</span>
+    <span style="color: #008000; font-weight: bold">if</span><span style="color: #666666">(</span>account <span style="color: #666666">==</span> <span style="color: #008000; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> Account<span style="color: #666666">.</span><span style="color: #7D9029">count</span><span style="color: #666666">()</span> <span style="color: #666666">==</span> <span style="color: #666666">0)</span> <span style="color: #666666">{</span>
+        account <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">new</span> Account<span style="color: #666666">(</span><span style="color: #BA2121">&quot;admin&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;admin&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;admin@test.com&quot;</span><span style="color: #666666">,</span> <span style="color: #008000; font-weight: bold">true</span><span style="color: #666666">,</span> <span style="color: #008000; font-weight: bold">null</span><span style="color: #666666">);</span>
+        account<span style="color: #666666">.</span><span style="color: #7D9029">save</span><span style="color: #666666">();</span>
+    <span style="color: #666666">}</span>
+    <span style="color: #666666">...</span>
+<span style="color: #666666">}</span>
+</pre></div>
+
+<p>You can actually see this in action at <code>23:32:41,051</code> in the log. So what&rsquo;s wrong with all of this? The account creation happened after I&rsquo;ve already logged in. In fact, <code>Security.isConnected()</code> checks whether the user is already logged in or not. How does this even make sense?</p>
+
+<p>Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we&rsquo;re missing a file called <code>initial-agencies-data.yml</code>. Ok, apparently it&rsquo;s a <a href="http://www.playframework.com/documentation/1.2.5/test#fixtures">fixture</a> like you would use for testing. It&rsquo;s easy enough to infer what the file&rsquo;s contents should be. We just copy it over from the GTFS data.</p>
+
+<p>But then where do you put the file? If you look at the log, it says <code>/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml</code> but that doesn&rsquo;t look right. That&rsquo;s in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the <code>test/</code> directory? No, that doesn&rsquo;t work either since we&rsquo;re not running a test.</p>
+
+<p>What I ended up doing was just looking at the sources for <code>Fixtures.load</code>. If you follow the stack trace, you end up finding <code>Play.javaPath</code> which sort of works like PATH for Fixtures and some other things. So where can we put the file? <code>app/</code> and <code>conf/</code>. And with that, we&rsquo;re done.</p>
+
+<h3 id="conclusion">Conclusion</h3>
+
+<p>GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone <a href="https://github.com/thatsmydoing/gtfs-editor">my branch</a> as I&rsquo;ve fixed the issues discussed earlier. The default login is <code>admin:admin</code>.</p>
+
+<p>Even after getting it to run, it&rsquo;s still not quite usable. Not in the UX sense, but you really can&rsquo;t do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don&rsquo;t have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-10">2013-07-10</time></small>
+		| <small class="commentline"><a href="/posts/gtfs-editor.html#disqus_thread" data-disqus-identifier="cache/posts/gtfs-editor.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/one-bus-or-maybe-jeep-away.html" class="u-url">One Bus (or maybe Jeep) Away</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>Link: <a href="http://onebusaway.org/">http://onebusaway.org/</a></p>
+
+<p><strong>TL;DR</strong> no routing; useless in Philippines</p>
+
+<p>OneBusAway is a transit information app. It provides data on what bus stops are near you, which buses pass by. You can also get schedules and the route of a particular bus given the number. It can also provide realtime updates like how many minutes until the next bus arrives. It does not, however, provide routing. There is no support for providing directions to get from point A to point B.</p>
+
+<p>It&rsquo;s comparable to what you get in some bus stops abroad. You&rsquo;d get a vicinity map and a list of buses passing through the stop. You might also get the times when the next buses will pass. It&rsquo;s useful for locals who already know how to get around, and want to avoid waiting for the bus. But it&rsquo;s not particularly good for people who want to know how to get around the city.</p>
+
+<p>OneBusAway is quite comprehensive in its platform support though. There is a webapp, apps for iOS, Android and Windows Phone, as well as SMS and Voice support. This would all be nice but we don&rsquo;t have the necessary infrastructure yet in the Philippines. We don&rsquo;t have bus or jeepney stops. We also wouldn&rsquo;t have realtime data to make the app particularly useful.</p>
+
+<p>You can try it out for yourself by following their <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/OneBusAway-Quickstart-Guide">Quickstart Guide</a>. One caveat is you will have to add <code>-P tripEntriesFactory.throwExceptionOnInvalidStopToShapeMappingException=false</code> when building the bundle. This has to do with the OneBusAway having difficulty matching the <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching">stops to the shape data</a>.</p>
+
+<p>Here&rsquo;s some screenshots of the app with the Philippine data. Notice how you only see the stops but there isn&rsquo;t a line for the route. This is a problem with our GTFS data. Also, at some points it&rsquo;s hard to tell where the jeep is going to pass since there isn&rsquo;t any indication of order either. This is more of a OneBusAway problem. It usually expects there to be shape data available.</p>
+
+<p><a href="../galleries/transit/onebusaway1.png"><img src="../galleries/transit/onebusaway1.png" alt="OneBusAway" title="All the stops along Katipunan Avenue are named Katipunan Avenue." /></a></p>
+
+<p>It doesn&rsquo;t really handle too many routes passing through a stop. The list just overflows past the bubble. You can still actually read it by panning the map. It&rsquo;s just a bit weird though.</p>
+
+<p>If you also noticed, there are usually 2 of each route. This is how the jeepney data was modeled as jeep routes might be different going one way and going back. This isn&rsquo;t the case for all jeeps though, so it might also be an implementation issue with the GTFS editor.</p>
+
+<p><a href="../galleries/transit/onebusaway2.png"><img src="../galleries/transit/onebusaway2.png" alt="OneBusAway" /></a></p>
+
+<p><a href="../galleries/transit/onebusaway3.png"><img src="../galleries/transit/onebusaway3.png" alt="OneBusAway" /></a></p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-09">2013-07-09</time></small>
+		| <small class="commentline"><a href="/posts/one-bus-or-maybe-jeep-away.html#disqus_thread" data-disqus-identifier="cache/posts/one-bus-or-maybe-jeep-away.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/open-trip-planner.html" class="u-url">Open Trip Planner</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			
+
+<p>Link: <a href="http://www.opentripplanner.org">http://www.opentripplanner.org</a></p>
+
+<p><strong>TL;DR</strong> routes pretty well; data might cause weird issues</p>
+
+<p>OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you&rsquo;re willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.</p>
+
+<p>It&rsquo;s actually in general use by the <a href="http://maps.trimet.org/">Trimet</a>, Portland&rsquo;s public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner&rsquo;s support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn&rsquo;t have. This actually just screams <a href="http://philippine-transit.hackathome.com/prizes/">Inclusive Technology Award</a>.</p>
+
+<h3 id="setup:8052f9d579c0ac6326f58a643a8791fb">Setup</h3>
+
+<p>Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I&rsquo;d suggest going through the <a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes">5-minute introduction</a> if you want to actually work with the Philippine data. You will also need to download the <a href="http://download.geofabrik.de/asia/philippines.html">Philippine data dump</a> from OSM. You will want the <code>osm.bz2</code> one (WARNING: 900MB unzipped).</p>
+
+<p>Once you get the webapp running, you&rsquo;ll notice the map tiles won&rsquo;t load correctly. This is because the default tileset used is from Mapbox which doesn&rsquo;t provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.</p>
+
+<h3 id="issues:8052f9d579c0ac6326f58a643a8791fb">Issues</h3>
+
+<p>The next thing you&rsquo;ll notice is that you can&rsquo;t search for a place. You can only just pick points on the map and route between those. I&rsquo;m still not exactly sure if it&rsquo;s supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn&rsquo;t be too difficult.</p>
+
+<p>Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet&rsquo;s implementation isn&rsquo;t as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.</p>
+
+<p>There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a &ldquo;stop&rdquo; in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the &ldquo;stop&rdquo; to Arguilla.</p>
+
+<p><img src="../galleries/transit/otp1.png" alt="OpenTripPlanner disconnected route" /></p>
+
+<p>I can&rsquo;t say this isn&rsquo;t a bug. After all, OpenTripPlanner couldn&rsquo;t have magically known there really was a street there. If it did, it wouldn&rsquo;t just teleport you to the corner. I&rsquo;m more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.</p>
+
+<p>Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won&rsquo;t give you the best route because it thinks you have to loop around to get to where you want to be. I don&rsquo;t really know how common this issue pops up though. It&rsquo;s highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.</p>
+
+<p><img src="../galleries/transit/otp2.png" alt="OpenTripPlanner loopy route" /></p>
+
+<p>Much like the earlier problem, I can&rsquo;t tell if this is a bug or it&rsquo;s a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren&rsquo;t even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.</p>
+
+<p><img src="../galleries/transit/upkatipunan.jpg" alt="UP Katipunan Route" /></p>
+
+<p>From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren&rsquo;t that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.</p>
+
+<h3 id="conclusion:8052f9d579c0ac6326f58a643a8791fb">Conclusion</h3>
+
+<p>Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There&rsquo;s also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-09">2013-07-09</time></small>
+		| <small class="commentline"><a href="/posts/open-trip-planner.html#disqus_thread" data-disqus-identifier="cache/posts/open-trip-planner.html">Comments</a></small>
+	</article>
+	</article>
+	
+</div>
+<nav class="postindexpager">
+	<ul class="pager clearfix">
+		
+		<li class="previous">
+			<a href="/page/2.html">&larr; Newer posts</a>
+		</li>
+		
+		
+		<li class="next">
+			<a href="/page/4.html">Older posts &rarr;</a>
+		</li>
+		
+	</ul>
+</nav>
+
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
+</div>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+<script id="dsq-count-scr" type="text/javascript" src="//pleasantprog.disqus.com/count.js" async></script>
+
+
+</body>
+</html>
+

+ 136 - 0
output/page/4.html

@@ -0,0 +1,136 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Pleasant Programmer</title>
+</head>
+
+<body>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<div class="postindex">
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/jeepney-and-bus-routes.html" class="u-url">Jeepney and Bus Routes</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>In the <a href="philippine-transit-app-challenge.html">last post</a>, I talked about how we now have data about jeepney and bus routes in the Philippines. The data is actually in the <a href="https://developers.google.com/transit/gtfs/">GTFS format</a>, which is the format the Google Maps consumes transit data. Apparently, the government will be submitting the GTFS data later this year. Transit directions for Metro Manila in Google Maps would be wonderful. That said, it definitely raises the bar for the app challenge people.</p>
+
+<p>In the last post, I mentioned the quality of the data isn&rsquo;t quite good. Even before seeing the data, I was already a bit unsure of it. The key problem is how you model the routes. The GTFS format was inherently designed for more well developed and organized transit agencies which isn&rsquo;t exactly what we have in the Philippines now.</p>
+
+<p>One potential problem is the nature of the jeeps and buses. GTFS routes are a collection of trips which are a sequence of stops. However, we don&rsquo;t have jeepney stops, and even if we did they still just stop anywhere. There are also times where jeeps will take a shortcut if no passengers need to get dropped off along their normal route.</p>
+
+<p>From what I&rsquo;ve seen of the data, they handled the first problem well enough. Stops are defined as where people typically get on the jeep or bus. This is good, but they didn&rsquo;t define a shape for the routes. There is no information as to which exact roads they pass through. All we have to go by are the stops to show the route on a map.</p>
+
+<p><img src="http://i.imgur.com/NSVlryE.jpg" alt="sample route" /></p>
+
+<p>The problem isn&rsquo;t that bad though. The agencies could still add the shapes later on. Or maybe an app challenge participant could make an app around fixing the routes via crowd-sourcing or similar. The shape itself isn&rsquo;t that important for a rudimentary directions app, but if we want better apps, we will need better data.</p>
+
+<p>There were also some minor issues with the data itself. Some of the files had extra columns. This normally isn&rsquo;t an issue, but it caused problems for <a href="https://github.com/harrisony/gtfs_SQL_importer">GTFS SQL importer</a>. There were also problems with matching the shape data with the stops when I tried it with <a href="http://onebusaway.org">OneBusAway</a>. They could probably be <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching">fixed</a> but that&rsquo;s for another day.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-07">2013-07-07</time></small>
+		| <small class="commentline"><a href="/posts/jeepney-and-bus-routes.html#disqus_thread" data-disqus-identifier="cache/posts/jeepney-and-bus-routes.html">Comments</a></small>
+	</article>
+	</article>
+	
+	<article class="h-entry post-text" itemscope itemtype="http://schema.org/Blog">
+		<header>
+			<h1 class="p-name entry-title" itemprop="headline">
+				<a href="/posts/philippine-transit-app-challenge.html" class="u-url">Philippine Transit App Challenge</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			<p>Last week, the DOTC launched the <a href="http://philippine-transit.hackathome.com">Philippine Transit App Challenge</a>. It&rsquo;s a competition to build something great using the newly available 1) jeepney/bus/rail routes and 2) traffic incident data in Metro Manila and Cebu.</p>
+
+<p>I&rsquo;m actually quite excited about this as it&rsquo;s not everyday our government does wonderful things. Many people have been waiting for this kind of data to be available. Before, the only way to figure out which jeeps to ride to get from A to B is by asking other people. The website of the LTFRB used to just have a list of jeepney routes, but nothing else, no maps or list of stops.</p>
+
+<p>During the launch, they also presented how CITOM (the Cebu MMDA) is pilot-testing a <a href="http://cebutraffic.org/">traffic tracking system</a>. What they did was supply Android phones to taxi drivers. The phones send GPS data which can then be aggregated to see what the average speeds along streets are. This also benefits the taxi company as it provides easy tracking of their taxis compared to their old telephone/radio with pen-and-paper process.</p>
+
+<p>The <a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/">route data</a> are already available, as well as the <a href="http://philippine-transit.hackathome.com/dataset-citom-traffic-alert-platform/">Cebu</a> and <a href="http://philippine-transit.hackathome.com/dataset-mmda-traffic-alert-platform/">Metro Manila</a> incident data. You do have to register to access them though. Right now, they&rsquo;re just one-off dumps of the data but the various agencies have promised to provide consistently updated data. This will be provided via ASTI later in the year.</p>
+
+<p>I&rsquo;ve just started looking at the route data and playing around with it. The quality could be better, but I&rsquo;m glad we at least have something to work with.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2013-07-07">2013-07-07</time></small>
+		| <small class="commentline"><a href="/posts/philippine-transit-app-challenge.html#disqus_thread" data-disqus-identifier="cache/posts/philippine-transit-app-challenge.html">Comments</a></small>
+	</article>
+	</article>
+	
+</div>
+<nav class="postindexpager">
+	<ul class="pager clearfix">
+		
+		<li class="previous">
+			<a href="/page/3.html">&larr; Newer posts</a>
+		</li>
+		
+		
+	</ul>
+</nav>
+
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
+</div>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+<script id="dsq-count-scr" type="text/javascript" src="//pleasantprog.disqus.com/count.js" async></script>
+
+
+</body>
+</html>
+

+ 162 - 0
output/posts.html

@@ -0,0 +1,162 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Posts - Pleasant Programmer</title>
+</head>
+
+<body>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article class="tagpage">
+	<header>
+		<h1 class="list-title">Archive</h1>
+	</header>
+	<ul class="postlist">
+		
+		<li>
+			<a class="listtitle" href="/posts/cloudflare-shenanigans.html">Cloudflare Shenanigans</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2015-12-25">2015-12-25</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html">TiddlyWiki in the Sky (or TiddlyWeb for TW5)</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2015-12-24">2015-12-24</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/is-my-terminal-window-active.html">Is My Terminal Window Active?</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2015-06-07">2015-06-07</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html">Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-11-27">2013-11-27</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/console-keymap-switching.html">Console Keymap Switching</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-10-29">2013-10-29</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/geocoding-services.html">Geocoding Services</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-09-25">2013-09-25</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/jeep-and-bus-schedules.html">Jeep and Bus Schedules</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-28">2013-07-28</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/highways-in-otp.html">Highways in OTP</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-24">2013-07-24</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/elevation-data-in-otp.html">Elevation Data in OTP</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-23">2013-07-23</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/graphserver.html">GraphServer</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-23">2013-07-23</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/transit-wand.html">Transit Wand</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-15">2013-07-15</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/fare-data.html">Fare Data</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-13">2013-07-13</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/gtfs-editor.html">GTFS Editor</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-10">2013-07-10</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/one-bus-or-maybe-jeep-away.html">One Bus (or maybe Jeep) Away</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-09">2013-07-09</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/open-trip-planner.html">Open Trip Planner</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-09">2013-07-09</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/jeepney-and-bus-routes.html">Jeepney and Bus Routes</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-07">2013-07-07</time></span>
+		</li>
+		
+		<li>
+			<a class="listtitle" href="/posts/philippine-transit-app-challenge.html">Philippine Transit App Challenge</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2013-07-07">2013-07-07</time></span>
+		</li>
+		
+	</ul>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
+</div>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
+</body>
+</html>
+

+ 140 - 123
output/posts/cloudflare-shenanigans.html

@@ -1,148 +1,165 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Cloudflare Shenanigans | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" title="TiddlyWiki in the Sky (or TiddlyWeb for TW5)" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Cloudflare Shenanigans">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html">
-<meta property="og:description" content="An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only wh">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2015-12-25T14:13:26+08:00">
-<meta property="article:tag" content="cloudflare">
-<meta property="article:tag" content="sysadmin">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Cloudflare Shenanigans - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Cloudflare Shenanigans</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2015-12-25T14:13:26+08:00" itemprop="datePublished" title="2015-12-25 14:13">2015-12-25 14:13</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/cloudflare.html" rel="tag">cloudflare</a>
-           <a class="tag p-category" href="../categories/sysadmin.html" rel="tag">sysadmin</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.</p>
-<p>Now the problem is that Cloudflare can put you behind <a href="https://www.cloudflare.com/ips/">any IP they own</a>, which is a huge range. There's no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/cloudflare-shenanigans.html">Cloudflare Shenanigans</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2015-12-25">2015-12-25</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/sysadmin.html" rel="tag">
+			sysadmin
+		</a>
+		
+		<a class="tag p-category" href="/tags/cloudflare.html" rel="tag">
+			cloudflare
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.</p>
+
+<p>Now the problem is that Cloudflare can put you behind <a href="https://www.cloudflare.com/ips/">any IP they own</a>, which is a huge range. There&rsquo;s no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.</p>
+
 <p>We never actually empirically tested whether other sites hosted on Cloudflare were also actually zero-rated. But I like to think that we saved a lot of people on their data costs from browsing Reddit and 4chan. But alas, good things must come to an end.</p>
-<p>A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn't want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn't really afford that, so we looked for other options.</p>
-<p>Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn't have its own certificate.</p>
+
+<p>A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn&rsquo;t want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn&rsquo;t really afford that, so we looked for other options.</p>
+
+<p>Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn&rsquo;t have its own certificate.</p>
+
 <p>After more testing, we figured out that you could actually use any Cloudflare backed domain so long as we properly set the Host header. We just needed to find one still in the old range. Coincidentally, 4chan.org was. Which led to this wonderful commit</p>
-<pre class="code literal-block">commit 123456789abcdef
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">commit 123456789abcdef
 Author: ~~~~~~
 Date:   ~~~~~~
 
     4chan hack
 
-<span class="gh">diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java</span>
-<span class="gd">--- a/src/com/client/common/Util.java</span>
-<span class="gi">+++ b/src/com/client/common/Util.java</span>
-<span class="gu">@@ -210,7 +210,8 @@ public class Util {</span>
+<span style="color: #000080; font-weight: bold">diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java</span>
+<span style="color: #A00000">--- a/src/com/client/common/Util.java</span>
+<span style="color: #00A000">+++ b/src/com/client/common/Util.java</span>
+<span style="color: #800080; font-weight: bold">@@ -210,7 +210,8 @@ public class Util {</span>
         }
 
         public static String getServerAddress(Context context) {
-<span class="gd">-               String address = "https://backend.client.com";</span>
-<span class="gi">+               // String address = "https://backend.client.com";</span>
-<span class="gi">+               String address = "https://4chan.org";</span>
+<span style="color: #A00000">-               String address = &quot;https://backend.client.com&quot;;</span>
+<span style="color: #00A000">+               // String address = &quot;https://backend.client.com&quot;;</span>
+<span style="color: #00A000">+               String address = &quot;https://4chan.org&quot;;</span>
                 if(!isDebug(context)) return address;
                 try {
-<span class="gh">diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java</span>
-<span class="gd">--- a/src/com/client/common/logging/APIClient.java</span>
-<span class="gi">+++ b/src/com/client/common/logging/APIClient.java</span>
-<span class="gu">@@ -101,6 +101,7 @@ public class APIClient {</span>
+<span style="color: #000080; font-weight: bold">diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java</span>
+<span style="color: #A00000">--- a/src/com/client/common/logging/APIClient.java</span>
+<span style="color: #00A000">+++ b/src/com/client/common/logging/APIClient.java</span>
+<span style="color: #800080; font-weight: bold">@@ -101,6 +101,7 @@ public class APIClient {</span>
         private HttpResponse postInternal(String url, List&lt;NameValuePair&gt; data, boolean forRegistration) throws ClientProtocolException, IOException {
-                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+"/api/"+url);
-                request.setHeader("X-API-VERSION", apiVersion);
-<span class="gi">+               request.setHeader("Host", "backend.client.com");</span>
+                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+&quot;/api/&quot;+url);
+                request.setHeader(&quot;X-API-VERSION&quot;, apiVersion);
+<span style="color: #00A000">+               request.setHeader(&quot;Host&quot;, &quot;backend.client.com&quot;);</span>
 
                 if(data == null) {
                         data = new ArrayList&lt;NameValuePair&gt;();
-</pre>
+</pre></div>
+
+<p>Eventually, we did decide to just abandon Cloudflare for the server. We probably weren&rsquo;t going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.</p>
+
+<p>I just still find it funny we were making people&rsquo;s phones go to 4chan.org everyday for more than a year.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				
+				<li class="next">
+					<a href="/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" rel="next" title="TiddlyWiki in the Sky (or TiddlyWeb for TW5)">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/cloudflare-shenanigans.html';
+var disqus_title = 'Cloudflare Shenanigans';
+var disqus_identifier = 'cache/posts/cloudflare-shenanigans.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
+</div>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
 
 
-<p>Eventually, we did decide to just abandon Cloudflare for the server. We probably weren't going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.</p>
-<p>I just still find it funny we were making people's phones go to 4chan.org everyday for more than a year.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" rel="prev" title="TiddlyWiki in the Sky (or TiddlyWeb for TW5)">← Previous post</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html",
-        disqus_title="Cloudflare Shenanigans",
-        disqus_identifier="cache/posts/cloudflare-shenanigans.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
 
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
 </body>
 </html>
+

+ 153 - 151
output/posts/console-keymap-switching.html

@@ -1,163 +1,165 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Console Keymap Switching | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/console-keymap-switching.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="geocoding-services.html" title="Geocoding Services" type="text/html">
-<link rel="next" href="removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" title="Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Console Keymap Switching">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/console-keymap-switching.html">
-<meta property="og:description" content="At the office, we have some people who use DVORAK. Normally, this isn't a problem. To each his own after all. It does become a bit problematic though, when we're dealing with the servers around the of">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-10-29T20:02:06+08:00">
-<meta property="article:tag" content="sysadmin">
-<meta property="article:tag" content="systemd">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Console Keymap Switching - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Console Keymap Switching</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-10-29T20:02:06+08:00" itemprop="datePublished" title="2013-10-29 20:02">2013-10-29 20:02</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/sysadmin.html" rel="tag">sysadmin</a>
-           <a class="tag p-category" href="../categories/systemd.html" rel="tag">systemd</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>At the office, we have some people who use DVORAK. Normally, this isn't a problem. To each his own after all. It does become a bit problematic though, when we're dealing with the servers around the office.</p>
-<p>We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it's apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.</p>
-<p>For the console, they'd typically do <code>sudo loadkeys dvorak</code> after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can't even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn't a readily available thing for the console.</p>
-<p>I googled around for solutions and came across <a href="http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux">a nice idea</a>. You could alias <code>asdf</code> to load the DVORAK mapping and <code>aoeu</code> (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don't really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/console-keymap-switching.html">Console Keymap Switching</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-10-29">2013-10-29</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/sysadmin.html" rel="tag">
+			sysadmin
+		</a>
+		
+		<a class="tag p-category" href="/tags/systemd.html" rel="tag">
+			systemd
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>At the office, we have some people who use DVORAK. Normally, this isn&rsquo;t a problem. To each his own after all. It does become a bit problematic though, when we&rsquo;re dealing with the servers around the office.</p>
+
+<p>We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it&rsquo;s apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.</p>
+
+<p>For the console, they&rsquo;d typically do <code>sudo loadkeys dvorak</code> after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can&rsquo;t even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn&rsquo;t a readily available thing for the console.</p>
+
+<p>I googled around for solutions and came across <a href="http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux">a nice idea</a>. You could alias <code>asdf</code> to load the DVORAK mapping and <code>aoeu</code> (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don&rsquo;t really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.</p>
+
 <p>After some further searching, I found <a href="http://unix.stackexchange.com/questions/2884/toggle-between-dvorak-and-qwerty">something close to what I wanted</a>. Apparently, Alt+Up sends a KeyboardSignal keycode to the init process, which can act on that. It also works anywhere, even before being logged in. For SysVinit systems, you can just add a line to your inittab for a command to be run when Alt+Up is pressed.</p>
-<p>In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. <code>kbrequest.target</code> is normally aliased to run the rescue service though, so you have to manually create the file in <code>/etc/systemd/system/kbrequest.target</code> and fill it with a description:</p>
-<pre class="code literal-block"><span class="k">[Unit]</span>
-<span class="na">Description</span><span class="o">=</span><span class="s">kbrequest target</span>
-</pre>
 
+<p>In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. <code>kbrequest.target</code> is normally aliased to run the rescue service though, so you have to manually create the file in <code>/etc/systemd/system/kbrequest.target</code> and fill it with a description:</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">[Unit]</span>
+<span style="color: #7D9029">Description</span><span style="color: #666666">=</span><span style="color: #BA2121">kbrequest target</span>
+</pre></div>
 
 <p>We can then add a service to be run whenever the target is called. Something like <code>/etc/systemd/system/keymap-switch.service</code>:</p>
-<pre class="code literal-block"><span class="k">[Unit]</span>
-<span class="na">Description</span><span class="o">=</span><span class="s">Keymap Switch Service</span>
-
-<span class="k">[Service]</span>
-<span class="na">Type</span><span class="o">=</span><span class="s">oneshot</span>
-<span class="na">ExecStart</span><span class="o">=</span><span class="s">/usr/local/bin/keymap-switch</span>
-
-<span class="k">[Install]</span>
-<span class="na">WantedBy</span><span class="o">=</span><span class="s">kbrequest.target</span>
-</pre>
-
-
-<p>After enabling said service, we only need the actual keymap switcher, <code>/usr/local/bin/keymap-switch</code>. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we're using SystemD, we can use that instead for managing which keymap we're actually using. It stores the current settings inside <code>/etc/vconsole.conf</code>. We can also then switch keymaps by using <code>localectl set-keymap</code>.</p>
-<table class="codehilitetable"><tr>
-<td class="linenos"><div class="linenodiv"><pre> 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10</pre></div></td>
-<td class="code">
-<pre class="code literal-block"><span class="c">#!/bin/sh</span>
-<span class="nb">source</span> /etc/vconsole.conf
-
-<span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$TERM</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"dumb"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
-  <span class="k">if</span> <span class="o">[</span> <span class="s2">"</span><span class="nv">$KEYMAP</span><span class="s2">"</span> <span class="o">=</span> <span class="s2">"dvorak"</span> <span class="o">]</span><span class="p">;</span> <span class="k">then</span>
-    localectl <span class="nb">set</span>-keymap us
-  <span class="k">else</span>
-    localectl <span class="nb">set</span>-keymap dvorak
-  <span class="k">fi</span>
-<span class="k">fi</span>
-</pre>
-</td>
-</tr></table>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">[Unit]</span>
+<span style="color: #7D9029">Description</span><span style="color: #666666">=</span><span style="color: #BA2121">Keymap Switch Service</span>
+
+<span style="color: #008000; font-weight: bold">[Service]</span>
+<span style="color: #7D9029">Type</span><span style="color: #666666">=</span><span style="color: #BA2121">oneshot</span>
+<span style="color: #7D9029">ExecStart</span><span style="color: #666666">=</span><span style="color: #BA2121">/usr/local/bin/keymap-switch</span>
+
+<span style="color: #008000; font-weight: bold">[Install]</span>
+<span style="color: #7D9029">WantedBy</span><span style="color: #666666">=</span><span style="color: #BA2121">kbrequest.target</span>
+</pre></div>
+
+<p>After enabling said service, we only need the actual keymap switcher, <code>/usr/local/bin/keymap-switch</code>. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we&rsquo;re using SystemD, we can use that instead for managing which keymap we&rsquo;re actually using. It stores the current settings inside <code>/etc/vconsole.conf</code>. We can also then switch keymaps by using <code>localectl set-keymap</code>.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic">#!/bin/sh</span>
+<span style="color: #008000">source</span> /etc/vconsole.conf
+
+<span style="color: #008000; font-weight: bold">if</span> <span style="color: #666666">[</span> <span style="color: #BA2121">&quot;</span><span style="color: #19177C">$TERM</span><span style="color: #BA2121">&quot;</span> <span style="color: #666666">=</span> <span style="color: #BA2121">&quot;dumb&quot;</span> <span style="color: #666666">]</span>; <span style="color: #008000; font-weight: bold">then</span>
+  <span style="color: #008000; font-weight: bold">if</span> <span style="color: #666666">[</span> <span style="color: #BA2121">&quot;</span><span style="color: #19177C">$KEYMAP</span><span style="color: #BA2121">&quot;</span> <span style="color: #666666">=</span> <span style="color: #BA2121">&quot;dvorak&quot;</span> <span style="color: #666666">]</span>; <span style="color: #008000; font-weight: bold">then</span>
+    localectl <span style="color: #008000">set</span>-keymap us
+  <span style="color: #008000; font-weight: bold">else</span>
+    localectl <span style="color: #008000">set</span>-keymap dvorak
+  <span style="color: #008000; font-weight: bold">fi</span>
+<span style="color: #008000; font-weight: bold">fi</span>
+</pre></div>
+
 <p>After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" rel="prev" title="Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/geocoding-services.html" rel="next" title="Geocoding Services">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/console-keymap-switching.html';
+var disqus_title = 'Console Keymap Switching';
+var disqus_identifier = 'cache/posts/console-keymap-switching.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="geocoding-services.html" rel="prev" title="Geocoding Services">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" rel="next" title="Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/console-keymap-switching.html",
-        disqus_title="Console Keymap Switching",
-        disqus_identifier="cache/posts/console-keymap-switching.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 0 - 50
output/posts/console-keymap-switching.md

@@ -1,50 +0,0 @@
-<!--
-.. link:
-.. description:
-.. tags: sysadmin, systemd
-.. date: 2013/10/29 20:02:06
-.. title: Console Keymap Switching
-.. slug: console-keymap-switching
--->
-
-At the office, we have some people who use DVORAK. Normally, this isn't a problem. To each his own after all. It does become a bit problematic though, when we're dealing with the servers around the office.
-
-We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it's apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.
-
-For the console, they'd typically do `sudo loadkeys dvorak` after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can't even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn't a readily available thing for the console.
-
-I googled around for solutions and came across [a nice idea](http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux). You could alias `asdf` to load the DVORAK mapping and `aoeu` (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don't really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.
-
-After some further searching, I found [something close to what I wanted](http://unix.stackexchange.com/questions/2884/toggle-between-dvorak-and-qwerty). Apparently, Alt+Up sends a KeyboardSignal keycode to the init process, which can act on that. It also works anywhere, even before being logged in. For SysVinit systems, you can just add a line to your inittab for a command to be run when Alt+Up is pressed.
-
-In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. `kbrequest.target` is normally aliased to run the rescue service though, so you have to manually create the file in `/etc/systemd/system/kbrequest.target` and fill it with a description:
-
-    [Unit]
-    Description=kbrequest target
-
-We can then add a service to be run whenever the target is called. Something like `/etc/systemd/system/keymap-switch.service`:
-
-    [Unit]
-    Description=Keymap Switch Service
-
-    [Service]
-    Type=oneshot
-    ExecStart=/usr/local/bin/keymap-switch
-
-    [Install]
-    WantedBy=kbrequest.target
-
-After enabling said service, we only need the actual keymap switcher, `/usr/local/bin/keymap-switch`. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we're using SystemD, we can use that instead for managing which keymap we're actually using. It stores the current settings inside `/etc/vconsole.conf`. We can also then switch keymaps by using `localectl set-keymap`.
-
-    #!/bin/sh
-    source /etc/vconsole.conf
-
-    if [ "$TERM" = "dumb" ]; then
-      if [ "$KEYMAP" = "dvorak" ]; then
-        localectl set-keymap us
-      else
-        localectl set-keymap dvorak
-      fi
-    fi
-
-After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.

+ 127 - 112
output/posts/elevation-data-in-otp.html

@@ -1,122 +1,137 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Elevation Data in OTP | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/elevation-data-in-otp.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="graphserver.html" title="GraphServer" type="text/html">
-<link rel="next" href="highways-in-otp.html" title="Highways in OTP" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Elevation Data in OTP">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/elevation-data-in-otp.html">
-<meta property="og:description" content="One thing I hadn't tested out last time was OTP's support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also ta">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-23T18:23:00+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Elevation Data in OTP - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Elevation Data in OTP</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-23T18:23:00+08:00" itemprop="datePublished" title="2013-07-23 18:23">2013-07-23 18:23</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p><img alt="OpenTripPlanner showing elevation data" src="../galleries/transit/otpelevation.png"></p>
-<p>One thing I hadn't tested out last time was OTP's support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/elevation-data-in-otp.html">Elevation Data in OTP</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-23">2013-07-23</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p><img src="../galleries/transit/otpelevation.png" alt="OpenTripPlanner showing elevation data" /></p>
+
+<p>One thing I hadn&rsquo;t tested out last time was OTP&rsquo;s support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.</p>
+
 <p>The <a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes">5 minute tutorial</a> actually discusses the elevation data briefly, but a more in-depth thing you can look at is the <a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data">GraphBuilder documentation</a>. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the <a href="http://www.philgis.org/freegisdata.htm">PhilGIS website</a>.</p>
-<p>I don't know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use <a href="http://www.gdal.org/">GDAL</a> for this. You'd just then run,</p>
-<pre class="code literal-block"> gdal_translate srtm41_90m_phl.img phil.tiff
-</pre>
 
+<p>I don&rsquo;t know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use <a href="http://www.gdal.org/">GDAL</a> for this. You&rsquo;d just then run,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">gdal_translate srtm41_90m_phl.img phil.tiff
+</pre></div>
 
-<p>Afterwards, it's just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you're running on limited RAM.</p>
-<p>I've actually hosted a <a href="http://maps.pleasantprogrammer.com">working example</a>. It's pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don't abuse it though.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="graphserver.html" rel="prev" title="GraphServer">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="highways-in-otp.html" rel="next" title="Highways in OTP">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/elevation-data-in-otp.html",
-        disqus_title="Elevation Data in OTP",
-        disqus_identifier="cache/posts/elevation-data-in-otp.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+<p>Afterwards, it&rsquo;s just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you&rsquo;re running on limited RAM.</p>
+
+<p>I&rsquo;ve actually hosted a <a href="http://maps.pleasantprogrammer.com">working example</a>. It&rsquo;s pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don&rsquo;t abuse it though.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/highways-in-otp.html" rel="prev" title="Highways in OTP">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/graphserver.html" rel="next" title="GraphServer">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/elevation-data-in-otp.html';
+var disqus_title = 'Elevation Data in OTP';
+var disqus_identifier = 'cache/posts/elevation-data-in-otp.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 163 - 135
output/posts/fare-data.html

@@ -1,164 +1,192 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Fare Data | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/fare-data.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="gtfs-editor.html" title="GTFS Editor" type="text/html">
-<link rel="next" href="transit-wand.html" title="Transit Wand" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Fare Data">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/fare-data.html">
-<meta property="og:description" content="As part of the data released by the DOTC, we also have the fare matrix for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the LTFRB website. ">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-13T21:15:09+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Fare Data - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Fare Data</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-13T21:15:09+08:00" itemprop="datePublished" title="2013-07-13 21:15">2013-07-13 21:15</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>As part of the data released by the DOTC, we also have the <a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/">fare matrix</a> for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the <a href="http://ltfrb.gov.ph/main/farerates">LTFRB website</a>. Generally, the fare scheme is represented as "pay <em>X</em> pesos for the first <em>Y</em> kilometers, pay <em>Z</em> for every succeeding kilometer." Instead of a table, we can simply represent this as a formula instead,</p>
-<pre class="code literal-block">base_fare + (distance - initial) * per_km
-</pre>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
 
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/fare-data.html">Fare Data</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-13">2013-07-13</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		
+
+<p>As part of the data released by the DOTC, we also have the <a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/">fare matrix</a> for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the <a href="http://ltfrb.gov.ph/main/farerates">LTFRB website</a>. Generally, the fare scheme is represented as &ldquo;pay <em>X</em> pesos for the first <em>Y</em> kilometers, pay <em>Z</em> for every succeeding kilometer.&rdquo; Instead of a table, we can simply represent this as a formula instead,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">base_fare + (distance - initial) * per_km
+</pre></div>
 
 <p>The relevant values for the three services are:</p>
+
 <table>
-<thead><tr>
-<td>type</td>
+<thead>
+  <tr>
+    <td>type</td>
     <td>base_fare</td>
     <td>initial</td>
     <td>per_km</td>
-  </tr></thead>
+  </tr>
+</thead>
 <tbody>
-<tr>
-<td>bus aircon</td>
+  <tr>
+    <td>bus aircon</td>
     <td>12.00</td>
     <td>5 km</td>
     <td>2.20</td>
   </tr>
-<tr>
-<td>bus ordinary</td>
+  <tr>
+    <td>bus ordinary</td>
     <td>10.00</td>
     <td>5 km</td>
     <td>1.85</td>
   </tr>
-<tr>
-<td>jeep aircon</td>
+  <tr>
+    <td>jeep aircon</td>
     <td>8.00</td>
     <td>4 km</td>
     <td>1.40</td>
   </tr>
 </tbody>
 </table>
-<p>It isn't as simple as that though. Fares are also rounded to the nearest 25 centavos. So we'd need to round them off correctly. This can be achieved by doing,</p>
-<pre class="code literal-block">round(calculated_fare * 4.0)/4.0
-</pre>
-
-
-<p>There's also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.</p>
-<p>Doing just this, we actually do get the same results as the fare matrices in the image for the most part. There are some discrepancies with the discounted jeep fares. I've tried to resolve it by tweaking around with the formulas, but it really doesn't make sense in any way. I presume these were manually adjusted for one reason or another.</p>
-<p>Here's a <a href="../uploads/farematrix.rb">script</a> that generates CSVs of all the three fare matrices. If you're too lazy to run it, here are links to the <a href="../uploads/pub_aircon.csv">aircon bus</a>, <a href="../uploads/pub_ordinary.csv">ordinary bus</a> and <a href="../uploads/puj.csv">jeep</a> fare matrices.</p>
-<h4>GTFS compatibility</h4>
-<p>As is, the provided GTFS data does not have any fare data. I imagine this is because the existing spec doesn't have good support for distance-based fares like we have in the Philippines. Judging from the <a href="https://code.google.com/p/googletransitdatafeed/wiki/FareExamples">fare examples</a>, the only reasonable way we could implement distance-based fares is following example 6. This would involve setting a fare for each possible pair of stops based on the distance between them. This isn't exactly ideal. In fact, the people originally working on the DOTC project have voiced <a href="https://groups.google.com/forum/#!topic/gtfs-fare-wg/V63xRSnQJGw">issues</a> and made <a href="https://groups.google.com/forum/#!msg/gtfs-changes/uybrAokZ9Cg/rqlzXdMypUgJ">proposals</a> for having distance-based fares included into GTFS.</p>
-<p>Apparently, public transit fares are a really complicated thing. You have fares based on distance, number of stops passed through, and transfers which may or may not cost extra. Not only that, you might have discounted fares, or first-class vs economy fares. The community will want to get it right before it's formally included in the spec. You can see the current state of the consolidated <a href="https://docs.google.com/document/d/1mK3--o5g4-3cCXaqmch92U63JTwChh0L2VCmcDViIlM/edit">GTFS fare proposal here</a>.</p>
-<p>Even in it's proposal form though, we might have hope of being able to see these being used. There's currently a <a href="https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/30">pull request</a> for supporting the distance-based fare scheme into the OneBusAway libraries. The libraries actually used by GTFS Editor and OpenTripPlanner for working with GTFS data.</p>
-<h4>Remaining Problems</h4>
-<p>Given all that, it would probably still be a long way before this allows us to make a really good routing app. We still don't have shape data, so the distance estimates would really be rough estimates at best. There's no support for rounding to the nearest centavo. I realize that's just nitpicking, but if we want something truly polished, even that has to be taken care of.</p>
-<p>We also don't know if the jeeps or buses strictly follow the distance-based scheme. After all, if you can get on and off anywhere, you can't really measure distance that exactly. I assume they generally work off the notion of "zones" than actual distance travelled. In that sense, they work more similarly to the LRT which has fares based on how many stops you pass. For jeeps and buses, your fare is probably based more on how many "zones" you pass through.</p>
-<h4>Conclusion</h4>
-<p>Philip, a co-worker of mine at By Implication, had suggested that we might want to use a different model than what the GTFS proposes. I have to agree with him. At this point, the GTFS doesn't really fit with our system. But I do think that open data and standards are great. In fact, I applaud the developers who made proposals for the fare system, as those are great first steps towards making the GTFS a more universal standard.</p>
-<p>Side note: I'd also actually really like to hear about the DOTC developers' experience with the project. It would be nice if they had a devblog.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="gtfs-editor.html" rel="prev" title="GTFS Editor">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="transit-wand.html" rel="next" title="Transit Wand">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/fare-data.html",
-        disqus_title="Fare Data",
-        disqus_identifier="cache/posts/fare-data.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+
+<p>It isn&rsquo;t as simple as that though. Fares are also rounded to the nearest 25 centavos. So we&rsquo;d need to round them off correctly. This can be achieved by doing,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">round(calculated_fare * 4.0)/4.0
+</pre></div>
+
+<p>There&rsquo;s also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.</p>
+
+<p>Doing just this, we actually do get the same results as the fare matrices in the image for the most part. There are some discrepancies with the discounted jeep fares. I&rsquo;ve tried to resolve it by tweaking around with the formulas, but it really doesn&rsquo;t make sense in any way. I presume these were manually adjusted for one reason or another.</p>
+
+<p>Here&rsquo;s a <a href="../uploads/farematrix.rb">script</a> that generates CSVs of all the three fare matrices. If you&rsquo;re too lazy to run it, here are links to the <a href="../uploads/pub_aircon.csv">aircon bus</a>, <a href="../uploads/pub_ordinary.csv">ordinary bus</a> and <a href="../uploads/puj.csv">jeep</a> fare matrices.</p>
+
+<h3 id="gtfs-compatibility:a6ffa536f572175993ee2d6ec342ac72">GTFS compatibility</h3>
+
+<p>As is, the provided GTFS data does not have any fare data. I imagine this is because the existing spec doesn&rsquo;t have good support for distance-based fares like we have in the Philippines. Judging from the <a href="https://code.google.com/p/googletransitdatafeed/wiki/FareExamples">fare examples</a>, the only reasonable way we could implement distance-based fares is following example 6. This would involve setting a fare for each possible pair of stops based on the distance between them. This isn&rsquo;t exactly ideal. In fact, the people originally working on the DOTC project have voiced <a href="https://groups.google.com/forum/#!topic/gtfs-fare-wg/V63xRSnQJGw">issues</a> and made <a href="https://groups.google.com/forum/#!msg/gtfs-changes/uybrAokZ9Cg/rqlzXdMypUgJ">proposals</a> for having distance-based fares included into GTFS.</p>
+
+<p>Apparently, public transit fares are a really complicated thing. You have fares based on distance, number of stops passed through, and transfers which may or may not cost extra. Not only that, you might have discounted fares, or first-class vs economy fares. The community will want to get it right before it&rsquo;s formally included in the spec. You can see the current state of the consolidated <a href="https://docs.google.com/document/d/1mK3--o5g4-3cCXaqmch92U63JTwChh0L2VCmcDViIlM/edit">GTFS fare proposal here</a>.</p>
+
+<p>Even in it&rsquo;s proposal form though, we might have hope of being able to see these being used. There&rsquo;s currently a <a href="https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/30">pull request</a> for supporting the distance-based fare scheme into the OneBusAway libraries. The libraries actually used by GTFS Editor and OpenTripPlanner for working with GTFS data.</p>
+
+<h3 id="remaining-problems:a6ffa536f572175993ee2d6ec342ac72">Remaining Problems</h3>
+
+<p>Given all that, it would probably still be a long way before this allows us to make a really good routing app. We still don&rsquo;t have shape data, so the distance estimates would really be rough estimates at best. There&rsquo;s no support for rounding to the nearest centavo. I realize that&rsquo;s just nitpicking, but if we want something truly polished, even that has to be taken care of.</p>
+
+<p>We also don&rsquo;t know if the jeeps or buses strictly follow the distance-based scheme. After all, if you can get on and off anywhere, you can&rsquo;t really measure distance that exactly. I assume they generally work off the notion of &ldquo;zones&rdquo; than actual distance travelled. In that sense, they work more similarly to the LRT which has fares based on how many stops you pass. For jeeps and buses, your fare is probably based more on how many &ldquo;zones&rdquo; you pass through.</p>
+
+<h3 id="conclusion:a6ffa536f572175993ee2d6ec342ac72">Conclusion</h3>
+
+<p>Philip, a co-worker of mine at By Implication, had suggested that we might want to use a different model than what the GTFS proposes. I have to agree with him. At this point, the GTFS doesn&rsquo;t really fit with our system. But I do think that open data and standards are great. In fact, I applaud the developers who made proposals for the fare system, as those are great first steps towards making the GTFS a more universal standard.</p>
+
+<p>Side note: I&rsquo;d also actually really like to hear about the DOTC developers&rsquo; experience with the project. It would be nice if they had a devblog.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/transit-wand.html" rel="prev" title="Transit Wand">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/gtfs-editor.html" rel="next" title="GTFS Editor">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/fare-data.html';
+var disqus_title = 'Fare Data';
+var disqus_identifier = 'cache/posts/fare-data.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 128 - 110
output/posts/geocoding-services.html

@@ -1,119 +1,137 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Geocoding Services | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/geocoding-services.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="jeep-and-bus-schedules.html" title="Jeep and Bus Schedules" type="text/html">
-<link rel="next" href="console-keymap-switching.html" title="Console Keymap Switching" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Geocoding Services">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/geocoding-services.html">
-<meta property="og:description" content="A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don't know exactly where their start and end points are on the map. Even the">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-09-25T12:26:59+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Geocoding Services - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Geocoding Services</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-09-25T12:26:59+08:00" itemprop="datePublished" title="2013-09-25 12:26">2013-09-25 12:26</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don't know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.</p>
-<p>The gold standard for doing geocoding right now is Google Maps. It's hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn't be <em>that</em> much you could do for the competition.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/geocoding-services.html">Geocoding Services</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-09-25">2013-09-25</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don&rsquo;t know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.</p>
+
+<p>The gold standard for doing geocoding right now is Google Maps. It&rsquo;s hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn&rsquo;t be <em>that</em> much you could do for the competition.</p>
+
 <p>When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called <a href="http://nominatim.openstreetmap.org">Nominatim</a>.</p>
+
 <p>Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.</p>
-<p>Given a typical mapping app, you might type in "ateneo" and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google's <a href="https://developers.google.com/maps/documentation/javascript/geocoding">geocoding API</a>, you probably won't get any result for this. What you want to use is the <a href="https://developers.google.com/maps/documentation/javascript/places">Places API</a> which provides an autocomplete search box. Using it, when you type in "ateneo", it automatically suggests in the dropdown, "Ateneo de Manila University".</p>
-<p>A downside to using the Places API is that it's against the terms of service to use it with something that isn't Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap's data will probably be a better long term solution.</p>
-<p>For now, since the competition's deadline is just a few days away, I'll be using Google Maps.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="jeep-and-bus-schedules.html" rel="prev" title="Jeep and Bus Schedules">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="console-keymap-switching.html" rel="next" title="Console Keymap Switching">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/geocoding-services.html",
-        disqus_title="Geocoding Services",
-        disqus_identifier="cache/posts/geocoding-services.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+
+<p>Given a typical mapping app, you might type in &ldquo;ateneo&rdquo; and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google&rsquo;s <a href="https://developers.google.com/maps/documentation/javascript/geocoding">geocoding API</a>, you probably won&rsquo;t get any result for this. What you want to use is the <a href="https://developers.google.com/maps/documentation/javascript/places">Places API</a> which provides an autocomplete search box. Using it, when you type in &ldquo;ateneo&rdquo;, it automatically suggests in the dropdown, &ldquo;Ateneo de Manila University&rdquo;.</p>
+
+<p>A downside to using the Places API is that it&rsquo;s against the terms of service to use it with something that isn&rsquo;t Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap&rsquo;s data will probably be a better long term solution.</p>
+
+<p>For now, since the competition&rsquo;s deadline is just a few days away, I&rsquo;ll be using Google Maps.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/console-keymap-switching.html" rel="prev" title="Console Keymap Switching">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/jeep-and-bus-schedules.html" rel="next" title="Jeep and Bus Schedules">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/geocoding-services.html';
+var disqus_title = 'Geocoding Services';
+var disqus_identifier = 'cache/posts/geocoding-services.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 0 - 22
output/posts/geocoding-services.md

@@ -1,22 +0,0 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/09/25 12:26:59
-.. title: Geocoding Services
-.. slug: geocoding-services
--->
-
-A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don't know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.
-
-The gold standard for doing geocoding right now is Google Maps. It's hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn't be *that* much you could do for the competition.
-
-When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called [Nominatim](http://nominatim.openstreetmap.org).
-
-Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.
-
-Given a typical mapping app, you might type in "ateneo" and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google's [geocoding API](https://developers.google.com/maps/documentation/javascript/geocoding), you probably won't get any result for this. What you want to use is the [Places API](https://developers.google.com/maps/documentation/javascript/places) which provides an autocomplete search box. Using it, when you type in "ateneo", it automatically suggests in the dropdown, "Ateneo de Manila University".
-
-A downside to using the Places API is that it's against the terms of service to use it with something that isn't Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap's data will probably be a better long term solution.
-
-For now, since the competition's deadline is just a few days away, I'll be using Google Maps.

+ 126 - 110
output/posts/graphserver.html

@@ -1,119 +1,135 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>GraphServer | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/graphserver.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="transit-wand.html" title="Transit Wand" type="text/html">
-<link rel="next" href="elevation-data-in-otp.html" title="Elevation Data in OTP" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="GraphServer">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/graphserver.html">
-<meta property="og:description" content="Link: http://graphserver.github.io/graphserver/
-One other routing webapp I saw was GraphServer. It's actually more of a general purpose Graph library which supports GTFS and OSM data than an actual de">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-23T14:48:29+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>GraphServer - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">GraphServer</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-23T14:48:29+08:00" itemprop="datePublished" title="2013-07-23 14:48">2013-07-23 14:48</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>Link: <a href="http://graphserver.github.io/graphserver/">http://graphserver.github.io/graphserver/</a></p>
-<p>One other routing webapp I saw was GraphServer. It's actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It's also based off python and C instead of Java, so it feels a lot less heavy.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/graphserver.html">GraphServer</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-23">2013-07-23</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>Link: <a href="http://graphserver.github.io/graphserver/">http://graphserver.github.io/graphserver/</a></p>
+
+<p>One other routing webapp I saw was GraphServer. It&rsquo;s actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It&rsquo;s also based off python and C instead of Java, so it feels a lot less heavy.</p>
+
 <p>The instructions on the website are already pretty good. There are just some minor errors with it. Where it says <code>gs_gtfsdb_build</code>, you should actually use <code>gs_gtfsdb_compile</code>. Also, when running <code>gs_osmdb_compile</code> you might need to use <code>-t</code> for tolerant in case you follow the instructions on chopping up the original OSM data.</p>
-<p>A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn't support 64-bit ids. The <a href="http://wiki.openstreetmap.org/wiki/Osmosis">latest version of Osmosis</a> easily did the job though.</p>
-<p>The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn't provide any alternate routes aside from that one. I'm not sure if it's a limitation of the provided routeserver, but I didn't bother checking if it supported parameters which might provide better routes.</p>
+
+<p>A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn&rsquo;t support 64-bit ids. The <a href="http://wiki.openstreetmap.org/wiki/Osmosis">latest version of Osmosis</a> easily did the job though.</p>
+
+<p>The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn&rsquo;t provide any alternate routes aside from that one. I&rsquo;m not sure if it&rsquo;s a limitation of the provided routeserver, but I didn&rsquo;t bother checking if it supported parameters which might provide better routes.</p>
+
 <p>I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/elevation-data-in-otp.html" rel="prev" title="Elevation Data in OTP">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/transit-wand.html" rel="next" title="Transit Wand">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/graphserver.html';
+var disqus_title = 'GraphServer';
+var disqus_identifier = 'cache/posts/graphserver.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="transit-wand.html" rel="prev" title="Transit Wand">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="elevation-data-in-otp.html" rel="next" title="Elevation Data in OTP">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/graphserver.html",
-        disqus_title="GraphServer",
-        disqus_identifier="cache/posts/graphserver.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 0 - 20
output/posts/graphserver.md

@@ -1,20 +0,0 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/23 14:48:29
-.. title: GraphServer
-.. slug: graphserver
--->
-
-Link: [http://graphserver.github.io/graphserver/](http://graphserver.github.io/graphserver/)
-
-One other routing webapp I saw was GraphServer. It's actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It's also based off python and C instead of Java, so it feels a lot less heavy.
-
-The instructions on the website are already pretty good. There are just some minor errors with it. Where it says `gs_gtfsdb_build`, you should actually use `gs_gtfsdb_compile`. Also, when running `gs_osmdb_compile` you might need to use `-t` for tolerant in case you follow the instructions on chopping up the original OSM data.
-
-A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn't support 64-bit ids. The [latest version of Osmosis](http://wiki.openstreetmap.org/wiki/Osmosis) easily did the job though.
-
-The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn't provide any alternate routes aside from that one. I'm not sure if it's a limitation of the provided routeserver, but I didn't bother checking if it supported parameters which might provide better routes.
-
-I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.

+ 247 - 218
output/posts/gtfs-editor.html

@@ -1,114 +1,115 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>GTFS Editor | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/gtfs-editor.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="open-trip-planner.html" title="Open Trip Planner" type="text/html">
-<link rel="next" href="fare-data.html" title="Fare Data" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="GTFS Editor">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/gtfs-editor.html">
-<meta property="og:description" content="Link: https://github.com/conveyal/gtfs-editor
-TL;DR they really meant under development
-When I first saw the source of GTFS Editor, I was ecstatic. They used Play framework!!! Not only that, they're t">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-10T11:30:01+08:00">
-<meta property="article:tag" content="lets-debug">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>GTFS Editor - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">GTFS Editor</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-10T11:30:01+08:00" itemprop="datePublished" title="2013-07-10 11:30">2013-07-10 11:30</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/lets-debug.html" rel="tag">lets-debug</a>
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/gtfs-editor.html">GTFS Editor</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-10">2013-07-10</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+		<a class="tag p-category" href="/tags/lets-debug.html" rel="tag">
+			lets-debug
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		
+
 <p>Link: <a href="https://github.com/conveyal/gtfs-editor">https://github.com/conveyal/gtfs-editor</a></p>
+
 <p><strong>TL;DR</strong> they really meant under development</p>
-<p>When I first saw the source of GTFS Editor, I was ecstatic. They used <a href="http://playframework.com/">Play framework</a>!!! Not only that, they're targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.</p>
-<p>Getting it to actually run though, wasn't very pleasant. The initial setup was easy enough. Get <a href="http://www.playframework.com/download">Play 1.2.5</a>, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that's necessary. Wonderful. Then, run play, open a browser, go to <a href="http://localhost:9000">http://localhost:9000</a>, compilation error. Fantastic.</p>
-<p>If you don't want to go through the technical details, you can just jump to the <a href="gtfs-editor.html#conclusion">conclusion</a>.</p>
-<h3>Let's Debug!</h3>
-<p>I'll be splitting the next section up into 2 parts. In the first pass, I'll talk about what I did to just get the app to run but I won't try hard to fix any bugs. This generally is what I do when I try to get apps to run. I'll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I'll explain what the problems were and how I fixed them.</p>
-<h4>First Pass</h4>
-<p>A thing to note about Play (and one of the reasons it's a lovely Java framework) is that you don't need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that's what I saw, <code>Error: type Check already defined</code></p>
-<pre class="code literal-block"><span class="nd">@Retention</span><span class="o">(</span><span class="n">RetentionPolicy</span><span class="o">.</span><span class="na">RUNTIME</span><span class="o">)</span>
-<span class="nd">@Target</span><span class="o">({</span><span class="n">ElementType</span><span class="o">.</span><span class="na">METHOD</span><span class="o">,</span> <span class="n">ElementType</span><span class="o">.</span><span class="na">TYPE</span><span class="o">})</span>
-<span class="kd">public</span> <span class="nd">@interface</span> <span class="n">Check</span> <span class="o">{</span> <span class="c1">// error here</span>
 
-    <span class="n">String</span><span class="o">[]</span> <span class="nf">value</span><span class="o">();</span>
-<span class="o">}</span>
-</pre>
+<p>When I first saw the source of GTFS Editor, I was ecstatic. They used <a href="http://playframework.com/">Play framework</a>!!! Not only that, they&rsquo;re targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.</p>
+
+<p>Getting it to actually run though, wasn&rsquo;t very pleasant. The initial setup was easy enough. Get <a href="http://www.playframework.com/download">Play 1.2.5</a>, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that&rsquo;s necessary. Wonderful. Then, run play, open a browser, go to <a href="http://localhost:9000">http://localhost:9000</a>, compilation error. Fantastic.</p>
+
+<p>If you don&rsquo;t want to go through the technical details, you can just jump to the <a href="#conclusion">conclusion</a>.</p>
+
+<h2 id="let-s-debug:9dc7854b573f1a2be2b19d1bfe826d39">Let&rsquo;s Debug!</h2>
 
+<p>I&rsquo;ll be splitting the next section up into 2 parts. In the first pass, I&rsquo;ll talk about what I did to just get the app to run but I won&rsquo;t try hard to fix any bugs. This generally is what I do when I try to get apps to run. I&rsquo;ll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I&rsquo;ll explain what the problems were and how I fixed them.</p>
 
-<p>You also know that typical behavior among programmers where your program doesn't compile, but you keep trying to compile it anyway hoping that it will magically just work. That's what I did, and it actually ran. I couldn't really just let this pass, so I decided to try deleting <code>Check.java</code>. I got another compilation error, <code>Error: type Secure already defined</code></p>
-<pre class="code literal-block"><span class="kd">public</span> <span class="kd">class</span> <span class="nc">Secure</span> <span class="kd">extends</span> <span class="n">Controller</span> <span class="o">{</span> <span class="c1">// error here</span>
+<h3 id="first-pass:9dc7854b573f1a2be2b19d1bfe826d39">First Pass</h3>
 
-    <span class="nd">@Before</span><span class="o">(</span><span class="n">unless</span><span class="o">={</span><span class="s">"login"</span><span class="o">,</span> <span class="s">"authenticate"</span><span class="o">,</span> <span class="s">"logout"</span><span class="o">})</span>
+<p>A thing to note about Play (and one of the reasons it&rsquo;s a lovely Java framework) is that you don&rsquo;t need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that&rsquo;s what I saw, <code>Error: type Check already defined</code></p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #AA22FF">@Retention</span><span style="color: #666666">(</span>RetentionPolicy<span style="color: #666666">.</span><span style="color: #7D9029">RUNTIME</span><span style="color: #666666">)</span>
+<span style="color: #AA22FF">@Target</span><span style="color: #666666">({</span>ElementType<span style="color: #666666">.</span><span style="color: #7D9029">METHOD</span><span style="color: #666666">,</span> ElementType<span style="color: #666666">.</span><span style="color: #7D9029">TYPE</span><span style="color: #666666">})</span>
+<span style="color: #008000; font-weight: bold">public</span> <span style="color: #AA22FF">@interface</span> Check <span style="color: #666666">{</span> <span style="color: #408080; font-style: italic">// error here</span>
 
-    <span class="kd">static</span> <span class="kt">void</span> <span class="nf">checkAccess</span><span class="o">()</span> <span class="kd">throws</span> <span class="n">Throwable</span> <span class="o">{</span>
-</pre>
+    String<span style="color: #666666">[]</span> <span style="color: #0000FF">value</span><span style="color: #666666">();</span>
+<span style="color: #666666">}</span>
+</pre></div>
 
+<p>You also know that typical behavior among programmers where your program doesn&rsquo;t compile, but you keep trying to compile it anyway hoping that it will magically just work. That&rsquo;s what I did, and it actually ran. I couldn&rsquo;t really just let this pass, so I decided to try deleting <code>Check.java</code>. I got another compilation error, <code>Error: type Secure already defined</code></p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">public</span> <span style="color: #008000; font-weight: bold">class</span> <span style="color: #0000FF; font-weight: bold">Secure</span> <span style="color: #008000; font-weight: bold">extends</span> Controller <span style="color: #666666">{</span> <span style="color: #408080; font-style: italic">// error here</span>
+
+    <span style="color: #AA22FF">@Before</span><span style="color: #666666">(</span>unless<span style="color: #666666">={</span><span style="color: #BA2121">&quot;login&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;authenticate&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;logout&quot;</span><span style="color: #666666">})</span>
+
+    <span style="color: #008000; font-weight: bold">static</span> <span style="color: #B00040">void</span> <span style="color: #0000FF">checkAccess</span><span style="color: #666666">()</span> <span style="color: #008000; font-weight: bold">throws</span> Throwable <span style="color: #666666">{</span>
+</pre></div>
 
 <p>At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put <code>Check.java</code> back in and proceeded to just refresh until it compiled and ran.</p>
-<p>The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the <code>account</code> table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn't work.</p>
+
+<p>The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the <code>account</code> table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn&rsquo;t work.</p>
+
 <p>Another note regarding Play 1.x, it provides the <a href="http://www.playframework.com/documentation/1.2.5/secure">secure module</a> which handles logins and keeping state, you simply need to implement the method <code>boolean authenticate(String username, String password)</code>. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return <code>true</code> and then any login would work. No need to actually set the password. Excellent.</p>
-<p>And we're logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, <code>IndexOutOfBoundsException occured : Index: 0, Size: 0</code></p>
-<pre class="code literal-block"><span class="k">if</span><span class="o">(</span><span class="n">session</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="s">"agencyId"</span><span class="o">)</span> <span class="o">==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
 
-    <span class="n">Agency</span> <span class="n">agency</span> <span class="o">=</span> <span class="n">agencies</span><span class="o">.</span><span class="na">get</span><span class="o">(</span><span class="mi">0</span><span class="o">);</span> <span class="c1">// error here</span>
+<p>And we&rsquo;re logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, <code>IndexOutOfBoundsException occured : Index: 0, Size: 0</code></p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">if</span><span style="color: #666666">(</span>session<span style="color: #666666">.</span><span style="color: #7D9029">get</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;agencyId&quot;</span><span style="color: #666666">)</span> <span style="color: #666666">==</span> <span style="color: #008000; font-weight: bold">null</span><span style="color: #666666">)</span> <span style="color: #666666">{</span>
+
+    Agency agency <span style="color: #666666">=</span> agencies<span style="color: #666666">.</span><span style="color: #7D9029">get</span><span style="color: #666666">(0);</span> <span style="color: #408080; font-style: italic">// error here</span>
 
-    <span class="n">session</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"agencyId"</span><span class="o">,</span> <span class="n">agency</span><span class="o">.</span><span class="na">id</span><span class="o">);</span>
-    <span class="n">session</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="s">"agencyName"</span><span class="o">,</span> <span class="n">agency</span><span class="o">.</span><span class="na">name</span><span class="o">);</span>
-</pre>
+    session<span style="color: #666666">.</span><span style="color: #7D9029">put</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;agencyId&quot;</span><span style="color: #666666">,</span> agency<span style="color: #666666">.</span><span style="color: #7D9029">id</span><span style="color: #666666">);</span>
+    session<span style="color: #666666">.</span><span style="color: #7D9029">put</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;agencyName&quot;</span><span style="color: #666666">,</span> agency<span style="color: #666666">.</span><span style="color: #7D9029">name</span><span style="color: #666666">);</span>
+</pre></div>
 
+<p>Apparently, we need to have an agency. That&rsquo;s generally simple enough. You just manually insert an agency into the <code>agency</code> table. After that&rsquo;s done, we finally have a view of the actual application. It&rsquo;s very Bootstrap-y, but that&rsquo;s just fine. The workflow though, is not perfectly intuitive, but I&rsquo;ll talk about that some other day.</p>
 
-<p>Apparently, we need to have an agency. That's generally simple enough. You just manually insert an agency into the <code>agency</code> table. After that's done, we finally have a view of the actual application. It's very Bootstrap-y, but that's just fine. The workflow though, is not perfectly intuitive, but I'll talk about that some other day.</p>
-<p>That's not the end of it though, we still have to fix these bugs. The developer obviously didn't have to put up with this when they were working, so what happened? Also, the log is showing some weird things,</p>
-<pre class="code literal-block">~        _            _
+<p>That&rsquo;s not the end of it though, we still have to fix these bugs. The developer obviously didn&rsquo;t have to put up with this when they were working, so what happened? Also, the log is showing some weird things,</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">~        _            _
 ~  _ __ | | __ _ _  _| |
-~ | '_ \| |/ _' | || |_|
+~ | &#39;_ \| |/ _&#39; | || |_|
 ~ |  __/|_|\____|\__ (_)
 ~ |_|            |__/
 ~
@@ -121,7 +122,7 @@ Listening for transport dt_socket at address: 8000
 23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
 23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
 23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
-23:32:15,830 WARN  ~ You're running Play! in DEV mode
+23:32:15,830 WARN  ~ You&#39;re running Play! in DEV mode
 23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
 23:32:28,792 ERROR ~
 
@@ -132,15 +133,15 @@ Compilation error (In /app/controllers/Check.java around line 10)
 The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
 
 play.exceptions.CompilationException: The type Check is already defined
-    at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
-    at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
-    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
-    at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
-    at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
-    at play.Play.start(Play.java:516)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at Invocation.HTTP Request(Play!)
+	at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
+	at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
+	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
+	at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
+	at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
+	at play.Play.start(Play.java:516)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at Invocation.HTTP Request(Play!)
 23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
 SLF4J: Class path contains multiple SLF4J bindings.
 SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
@@ -150,46 +151,46 @@ SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
 23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
 23:32:32,494 INFO  ~ Checking for default configuration file.
 23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
-23:32:34,077 INFO  ~ Application 'gtfs-editor' is now started !
+23:32:34,077 INFO  ~ Application &#39;gtfs-editor&#39; is now started !
 23:32:34,151 INFO  ~ Bootstrapping Database...
 23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
 play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
-    at play.templates.TemplateLoader.load(TemplateLoader.java:78)
-    at play.test.Fixtures.loadModels(Fixtures.java:174)
-    at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
-    at play.jobs.Job.doJobWithResult(Job.java:50)
-    at play.jobs.Job.call(Job.java:146)
-    at play.jobs.Job.run(Job.java:132)
-    at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
-    at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
-    at play.Play.start(Play.java:547)
-    at play.Play.detectChanges(Play.java:630)
-    at play.Invoker$Invocation.init(Invoker.java:198)
-    at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
-    at play.Invoker$Invocation.run(Invoker.java:276)
-    at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
-    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
-    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
-    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
-    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
-    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
-    at java.lang.Thread.run(Thread.java:680)
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
+	at play.templates.TemplateLoader.load(TemplateLoader.java:78)
+	at play.test.Fixtures.loadModels(Fixtures.java:174)
+	at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
+	at play.jobs.Job.doJobWithResult(Job.java:50)
+	at play.jobs.Job.call(Job.java:146)
+	at play.jobs.Job.run(Job.java:132)
+	at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
+	at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
+	at play.Play.start(Play.java:547)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
+	at play.Invoker$Invocation.run(Invoker.java:276)
+	at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
+	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
+	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
+	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
+	at java.lang.Thread.run(Thread.java:680)
 Caused by: play.exceptions.UnexpectedException: Unexpected Error
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
-    at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
-    ... 22 more
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
+	... 22 more
 Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
-    at java.io.FileInputStream.open(Native Method)
-    at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120)
-    at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
-    ... 23 more
+	at java.io.FileInputStream.open(Native Method)
+	at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:120)
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
+	... 23 more
 23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
 23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
 23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
-23:32:40,999 DEBUG ~ select nextval ('hibernate_sequence')
+23:32:40,999 DEBUG ~ select nextval (&#39;hibernate_sequence&#39;)
 23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
 23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
 23:32:41,175 ERROR ~
@@ -201,93 +202,121 @@ Execution exception (In /app/controllers/Application.java around line 57)
 IndexOutOfBoundsException occured : Index: 0, Size: 0
 
 play.exceptions.JavaExecutionException: Index: 0, Size: 0
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
-    at Invocation.HTTP Request(Play!)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
+	at Invocation.HTTP Request(Play!)
 Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
-    at java.util.ArrayList.RangeCheck(ArrayList.java:547)
-    at java.util.ArrayList.get(ArrayList.java:322)
-    at controllers.Application.initSession(Application.java:57)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
-    at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
-    at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
-    at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
-    ... 1 more
-</pre>
-
-
-<p>After <code>23:32:34</code> is when I get the login page. <code>23:32:40</code> is after I've logged in.</p>
-<h4>Second Pass</h4>
-<p>So how did you do? First, the error that <code>type Check already defined</code> usually does mean that <code>Check</code> was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It's the only one there that was <code>Check.java</code>. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, <code>Check.java</code>. Doing a diff shows nothing was changed. So the solution really was just simply delete <code>Check.java</code> and also <code>Secure.java</code>. No more compilation errors!</p>
+	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
+	at java.util.ArrayList.get(ArrayList.java:322)
+	at controllers.Application.initSession(Application.java:57)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
+	at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
+	... 1 more
+</pre></div>
+
+<p>After <code>23:32:34</code> is when I get the login page. <code>23:32:40</code> is after I&rsquo;ve logged in.</p>
+
+<h3 id="second-pass:9dc7854b573f1a2be2b19d1bfe826d39">Second Pass</h3>
+
+<p>So how did you do? First, the error that <code>type Check already defined</code> usually does mean that <code>Check</code> was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It&rsquo;s the only one there that was <code>Check.java</code>. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, <code>Check.java</code>. Doing a diff shows nothing was changed. So the solution really was just simply delete <code>Check.java</code> and also <code>Secure.java</code>. No more compilation errors!</p>
+
 <p>The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,</p>
-<pre class="code literal-block"><span class="k">if</span><span class="o">(</span><span class="n">Security</span><span class="o">.</span><span class="na">isConnected</span><span class="o">())</span> <span class="o">{</span>
-    <span class="o">...</span>
-    <span class="n">Account</span> <span class="n">account</span> <span class="o">=</span> <span class="n">Account</span><span class="o">.</span><span class="na">find</span><span class="o">(</span><span class="s">"username = ?"</span><span class="o">,</span> <span class="n">Security</span><span class="o">.</span><span class="na">connected</span><span class="o">()).</span><span class="na">first</span><span class="o">();</span>
-    <span class="o">...</span>
-    <span class="k">if</span><span class="o">(</span><span class="n">account</span> <span class="o">==</span> <span class="kc">null</span> <span class="o">&amp;&amp;</span> <span class="n">Account</span><span class="o">.</span><span class="na">count</span><span class="o">()</span> <span class="o">==</span> <span class="mi">0</span><span class="o">)</span> <span class="o">{</span>
-        <span class="n">account</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Account</span><span class="o">(</span><span class="s">"admin"</span><span class="o">,</span> <span class="s">"admin"</span><span class="o">,</span> <span class="s">"admin@test.com"</span><span class="o">,</span> <span class="kc">true</span><span class="o">,</span> <span class="kc">null</span><span class="o">);</span>
-        <span class="n">account</span><span class="o">.</span><span class="na">save</span><span class="o">();</span>
-    <span class="o">}</span>
-    <span class="o">...</span>
-<span class="o">}</span>
-</pre>
-
-
-<p>You can actually see this in action at <code>23:32:41,051</code> in the log. So what's wrong with all of this? The account creation happened after I've already logged in. In fact, <code>Security.isConnected()</code> checks whether the user is already logged in or not. How does this even make sense?</p>
-<p>Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we're missing a file called <code>initial-agencies-data.yml</code>. Ok, apparently it's a <a href="http://www.playframework.com/documentation/1.2.5/test#fixtures">fixture</a> like you would use for testing. It's easy enough to infer what the file's contents should be. We just copy it over from the GTFS data.</p>
-<p>But then where do you put the file? If you look at the log, it says <code>/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml</code> but that doesn't look right. That's in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the <code>test/</code> directory? No, that doesn't work either since we're not running a test.</p>
-<p>What I ended up doing was just looking at the sources for <code>Fixtures.load</code>. If you follow the stack trace, you end up finding <code>Play.javaPath</code> which sort of works like PATH for Fixtures and some other things. So where can we put the file? <code>app/</code> and <code>conf/</code>. And with that, we're done.</p>
-<h4 id="conclusion">Conclusion</h4>
-
-<p>GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone <a href="https://github.com/thatsmydoing/gtfs-editor">my branch</a> as I've fixed the issues discussed earlier. The default login is <code>admin:admin</code>.</p>
-<p>Even after getting it to run, it's still not quite usable. Not in the UX sense, but you really can't do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don't have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #008000; font-weight: bold">if</span><span style="color: #666666">(</span>Security<span style="color: #666666">.</span><span style="color: #7D9029">isConnected</span><span style="color: #666666">())</span> <span style="color: #666666">{</span>
+    <span style="color: #666666">...</span>
+    Account account <span style="color: #666666">=</span> Account<span style="color: #666666">.</span><span style="color: #7D9029">find</span><span style="color: #666666">(</span><span style="color: #BA2121">&quot;username = ?&quot;</span><span style="color: #666666">,</span> Security<span style="color: #666666">.</span><span style="color: #7D9029">connected</span><span style="color: #666666">()).</span><span style="color: #7D9029">first</span><span style="color: #666666">();</span>
+    <span style="color: #666666">...</span>
+    <span style="color: #008000; font-weight: bold">if</span><span style="color: #666666">(</span>account <span style="color: #666666">==</span> <span style="color: #008000; font-weight: bold">null</span> <span style="color: #666666">&amp;&amp;</span> Account<span style="color: #666666">.</span><span style="color: #7D9029">count</span><span style="color: #666666">()</span> <span style="color: #666666">==</span> <span style="color: #666666">0)</span> <span style="color: #666666">{</span>
+        account <span style="color: #666666">=</span> <span style="color: #008000; font-weight: bold">new</span> Account<span style="color: #666666">(</span><span style="color: #BA2121">&quot;admin&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;admin&quot;</span><span style="color: #666666">,</span> <span style="color: #BA2121">&quot;admin@test.com&quot;</span><span style="color: #666666">,</span> <span style="color: #008000; font-weight: bold">true</span><span style="color: #666666">,</span> <span style="color: #008000; font-weight: bold">null</span><span style="color: #666666">);</span>
+        account<span style="color: #666666">.</span><span style="color: #7D9029">save</span><span style="color: #666666">();</span>
+    <span style="color: #666666">}</span>
+    <span style="color: #666666">...</span>
+<span style="color: #666666">}</span>
+</pre></div>
+
+<p>You can actually see this in action at <code>23:32:41,051</code> in the log. So what&rsquo;s wrong with all of this? The account creation happened after I&rsquo;ve already logged in. In fact, <code>Security.isConnected()</code> checks whether the user is already logged in or not. How does this even make sense?</p>
+
+<p>Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we&rsquo;re missing a file called <code>initial-agencies-data.yml</code>. Ok, apparently it&rsquo;s a <a href="http://www.playframework.com/documentation/1.2.5/test#fixtures">fixture</a> like you would use for testing. It&rsquo;s easy enough to infer what the file&rsquo;s contents should be. We just copy it over from the GTFS data.</p>
+
+<p>But then where do you put the file? If you look at the log, it says <code>/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml</code> but that doesn&rsquo;t look right. That&rsquo;s in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the <code>test/</code> directory? No, that doesn&rsquo;t work either since we&rsquo;re not running a test.</p>
+
+<p>What I ended up doing was just looking at the sources for <code>Fixtures.load</code>. If you follow the stack trace, you end up finding <code>Play.javaPath</code> which sort of works like PATH for Fixtures and some other things. So where can we put the file? <code>app/</code> and <code>conf/</code>. And with that, we&rsquo;re done.</p>
+
+<h3 id="conclusion">Conclusion</h3>
+
+<p>GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone <a href="https://github.com/thatsmydoing/gtfs-editor">my branch</a> as I&rsquo;ve fixed the issues discussed earlier. The default login is <code>admin:admin</code>.</p>
+
+<p>Even after getting it to run, it&rsquo;s still not quite usable. Not in the UX sense, but you really can&rsquo;t do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don&rsquo;t have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/fare-data.html" rel="prev" title="Fare Data">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/one-bus-or-maybe-jeep-away.html" rel="next" title="One Bus (or maybe Jeep) Away">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/gtfs-editor.html';
+var disqus_title = 'GTFS Editor';
+var disqus_identifier = 'cache/posts/gtfs-editor.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="open-trip-planner.html" rel="prev" title="Open Trip Planner">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="fare-data.html" rel="next" title="Fare Data">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/gtfs-editor.html",
-        disqus_title="GTFS Editor",
-        disqus_identifier="cache/posts/gtfs-editor.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 0 - 206
output/posts/gtfs-editor.md

@@ -1,206 +0,0 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming, lets-debug
-.. date: 2013/07/10 11:30:01
-.. title: GTFS Editor
-.. slug: gtfs-editor
--->
-
-Link: [https://github.com/conveyal/gtfs-editor](https://github.com/conveyal/gtfs-editor)
-
-**TL;DR** they really meant under development
-
-When I first saw the source of GTFS Editor, I was ecstatic. They used [Play framework](http://playframework.com/)!!! Not only that, they're targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.
-
-Getting it to actually run though, wasn't very pleasant. The initial setup was easy enough. Get [Play 1.2.5](http://www.playframework.com/download), install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that's necessary. Wonderful. Then, run play, open a browser, go to [http://localhost:9000](http://localhost:9000), compilation error. Fantastic.
-
-If you don't want to go through the technical details, you can just jump to the [conclusion](#conclusion).
-
-## Let's Debug!
-
-I'll be splitting the next section up into 2 parts. In the first pass, I'll talk about what I did to just get the app to run but I won't try hard to fix any bugs. This generally is what I do when I try to get apps to run. I'll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I'll explain what the problems were and how I fixed them.
-
-### First Pass
-
-A thing to note about Play (and one of the reasons it's a lovely Java framework) is that you don't need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that's what I saw, `Error: type Check already defined`
-
-    :::java
-    @Retention(RetentionPolicy.RUNTIME)
-    @Target({ElementType.METHOD, ElementType.TYPE})
-    public @interface Check { // error here
-    
-        String[] value();
-    }
-
-You also know that typical behavior among programmers where your program doesn't compile, but you keep trying to compile it anyway hoping that it will magically just work. That's what I did, and it actually ran. I couldn't really just let this pass, so I decided to try deleting `Check.java`. I got another compilation error, `Error: type Secure already defined`
-
-    :::java
-    public class Secure extends Controller { // error here
-
-        @Before(unless={"login", "authenticate", "logout"})
-
-        static void checkAccess() throws Throwable {
-
-At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put `Check.java` back in and proceeded to just refresh until it compiled and ran.
-
-The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the `account` table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn't work.
-
-Another note regarding Play 1.x, it provides the [secure module](http://www.playframework.com/documentation/1.2.5/secure) which handles logins and keeping state, you simply need to implement the method `boolean authenticate(String username, String password)`. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return `true` and then any login would work. No need to actually set the password. Excellent.
-
-And we're logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, `IndexOutOfBoundsException occured : Index: 0, Size: 0`
-
-    :::java
-    if(session.get("agencyId") == null) {
-    
-        Agency agency = agencies.get(0); // error here
-        
-        session.put("agencyId", agency.id);
-        session.put("agencyName", agency.name);
-
-Apparently, we need to have an agency. That's generally simple enough. You just manually insert an agency into the `agency` table. After that's done, we finally have a view of the actual application. It's very Bootstrap-y, but that's just fine. The workflow though, is not perfectly intuitive, but I'll talk about that some other day.
-
-That's not the end of it though, we still have to fix these bugs. The developer obviously didn't have to put up with this when they were working, so what happened? Also, the log is showing some weird things,
-
-    :::text
-    ~        _            _
-    ~  _ __ | | __ _ _  _| |
-    ~ | '_ \| |/ _' | || |_|
-    ~ |  __/|_|\____|\__ (_)
-    ~ |_|            |__/
-    ~
-    ~ play! 1.2.5, http://www.playframework.org
-    ~
-    ~ Ctrl+C to stop
-    ~
-    CompilerOracle: exclude jregex/Pretokenizer.next
-    Listening for transport dt_socket at address: 8000
-    23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
-    23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
-    23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
-    23:32:15,830 WARN  ~ You're running Play! in DEV mode
-    23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
-    23:32:28,792 ERROR ~
-    
-    @6f02fa9dd
-    Internal Server Error (500) for request GET /
-    
-    Compilation error (In /app/controllers/Check.java around line 10)
-    The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
-    
-    play.exceptions.CompilationException: The type Check is already defined
-    	at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
-    	at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
-    	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
-    	at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
-    	at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
-    	at play.Play.start(Play.java:516)
-    	at play.Play.detectChanges(Play.java:630)
-    	at play.Invoker$Invocation.init(Invoker.java:198)
-    	at Invocation.HTTP Request(Play!)
-    23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
-    SLF4J: Class path contains multiple SLF4J bindings.
-    SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-    SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
-    SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
-    23:32:32,490 INFO  ~ Initializing HBSpatialExtension
-    23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
-    23:32:32,494 INFO  ~ Checking for default configuration file.
-    23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
-    23:32:34,077 INFO  ~ Application 'gtfs-editor' is now started !
-    23:32:34,151 INFO  ~ Bootstrapping Database...
-    23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
-    play.exceptions.UnexpectedException: Unexpected Error
-    	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
-    	at play.templates.TemplateLoader.load(TemplateLoader.java:78)
-    	at play.test.Fixtures.loadModels(Fixtures.java:174)
-    	at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
-    	at play.jobs.Job.doJobWithResult(Job.java:50)
-    	at play.jobs.Job.call(Job.java:146)
-    	at play.jobs.Job.run(Job.java:132)
-    	at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
-    	at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
-    	at play.Play.start(Play.java:547)
-    	at play.Play.detectChanges(Play.java:630)
-    	at play.Invoker$Invocation.init(Invoker.java:198)
-    	at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
-    	at play.Invoker$Invocation.run(Invoker.java:276)
-    	at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
-    	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
-    	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
-    	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
-    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
-    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
-    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
-    	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
-    	at java.lang.Thread.run(Thread.java:680)
-    Caused by: play.exceptions.UnexpectedException: Unexpected Error
-    	at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
-    	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
-    	... 22 more
-    Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
-    	at java.io.FileInputStream.open(Native Method)
-    	at java.io.FileInputStream.<init>(FileInputStream.java:120)
-    	at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
-    	... 23 more
-    23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
-    23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
-    23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
-    23:32:40,999 DEBUG ~ select nextval ('hibernate_sequence')
-    23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
-    23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
-    23:32:41,175 ERROR ~
-    
-    @6f02fa9dg
-    Internal Server Error (500) for request GET /
-    
-    Execution exception (In /app/controllers/Application.java around line 57)
-    IndexOutOfBoundsException occured : Index: 0, Size: 0
-    
-    play.exceptions.JavaExecutionException: Index: 0, Size: 0
-    	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
-    	at Invocation.HTTP Request(Play!)
-    Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
-    	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
-    	at java.util.ArrayList.get(ArrayList.java:322)
-    	at controllers.Application.initSession(Application.java:57)
-    	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
-    	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
-    	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
-    	at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
-    	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
-    	... 1 more
-
-After `23:32:34` is when I get the login page. `23:32:40` is after I've logged in.
-
-### Second Pass
-
-So how did you do? First, the error that `type Check already defined` usually does mean that `Check` was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It's the only one there that was `Check.java`. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, `Check.java`. Doing a diff shows nothing was changed. So the solution really was just simply delete `Check.java` and also `Secure.java`. No more compilation errors!
-
-The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,
-
-    :::java
-    if(Security.isConnected()) {
-        ...
-        Account account = Account.find("username = ?", Security.connected()).first();
-        ...
-        if(account == null && Account.count() == 0) {
-            account = new Account("admin", "admin", "admin@test.com", true, null);
-            account.save();
-        }
-        ...
-    }
-
-You can actually see this in action at `23:32:41,051` in the log. So what's wrong with all of this? The account creation happened after I've already logged in. In fact, `Security.isConnected()` checks whether the user is already logged in or not. How does this even make sense?
-
-Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we're missing a file called `initial-agencies-data.yml`. Ok, apparently it's a [fixture](http://www.playframework.com/documentation/1.2.5/test#fixtures) like you would use for testing. It's easy enough to infer what the file's contents should be. We just copy it over from the GTFS data.
-
-But then where do you put the file? If you look at the log, it says `/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml` but that doesn't look right. That's in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the `test/` directory? No, that doesn't work either since we're not running a test.
-
-What I ended up doing was just looking at the sources for `Fixtures.load`. If you follow the stack trace, you end up finding `Play.javaPath` which sort of works like PATH for Fixtures and some other things. So where can we put the file? `app/` and `conf/`. And with that, we're done.
-
-<h3 id="conclusion">Conclusion</h3>
-
-GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone [my branch](https://github.com/thatsmydoing/gtfs-editor) as I've fixed the issues discussed earlier. The default login is `admin:admin`.
-
-Even after getting it to run, it's still not quite usable. Not in the UX sense, but you really can't do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don't have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.

+ 131 - 116
output/posts/highways-in-otp.html

@@ -1,126 +1,141 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Highways in OTP | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/highways-in-otp.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="elevation-data-in-otp.html" title="Elevation Data in OTP" type="text/html">
-<link rel="next" href="jeep-and-bus-schedules.html" title="Jeep and Bus Schedules" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Highways in OTP">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/highways-in-otp.html">
-<meta property="og:description" content="One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP's suggested route for walking from UP to Ateneo:
-
-This is just so hilariously wrong. It's mu">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-24T23:15:57+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Highways in OTP - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Highways in OTP</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-24T23:15:57+08:00" itemprop="datePublished" title="2013-07-24 23:15">2013-07-24 23:15</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP's suggested route for walking from UP to Ateneo:</p>
-<p><img alt="Roundabout route from UP to Ateneo" src="../galleries/transit/otproundabout.png"></p>
-<p>This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.</p>
-<p>OTP couldn't possibly be that dumb though, so there must be something we're doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the "road type" designated to Katipunan.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/highways-in-otp.html">Highways in OTP</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-24">2013-07-24</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP&rsquo;s suggested route for walking from UP to Ateneo:</p>
+
+<p><img src="../galleries/transit/otproundabout.png" alt="Roundabout route from UP to Ateneo" /></p>
+
+<p>This is just so hilariously wrong. It&rsquo;s much simpler to just walk along Katipunan Avenue.</p>
+
+<p>OTP couldn&rsquo;t possibly be that dumb though, so there must be something we&rsquo;re doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the &ldquo;road type&rdquo; designated to Katipunan.</p>
+
 <p>Apparently, by default OTP will consider roads of type <code>trunk</code> to be non-walkable and non-bikable. This is documented in the <a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner">OpenStreetMap wiki</a> and the <a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety">OTP wiki</a> as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.</p>
-<pre class="code literal-block">sed -i .bak s/trunk/primary/g manila.osm
-</pre>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">sed -i .bak s/trunk/primary/g manila.osm
+</pre></div>
 
+<p>And rebuild the graph. It doesn&rsquo;t really matter much because the OSM data isn&rsquo;t used to render the maps. It&rsquo;s just used to build the routing data. This is actually what I did for <a href="http://maps.pleasantprogrammer.com">maps.pleasantprogrammer.com</a>.</p>
 
-<p>And rebuild the graph. It doesn't really matter much because the OSM data isn't used to render the maps. It's just used to build the routing data. This is actually what I did for <a href="http://maps.pleasantprogrammer.com">maps.pleasantprogrammer.com</a>.</p>
-<p>It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on <code>highway=trunk</code> we could allow that. This is not much better than the <code>sed</code> solution though. It's better since you keep the weighting done by OTP, but you're still saying that all trunks are walkable which might not be the case.</p>
-<p>The most correct way to actually fix this is to go through each of the trunks and specifying <code>foot=yes</code> and <code>bicycle=yes</code> for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I'm not sure on the particulars with updating OSM though.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="elevation-data-in-otp.html" rel="prev" title="Elevation Data in OTP">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="jeep-and-bus-schedules.html" rel="next" title="Jeep and Bus Schedules">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/highways-in-otp.html",
-        disqus_title="Highways in OTP",
-        disqus_identifier="cache/posts/highways-in-otp.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+<p>It&rsquo;s also possible to set the default way properties in OTP. Instead of disallowing walking and biking on <code>highway=trunk</code> we could allow that. This is not much better than the <code>sed</code> solution though. It&rsquo;s better since you keep the weighting done by OTP, but you&rsquo;re still saying that all trunks are walkable which might not be the case.</p>
+
+<p>The most correct way to actually fix this is to go through each of the trunks and specifying <code>foot=yes</code> and <code>bicycle=yes</code> for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I&rsquo;m not sure on the particulars with updating OSM though.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/jeep-and-bus-schedules.html" rel="prev" title="Jeep and Bus Schedules">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/elevation-data-in-otp.html" rel="next" title="Elevation Data in OTP">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/highways-in-otp.html';
+var disqus_title = 'Highways in OTP';
+var disqus_identifier = 'cache/posts/highways-in-otp.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 144 - 118
output/posts/is-my-terminal-window-active.html

@@ -1,125 +1,151 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Is My Terminal Window Active? | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" title="Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU" type="text/html">
-<link rel="next" href="tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" title="TiddlyWiki in the Sky (or TiddlyWeb for TW5)" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Is My Terminal Window Active?">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html">
-<meta property="og:description" content="I've been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2015-06-07T16:20:45+08:00">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Is My Terminal Window Active? - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Is My Terminal Window Active?</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2015-06-07T16:20:45+08:00" itemprop="datePublished" title="2015-06-07 16:20">2015-06-07 16:20</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>I've been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is <a href="https://github.com/marzocchi/zsh-notify">zsh-notify</a>. It's a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.</p>
-<p>It's pretty convenient when you're compiling something and then go on to browse reddit while waiting. Usually, I spend too much time just reading and forget about the compilation entirely. With the plugin, I get the notification and maybe go back to work.</p>
-<p>One nice feature it has is that if you're currently looking at the terminal window of the job that just finished, it won't notify you. It only notifies on windows that aren't currently in focus. To do this, it has to actually talk to Terminal.app or iTerm2 to see if the window and tab are active.</p>
-<p>This is alright in OSX since those 2 are the generally most used terminal emulators. On Linux though, everyone has their own favorite terminal. Given that, I figured I could probably rely on talking to X to see if the window is active instead of each single terminal emulator. X can't tell if the tab is active though, but I don't use tabs in my current setup so it should still be good.</p>
-<h3>xdotool</h3>
-<p><a href="http://superuser.com/questions/382616/detecting-currently-active-window">Preliminary research</a> reveals that we can easily get what the active window is with xdotool. <code>xdotool getactivewindow</code> gives us the X window id of the active one. Now all we need is a way to get the window id of the terminal we're in.</p>
-<h3>First Attempt: $WINDOWID</h3>
-<p>Apparently, xterm and similar terminal emulators define an environment variable called <code>$WINDOWID</code> with the window id of the terminal. Obviously, this is too good to be true. In xterm and konsole the <code>$WINDOWID</code> was correct, but in VTE-based terminal emulators, <code>$WINDOWID</code> had the wrong value. In terminology, it didn't define <code>$WINDOWID</code> altogether. So <code>$WINDOWID</code> wasn't going to work.</p>
-<h3>Second Attempt: xdotool search $MAGIC</h3>
-<p>My second idea was that you can use zsh to change the window title to a magic number and then just check if the active window is the same one as the window with the magic number. This sort of worked for most terminals, except konsole which does whatever it wants with the window title. There's also the problem of some zsh configs automatically settings the window title to the current command.</p>
-<p>In hindsight, I could probably have just done <code>xdotool search --name xdotool</code> since in most cases, when you run the search, zsh or konsole will set the window name to the current command. Maybe that's another option I can explore some day.</p>
-<h3>Third Attempt: $PPID</h3>
-<p>My third idea was another environment variable called <code>$PPID</code>, which is the process id of the parent of the shell. As it happens, the parent is the window containing the zsh instance. This is actually pretty consistent across most terminals. The only problem was if you launched zsh from another shell since your new zsh's parent will now be another zsh instance instead of an X window.</p>
-<p>At first glance, launching zsh within zsh doesn't seem like something most people would do, but this is what happens when you run screen or tmux. To work around this, we can actually just save the original <code>$PPID</code> in a different variable and use that instead.</p>
-<p>Now that we have the PID of the window from zsh, we can once again use xdotool to get the PID of the current active window with <code>xdotool getactivewindow getwindowpid</code>. We just simply compare that with our <code>$PPID</code> and we can tell if we're in an active window or not. Overall, this approach worked surprisingly well so that's the final solution I went with.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" rel="prev" title="Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" rel="next" title="TiddlyWiki in the Sky (or TiddlyWeb for TW5)">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html",
-        disqus_title="Is My Terminal Window Active?",
-        disqus_identifier="cache/posts/is-my-terminal-window-active.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/is-my-terminal-window-active.html">Is My Terminal Window Active?</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2015-06-07">2015-06-07</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		
+
+<p>I&rsquo;ve been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is <a href="https://github.com/marzocchi/zsh-notify">zsh-notify</a>. It&rsquo;s a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.</p>
+
+<p>It&rsquo;s pretty convenient when you&rsquo;re compiling something and then go on to browse reddit while waiting. Usually, I spend too much time just reading and forget about the compilation entirely. With the plugin, I get the notification and maybe go back to work.</p>
+
+<p>One nice feature it has is that if you&rsquo;re currently looking at the terminal window of the job that just finished, it won&rsquo;t notify you. It only notifies on windows that aren&rsquo;t currently in focus. To do this, it has to actually talk to Terminal.app or iTerm2 to see if the window and tab are active.</p>
+
+<p>This is alright in OSX since those 2 are the generally most used terminal emulators. On Linux though, everyone has their own favorite terminal. Given that, I figured I could probably rely on talking to X to see if the window is active instead of each single terminal emulator. X can&rsquo;t tell if the tab is active though, but I don&rsquo;t use tabs in my current setup so it should still be good.</p>
+
+<h2 id="xdotool:bfade06d39f7975f041a61de11ad4d4f">xdotool</h2>
+
+<p><a href="http://superuser.com/questions/382616/detecting-currently-active-window">Preliminary research</a> reveals that we can easily get what the active window is with xdotool. <code>xdotool getactivewindow</code> gives us the X window id of the active one. Now all we need is a way to get the window id of the terminal we&rsquo;re in.</p>
+
+<h2 id="first-attempt-windowid:bfade06d39f7975f041a61de11ad4d4f">First Attempt: $WINDOWID</h2>
+
+<p>Apparently, xterm and similar terminal emulators define an environment variable called <code>$WINDOWID</code> with the window id of the terminal. Obviously, this is too good to be true. In xterm and konsole the <code>$WINDOWID</code> was correct, but in VTE-based terminal emulators, <code>$WINDOWID</code> had the wrong value. In terminology, it didn&rsquo;t define <code>$WINDOWID</code> altogether. So <code>$WINDOWID</code> wasn&rsquo;t going to work.</p>
+
+<h2 id="second-attempt-xdotool-search-magic:bfade06d39f7975f041a61de11ad4d4f">Second Attempt: xdotool search $MAGIC</h2>
+
+<p>My second idea was that you can use zsh to change the window title to a magic number and then just check if the active window is the same one as the window with the magic number. This sort of worked for most terminals, except konsole which does whatever it wants with the window title. There&rsquo;s also the problem of some zsh configs automatically settings the window title to the current command.</p>
+
+<p>In hindsight, I could probably have just done <code>xdotool search --name xdotool</code> since in most cases, when you run the search, zsh or konsole will set the window name to the current command. Maybe that&rsquo;s another option I can explore some day.</p>
+
+<h2 id="third-attempt-ppid:bfade06d39f7975f041a61de11ad4d4f">Third Attempt: $PPID</h2>
+
+<p>My third idea was another environment variable called <code>$PPID</code>, which is the process id of the parent of the shell. As it happens, the parent is the window containing the zsh instance. This is actually pretty consistent across most terminals. The only problem was if you launched zsh from another shell since your new zsh&rsquo;s parent will now be another zsh instance instead of an X window.</p>
+
+<p>At first glance, launching zsh within zsh doesn&rsquo;t seem like something most people would do, but this is what happens when you run screen or tmux. To work around this, we can actually just save the original <code>$PPID</code> in a different variable and use that instead.</p>
+
+<p>Now that we have the PID of the window from zsh, we can once again use xdotool to get the PID of the current active window with <code>xdotool getactivewindow getwindowpid</code>. We just simply compare that with our <code>$PPID</code> and we can tell if we&rsquo;re in an active window or not. Overall, this approach worked surprisingly well so that&rsquo;s the final solution I went with.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html" rel="prev" title="TiddlyWiki in the Sky (or TiddlyWeb for TW5)">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html" rel="next" title="Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/is-my-terminal-window-active.html';
+var disqus_title = 'Is My Terminal Window Active?';
+var disqus_identifier = 'cache/posts/is-my-terminal-window-active.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 136 - 119
output/posts/jeep-and-bus-schedules.html

@@ -1,132 +1,149 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Jeep and Bus Schedules | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="highways-in-otp.html" title="Highways in OTP" type="text/html">
-<link rel="next" href="geocoding-services.html" title="Geocoding Services" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Jeep and Bus Schedules">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html">
-<meta property="og:description" content="Wouldn't it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist's paradise. Imagine biking along EDSA, normally that would be a death sent">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-28T16:26:31+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Jeep and Bus Schedules - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Jeep and Bus Schedules</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-28T16:26:31+08:00" itemprop="datePublished" title="2013-07-28 16:26">2013-07-28 16:26</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>Wouldn't it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist's paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn't worry. I can assure you, it's still a death sentence.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/jeep-and-bus-schedules.html">Jeep and Bus Schedules</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-28">2013-07-28</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>Wouldn&rsquo;t it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist&rsquo;s paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn&rsquo;t worry. I can assure you, it&rsquo;s still a death sentence.</p>
+
 <p>The GTFS spec defines 2 ways of statically specifying trip schedules. You can define the exact times that a service will arrive at a stop. You can also specify between what times the service is active and how often a new bus or jeep leaves the first stop. You also define which days those rules apply. You could say every MWF, the bus operates from 9:00AM to 9:00PM and every TTH, the bus services from 3:00AM to 11:00PM.</p>
-<p>This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there's another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.</p>
-<p>Like much everything else about the Philippine transit system, there aren't really any "schedules" to speak of. It's generally whenever the buses or jeeps feel like it. So we have no static schedules. We don't have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.</p>
-<p>Ideally, we shouldn't bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn't work without it. So we have to add a reasonable trip schedule for jeeps and buses.</p>
+
+<p>This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there&rsquo;s another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.</p>
+
+<p>Like much everything else about the Philippine transit system, there aren&rsquo;t really any &ldquo;schedules&rdquo; to speak of. It&rsquo;s generally whenever the buses or jeeps feel like it. So we have no static schedules. We don&rsquo;t have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.</p>
+
+<p>Ideally, we shouldn&rsquo;t bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn&rsquo;t work without it. So we have to add a reasonable trip schedule for jeeps and buses.</p>
+
 <p>The current GTFS data does define these trip schedules. We assume that jeeps and buses operate between 6:00AM and 11:00PM and a new jeep passes by every 10 minutes. Also, jeeps and buses are defined to only operate on weekdays.</p>
-<p>While there might be jeeps who change routes or don't operate on weekends, I'm pretty sure that jeeps and buses run on weekends. We'll have to fix it ourselves temporarily since there's no central GTFS feed yet.</p>
-<pre class="code literal-block"><span class="c"># 724594 seems to be the service id used by jeeps and buses</span>
-sed -i .bak <span class="s1">'/^724594/ s/0,0/1,1/'</span> calendar.txt
-</pre>
 
+<p>While there might be jeeps who change routes or don&rsquo;t operate on weekends, I&rsquo;m pretty sure that jeeps and buses run on weekends. We&rsquo;ll have to fix it ourselves temporarily since there&rsquo;s no central GTFS feed yet.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic"># 724594 seems to be the service id used by jeeps and buses</span>
+sed -i .bak <span style="color: #BA2121">&#39;/^724594/ s/0,0/1,1/&#39;</span> calendar.txt
+</pre></div>
 
-<p>Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you're sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.</p>
-<p>If we set the frequency to one minute, it <em>might</em> give better routes by eliminating the timing issue. Or not, it's kind of hard to tell.</p>
-<pre class="code literal-block"><span class="c"># jeep and bus route ids tend to start with 72</span>
-sed -i .bak <span class="s1">'/^72/ s/,600/,60/'</span> frequencies.txt
-</pre>
+<p>Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you&rsquo;re sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.</p>
 
+<p>If we set the frequency to one minute, it <em>might</em> give better routes by eliminating the timing issue. Or not, it&rsquo;s kind of hard to tell.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic"># jeep and bus route ids tend to start with 72</span>
+sed -i .bak <span style="color: #BA2121">&#39;/^72/ s/,600/,60/&#39;</span> frequencies.txt
+</pre></div>
 
-<p>Overall, the problems we're having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don't need to do hackish things for it to fit the GTFS, but that's still a dream. For now, all we can really do is fit a triangle into a square hole.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="highways-in-otp.html" rel="prev" title="Highways in OTP">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="geocoding-services.html" rel="next" title="Geocoding Services">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html",
-        disqus_title="Jeep and Bus Schedules",
-        disqus_identifier="cache/posts/jeep-and-bus-schedules.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+<p>Overall, the problems we&rsquo;re having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don&rsquo;t need to do hackish things for it to fit the GTFS, but that&rsquo;s still a dream. For now, all we can really do is fit a triangle into a square hole.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/geocoding-services.html" rel="prev" title="Geocoding Services">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/highways-in-otp.html" rel="next" title="Highways in OTP">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/jeep-and-bus-schedules.html';
+var disqus_title = 'Jeep and Bus Schedules';
+var disqus_identifier = 'cache/posts/jeep-and-bus-schedules.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 130 - 112
output/posts/jeepney-and-bus-routes.html

@@ -1,119 +1,137 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Jeepney and Bus Routes | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/jeepney-and-bus-routes.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="philippine-transit-app-challenge.html" title="Philippine Transit App Challenge" type="text/html">
-<link rel="next" href="one-bus-or-maybe-jeep-away.html" title="One Bus (or maybe Jeep) Away" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Jeepney and Bus Routes">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/jeepney-and-bus-routes.html">
-<meta property="og:description" content="In the last post, I talked about how we now have data about jeepney and bus routes in the Philippines. The data is actually in the GTFS format, which is the format the Google Maps consumes transit dat">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-07T10:32:36+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Jeepney and Bus Routes - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Jeepney and Bus Routes</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-07T10:32:36+08:00" itemprop="datePublished" title="2013-07-07 10:32">2013-07-07 10:32</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>In the <a href="philippine-transit-app-challenge.html">last post</a>, I talked about how we now have data about jeepney and bus routes in the Philippines. The data is actually in the <a href="https://developers.google.com/transit/gtfs/">GTFS format</a>, which is the format the Google Maps consumes transit data. Apparently, the government will be submitting the GTFS data later this year. Transit directions for Metro Manila in Google Maps would be wonderful. That said, it definitely raises the bar for the app challenge people.</p>
-<p>In the last post, I mentioned the quality of the data isn't quite good. Even before seeing the data, I was already a bit unsure of it. The key problem is how you model the routes. The GTFS format was inherently designed for more well developed and organized transit agencies which isn't exactly what we have in the Philippines now.</p>
-<p>One potential problem is the nature of the jeeps and buses. GTFS routes are a collection of trips which are a sequence of stops. However, we don't have jeepney stops, and even if we did they still just stop anywhere. There are also times where jeeps will take a shortcut if no passengers need to get dropped off along their normal route.</p>
-<p>From what I've seen of the data, they handled the first problem well enough. Stops are defined as where people typically get on the jeep or bus. This is good, but they didn't define a shape for the routes. There is no information as to which exact roads they pass through. All we have to go by are the stops to show the route on a map.</p>
-<p><img alt="sample route" src="http://i.imgur.com/NSVlryE.jpg"></p>
-<p>The problem isn't that bad though. The agencies could still add the shapes later on. Or maybe an app challenge participant could make an app around fixing the routes via crowd-sourcing or similar. The shape itself isn't that important for a rudimentary directions app, but if we want better apps, we will need better data.</p>
-<p>There were also some minor issues with the data itself. Some of the files had extra columns. This normally isn't an issue, but it caused problems for <a href="https://github.com/harrisony/gtfs_SQL_importer">GTFS SQL importer</a>. There were also problems with matching the shape data with the stops when I tried it with <a href="http://onebusaway.org">OneBusAway</a>. They could probably be <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching">fixed</a> but that's for another day.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="philippine-transit-app-challenge.html" rel="prev" title="Philippine Transit App Challenge">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="one-bus-or-maybe-jeep-away.html" rel="next" title="One Bus (or maybe Jeep) Away">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/jeepney-and-bus-routes.html",
-        disqus_title="Jeepney and Bus Routes",
-        disqus_identifier="cache/posts/jeepney-and-bus-routes.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/jeepney-and-bus-routes.html">Jeepney and Bus Routes</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-07">2013-07-07</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>In the <a href="philippine-transit-app-challenge.html">last post</a>, I talked about how we now have data about jeepney and bus routes in the Philippines. The data is actually in the <a href="https://developers.google.com/transit/gtfs/">GTFS format</a>, which is the format the Google Maps consumes transit data. Apparently, the government will be submitting the GTFS data later this year. Transit directions for Metro Manila in Google Maps would be wonderful. That said, it definitely raises the bar for the app challenge people.</p>
+
+<p>In the last post, I mentioned the quality of the data isn&rsquo;t quite good. Even before seeing the data, I was already a bit unsure of it. The key problem is how you model the routes. The GTFS format was inherently designed for more well developed and organized transit agencies which isn&rsquo;t exactly what we have in the Philippines now.</p>
+
+<p>One potential problem is the nature of the jeeps and buses. GTFS routes are a collection of trips which are a sequence of stops. However, we don&rsquo;t have jeepney stops, and even if we did they still just stop anywhere. There are also times where jeeps will take a shortcut if no passengers need to get dropped off along their normal route.</p>
+
+<p>From what I&rsquo;ve seen of the data, they handled the first problem well enough. Stops are defined as where people typically get on the jeep or bus. This is good, but they didn&rsquo;t define a shape for the routes. There is no information as to which exact roads they pass through. All we have to go by are the stops to show the route on a map.</p>
+
+<p><img src="http://i.imgur.com/NSVlryE.jpg" alt="sample route" /></p>
+
+<p>The problem isn&rsquo;t that bad though. The agencies could still add the shapes later on. Or maybe an app challenge participant could make an app around fixing the routes via crowd-sourcing or similar. The shape itself isn&rsquo;t that important for a rudimentary directions app, but if we want better apps, we will need better data.</p>
+
+<p>There were also some minor issues with the data itself. Some of the files had extra columns. This normally isn&rsquo;t an issue, but it caused problems for <a href="https://github.com/harrisony/gtfs_SQL_importer">GTFS SQL importer</a>. There were also problems with matching the shape data with the stops when I tried it with <a href="http://onebusaway.org">OneBusAway</a>. They could probably be <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching">fixed</a> but that&rsquo;s for another day.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/open-trip-planner.html" rel="prev" title="Open Trip Planner">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/philippine-transit-app-challenge.html" rel="next" title="Philippine Transit App Challenge">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/jeepney-and-bus-routes.html';
+var disqus_title = 'Jeepney and Bus Routes';
+var disqus_identifier = 'cache/posts/jeepney-and-bus-routes.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 0 - 22
output/posts/jeepney-and-bus-routes.md

@@ -1,22 +0,0 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/07 10:32:36
-.. title: Jeepney and Bus Routes
-.. slug: jeepney-and-bus-routes
--->
-
-In the [last post](philippine-transit-app-challenge.html), I talked about how we now have data about jeepney and bus routes in the Philippines. The data is actually in the [GTFS format](https://developers.google.com/transit/gtfs/), which is the format the Google Maps consumes transit data. Apparently, the government will be submitting the GTFS data later this year. Transit directions for Metro Manila in Google Maps would be wonderful. That said, it definitely raises the bar for the app challenge people.
-
-In the last post, I mentioned the quality of the data isn't quite good. Even before seeing the data, I was already a bit unsure of it. The key problem is how you model the routes. The GTFS format was inherently designed for more well developed and organized transit agencies which isn't exactly what we have in the Philippines now.
-
-One potential problem is the nature of the jeeps and buses. GTFS routes are a collection of trips which are a sequence of stops. However, we don't have jeepney stops, and even if we did they still just stop anywhere. There are also times where jeeps will take a shortcut if no passengers need to get dropped off along their normal route.
-
-From what I've seen of the data, they handled the first problem well enough. Stops are defined as where people typically get on the jeep or bus. This is good, but they didn't define a shape for the routes. There is no information as to which exact roads they pass through. All we have to go by are the stops to show the route on a map.
-
-![sample route](http://i.imgur.com/NSVlryE.jpg)
-
-The problem isn't that bad though. The agencies could still add the shapes later on. Or maybe an app challenge participant could make an app around fixing the routes via crowd-sourcing or similar. The shape itself isn't that important for a rudimentary directions app, but if we want better apps, we will need better data.
-
-There were also some minor issues with the data itself. Some of the files had extra columns. This normally isn't an issue, but it caused problems for [GTFS SQL importer](https://github.com/harrisony/gtfs_SQL_importer). There were also problems with matching the shape data with the stops when I tried it with [OneBusAway](http://onebusaway.org). They could probably be [fixed](https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching) but that's for another day.

+ 137 - 116
output/posts/one-bus-or-maybe-jeep-away.html

@@ -1,126 +1,147 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>One Bus (or maybe Jeep) Away | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="jeepney-and-bus-routes.html" title="Jeepney and Bus Routes" type="text/html">
-<link rel="next" href="open-trip-planner.html" title="Open Trip Planner" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="One Bus (or maybe Jeep) Away">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html">
-<meta property="og:description" content="Link: http://onebusaway.org/
-TL;DR no routing; useless in Philippines
-OneBusAway is a transit information app. It provides data on what bus stops are near you, which buses pass by. You can also get sc">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-09T01:53:59+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>One Bus (or maybe Jeep) Away - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">One Bus (or maybe Jeep) Away</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-09T01:53:59+08:00" itemprop="datePublished" title="2013-07-09 01:53">2013-07-09 01:53</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>Link: <a href="http://onebusaway.org/">http://onebusaway.org/</a></p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/one-bus-or-maybe-jeep-away.html">One Bus (or maybe Jeep) Away</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-09">2013-07-09</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>Link: <a href="http://onebusaway.org/">http://onebusaway.org/</a></p>
+
 <p><strong>TL;DR</strong> no routing; useless in Philippines</p>
+
 <p>OneBusAway is a transit information app. It provides data on what bus stops are near you, which buses pass by. You can also get schedules and the route of a particular bus given the number. It can also provide realtime updates like how many minutes until the next bus arrives. It does not, however, provide routing. There is no support for providing directions to get from point A to point B.</p>
-<p>It's comparable to what you get in some bus stops abroad. You'd get a vicinity map and a list of buses passing through the stop. You might also get the times when the next buses will pass. It's useful for locals who already know how to get around, and want to avoid waiting for the bus. But it's not particularly good for people who want to know how to get around the city.</p>
-<p>OneBusAway is quite comprehensive in its platform support though. There is a webapp, apps for iOS, Android and Windows Phone, as well as SMS and Voice support. This would all be nice but we don't have the necessary infrastructure yet in the Philippines. We don't have bus or jeepney stops. We also wouldn't have realtime data to make the app particularly useful.</p>
+
+<p>It&rsquo;s comparable to what you get in some bus stops abroad. You&rsquo;d get a vicinity map and a list of buses passing through the stop. You might also get the times when the next buses will pass. It&rsquo;s useful for locals who already know how to get around, and want to avoid waiting for the bus. But it&rsquo;s not particularly good for people who want to know how to get around the city.</p>
+
+<p>OneBusAway is quite comprehensive in its platform support though. There is a webapp, apps for iOS, Android and Windows Phone, as well as SMS and Voice support. This would all be nice but we don&rsquo;t have the necessary infrastructure yet in the Philippines. We don&rsquo;t have bus or jeepney stops. We also wouldn&rsquo;t have realtime data to make the app particularly useful.</p>
+
 <p>You can try it out for yourself by following their <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/OneBusAway-Quickstart-Guide">Quickstart Guide</a>. One caveat is you will have to add <code>-P tripEntriesFactory.throwExceptionOnInvalidStopToShapeMappingException=false</code> when building the bundle. This has to do with the OneBusAway having difficulty matching the <a href="https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching">stops to the shape data</a>.</p>
-<p>Here's some screenshots of the app with the Philippine data. Notice how you only see the stops but there isn't a line for the route. This is a problem with our GTFS data. Also, at some points it's hard to tell where the jeep is going to pass since there isn't any indication of order either. This is more of a OneBusAway problem. It usually expects there to be shape data available.</p>
-<p><a href="../galleries/transit/onebusaway1.png"><img alt="OneBusAway" src="../galleries/transit/onebusaway1.png" title="All the stops along Katipunan Avenue are named Katipunan Avenue."></a></p>
-<p>It doesn't really handle too many routes passing through a stop. The list just overflows past the bubble. You can still actually read it by panning the map. It's just a bit weird though.</p>
-<p>If you also noticed, there are usually 2 of each route. This is how the jeepney data was modeled as jeep routes might be different going one way and going back. This isn't the case for all jeeps though, so it might also be an implementation issue with the GTFS editor.</p>
-<p><a href="../galleries/transit/onebusaway2.png"><img alt="OneBusAway" src="../galleries/transit/onebusaway2.png"></a></p>
-<p><a href="../galleries/transit/onebusaway3.png"><img alt="OneBusAway" src="../galleries/transit/onebusaway3.png"></a></p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="jeepney-and-bus-routes.html" rel="prev" title="Jeepney and Bus Routes">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="open-trip-planner.html" rel="next" title="Open Trip Planner">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html",
-        disqus_title="One Bus (or maybe Jeep) Away",
-        disqus_identifier="cache/posts/one-bus-or-maybe-jeep-away.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+
+<p>Here&rsquo;s some screenshots of the app with the Philippine data. Notice how you only see the stops but there isn&rsquo;t a line for the route. This is a problem with our GTFS data. Also, at some points it&rsquo;s hard to tell where the jeep is going to pass since there isn&rsquo;t any indication of order either. This is more of a OneBusAway problem. It usually expects there to be shape data available.</p>
+
+<p><a href="../galleries/transit/onebusaway1.png"><img src="../galleries/transit/onebusaway1.png" alt="OneBusAway" title="All the stops along Katipunan Avenue are named Katipunan Avenue." /></a></p>
+
+<p>It doesn&rsquo;t really handle too many routes passing through a stop. The list just overflows past the bubble. You can still actually read it by panning the map. It&rsquo;s just a bit weird though.</p>
+
+<p>If you also noticed, there are usually 2 of each route. This is how the jeepney data was modeled as jeep routes might be different going one way and going back. This isn&rsquo;t the case for all jeeps though, so it might also be an implementation issue with the GTFS editor.</p>
+
+<p><a href="../galleries/transit/onebusaway2.png"><img src="../galleries/transit/onebusaway2.png" alt="OneBusAway" /></a></p>
+
+<p><a href="../galleries/transit/onebusaway3.png"><img src="../galleries/transit/onebusaway3.png" alt="OneBusAway" /></a></p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/gtfs-editor.html" rel="prev" title="GTFS Editor">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/open-trip-planner.html" rel="next" title="Open Trip Planner">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/one-bus-or-maybe-jeep-away.html';
+var disqus_title = 'One Bus (or maybe Jeep) Away';
+var disqus_identifier = 'cache/posts/one-bus-or-maybe-jeep-away.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 156 - 125
output/posts/open-trip-planner.html

@@ -1,134 +1,165 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Open Trip Planner | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/open-trip-planner.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="one-bus-or-maybe-jeep-away.html" title="One Bus (or maybe Jeep) Away" type="text/html">
-<link rel="next" href="gtfs-editor.html" title="GTFS Editor" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Open Trip Planner">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/open-trip-planner.html">
-<meta property="og:description" content="Link: http://www.opentripplanner.org
-TL;DR routes pretty well; data might cause weird issues
-OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible ">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-09T23:16:12+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Open Trip Planner - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Open Trip Planner</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-09T23:16:12+08:00" itemprop="datePublished" title="2013-07-09 23:16">2013-07-09 23:16</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/open-trip-planner.html">Open Trip Planner</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-09">2013-07-09</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		
+
 <p>Link: <a href="http://www.opentripplanner.org">http://www.opentripplanner.org</a></p>
+
 <p><strong>TL;DR</strong> routes pretty well; data might cause weird issues</p>
-<p>OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you're willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.</p>
-<p>It's actually in general use by the <a href="http://maps.trimet.org/">Trimet</a>, Portland's public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner's support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn't have. This actually just screams <a href="http://philippine-transit.hackathome.com/prizes/">Inclusive Technology Award</a>.</p>
-<h4>Setup</h4>
-<p>Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I'd suggest going through the <a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes">5-minute introduction</a> if you want to actually work with the Philippine data. You will also need to download the <a href="http://download.geofabrik.de/asia/philippines.html">Philippine data dump</a> from OSM. You will want the <code>osm.bz2</code> one (WARNING: 900MB unzipped).</p>
-<p>Once you get the webapp running, you'll notice the map tiles won't load correctly. This is because the default tileset used is from Mapbox which doesn't provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.</p>
-<h4>Issues</h4>
-<p>The next thing you'll notice is that you can't search for a place. You can only just pick points on the map and route between those. I'm still not exactly sure if it's supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn't be too difficult.</p>
-<p>Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet's implementation isn't as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.</p>
-<p>There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a "stop" in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the "stop" to Arguilla.</p>
-<p><img alt="OpenTripPlanner disconnected route" src="../galleries/transit/otp1.png"></p>
-<p>I can't say this isn't a bug. After all, OpenTripPlanner couldn't have magically known there really was a street there. If it did, it wouldn't just teleport you to the corner. I'm more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.</p>
-<p>Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won't give you the best route because it thinks you have to loop around to get to where you want to be. I don't really know how common this issue pops up though. It's highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.</p>
-<p><img alt="OpenTripPlanner loopy route" src="../galleries/transit/otp2.png"></p>
-<p>Much like the earlier problem, I can't tell if this is a bug or it's a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren't even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.</p>
-<p><img alt="UP Katipunan Route" src="../galleries/transit/upkatipunan.jpg"></p>
-<p>From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren't that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.</p>
-<h4>Conclusion</h4>
-<p>Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There's also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="one-bus-or-maybe-jeep-away.html" rel="prev" title="One Bus (or maybe Jeep) Away">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="gtfs-editor.html" rel="next" title="GTFS Editor">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/open-trip-planner.html",
-        disqus_title="Open Trip Planner",
-        disqus_identifier="cache/posts/open-trip-planner.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+
+<p>OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you&rsquo;re willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.</p>
+
+<p>It&rsquo;s actually in general use by the <a href="http://maps.trimet.org/">Trimet</a>, Portland&rsquo;s public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner&rsquo;s support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn&rsquo;t have. This actually just screams <a href="http://philippine-transit.hackathome.com/prizes/">Inclusive Technology Award</a>.</p>
+
+<h3 id="setup:8052f9d579c0ac6326f58a643a8791fb">Setup</h3>
+
+<p>Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I&rsquo;d suggest going through the <a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes">5-minute introduction</a> if you want to actually work with the Philippine data. You will also need to download the <a href="http://download.geofabrik.de/asia/philippines.html">Philippine data dump</a> from OSM. You will want the <code>osm.bz2</code> one (WARNING: 900MB unzipped).</p>
+
+<p>Once you get the webapp running, you&rsquo;ll notice the map tiles won&rsquo;t load correctly. This is because the default tileset used is from Mapbox which doesn&rsquo;t provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.</p>
+
+<h3 id="issues:8052f9d579c0ac6326f58a643a8791fb">Issues</h3>
+
+<p>The next thing you&rsquo;ll notice is that you can&rsquo;t search for a place. You can only just pick points on the map and route between those. I&rsquo;m still not exactly sure if it&rsquo;s supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn&rsquo;t be too difficult.</p>
+
+<p>Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet&rsquo;s implementation isn&rsquo;t as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.</p>
+
+<p>There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a &ldquo;stop&rdquo; in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the &ldquo;stop&rdquo; to Arguilla.</p>
+
+<p><img src="../galleries/transit/otp1.png" alt="OpenTripPlanner disconnected route" /></p>
+
+<p>I can&rsquo;t say this isn&rsquo;t a bug. After all, OpenTripPlanner couldn&rsquo;t have magically known there really was a street there. If it did, it wouldn&rsquo;t just teleport you to the corner. I&rsquo;m more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.</p>
+
+<p>Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won&rsquo;t give you the best route because it thinks you have to loop around to get to where you want to be. I don&rsquo;t really know how common this issue pops up though. It&rsquo;s highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.</p>
+
+<p><img src="../galleries/transit/otp2.png" alt="OpenTripPlanner loopy route" /></p>
+
+<p>Much like the earlier problem, I can&rsquo;t tell if this is a bug or it&rsquo;s a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren&rsquo;t even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.</p>
+
+<p><img src="../galleries/transit/upkatipunan.jpg" alt="UP Katipunan Route" /></p>
+
+<p>From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren&rsquo;t that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.</p>
+
+<h3 id="conclusion:8052f9d579c0ac6326f58a643a8791fb">Conclusion</h3>
+
+<p>Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There&rsquo;s also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/one-bus-or-maybe-jeep-away.html" rel="prev" title="One Bus (or maybe Jeep) Away">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/jeepney-and-bus-routes.html" rel="next" title="Jeepney and Bus Routes">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/open-trip-planner.html';
+var disqus_title = 'Open Trip Planner';
+var disqus_identifier = 'cache/posts/open-trip-planner.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 0 - 48
output/posts/open-trip-planner.md

@@ -1,48 +0,0 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/09 23:16:12
-.. title: Open Trip Planner
-.. slug: open-trip-planner
--->
-
-Link: [http://www.opentripplanner.org](http://www.opentripplanner.org)
-
-**TL;DR** routes pretty well; data might cause weird issues
-
-OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you're willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.
-
-It's actually in general use by the [Trimet](http://maps.trimet.org/), Portland's public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner's support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn't have. This actually just screams [Inclusive Technology Award](http://philippine-transit.hackathome.com/prizes/).
-
-### Setup
-
-Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I'd suggest going through the [5-minute introduction](https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes) if you want to actually work with the Philippine data. You will also need to download the [Philippine data dump](http://download.geofabrik.de/asia/philippines.html) from OSM. You will want the `osm.bz2` one (WARNING: 900MB unzipped).
-
-Once you get the webapp running, you'll notice the map tiles won't load correctly. This is because the default tileset used is from Mapbox which doesn't provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.
-
-### Issues
-
-The next thing you'll notice is that you can't search for a place. You can only just pick points on the map and route between those. I'm still not exactly sure if it's supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn't be too difficult.
-
-Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet's implementation isn't as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.
-
-There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a "stop" in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the "stop" to Arguilla.
-
-![OpenTripPlanner disconnected route](../galleries/transit/otp1.png)
-
-I can't say this isn't a bug. After all, OpenTripPlanner couldn't have magically known there really was a street there. If it did, it wouldn't just teleport you to the corner. I'm more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.
-
-Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won't give you the best route because it thinks you have to loop around to get to where you want to be. I don't really know how common this issue pops up though. It's highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.
-
-![OpenTripPlanner loopy route](../galleries/transit/otp2.png)
-
-Much like the earlier problem, I can't tell if this is a bug or it's a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren't even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.
-
-![UP Katipunan Route](../galleries/transit/upkatipunan.jpg)
-
-From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren't that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.
-
-### Conclusion
-
-Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There's also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.

+ 121 - 105
output/posts/philippine-transit-app-challenge.html

@@ -1,113 +1,129 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Philippine Transit App Challenge | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/philippine-transit-app-challenge.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="next" href="jeepney-and-bus-routes.html" title="Jeepney and Bus Routes" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Philippine Transit App Challenge">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/philippine-transit-app-challenge.html">
-<meta property="og:description" content="Last week, the DOTC launched the Philippine Transit App Challenge. It's a competition to build something great using the newly available 1) jeepney/bus/rail routes and 2) traffic incident data in Metr">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-07T00:17:37+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Philippine Transit App Challenge - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Philippine Transit App Challenge</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-07T00:17:37+08:00" itemprop="datePublished" title="2013-07-07 00:17">2013-07-07 00:17</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>Last week, the DOTC launched the <a href="http://philippine-transit.hackathome.com">Philippine Transit App Challenge</a>. It's a competition to build something great using the newly available 1) jeepney/bus/rail routes and 2) traffic incident data in Metro Manila and Cebu.</p>
-<p>I'm actually quite excited about this as it's not everyday our government does wonderful things. Many people have been waiting for this kind of data to be available. Before, the only way to figure out which jeeps to ride to get from A to B is by asking other people. The website of the LTFRB used to just have a list of jeepney routes, but nothing else, no maps or list of stops.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/philippine-transit-app-challenge.html">Philippine Transit App Challenge</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-07">2013-07-07</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>Last week, the DOTC launched the <a href="http://philippine-transit.hackathome.com">Philippine Transit App Challenge</a>. It&rsquo;s a competition to build something great using the newly available 1) jeepney/bus/rail routes and 2) traffic incident data in Metro Manila and Cebu.</p>
+
+<p>I&rsquo;m actually quite excited about this as it&rsquo;s not everyday our government does wonderful things. Many people have been waiting for this kind of data to be available. Before, the only way to figure out which jeeps to ride to get from A to B is by asking other people. The website of the LTFRB used to just have a list of jeepney routes, but nothing else, no maps or list of stops.</p>
+
 <p>During the launch, they also presented how CITOM (the Cebu MMDA) is pilot-testing a <a href="http://cebutraffic.org/">traffic tracking system</a>. What they did was supply Android phones to taxi drivers. The phones send GPS data which can then be aggregated to see what the average speeds along streets are. This also benefits the taxi company as it provides easy tracking of their taxis compared to their old telephone/radio with pen-and-paper process.</p>
-<p>The <a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/">route data</a> are already available, as well as the <a href="http://philippine-transit.hackathome.com/dataset-citom-traffic-alert-platform/">Cebu</a> and <a href="http://philippine-transit.hackathome.com/dataset-mmda-traffic-alert-platform/">Metro Manila</a> incident data. You do have to register to access them though. Right now, they're just one-off dumps of the data but the various agencies have promised to provide consistently updated data. This will be provided via ASTI later in the year.</p>
-<p>I've just started looking at the route data and playing around with it. The quality could be better, but I'm glad we at least have something to work with.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="next">
-                <a href="jeepney-and-bus-routes.html" rel="next" title="Jeepney and Bus Routes">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/philippine-transit-app-challenge.html",
-        disqus_title="Philippine Transit App Challenge",
-        disqus_identifier="cache/posts/philippine-transit-app-challenge.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+
+<p>The <a href="http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/">route data</a> are already available, as well as the <a href="http://philippine-transit.hackathome.com/dataset-citom-traffic-alert-platform/">Cebu</a> and <a href="http://philippine-transit.hackathome.com/dataset-mmda-traffic-alert-platform/">Metro Manila</a> incident data. You do have to register to access them though. Right now, they&rsquo;re just one-off dumps of the data but the various agencies have promised to provide consistently updated data. This will be provided via ASTI later in the year.</p>
+
+<p>I&rsquo;ve just started looking at the route data and playing around with it. The quality could be better, but I&rsquo;m glad we at least have something to work with.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/jeepney-and-bus-routes.html" rel="prev" title="Jeepney and Bus Routes">&larr; Previous post</a>
+				</li>
+				
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/philippine-transit-app-challenge.html';
+var disqus_title = 'Philippine Transit App Challenge';
+var disqus_identifier = 'cache/posts/philippine-transit-app-challenge.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 124 - 109
output/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html

@@ -1,116 +1,131 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="console-keymap-switching.html" title="Console Keymap Switching" type="text/html">
-<link rel="next" href="is-my-terminal-window-active.html" title="Is My Terminal Window Active?" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html">
-<meta property="og:description" content="I've always thought that people were just too lazy to change their SSIDs when I see &quot;PLDTMyDSLBizCafeJapan&quot;. It became apparent when we got our own PLDT line that it was because the bundled router/mod">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-11-27T10:12:31+08:00">
-<meta property="article:tag" content="sysadmin">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-11-27T10:12:31+08:00" itemprop="datePublished" title="2013-11-27 10:12">2013-11-27 10:12</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/sysadmin.html" rel="tag">sysadmin</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>I've always thought that people were just too lazy to change their SSIDs when I see "PLDTMyDSLBizCafeJapan". It became apparent when we got our own PLDT line that it was because the bundled router/modem <em>does not</em> allow you to remove the prefix.</p>
-<p>This is not the kind of thing you expect as a business customer. Even for home customers, I feel it's still a bit dishonest. I'd be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.</p>
-<p>Of course, we couldn't just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the <a href="http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html">Prolink H5004N</a> or the <a href="http://www.symbianize.com/showthread.php?t=730091">ZyXEL P-660HN-T1A</a> but not for the one we got which was the ZyXEL P-2612HNU-F1F.</p>
-<p>We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the "PLDTMyDSLBiz". We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.</p>
-<p>The backup is actually just an XML file. You can search for SSID and change the parameter there. It's a bit annoying because the router has to restart after restoring the configuration, but it works!</p>
-<p>A minor note, the router doesn't seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="console-keymap-switching.html" rel="prev" title="Console Keymap Switching">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="is-my-terminal-window-active.html" rel="next" title="Is My Terminal Window Active?">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html",
-        disqus_title="Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU",
-        disqus_identifier="cache/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html">Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-11-27">2013-11-27</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/sysadmin.html" rel="tag">
+			sysadmin
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>I&rsquo;ve always thought that people were just too lazy to change their SSIDs when I see &ldquo;PLDTMyDSLBizCafeJapan&rdquo;. It became apparent when we got our own PLDT line that it was because the bundled router/modem <em>does not</em> allow you to remove the prefix.</p>
+
+<p>This is not the kind of thing you expect as a business customer. Even for home customers, I feel it&rsquo;s still a bit dishonest. I&rsquo;d be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.</p>
+
+<p>Of course, we couldn&rsquo;t just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the <a href="http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html">Prolink H5004N</a> or the <a href="http://www.symbianize.com/showthread.php?t=730091">ZyXEL P-660HN-T1A</a> but not for the one we got which was the ZyXEL P-2612HNU-F1F.</p>
+
+<p>We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the &ldquo;PLDTMyDSLBiz&rdquo;. We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.</p>
+
+<p>The backup is actually just an XML file. You can search for SSID and change the parameter there. It&rsquo;s a bit annoying because the router has to restart after restoring the configuration, but it works!</p>
+
+<p>A minor note, the router doesn&rsquo;t seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/is-my-terminal-window-active.html" rel="prev" title="Is My Terminal Window Active?">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/console-keymap-switching.html" rel="next" title="Console Keymap Switching">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html';
+var disqus_title = 'Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU';
+var disqus_identifier = 'cache/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 784 - 0
output/posts/rss.xml

@@ -0,0 +1,784 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+  <channel>
+    <title>Posts on Pleasant Programmer</title>
+    <link>http://pleasantprogrammer.com/posts.html</link>
+    <description>Recent content in Posts on Pleasant Programmer</description>
+    <generator>Hugo -- gohugo.io</generator>
+    <language>en-us</language>
+    <lastBuildDate>Fri, 25 Dec 2015 00:00:00 +0000</lastBuildDate>
+    <atom:link href="http://pleasantprogrammer.com/posts/rss.xml" rel="self" type="application/rss+xml" />
+    
+    <item>
+      <title>Cloudflare Shenanigans</title>
+      <link>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</link>
+      <pubDate>Fri, 25 Dec 2015 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</guid>
+      <description>&lt;p&gt;An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.&lt;/p&gt;
+
+&lt;p&gt;Now the problem is that Cloudflare can put you behind &lt;a href=&#34;https://www.cloudflare.com/ips/&#34;&gt;any IP they own&lt;/a&gt;, which is a huge range. There&amp;rsquo;s no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.&lt;/p&gt;
+
+&lt;p&gt;We never actually empirically tested whether other sites hosted on Cloudflare were also actually zero-rated. But I like to think that we saved a lot of people on their data costs from browsing Reddit and 4chan. But alas, good things must come to an end.&lt;/p&gt;
+
+&lt;p&gt;A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn&amp;rsquo;t want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn&amp;rsquo;t really afford that, so we looked for other options.&lt;/p&gt;
+
+&lt;p&gt;Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn&amp;rsquo;t have its own certificate.&lt;/p&gt;
+
+&lt;p&gt;After more testing, we figured out that you could actually use any Cloudflare backed domain so long as we properly set the Host header. We just needed to find one still in the old range. Coincidentally, 4chan.org was. Which led to this wonderful commit&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;commit 123456789abcdef
+Author: ~~~~~~
+Date:   ~~~~~~
+
+    4chan hack
+
+&lt;span style=&#34;color: #000080; font-weight: bold&#34;&gt;diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java&lt;/span&gt;
+&lt;span style=&#34;color: #A00000&#34;&gt;--- a/src/com/client/common/Util.java&lt;/span&gt;
+&lt;span style=&#34;color: #00A000&#34;&gt;+++ b/src/com/client/common/Util.java&lt;/span&gt;
+&lt;span style=&#34;color: #800080; font-weight: bold&#34;&gt;@@ -210,7 +210,8 @@ public class Util {&lt;/span&gt;
+        }
+
+        public static String getServerAddress(Context context) {
+&lt;span style=&#34;color: #A00000&#34;&gt;-               String address = &amp;quot;https://backend.client.com&amp;quot;;&lt;/span&gt;
+&lt;span style=&#34;color: #00A000&#34;&gt;+               // String address = &amp;quot;https://backend.client.com&amp;quot;;&lt;/span&gt;
+&lt;span style=&#34;color: #00A000&#34;&gt;+               String address = &amp;quot;https://4chan.org&amp;quot;;&lt;/span&gt;
+                if(!isDebug(context)) return address;
+                try {
+&lt;span style=&#34;color: #000080; font-weight: bold&#34;&gt;diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
+&lt;span style=&#34;color: #A00000&#34;&gt;--- a/src/com/client/common/logging/APIClient.java&lt;/span&gt;
+&lt;span style=&#34;color: #00A000&#34;&gt;+++ b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
+&lt;span style=&#34;color: #800080; font-weight: bold&#34;&gt;@@ -101,6 +101,7 @@ public class APIClient {&lt;/span&gt;
+        private HttpResponse postInternal(String url, List&amp;lt;NameValuePair&amp;gt; data, boolean forRegistration) throws ClientProtocolException, IOException {
+                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+&amp;quot;/api/&amp;quot;+url);
+                request.setHeader(&amp;quot;X-API-VERSION&amp;quot;, apiVersion);
+&lt;span style=&#34;color: #00A000&#34;&gt;+               request.setHeader(&amp;quot;Host&amp;quot;, &amp;quot;backend.client.com&amp;quot;);&lt;/span&gt;
+
+                if(data == null) {
+                        data = new ArrayList&amp;lt;NameValuePair&amp;gt;();
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Eventually, we did decide to just abandon Cloudflare for the server. We probably weren&amp;rsquo;t going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.&lt;/p&gt;
+
+&lt;p&gt;I just still find it funny we were making people&amp;rsquo;s phones go to 4chan.org everyday for more than a year.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>TiddlyWiki in the Sky (or TiddlyWeb for TW5)</title>
+      <link>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</link>
+      <pubDate>Thu, 24 Dec 2015 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</guid>
+      <description>
+
+&lt;p&gt;I&amp;rsquo;ve always liked &lt;a href=&#34;http://tiddlywiki.com&#34;&gt;TiddlyWiki&lt;/a&gt;. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn&amp;rsquo;t need a backend, it would just save itself as an all new HTML file with all your posts inside. I&amp;rsquo;ve used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.&lt;/p&gt;
+
+&lt;p&gt;Now, there&amp;rsquo;s TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.&lt;/p&gt;
+
+&lt;p&gt;If you&amp;rsquo;re just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There&amp;rsquo;s plenty of documentation on the site. But if you&amp;rsquo;re looking for more advanced features (like storing your posts in git or a database), then you&amp;rsquo;ll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.&lt;/p&gt;
+
+&lt;p&gt;To support TiddlyWiki5, we&amp;rsquo;ll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.&lt;/p&gt;
+
+&lt;h2 id=&#34;setting-up-tiddlywiki:1f502be524b8b2be2ec53e61b7c9a5cf&#34;&gt;Setting Up TiddlyWiki&lt;/h2&gt;
+
+&lt;p&gt;TiddlyWiki5 provides a command line tool via &lt;code&gt;npm&lt;/code&gt; that allows building custom versions of the wiki. In fact, it comes with templates, called &amp;ldquo;editions&amp;rdquo;, that we can use for our setup. Assuming you already have it installed, create the wiki using&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;tiddlywiki mywiki --init tw5tank          &lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# create wiki from template&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;This creates a wiki intended for use with &lt;a href=&#34;https://tank.peermore.com/&#34;&gt;Tank&lt;/a&gt;, which is built on top of TiddlyWeb. From here, you should look in &lt;code&gt;mywiki/tiddlers/system&lt;/code&gt; which contain the entries for &lt;code&gt;SiteTitle&lt;/code&gt;, &lt;code&gt;SiteSubtitle&lt;/code&gt;, &lt;code&gt;DefaultTiddlers&lt;/code&gt;, and &lt;code&gt;tiddlyweb-host&lt;/code&gt;. The first 3 should be configured however you want. These are necessary because they&amp;rsquo;re needed before the wiki can load them from the server. &lt;code&gt;tiddlyweb-host&lt;/code&gt; contains the location of the TiddlyWeb server, this should be &lt;code&gt;http://localhost:8080/&lt;/code&gt; if you&amp;rsquo;re just testing locally. With everything configured, you can build the new wiki by running&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;tiddlywiki mywiki --build
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;This will output the wiki to &lt;code&gt;mywiki/output/tw5tank.html&lt;/code&gt;. You can now serve it using your favorite local webserver, like &lt;code&gt;python -m http.server&lt;/code&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;setting-up-tiddlyweb:1f502be524b8b2be2ec53e61b7c9a5cf&#34;&gt;Setting Up TiddlyWeb&lt;/h2&gt;
+
+&lt;p&gt;The TiddlyWeb tutorial recommends using &lt;code&gt;tiddlywebwiki&lt;/code&gt; which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren&amp;rsquo;t really needed, so we won&amp;rsquo;t go with that. So first, we&amp;rsquo;ll need to install TiddlyWeb and any plugins we might want to use.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Next, we&amp;rsquo;ll need the tiddlyweb configuration in &lt;code&gt;tiddlywebconfig.py&lt;/code&gt;&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# A basic configuration.&lt;/span&gt;
+&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# `pydoc tiddlyweb.config` for details on configuration items.&lt;/span&gt;
+
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color: #0000FF; font-weight: bold&#34;&gt;tiddlywebplugins.status&lt;/span&gt;
+
+config &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; {
+    &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;system_plugins&amp;#39;&lt;/span&gt;: [&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;tiddlywebplugins.status&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;tiddlywebplugins.cors&amp;#39;&lt;/span&gt;],
+    &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;secret&amp;#39;&lt;/span&gt;: &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0&amp;#39;&lt;/span&gt;,
+    &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;wsgi_server&amp;#39;&lt;/span&gt;: &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;tiddlywebplugins.cherrypy&amp;#39;&lt;/span&gt;,
+    &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;cors.enable_non_simple&amp;#39;&lt;/span&gt;: &lt;span style=&#34;color: #008000&#34;&gt;True&lt;/span&gt;
+}
+
+original_gather_data &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; tiddlywebplugins&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;status&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;_gather_data
+
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color: #0000FF&#34;&gt;_status_gather_data&lt;/span&gt;(environ):
+    data &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; original_gather_data(environ)
+    data[&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;space&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; {&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;recipe&amp;#39;&lt;/span&gt;: &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;default&amp;#39;&lt;/span&gt;}
+    &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;return&lt;/span&gt; data
+
+tiddlywebplugins&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;status&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;_gather_data &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; _status_gather_data
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;The tweaks involved are:&lt;/p&gt;
+
+&lt;ul&gt;
+&lt;li&gt;using the status plugin which the wiki requires&lt;/li&gt;
+&lt;li&gt;monkeypatching the status plugin for the wiki to use the correct &amp;ldquo;recipe&amp;rdquo;&lt;/li&gt;
+&lt;li&gt;using cherrypy server instead of the buggy default one&lt;/li&gt;
+&lt;li&gt;using cors since we&amp;rsquo;re not hosting the wiki itself on the same server&lt;/li&gt;
+&lt;/ul&gt;
+
+&lt;p&gt;With that, we just need to create the store that will hold our data&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;twanager recipe default &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;lt;&amp;lt;EOF&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;desc: standard TiddlyWebWiki environment&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;policy: {&amp;quot;read&amp;quot;: [], &amp;quot;create&amp;quot;: [], &amp;quot;manage&amp;quot;: [&amp;quot;R:ADMIN&amp;quot;], &amp;quot;accept&amp;quot;: [], &amp;quot;write&amp;quot;: [&amp;quot;R:ADMIN&amp;quot;], &amp;quot;owner&amp;quot;: &amp;quot;administrator&amp;quot;, &amp;quot;delete&amp;quot;: [&amp;quot;R:ADMIN&amp;quot;]}&lt;/span&gt;
+
+&lt;span style=&#34;color: #BA2121&#34;&gt;/bags/default/tiddlers&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;EOF&lt;/span&gt;
+
+twanager bag default &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;lt;&amp;lt;EOF&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;{&amp;quot;policy&amp;quot;: {&amp;quot;read&amp;quot;: [], &amp;quot;create&amp;quot;: [], &amp;quot;manage&amp;quot;: [&amp;quot;R:ADMIN&amp;quot;], &amp;quot;accept&amp;quot;: [], &amp;quot;write&amp;quot;: [], &amp;quot;owner&amp;quot;: &amp;quot;administrator&amp;quot;, &amp;quot;delete&amp;quot;: []}}&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;EOF&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Finally, we can start the TiddlyWeb server&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;twanager server
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;h2 id=&#34;putting-it-all-together:1f502be524b8b2be2ec53e61b7c9a5cf&#34;&gt;Putting it all together&lt;/h2&gt;
+
+&lt;p&gt;Once you have the TiddlyWeb server running, you can just go to wherever you&amp;rsquo;re hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that&amp;rsquo;s done it&amp;rsquo;s saved. You can refresh your browser and your posts should still be there.&lt;/p&gt;
+
+&lt;p&gt;At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won&amp;rsquo;t need CORS anymore.&lt;/p&gt;
+
+&lt;p&gt;TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Is My Terminal Window Active?</title>
+      <link>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</link>
+      <pubDate>Sun, 07 Jun 2015 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</guid>
+      <description>
+
+&lt;p&gt;I&amp;rsquo;ve been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is &lt;a href=&#34;https://github.com/marzocchi/zsh-notify&#34;&gt;zsh-notify&lt;/a&gt;. It&amp;rsquo;s a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s pretty convenient when you&amp;rsquo;re compiling something and then go on to browse reddit while waiting. Usually, I spend too much time just reading and forget about the compilation entirely. With the plugin, I get the notification and maybe go back to work.&lt;/p&gt;
+
+&lt;p&gt;One nice feature it has is that if you&amp;rsquo;re currently looking at the terminal window of the job that just finished, it won&amp;rsquo;t notify you. It only notifies on windows that aren&amp;rsquo;t currently in focus. To do this, it has to actually talk to Terminal.app or iTerm2 to see if the window and tab are active.&lt;/p&gt;
+
+&lt;p&gt;This is alright in OSX since those 2 are the generally most used terminal emulators. On Linux though, everyone has their own favorite terminal. Given that, I figured I could probably rely on talking to X to see if the window is active instead of each single terminal emulator. X can&amp;rsquo;t tell if the tab is active though, but I don&amp;rsquo;t use tabs in my current setup so it should still be good.&lt;/p&gt;
+
+&lt;h2 id=&#34;xdotool:bfade06d39f7975f041a61de11ad4d4f&#34;&gt;xdotool&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://superuser.com/questions/382616/detecting-currently-active-window&#34;&gt;Preliminary research&lt;/a&gt; reveals that we can easily get what the active window is with xdotool. &lt;code&gt;xdotool getactivewindow&lt;/code&gt; gives us the X window id of the active one. Now all we need is a way to get the window id of the terminal we&amp;rsquo;re in.&lt;/p&gt;
+
+&lt;h2 id=&#34;first-attempt-windowid:bfade06d39f7975f041a61de11ad4d4f&#34;&gt;First Attempt: $WINDOWID&lt;/h2&gt;
+
+&lt;p&gt;Apparently, xterm and similar terminal emulators define an environment variable called &lt;code&gt;$WINDOWID&lt;/code&gt; with the window id of the terminal. Obviously, this is too good to be true. In xterm and konsole the &lt;code&gt;$WINDOWID&lt;/code&gt; was correct, but in VTE-based terminal emulators, &lt;code&gt;$WINDOWID&lt;/code&gt; had the wrong value. In terminology, it didn&amp;rsquo;t define &lt;code&gt;$WINDOWID&lt;/code&gt; altogether. So &lt;code&gt;$WINDOWID&lt;/code&gt; wasn&amp;rsquo;t going to work.&lt;/p&gt;
+
+&lt;h2 id=&#34;second-attempt-xdotool-search-magic:bfade06d39f7975f041a61de11ad4d4f&#34;&gt;Second Attempt: xdotool search $MAGIC&lt;/h2&gt;
+
+&lt;p&gt;My second idea was that you can use zsh to change the window title to a magic number and then just check if the active window is the same one as the window with the magic number. This sort of worked for most terminals, except konsole which does whatever it wants with the window title. There&amp;rsquo;s also the problem of some zsh configs automatically settings the window title to the current command.&lt;/p&gt;
+
+&lt;p&gt;In hindsight, I could probably have just done &lt;code&gt;xdotool search --name xdotool&lt;/code&gt; since in most cases, when you run the search, zsh or konsole will set the window name to the current command. Maybe that&amp;rsquo;s another option I can explore some day.&lt;/p&gt;
+
+&lt;h2 id=&#34;third-attempt-ppid:bfade06d39f7975f041a61de11ad4d4f&#34;&gt;Third Attempt: $PPID&lt;/h2&gt;
+
+&lt;p&gt;My third idea was another environment variable called &lt;code&gt;$PPID&lt;/code&gt;, which is the process id of the parent of the shell. As it happens, the parent is the window containing the zsh instance. This is actually pretty consistent across most terminals. The only problem was if you launched zsh from another shell since your new zsh&amp;rsquo;s parent will now be another zsh instance instead of an X window.&lt;/p&gt;
+
+&lt;p&gt;At first glance, launching zsh within zsh doesn&amp;rsquo;t seem like something most people would do, but this is what happens when you run screen or tmux. To work around this, we can actually just save the original &lt;code&gt;$PPID&lt;/code&gt; in a different variable and use that instead.&lt;/p&gt;
+
+&lt;p&gt;Now that we have the PID of the window from zsh, we can once again use xdotool to get the PID of the current active window with &lt;code&gt;xdotool getactivewindow getwindowpid&lt;/code&gt;. We just simply compare that with our &lt;code&gt;$PPID&lt;/code&gt; and we can tell if we&amp;rsquo;re in an active window or not. Overall, this approach worked surprisingly well so that&amp;rsquo;s the final solution I went with.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</title>
+      <link>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</link>
+      <pubDate>Wed, 27 Nov 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</guid>
+      <description>&lt;p&gt;I&amp;rsquo;ve always thought that people were just too lazy to change their SSIDs when I see &amp;ldquo;PLDTMyDSLBizCafeJapan&amp;rdquo;. It became apparent when we got our own PLDT line that it was because the bundled router/modem &lt;em&gt;does not&lt;/em&gt; allow you to remove the prefix.&lt;/p&gt;
+
+&lt;p&gt;This is not the kind of thing you expect as a business customer. Even for home customers, I feel it&amp;rsquo;s still a bit dishonest. I&amp;rsquo;d be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.&lt;/p&gt;
+
+&lt;p&gt;Of course, we couldn&amp;rsquo;t just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the &lt;a href=&#34;http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html&#34;&gt;Prolink H5004N&lt;/a&gt; or the &lt;a href=&#34;http://www.symbianize.com/showthread.php?t=730091&#34;&gt;ZyXEL P-660HN-T1A&lt;/a&gt; but not for the one we got which was the ZyXEL P-2612HNU-F1F.&lt;/p&gt;
+
+&lt;p&gt;We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the &amp;ldquo;PLDTMyDSLBiz&amp;rdquo;. We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.&lt;/p&gt;
+
+&lt;p&gt;The backup is actually just an XML file. You can search for SSID and change the parameter there. It&amp;rsquo;s a bit annoying because the router has to restart after restoring the configuration, but it works!&lt;/p&gt;
+
+&lt;p&gt;A minor note, the router doesn&amp;rsquo;t seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Console Keymap Switching</title>
+      <link>http://pleasantprogrammer.com/posts/console-keymap-switching.html</link>
+      <pubDate>Tue, 29 Oct 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/console-keymap-switching.html</guid>
+      <description>&lt;p&gt;At the office, we have some people who use DVORAK. Normally, this isn&amp;rsquo;t a problem. To each his own after all. It does become a bit problematic though, when we&amp;rsquo;re dealing with the servers around the office.&lt;/p&gt;
+
+&lt;p&gt;We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it&amp;rsquo;s apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.&lt;/p&gt;
+
+&lt;p&gt;For the console, they&amp;rsquo;d typically do &lt;code&gt;sudo loadkeys dvorak&lt;/code&gt; after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can&amp;rsquo;t even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn&amp;rsquo;t a readily available thing for the console.&lt;/p&gt;
+
+&lt;p&gt;I googled around for solutions and came across &lt;a href=&#34;http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux&#34;&gt;a nice idea&lt;/a&gt;. You could alias &lt;code&gt;asdf&lt;/code&gt; to load the DVORAK mapping and &lt;code&gt;aoeu&lt;/code&gt; (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don&amp;rsquo;t really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.&lt;/p&gt;
+
+&lt;p&gt;After some further searching, I found &lt;a href=&#34;http://unix.stackexchange.com/questions/2884/toggle-between-dvorak-and-qwerty&#34;&gt;something close to what I wanted&lt;/a&gt;. Apparently, Alt+Up sends a KeyboardSignal keycode to the init process, which can act on that. It also works anywhere, even before being logged in. For SysVinit systems, you can just add a line to your inittab for a command to be run when Alt+Up is pressed.&lt;/p&gt;
+
+&lt;p&gt;In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. &lt;code&gt;kbrequest.target&lt;/code&gt; is normally aliased to run the rescue service though, so you have to manually create the file in &lt;code&gt;/etc/systemd/system/kbrequest.target&lt;/code&gt; and fill it with a description:&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;[Unit]&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;Description&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;kbrequest target&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;We can then add a service to be run whenever the target is called. Something like &lt;code&gt;/etc/systemd/system/keymap-switch.service&lt;/code&gt;:&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;[Unit]&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;Description&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;Keymap Switch Service&lt;/span&gt;
+
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;[Service]&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;Type&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;oneshot&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;ExecStart&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;/usr/local/bin/keymap-switch&lt;/span&gt;
+
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;[Install]&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;WantedBy&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;kbrequest.target&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;After enabling said service, we only need the actual keymap switcher, &lt;code&gt;/usr/local/bin/keymap-switch&lt;/code&gt;. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we&amp;rsquo;re using SystemD, we can use that instead for managing which keymap we&amp;rsquo;re actually using. It stores the current settings inside &lt;code&gt;/etc/vconsole.conf&lt;/code&gt;. We can also then switch keymaps by using &lt;code&gt;localectl set-keymap&lt;/code&gt;.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;#!/bin/sh&lt;/span&gt;
+&lt;span style=&#34;color: #008000&#34;&gt;source&lt;/span&gt; /etc/vconsole.conf
+
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;[&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #19177C&#34;&gt;$TERM&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;dumb&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;]&lt;/span&gt;; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;then&lt;/span&gt;
+  &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;[&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #19177C&#34;&gt;$KEYMAP&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;dvorak&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;]&lt;/span&gt;; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;then&lt;/span&gt;
+    localectl &lt;span style=&#34;color: #008000&#34;&gt;set&lt;/span&gt;-keymap us
+  &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;else&lt;/span&gt;
+    localectl &lt;span style=&#34;color: #008000&#34;&gt;set&lt;/span&gt;-keymap dvorak
+  &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;fi&lt;/span&gt;
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;fi&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Geocoding Services</title>
+      <link>http://pleasantprogrammer.com/posts/geocoding-services.html</link>
+      <pubDate>Wed, 25 Sep 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/geocoding-services.html</guid>
+      <description>&lt;p&gt;A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don&amp;rsquo;t know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.&lt;/p&gt;
+
+&lt;p&gt;The gold standard for doing geocoding right now is Google Maps. It&amp;rsquo;s hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn&amp;rsquo;t be &lt;em&gt;that&lt;/em&gt; much you could do for the competition.&lt;/p&gt;
+
+&lt;p&gt;When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called &lt;a href=&#34;http://nominatim.openstreetmap.org&#34;&gt;Nominatim&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.&lt;/p&gt;
+
+&lt;p&gt;Given a typical mapping app, you might type in &amp;ldquo;ateneo&amp;rdquo; and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google&amp;rsquo;s &lt;a href=&#34;https://developers.google.com/maps/documentation/javascript/geocoding&#34;&gt;geocoding API&lt;/a&gt;, you probably won&amp;rsquo;t get any result for this. What you want to use is the &lt;a href=&#34;https://developers.google.com/maps/documentation/javascript/places&#34;&gt;Places API&lt;/a&gt; which provides an autocomplete search box. Using it, when you type in &amp;ldquo;ateneo&amp;rdquo;, it automatically suggests in the dropdown, &amp;ldquo;Ateneo de Manila University&amp;rdquo;.&lt;/p&gt;
+
+&lt;p&gt;A downside to using the Places API is that it&amp;rsquo;s against the terms of service to use it with something that isn&amp;rsquo;t Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap&amp;rsquo;s data will probably be a better long term solution.&lt;/p&gt;
+
+&lt;p&gt;For now, since the competition&amp;rsquo;s deadline is just a few days away, I&amp;rsquo;ll be using Google Maps.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Jeep and Bus Schedules</title>
+      <link>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</link>
+      <pubDate>Sun, 28 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</guid>
+      <description>&lt;p&gt;Wouldn&amp;rsquo;t it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist&amp;rsquo;s paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn&amp;rsquo;t worry. I can assure you, it&amp;rsquo;s still a death sentence.&lt;/p&gt;
+
+&lt;p&gt;The GTFS spec defines 2 ways of statically specifying trip schedules. You can define the exact times that a service will arrive at a stop. You can also specify between what times the service is active and how often a new bus or jeep leaves the first stop. You also define which days those rules apply. You could say every MWF, the bus operates from 9:00AM to 9:00PM and every TTH, the bus services from 3:00AM to 11:00PM.&lt;/p&gt;
+
+&lt;p&gt;This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there&amp;rsquo;s another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.&lt;/p&gt;
+
+&lt;p&gt;Like much everything else about the Philippine transit system, there aren&amp;rsquo;t really any &amp;ldquo;schedules&amp;rdquo; to speak of. It&amp;rsquo;s generally whenever the buses or jeeps feel like it. So we have no static schedules. We don&amp;rsquo;t have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.&lt;/p&gt;
+
+&lt;p&gt;Ideally, we shouldn&amp;rsquo;t bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn&amp;rsquo;t work without it. So we have to add a reasonable trip schedule for jeeps and buses.&lt;/p&gt;
+
+&lt;p&gt;The current GTFS data does define these trip schedules. We assume that jeeps and buses operate between 6:00AM and 11:00PM and a new jeep passes by every 10 minutes. Also, jeeps and buses are defined to only operate on weekdays.&lt;/p&gt;
+
+&lt;p&gt;While there might be jeeps who change routes or don&amp;rsquo;t operate on weekends, I&amp;rsquo;m pretty sure that jeeps and buses run on weekends. We&amp;rsquo;ll have to fix it ourselves temporarily since there&amp;rsquo;s no central GTFS feed yet.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# 724594 seems to be the service id used by jeeps and buses&lt;/span&gt;
+sed -i .bak &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;/^724594/ s/0,0/1,1/&amp;#39;&lt;/span&gt; calendar.txt
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you&amp;rsquo;re sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.&lt;/p&gt;
+
+&lt;p&gt;If we set the frequency to one minute, it &lt;em&gt;might&lt;/em&gt; give better routes by eliminating the timing issue. Or not, it&amp;rsquo;s kind of hard to tell.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# jeep and bus route ids tend to start with 72&lt;/span&gt;
+sed -i .bak &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;/^72/ s/,600/,60/&amp;#39;&lt;/span&gt; frequencies.txt
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Overall, the problems we&amp;rsquo;re having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don&amp;rsquo;t need to do hackish things for it to fit the GTFS, but that&amp;rsquo;s still a dream. For now, all we can really do is fit a triangle into a square hole.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Highways in OTP</title>
+      <link>http://pleasantprogrammer.com/posts/highways-in-otp.html</link>
+      <pubDate>Wed, 24 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/highways-in-otp.html</guid>
+      <description>&lt;p&gt;One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP&amp;rsquo;s suggested route for walking from UP to Ateneo:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;../galleries/transit/otproundabout.png&#34; alt=&#34;Roundabout route from UP to Ateneo&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;This is just so hilariously wrong. It&amp;rsquo;s much simpler to just walk along Katipunan Avenue.&lt;/p&gt;
+
+&lt;p&gt;OTP couldn&amp;rsquo;t possibly be that dumb though, so there must be something we&amp;rsquo;re doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the &amp;ldquo;road type&amp;rdquo; designated to Katipunan.&lt;/p&gt;
+
+&lt;p&gt;Apparently, by default OTP will consider roads of type &lt;code&gt;trunk&lt;/code&gt; to be non-walkable and non-bikable. This is documented in the &lt;a href=&#34;http://wiki.openstreetmap.org/wiki/OpenTripPlanner&#34;&gt;OpenStreetMap wiki&lt;/a&gt; and the &lt;a href=&#34;https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety&#34;&gt;OTP wiki&lt;/a&gt; as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;sed -i .bak s/trunk/primary/g manila.osm
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;And rebuild the graph. It doesn&amp;rsquo;t really matter much because the OSM data isn&amp;rsquo;t used to render the maps. It&amp;rsquo;s just used to build the routing data. This is actually what I did for &lt;a href=&#34;http://maps.pleasantprogrammer.com&#34;&gt;maps.pleasantprogrammer.com&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s also possible to set the default way properties in OTP. Instead of disallowing walking and biking on &lt;code&gt;highway=trunk&lt;/code&gt; we could allow that. This is not much better than the &lt;code&gt;sed&lt;/code&gt; solution though. It&amp;rsquo;s better since you keep the weighting done by OTP, but you&amp;rsquo;re still saying that all trunks are walkable which might not be the case.&lt;/p&gt;
+
+&lt;p&gt;The most correct way to actually fix this is to go through each of the trunks and specifying &lt;code&gt;foot=yes&lt;/code&gt; and &lt;code&gt;bicycle=yes&lt;/code&gt; for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I&amp;rsquo;m not sure on the particulars with updating OSM though.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Elevation Data in OTP</title>
+      <link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link>
+      <pubDate>Tue, 23 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</guid>
+      <description>&lt;p&gt;&lt;img src=&#34;../galleries/transit/otpelevation.png&#34; alt=&#34;OpenTripPlanner showing elevation data&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;One thing I hadn&amp;rsquo;t tested out last time was OTP&amp;rsquo;s support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.&lt;/p&gt;
+
+&lt;p&gt;The &lt;a href=&#34;https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes&#34;&gt;5 minute tutorial&lt;/a&gt; actually discusses the elevation data briefly, but a more in-depth thing you can look at is the &lt;a href=&#34;https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data&#34;&gt;GraphBuilder documentation&lt;/a&gt;. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the &lt;a href=&#34;http://www.philgis.org/freegisdata.htm&#34;&gt;PhilGIS website&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;I don&amp;rsquo;t know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use &lt;a href=&#34;http://www.gdal.org/&#34;&gt;GDAL&lt;/a&gt; for this. You&amp;rsquo;d just then run,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;gdal_translate srtm41_90m_phl.img phil.tiff
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Afterwards, it&amp;rsquo;s just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you&amp;rsquo;re running on limited RAM.&lt;/p&gt;
+
+&lt;p&gt;I&amp;rsquo;ve actually hosted a &lt;a href=&#34;http://maps.pleasantprogrammer.com&#34;&gt;working example&lt;/a&gt;. It&amp;rsquo;s pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don&amp;rsquo;t abuse it though.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>GraphServer</title>
+      <link>http://pleasantprogrammer.com/posts/graphserver.html</link>
+      <pubDate>Tue, 23 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/graphserver.html</guid>
+      <description>&lt;p&gt;Link: &lt;a href=&#34;http://graphserver.github.io/graphserver/&#34;&gt;http://graphserver.github.io/graphserver/&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;One other routing webapp I saw was GraphServer. It&amp;rsquo;s actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It&amp;rsquo;s also based off python and C instead of Java, so it feels a lot less heavy.&lt;/p&gt;
+
+&lt;p&gt;The instructions on the website are already pretty good. There are just some minor errors with it. Where it says &lt;code&gt;gs_gtfsdb_build&lt;/code&gt;, you should actually use &lt;code&gt;gs_gtfsdb_compile&lt;/code&gt;. Also, when running &lt;code&gt;gs_osmdb_compile&lt;/code&gt; you might need to use &lt;code&gt;-t&lt;/code&gt; for tolerant in case you follow the instructions on chopping up the original OSM data.&lt;/p&gt;
+
+&lt;p&gt;A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn&amp;rsquo;t support 64-bit ids. The &lt;a href=&#34;http://wiki.openstreetmap.org/wiki/Osmosis&#34;&gt;latest version of Osmosis&lt;/a&gt; easily did the job though.&lt;/p&gt;
+
+&lt;p&gt;The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn&amp;rsquo;t provide any alternate routes aside from that one. I&amp;rsquo;m not sure if it&amp;rsquo;s a limitation of the provided routeserver, but I didn&amp;rsquo;t bother checking if it supported parameters which might provide better routes.&lt;/p&gt;
+
+&lt;p&gt;I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Transit Wand</title>
+      <link>http://pleasantprogrammer.com/posts/transit-wand.html</link>
+      <pubDate>Mon, 15 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/transit-wand.html</guid>
+      <description>&lt;p&gt;Link: &lt;a href=&#34;https://play.google.com/store/apps/details?id=com.conveyal.transitwand&#34;&gt;http://transitwand.com&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;Overall, this was the simplest of the &lt;a href=&#34;http://philippine-transit.hackathome.com/use-this-code/&#34;&gt;open-source transit tools&lt;/a&gt; to actually get up and running. There&amp;rsquo;s already a deployed instance of the server, and you can easily download the phone app via the &lt;a href=&#34;https://play.google.com/store/apps/details?id=com.conveyal.transitwand&#34;&gt;Play Store&lt;/a&gt;. Even running the server by yourself didn&amp;rsquo;t have any of the hiccups I had with GTFS Editor.&lt;/p&gt;
+
+&lt;p&gt;The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.&lt;/p&gt;
+
+&lt;p&gt;After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it&amp;rsquo;s free and you don&amp;rsquo;t even actually need to put in a username or anything. It simply registers the phone&amp;rsquo;s IMEI on the server and gives you a 6-digit identifier.&lt;/p&gt;
+
+&lt;p&gt;You can then use the 6-digit identifier to view the data on Transit Wand&amp;rsquo;s server, which is good since uploading any data automatically deletes it from the phone. There really isn&amp;rsquo;t much else you can do with it though. It just allows you to view the data, and export it as a &lt;a href=&#34;https://en.wikipedia.org/wiki/Shapefile&#34;&gt;Shapefile&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There&amp;rsquo;s also no way to extract the ridership information from the server yet. This isn&amp;rsquo;t to say that the data won&amp;rsquo;t eventually go public though.&lt;/p&gt;
+
+&lt;p&gt;An interesting thing you &lt;em&gt;can&lt;/em&gt; do with the Transit Wand data is import it into GTFS Editor to make a new route. You don&amp;rsquo;t even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you&amp;rsquo;ve captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.&lt;/p&gt;
+
+&lt;p&gt;I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don&amp;rsquo;t understand is why the shape data isn&amp;rsquo;t present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can&amp;rsquo;t easily move stops, you have to input coordinates to change the position.&lt;/p&gt;
+
+&lt;p&gt;It &lt;em&gt;might&lt;/em&gt; also be possible that when the DOTC was still collecting the data, the route collection or editing features weren&amp;rsquo;t present yet. That would just be lame and depressing though.&lt;/p&gt;
+
+&lt;p&gt;Overall, Transit Wand does what it&amp;rsquo;s supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Fare Data</title>
+      <link>http://pleasantprogrammer.com/posts/fare-data.html</link>
+      <pubDate>Sat, 13 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/fare-data.html</guid>
+      <description>
+
+&lt;p&gt;As part of the data released by the DOTC, we also have the &lt;a href=&#34;http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/&#34;&gt;fare matrix&lt;/a&gt; for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the &lt;a href=&#34;http://ltfrb.gov.ph/main/farerates&#34;&gt;LTFRB website&lt;/a&gt;. Generally, the fare scheme is represented as &amp;ldquo;pay &lt;em&gt;X&lt;/em&gt; pesos for the first &lt;em&gt;Y&lt;/em&gt; kilometers, pay &lt;em&gt;Z&lt;/em&gt; for every succeeding kilometer.&amp;rdquo; Instead of a table, we can simply represent this as a formula instead,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;base_fare + (distance - initial) * per_km
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;The relevant values for the three services are:&lt;/p&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+  &lt;tr&gt;
+    &lt;td&gt;type&lt;/td&gt;
+    &lt;td&gt;base_fare&lt;/td&gt;
+    &lt;td&gt;initial&lt;/td&gt;
+    &lt;td&gt;per_km&lt;/td&gt;
+  &lt;/tr&gt;
+&lt;/thead&gt;
+&lt;tbody&gt;
+  &lt;tr&gt;
+    &lt;td&gt;bus aircon&lt;/td&gt;
+    &lt;td&gt;12.00&lt;/td&gt;
+    &lt;td&gt;5 km&lt;/td&gt;
+    &lt;td&gt;2.20&lt;/td&gt;
+  &lt;/tr&gt;
+  &lt;tr&gt;
+    &lt;td&gt;bus ordinary&lt;/td&gt;
+    &lt;td&gt;10.00&lt;/td&gt;
+    &lt;td&gt;5 km&lt;/td&gt;
+    &lt;td&gt;1.85&lt;/td&gt;
+  &lt;/tr&gt;
+  &lt;tr&gt;
+    &lt;td&gt;jeep aircon&lt;/td&gt;
+    &lt;td&gt;8.00&lt;/td&gt;
+    &lt;td&gt;4 km&lt;/td&gt;
+    &lt;td&gt;1.40&lt;/td&gt;
+  &lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;p&gt;It isn&amp;rsquo;t as simple as that though. Fares are also rounded to the nearest 25 centavos. So we&amp;rsquo;d need to round them off correctly. This can be achieved by doing,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;round(calculated_fare * 4.0)/4.0
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;There&amp;rsquo;s also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.&lt;/p&gt;
+
+&lt;p&gt;Doing just this, we actually do get the same results as the fare matrices in the image for the most part. There are some discrepancies with the discounted jeep fares. I&amp;rsquo;ve tried to resolve it by tweaking around with the formulas, but it really doesn&amp;rsquo;t make sense in any way. I presume these were manually adjusted for one reason or another.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s a &lt;a href=&#34;../uploads/farematrix.rb&#34;&gt;script&lt;/a&gt; that generates CSVs of all the three fare matrices. If you&amp;rsquo;re too lazy to run it, here are links to the &lt;a href=&#34;../uploads/pub_aircon.csv&#34;&gt;aircon bus&lt;/a&gt;, &lt;a href=&#34;../uploads/pub_ordinary.csv&#34;&gt;ordinary bus&lt;/a&gt; and &lt;a href=&#34;../uploads/puj.csv&#34;&gt;jeep&lt;/a&gt; fare matrices.&lt;/p&gt;
+
+&lt;h3 id=&#34;gtfs-compatibility:a6ffa536f572175993ee2d6ec342ac72&#34;&gt;GTFS compatibility&lt;/h3&gt;
+
+&lt;p&gt;As is, the provided GTFS data does not have any fare data. I imagine this is because the existing spec doesn&amp;rsquo;t have good support for distance-based fares like we have in the Philippines. Judging from the &lt;a href=&#34;https://code.google.com/p/googletransitdatafeed/wiki/FareExamples&#34;&gt;fare examples&lt;/a&gt;, the only reasonable way we could implement distance-based fares is following example 6. This would involve setting a fare for each possible pair of stops based on the distance between them. This isn&amp;rsquo;t exactly ideal. In fact, the people originally working on the DOTC project have voiced &lt;a href=&#34;https://groups.google.com/forum/#!topic/gtfs-fare-wg/V63xRSnQJGw&#34;&gt;issues&lt;/a&gt; and made &lt;a href=&#34;https://groups.google.com/forum/#!msg/gtfs-changes/uybrAokZ9Cg/rqlzXdMypUgJ&#34;&gt;proposals&lt;/a&gt; for having distance-based fares included into GTFS.&lt;/p&gt;
+
+&lt;p&gt;Apparently, public transit fares are a really complicated thing. You have fares based on distance, number of stops passed through, and transfers which may or may not cost extra. Not only that, you might have discounted fares, or first-class vs economy fares. The community will want to get it right before it&amp;rsquo;s formally included in the spec. You can see the current state of the consolidated &lt;a href=&#34;https://docs.google.com/document/d/1mK3--o5g4-3cCXaqmch92U63JTwChh0L2VCmcDViIlM/edit&#34;&gt;GTFS fare proposal here&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Even in it&amp;rsquo;s proposal form though, we might have hope of being able to see these being used. There&amp;rsquo;s currently a &lt;a href=&#34;https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/30&#34;&gt;pull request&lt;/a&gt; for supporting the distance-based fare scheme into the OneBusAway libraries. The libraries actually used by GTFS Editor and OpenTripPlanner for working with GTFS data.&lt;/p&gt;
+
+&lt;h3 id=&#34;remaining-problems:a6ffa536f572175993ee2d6ec342ac72&#34;&gt;Remaining Problems&lt;/h3&gt;
+
+&lt;p&gt;Given all that, it would probably still be a long way before this allows us to make a really good routing app. We still don&amp;rsquo;t have shape data, so the distance estimates would really be rough estimates at best. There&amp;rsquo;s no support for rounding to the nearest centavo. I realize that&amp;rsquo;s just nitpicking, but if we want something truly polished, even that has to be taken care of.&lt;/p&gt;
+
+&lt;p&gt;We also don&amp;rsquo;t know if the jeeps or buses strictly follow the distance-based scheme. After all, if you can get on and off anywhere, you can&amp;rsquo;t really measure distance that exactly. I assume they generally work off the notion of &amp;ldquo;zones&amp;rdquo; than actual distance travelled. In that sense, they work more similarly to the LRT which has fares based on how many stops you pass. For jeeps and buses, your fare is probably based more on how many &amp;ldquo;zones&amp;rdquo; you pass through.&lt;/p&gt;
+
+&lt;h3 id=&#34;conclusion:a6ffa536f572175993ee2d6ec342ac72&#34;&gt;Conclusion&lt;/h3&gt;
+
+&lt;p&gt;Philip, a co-worker of mine at By Implication, had suggested that we might want to use a different model than what the GTFS proposes. I have to agree with him. At this point, the GTFS doesn&amp;rsquo;t really fit with our system. But I do think that open data and standards are great. In fact, I applaud the developers who made proposals for the fare system, as those are great first steps towards making the GTFS a more universal standard.&lt;/p&gt;
+
+&lt;p&gt;Side note: I&amp;rsquo;d also actually really like to hear about the DOTC developers&amp;rsquo; experience with the project. It would be nice if they had a devblog.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>GTFS Editor</title>
+      <link>http://pleasantprogrammer.com/posts/gtfs-editor.html</link>
+      <pubDate>Wed, 10 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/gtfs-editor.html</guid>
+      <description>
+
+&lt;p&gt;Link: &lt;a href=&#34;https://github.com/conveyal/gtfs-editor&#34;&gt;https://github.com/conveyal/gtfs-editor&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; they really meant under development&lt;/p&gt;
+
+&lt;p&gt;When I first saw the source of GTFS Editor, I was ecstatic. They used &lt;a href=&#34;http://playframework.com/&#34;&gt;Play framework&lt;/a&gt;!!! Not only that, they&amp;rsquo;re targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.&lt;/p&gt;
+
+&lt;p&gt;Getting it to actually run though, wasn&amp;rsquo;t very pleasant. The initial setup was easy enough. Get &lt;a href=&#34;http://www.playframework.com/download&#34;&gt;Play 1.2.5&lt;/a&gt;, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that&amp;rsquo;s necessary. Wonderful. Then, run play, open a browser, go to &lt;a href=&#34;http://localhost:9000&#34;&gt;http://localhost:9000&lt;/a&gt;, compilation error. Fantastic.&lt;/p&gt;
+
+&lt;p&gt;If you don&amp;rsquo;t want to go through the technical details, you can just jump to the &lt;a href=&#34;#conclusion&#34;&gt;conclusion&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;let-s-debug:9dc7854b573f1a2be2b19d1bfe826d39&#34;&gt;Let&amp;rsquo;s Debug!&lt;/h2&gt;
+
+&lt;p&gt;I&amp;rsquo;ll be splitting the next section up into 2 parts. In the first pass, I&amp;rsquo;ll talk about what I did to just get the app to run but I won&amp;rsquo;t try hard to fix any bugs. This generally is what I do when I try to get apps to run. I&amp;rsquo;ll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I&amp;rsquo;ll explain what the problems were and how I fixed them.&lt;/p&gt;
+
+&lt;h3 id=&#34;first-pass:9dc7854b573f1a2be2b19d1bfe826d39&#34;&gt;First Pass&lt;/h3&gt;
+
+&lt;p&gt;A thing to note about Play (and one of the reasons it&amp;rsquo;s a lovely Java framework) is that you don&amp;rsquo;t need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that&amp;rsquo;s what I saw, &lt;code&gt;Error: type Check already defined&lt;/code&gt;&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #AA22FF&#34;&gt;@Retention&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;RetentionPolicy&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;RUNTIME&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;)&lt;/span&gt;
+&lt;span style=&#34;color: #AA22FF&#34;&gt;@Target&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;({&lt;/span&gt;ElementType&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;METHOD&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; ElementType&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;TYPE&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;})&lt;/span&gt;
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color: #AA22FF&#34;&gt;@interface&lt;/span&gt; Check &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;// error here&lt;/span&gt;
+
+    String&lt;span style=&#34;color: #666666&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color: #0000FF&#34;&gt;value&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;();&lt;/span&gt;
+&lt;span style=&#34;color: #666666&#34;&gt;}&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;You also know that typical behavior among programmers where your program doesn&amp;rsquo;t compile, but you keep trying to compile it anyway hoping that it will magically just work. That&amp;rsquo;s what I did, and it actually ran. I couldn&amp;rsquo;t really just let this pass, so I decided to try deleting &lt;code&gt;Check.java&lt;/code&gt;. I got another compilation error, &lt;code&gt;Error: type Secure already defined&lt;/code&gt;&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color: #0000FF; font-weight: bold&#34;&gt;Secure&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;extends&lt;/span&gt; Controller &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;// error here&lt;/span&gt;
+
+    &lt;span style=&#34;color: #AA22FF&#34;&gt;@Before&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;unless&lt;span style=&#34;color: #666666&#34;&gt;={&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;login&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;authenticate&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;logout&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;})&lt;/span&gt;
+
+    &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color: #B00040&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color: #0000FF&#34;&gt;checkAccess&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;throws&lt;/span&gt; Throwable &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put &lt;code&gt;Check.java&lt;/code&gt; back in and proceeded to just refresh until it compiled and ran.&lt;/p&gt;
+
+&lt;p&gt;The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the &lt;code&gt;account&lt;/code&gt; table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn&amp;rsquo;t work.&lt;/p&gt;
+
+&lt;p&gt;Another note regarding Play 1.x, it provides the &lt;a href=&#34;http://www.playframework.com/documentation/1.2.5/secure&#34;&gt;secure module&lt;/a&gt; which handles logins and keeping state, you simply need to implement the method &lt;code&gt;boolean authenticate(String username, String password)&lt;/code&gt;. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return &lt;code&gt;true&lt;/code&gt; and then any login would work. No need to actually set the password. Excellent.&lt;/p&gt;
+
+&lt;p&gt;And we&amp;rsquo;re logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, &lt;code&gt;IndexOutOfBoundsException occured : Index: 0, Size: 0&lt;/code&gt;&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;session&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;get&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;agencyId&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;null&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt;
+
+    Agency agency &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; agencies&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;get&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(0);&lt;/span&gt; &lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;// error here&lt;/span&gt;
+
+    session&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;put&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;agencyId&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; agency&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;);&lt;/span&gt;
+    session&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;put&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;agencyName&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; agency&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;);&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Apparently, we need to have an agency. That&amp;rsquo;s generally simple enough. You just manually insert an agency into the &lt;code&gt;agency&lt;/code&gt; table. After that&amp;rsquo;s done, we finally have a view of the actual application. It&amp;rsquo;s very Bootstrap-y, but that&amp;rsquo;s just fine. The workflow though, is not perfectly intuitive, but I&amp;rsquo;ll talk about that some other day.&lt;/p&gt;
+
+&lt;p&gt;That&amp;rsquo;s not the end of it though, we still have to fix these bugs. The developer obviously didn&amp;rsquo;t have to put up with this when they were working, so what happened? Also, the log is showing some weird things,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;~        _            _
+~  _ __ | | __ _ _  _| |
+~ | &amp;#39;_ \| |/ _&amp;#39; | || |_|
+~ |  __/|_|\____|\__ (_)
+~ |_|            |__/
+~
+~ play! 1.2.5, http://www.playframework.org
+~
+~ Ctrl+C to stop
+~
+CompilerOracle: exclude jregex/Pretokenizer.next
+Listening for transport dt_socket at address: 8000
+23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
+23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
+23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
+23:32:15,830 WARN  ~ You&amp;#39;re running Play! in DEV mode
+23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
+23:32:28,792 ERROR ~
+
+@6f02fa9dd
+Internal Server Error (500) for request GET /
+
+Compilation error (In /app/controllers/Check.java around line 10)
+The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
+
+play.exceptions.CompilationException: The type Check is already defined
+	at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
+	at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
+	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
+	at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
+	at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
+	at play.Play.start(Play.java:516)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at Invocation.HTTP Request(Play!)
+23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
+SLF4J: Class path contains multiple SLF4J bindings.
+SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
+23:32:32,490 INFO  ~ Initializing HBSpatialExtension
+23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
+23:32:32,494 INFO  ~ Checking for default configuration file.
+23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
+23:32:34,077 INFO  ~ Application &amp;#39;gtfs-editor&amp;#39; is now started !
+23:32:34,151 INFO  ~ Bootstrapping Database...
+23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
+play.exceptions.UnexpectedException: Unexpected Error
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
+	at play.templates.TemplateLoader.load(TemplateLoader.java:78)
+	at play.test.Fixtures.loadModels(Fixtures.java:174)
+	at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
+	at play.jobs.Job.doJobWithResult(Job.java:50)
+	at play.jobs.Job.call(Job.java:146)
+	at play.jobs.Job.run(Job.java:132)
+	at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
+	at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
+	at play.Play.start(Play.java:547)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
+	at play.Invoker$Invocation.run(Invoker.java:276)
+	at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
+	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
+	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
+	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
+	at java.lang.Thread.run(Thread.java:680)
+Caused by: play.exceptions.UnexpectedException: Unexpected Error
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
+	... 22 more
+Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
+	at java.io.FileInputStream.open(Native Method)
+	at java.io.FileInputStream.&amp;lt;init&amp;gt;(FileInputStream.java:120)
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
+	... 23 more
+23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
+23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
+23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
+23:32:40,999 DEBUG ~ select nextval (&amp;#39;hibernate_sequence&amp;#39;)
+23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
+23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
+23:32:41,175 ERROR ~
+
+@6f02fa9dg
+Internal Server Error (500) for request GET /
+
+Execution exception (In /app/controllers/Application.java around line 57)
+IndexOutOfBoundsException occured : Index: 0, Size: 0
+
+play.exceptions.JavaExecutionException: Index: 0, Size: 0
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
+	at Invocation.HTTP Request(Play!)
+Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
+	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
+	at java.util.ArrayList.get(ArrayList.java:322)
+	at controllers.Application.initSession(Application.java:57)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
+	at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
+	... 1 more
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;After &lt;code&gt;23:32:34&lt;/code&gt; is when I get the login page. &lt;code&gt;23:32:40&lt;/code&gt; is after I&amp;rsquo;ve logged in.&lt;/p&gt;
+
+&lt;h3 id=&#34;second-pass:9dc7854b573f1a2be2b19d1bfe826d39&#34;&gt;Second Pass&lt;/h3&gt;
+
+&lt;p&gt;So how did you do? First, the error that &lt;code&gt;type Check already defined&lt;/code&gt; usually does mean that &lt;code&gt;Check&lt;/code&gt; was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It&amp;rsquo;s the only one there that was &lt;code&gt;Check.java&lt;/code&gt;. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, &lt;code&gt;Check.java&lt;/code&gt;. Doing a diff shows nothing was changed. So the solution really was just simply delete &lt;code&gt;Check.java&lt;/code&gt; and also &lt;code&gt;Secure.java&lt;/code&gt;. No more compilation errors!&lt;/p&gt;
+
+&lt;p&gt;The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;Security&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;isConnected&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;())&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt;
+    &lt;span style=&#34;color: #666666&#34;&gt;...&lt;/span&gt;
+    Account account &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; Account&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;find&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;username = ?&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; Security&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;connected&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;()).&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;first&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;();&lt;/span&gt;
+    &lt;span style=&#34;color: #666666&#34;&gt;...&lt;/span&gt;
+    &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;account &lt;span style=&#34;color: #666666&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;null&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; Account&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;0)&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt;
+        account &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;new&lt;/span&gt; Account&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;admin&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;admin&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;admin@test.com&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;null&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;);&lt;/span&gt;
+        account&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;save&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;();&lt;/span&gt;
+    &lt;span style=&#34;color: #666666&#34;&gt;}&lt;/span&gt;
+    &lt;span style=&#34;color: #666666&#34;&gt;...&lt;/span&gt;
+&lt;span style=&#34;color: #666666&#34;&gt;}&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;You can actually see this in action at &lt;code&gt;23:32:41,051&lt;/code&gt; in the log. So what&amp;rsquo;s wrong with all of this? The account creation happened after I&amp;rsquo;ve already logged in. In fact, &lt;code&gt;Security.isConnected()&lt;/code&gt; checks whether the user is already logged in or not. How does this even make sense?&lt;/p&gt;
+
+&lt;p&gt;Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we&amp;rsquo;re missing a file called &lt;code&gt;initial-agencies-data.yml&lt;/code&gt;. Ok, apparently it&amp;rsquo;s a &lt;a href=&#34;http://www.playframework.com/documentation/1.2.5/test#fixtures&#34;&gt;fixture&lt;/a&gt; like you would use for testing. It&amp;rsquo;s easy enough to infer what the file&amp;rsquo;s contents should be. We just copy it over from the GTFS data.&lt;/p&gt;
+
+&lt;p&gt;But then where do you put the file? If you look at the log, it says &lt;code&gt;/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml&lt;/code&gt; but that doesn&amp;rsquo;t look right. That&amp;rsquo;s in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the &lt;code&gt;test/&lt;/code&gt; directory? No, that doesn&amp;rsquo;t work either since we&amp;rsquo;re not running a test.&lt;/p&gt;
+
+&lt;p&gt;What I ended up doing was just looking at the sources for &lt;code&gt;Fixtures.load&lt;/code&gt;. If you follow the stack trace, you end up finding &lt;code&gt;Play.javaPath&lt;/code&gt; which sort of works like PATH for Fixtures and some other things. So where can we put the file? &lt;code&gt;app/&lt;/code&gt; and &lt;code&gt;conf/&lt;/code&gt;. And with that, we&amp;rsquo;re done.&lt;/p&gt;
+
+&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;
+
+&lt;p&gt;GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone &lt;a href=&#34;https://github.com/thatsmydoing/gtfs-editor&#34;&gt;my branch&lt;/a&gt; as I&amp;rsquo;ve fixed the issues discussed earlier. The default login is &lt;code&gt;admin:admin&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Even after getting it to run, it&amp;rsquo;s still not quite usable. Not in the UX sense, but you really can&amp;rsquo;t do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don&amp;rsquo;t have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>One Bus (or maybe Jeep) Away</title>
+      <link>http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html</link>
+      <pubDate>Tue, 09 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html</guid>
+      <description>&lt;p&gt;Link: &lt;a href=&#34;http://onebusaway.org/&#34;&gt;http://onebusaway.org/&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; no routing; useless in Philippines&lt;/p&gt;
+
+&lt;p&gt;OneBusAway is a transit information app. It provides data on what bus stops are near you, which buses pass by. You can also get schedules and the route of a particular bus given the number. It can also provide realtime updates like how many minutes until the next bus arrives. It does not, however, provide routing. There is no support for providing directions to get from point A to point B.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s comparable to what you get in some bus stops abroad. You&amp;rsquo;d get a vicinity map and a list of buses passing through the stop. You might also get the times when the next buses will pass. It&amp;rsquo;s useful for locals who already know how to get around, and want to avoid waiting for the bus. But it&amp;rsquo;s not particularly good for people who want to know how to get around the city.&lt;/p&gt;
+
+&lt;p&gt;OneBusAway is quite comprehensive in its platform support though. There is a webapp, apps for iOS, Android and Windows Phone, as well as SMS and Voice support. This would all be nice but we don&amp;rsquo;t have the necessary infrastructure yet in the Philippines. We don&amp;rsquo;t have bus or jeepney stops. We also wouldn&amp;rsquo;t have realtime data to make the app particularly useful.&lt;/p&gt;
+
+&lt;p&gt;You can try it out for yourself by following their &lt;a href=&#34;https://github.com/OneBusAway/onebusaway-application-modules/wiki/OneBusAway-Quickstart-Guide&#34;&gt;Quickstart Guide&lt;/a&gt;. One caveat is you will have to add &lt;code&gt;-P tripEntriesFactory.throwExceptionOnInvalidStopToShapeMappingException=false&lt;/code&gt; when building the bundle. This has to do with the OneBusAway having difficulty matching the &lt;a href=&#34;https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching&#34;&gt;stops to the shape data&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s some screenshots of the app with the Philippine data. Notice how you only see the stops but there isn&amp;rsquo;t a line for the route. This is a problem with our GTFS data. Also, at some points it&amp;rsquo;s hard to tell where the jeep is going to pass since there isn&amp;rsquo;t any indication of order either. This is more of a OneBusAway problem. It usually expects there to be shape data available.&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;../galleries/transit/onebusaway1.png&#34;&gt;&lt;img src=&#34;../galleries/transit/onebusaway1.png&#34; alt=&#34;OneBusAway&#34; title=&#34;All the stops along Katipunan Avenue are named Katipunan Avenue.&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;It doesn&amp;rsquo;t really handle too many routes passing through a stop. The list just overflows past the bubble. You can still actually read it by panning the map. It&amp;rsquo;s just a bit weird though.&lt;/p&gt;
+
+&lt;p&gt;If you also noticed, there are usually 2 of each route. This is how the jeepney data was modeled as jeep routes might be different going one way and going back. This isn&amp;rsquo;t the case for all jeeps though, so it might also be an implementation issue with the GTFS editor.&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;../galleries/transit/onebusaway2.png&#34;&gt;&lt;img src=&#34;../galleries/transit/onebusaway2.png&#34; alt=&#34;OneBusAway&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;../galleries/transit/onebusaway3.png&#34;&gt;&lt;img src=&#34;../galleries/transit/onebusaway3.png&#34; alt=&#34;OneBusAway&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Open Trip Planner</title>
+      <link>http://pleasantprogrammer.com/posts/open-trip-planner.html</link>
+      <pubDate>Tue, 09 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/open-trip-planner.html</guid>
+      <description>
+
+&lt;p&gt;Link: &lt;a href=&#34;http://www.opentripplanner.org&#34;&gt;http://www.opentripplanner.org&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; routes pretty well; data might cause weird issues&lt;/p&gt;
+
+&lt;p&gt;OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you&amp;rsquo;re willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s actually in general use by the &lt;a href=&#34;http://maps.trimet.org/&#34;&gt;Trimet&lt;/a&gt;, Portland&amp;rsquo;s public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner&amp;rsquo;s support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn&amp;rsquo;t have. This actually just screams &lt;a href=&#34;http://philippine-transit.hackathome.com/prizes/&#34;&gt;Inclusive Technology Award&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h3 id=&#34;setup:8052f9d579c0ac6326f58a643a8791fb&#34;&gt;Setup&lt;/h3&gt;
+
+&lt;p&gt;Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I&amp;rsquo;d suggest going through the &lt;a href=&#34;https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes&#34;&gt;5-minute introduction&lt;/a&gt; if you want to actually work with the Philippine data. You will also need to download the &lt;a href=&#34;http://download.geofabrik.de/asia/philippines.html&#34;&gt;Philippine data dump&lt;/a&gt; from OSM. You will want the &lt;code&gt;osm.bz2&lt;/code&gt; one (WARNING: 900MB unzipped).&lt;/p&gt;
+
+&lt;p&gt;Once you get the webapp running, you&amp;rsquo;ll notice the map tiles won&amp;rsquo;t load correctly. This is because the default tileset used is from Mapbox which doesn&amp;rsquo;t provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.&lt;/p&gt;
+
+&lt;h3 id=&#34;issues:8052f9d579c0ac6326f58a643a8791fb&#34;&gt;Issues&lt;/h3&gt;
+
+&lt;p&gt;The next thing you&amp;rsquo;ll notice is that you can&amp;rsquo;t search for a place. You can only just pick points on the map and route between those. I&amp;rsquo;m still not exactly sure if it&amp;rsquo;s supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn&amp;rsquo;t be too difficult.&lt;/p&gt;
+
+&lt;p&gt;Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet&amp;rsquo;s implementation isn&amp;rsquo;t as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.&lt;/p&gt;
+
+&lt;p&gt;There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a &amp;ldquo;stop&amp;rdquo; in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the &amp;ldquo;stop&amp;rdquo; to Arguilla.&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;../galleries/transit/otp1.png&#34; alt=&#34;OpenTripPlanner disconnected route&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;I can&amp;rsquo;t say this isn&amp;rsquo;t a bug. After all, OpenTripPlanner couldn&amp;rsquo;t have magically known there really was a street there. If it did, it wouldn&amp;rsquo;t just teleport you to the corner. I&amp;rsquo;m more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.&lt;/p&gt;
+
+&lt;p&gt;Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won&amp;rsquo;t give you the best route because it thinks you have to loop around to get to where you want to be. I don&amp;rsquo;t really know how common this issue pops up though. It&amp;rsquo;s highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;../galleries/transit/otp2.png&#34; alt=&#34;OpenTripPlanner loopy route&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;Much like the earlier problem, I can&amp;rsquo;t tell if this is a bug or it&amp;rsquo;s a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren&amp;rsquo;t even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;../galleries/transit/upkatipunan.jpg&#34; alt=&#34;UP Katipunan Route&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren&amp;rsquo;t that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.&lt;/p&gt;
+
+&lt;h3 id=&#34;conclusion:8052f9d579c0ac6326f58a643a8791fb&#34;&gt;Conclusion&lt;/h3&gt;
+
+&lt;p&gt;Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There&amp;rsquo;s also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.&lt;/p&gt;
+</description>
+    </item>
+    
+  </channel>
+</rss>

+ 177 - 157
output/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html

@@ -1,188 +1,208 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>TiddlyWiki in the Sky (or TiddlyWeb for TW5) | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="is-my-terminal-window-active.html" title="Is My Terminal Window Active?" type="text/html">
-<link rel="next" href="cloudflare-shenanigans.html" title="Cloudflare Shenanigans" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="TiddlyWiki in the Sky (or TiddlyWeb for TW5)">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html">
-<meta property="og:description" content="I've always liked TiddlyWiki. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new ">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2015-12-24T14:48:20+08:00">
-<meta property="article:tag" content="sysadmin">
-<meta property="article:tag" content="tiddlywiki">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>TiddlyWiki in the Sky (or TiddlyWeb for TW5) - Pleasant Programmer</title>
 </head>
-<body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">TiddlyWiki in the Sky (or TiddlyWeb for TW5)</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2015-12-24T14:48:20+08:00" itemprop="datePublished" title="2015-12-24 14:48">2015-12-24 14:48</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/sysadmin.html" rel="tag">sysadmin</a>
-           <a class="tag p-category" href="../categories/tiddlywiki.html" rel="tag">tiddlywiki</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>I've always liked <a href="http://tiddlywiki.com">TiddlyWiki</a>. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new HTML file with all your posts inside. I've used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.</p>
-<p>Now, there's TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.</p>
-<p>If you're just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There's plenty of documentation on the site. But if you're looking for more advanced features (like storing your posts in git or a database), then you'll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.</p>
-<p>To support TiddlyWiki5, we'll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.</p>
-<h3>Setting Up TiddlyWiki</h3>
-<p>TiddlyWiki5 provides a command line tool via <code>npm</code> that allows building custom versions of the wiki. In fact, it comes with templates, called "editions", that we can use for our setup. Assuming you already have it installed, create the wiki using</p>
-<pre class="code literal-block">tiddlywiki mywiki --init tw5tank          # create wiki from template
-</pre>
-
-
-<p>This creates a wiki intended for use with <a href="https://tank.peermore.com/">Tank</a>, which is built on top of TiddlyWeb. From here, you should look in <code>mywiki/tiddlers/system</code> which contain the entries for <code>SiteTitle</code>, <code>SiteSubtitle</code>, <code>DefaultTiddlers</code>, and <code>tiddlyweb-host</code>. The first 3 should be configured however you want. These are necessary because they're needed before the wiki can load them from the server. <code>tiddlyweb-host</code> contains the location of the TiddlyWeb server, this should be <code>http://localhost:8080/</code> if you're just testing locally. With everything configured, you can build the new wiki by running</p>
-<pre class="code literal-block">tiddlywiki mywiki --build
-</pre>
 
+<body>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html">TiddlyWiki in the Sky (or TiddlyWeb for TW5)</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2015-12-24">2015-12-24</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/sysadmin.html" rel="tag">
+			sysadmin
+		</a>
+		
+		<a class="tag p-category" href="/tags/tiddlywiki.html" rel="tag">
+			tiddlywiki
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		
+
+<p>I&rsquo;ve always liked <a href="http://tiddlywiki.com">TiddlyWiki</a>. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn&rsquo;t need a backend, it would just save itself as an all new HTML file with all your posts inside. I&rsquo;ve used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.</p>
+
+<p>Now, there&rsquo;s TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.</p>
+
+<p>If you&rsquo;re just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There&rsquo;s plenty of documentation on the site. But if you&rsquo;re looking for more advanced features (like storing your posts in git or a database), then you&rsquo;ll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.</p>
+
+<p>To support TiddlyWiki5, we&rsquo;ll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.</p>
+
+<h2 id="setting-up-tiddlywiki:1f502be524b8b2be2ec53e61b7c9a5cf">Setting Up TiddlyWiki</h2>
+
+<p>TiddlyWiki5 provides a command line tool via <code>npm</code> that allows building custom versions of the wiki. In fact, it comes with templates, called &ldquo;editions&rdquo;, that we can use for our setup. Assuming you already have it installed, create the wiki using</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">tiddlywiki mywiki --init tw5tank          <span style="color: #408080; font-style: italic"># create wiki from template</span>
+</pre></div>
+
+<p>This creates a wiki intended for use with <a href="https://tank.peermore.com/">Tank</a>, which is built on top of TiddlyWeb. From here, you should look in <code>mywiki/tiddlers/system</code> which contain the entries for <code>SiteTitle</code>, <code>SiteSubtitle</code>, <code>DefaultTiddlers</code>, and <code>tiddlyweb-host</code>. The first 3 should be configured however you want. These are necessary because they&rsquo;re needed before the wiki can load them from the server. <code>tiddlyweb-host</code> contains the location of the TiddlyWeb server, this should be <code>http://localhost:8080/</code> if you&rsquo;re just testing locally. With everything configured, you can build the new wiki by running</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">tiddlywiki mywiki --build
+</pre></div>
 
 <p>This will output the wiki to <code>mywiki/output/tw5tank.html</code>. You can now serve it using your favorite local webserver, like <code>python -m http.server</code>.</p>
-<h3>Setting Up TiddlyWeb</h3>
-<p>The TiddlyWeb tutorial recommends using <code>tiddlywebwiki</code> which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren't really needed, so we won't go with that. So first, we'll need to install TiddlyWeb and any plugins we might want to use.</p>
-<pre class="code literal-block">pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
-</pre>
 
+<h2 id="setting-up-tiddlyweb:1f502be524b8b2be2ec53e61b7c9a5cf">Setting Up TiddlyWeb</h2>
 
-<p>Next, we'll need the tiddlyweb configuration in <code>tiddlywebconfig.py</code></p>
-<pre class="code literal-block"><span class="c"># A basic configuration.</span>
-<span class="c"># `pydoc tiddlyweb.config` for details on configuration items.</span>
+<p>The TiddlyWeb tutorial recommends using <code>tiddlywebwiki</code> which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren&rsquo;t really needed, so we won&rsquo;t go with that. So first, we&rsquo;ll need to install TiddlyWeb and any plugins we might want to use.</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
+</pre></div>
 
-<span class="kn">import</span> <span class="nn">tiddlywebplugins.status</span>
+<p>Next, we&rsquo;ll need the tiddlyweb configuration in <code>tiddlywebconfig.py</code></p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%"><span style="color: #408080; font-style: italic"># A basic configuration.</span>
+<span style="color: #408080; font-style: italic"># `pydoc tiddlyweb.config` for details on configuration items.</span>
 
-<span class="n">config</span> <span class="o">=</span> <span class="p">{</span>
-    <span class="s">'system_plugins'</span><span class="p">:</span> <span class="p">[</span><span class="s">'tiddlywebplugins.status'</span><span class="p">,</span> <span class="s">'tiddlywebplugins.cors'</span><span class="p">],</span>
-    <span class="s">'secret'</span><span class="p">:</span> <span class="s">'36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0'</span><span class="p">,</span>
-    <span class="s">'wsgi_server'</span><span class="p">:</span> <span class="s">'tiddlywebplugins.cherrypy'</span><span class="p">,</span>
-    <span class="s">'cors.enable_non_simple'</span><span class="p">:</span> <span class="bp">True</span>
-<span class="p">}</span>
+<span style="color: #008000; font-weight: bold">import</span> <span style="color: #0000FF; font-weight: bold">tiddlywebplugins.status</span>
 
-<span class="n">original_gather_data</span> <span class="o">=</span> <span class="n">tiddlywebplugins</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="n">_gather_data</span>
+config <span style="color: #666666">=</span> {
+    <span style="color: #BA2121">&#39;system_plugins&#39;</span>: [<span style="color: #BA2121">&#39;tiddlywebplugins.status&#39;</span>, <span style="color: #BA2121">&#39;tiddlywebplugins.cors&#39;</span>],
+    <span style="color: #BA2121">&#39;secret&#39;</span>: <span style="color: #BA2121">&#39;36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0&#39;</span>,
+    <span style="color: #BA2121">&#39;wsgi_server&#39;</span>: <span style="color: #BA2121">&#39;tiddlywebplugins.cherrypy&#39;</span>,
+    <span style="color: #BA2121">&#39;cors.enable_non_simple&#39;</span>: <span style="color: #008000">True</span>
+}
 
-<span class="k">def</span> <span class="nf">_status_gather_data</span><span class="p">(</span><span class="n">environ</span><span class="p">):</span>
-    <span class="n">data</span> <span class="o">=</span> <span class="n">original_gather_data</span><span class="p">(</span><span class="n">environ</span><span class="p">)</span>
-    <span class="n">data</span><span class="p">[</span><span class="s">'space'</span><span class="p">]</span> <span class="o">=</span> <span class="p">{</span><span class="s">'recipe'</span><span class="p">:</span> <span class="s">'default'</span><span class="p">}</span>
-    <span class="k">return</span> <span class="n">data</span>
+original_gather_data <span style="color: #666666">=</span> tiddlywebplugins<span style="color: #666666">.</span>status<span style="color: #666666">.</span>_gather_data
 
-<span class="n">tiddlywebplugins</span><span class="o">.</span><span class="n">status</span><span class="o">.</span><span class="n">_gather_data</span> <span class="o">=</span> <span class="n">_status_gather_data</span>
-</pre>
+<span style="color: #008000; font-weight: bold">def</span> <span style="color: #0000FF">_status_gather_data</span>(environ):
+    data <span style="color: #666666">=</span> original_gather_data(environ)
+    data[<span style="color: #BA2121">&#39;space&#39;</span>] <span style="color: #666666">=</span> {<span style="color: #BA2121">&#39;recipe&#39;</span>: <span style="color: #BA2121">&#39;default&#39;</span>}
+    <span style="color: #008000; font-weight: bold">return</span> data
 
+tiddlywebplugins<span style="color: #666666">.</span>status<span style="color: #666666">.</span>_gather_data <span style="color: #666666">=</span> _status_gather_data
+</pre></div>
 
 <p>The tweaks involved are:</p>
+
 <ul>
 <li>using the status plugin which the wiki requires</li>
-<li>monkeypatching the status plugin for the wiki to use the correct "recipe"</li>
+<li>monkeypatching the status plugin for the wiki to use the correct &ldquo;recipe&rdquo;</li>
 <li>using cherrypy server instead of the buggy default one</li>
-<li>using cors since we're not hosting the wiki itself on the same server</li>
+<li>using cors since we&rsquo;re not hosting the wiki itself on the same server</li>
 </ul>
-<p>With that, we just need to create the store that will hold our data</p>
-<pre class="code literal-block">twanager recipe default &lt;&lt;EOF
-desc: standard TiddlyWebWiki environment
-policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
 
-/bags/default/tiddlers
-EOF
+<p>With that, we just need to create the store that will hold our data</p>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">twanager recipe default <span style="color: #BA2121">&lt;&lt;EOF</span>
+<span style="color: #BA2121">desc: standard TiddlyWebWiki environment</span>
+<span style="color: #BA2121">policy: {&quot;read&quot;: [], &quot;create&quot;: [], &quot;manage&quot;: [&quot;R:ADMIN&quot;], &quot;accept&quot;: [], &quot;write&quot;: [&quot;R:ADMIN&quot;], &quot;owner&quot;: &quot;administrator&quot;, &quot;delete&quot;: [&quot;R:ADMIN&quot;]}</span>
 
-twanager bag default &lt;&lt;EOF
-{"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
-EOF
-</pre>
+<span style="color: #BA2121">/bags/default/tiddlers</span>
+<span style="color: #BA2121">EOF</span>
 
+twanager bag default <span style="color: #BA2121">&lt;&lt;EOF</span>
+<span style="color: #BA2121">{&quot;policy&quot;: {&quot;read&quot;: [], &quot;create&quot;: [], &quot;manage&quot;: [&quot;R:ADMIN&quot;], &quot;accept&quot;: [], &quot;write&quot;: [], &quot;owner&quot;: &quot;administrator&quot;, &quot;delete&quot;: []}}</span>
+<span style="color: #BA2121">EOF</span>
+</pre></div>
 
 <p>Finally, we can start the TiddlyWeb server</p>
-<pre class="code literal-block">twanager server
-</pre>
+<div class="highlight" style="background: #f8f8f8"><pre style="line-height: 125%">twanager server
+</pre></div>
+
+<h2 id="putting-it-all-together:1f502be524b8b2be2ec53e61b7c9a5cf">Putting it all together</h2>
 
+<p>Once you have the TiddlyWeb server running, you can just go to wherever you&rsquo;re hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that&rsquo;s done it&rsquo;s saved. You can refresh your browser and your posts should still be there.</p>
+
+<p>At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won&rsquo;t need CORS anymore.</p>
 
-<h3>Putting it all together</h3>
-<p>Once you have the TiddlyWeb server running, you can just go to wherever you're hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that's done it's saved. You can refresh your browser and your posts should still be there.</p>
-<p>At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won't need CORS anymore.</p>
 <p>TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/cloudflare-shenanigans.html" rel="prev" title="Cloudflare Shenanigans">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/is-my-terminal-window-active.html" rel="next" title="Is My Terminal Window Active?">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html';
+var disqus_title = 'TiddlyWiki in the Sky (or TiddlyWeb for TW5)';
+var disqus_identifier = 'cache/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="is-my-terminal-window-active.html" rel="prev" title="Is My Terminal Window Active?">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="cloudflare-shenanigans.html" rel="next" title="Cloudflare Shenanigans">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html",
-        disqus_title="TiddlyWiki in the Sky (or TiddlyWeb for TW5)",
-        disqus_identifier="cache/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
-</div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 0 - 91
output/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.md

@@ -1,91 +0,0 @@
-<!--
-.. title: TiddlyWiki in the Sky (or TiddlyWeb for TW5)
-.. slug: tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5
-.. date: 2015-12-24 14:48:20 UTC+08:00
-.. tags: sysadmin, tiddlywiki
-.. category:
-.. link:
-.. description:
-.. type: text
--->
-
-I've always liked [TiddlyWiki](http://tiddlywiki.com). Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new HTML file with all your posts inside. I've used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.
-
-Now, there's TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.
-
-If you're just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There's plenty of documentation on the site. But if you're looking for more advanced features (like storing your posts in git or a database), then you'll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.
-
-To support TiddlyWiki5, we'll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.
-
-## Setting Up TiddlyWiki
-
-TiddlyWiki5 provides a command line tool via `npm` that allows building custom versions of the wiki. In fact, it comes with templates, called "editions", that we can use for our setup. Assuming you already have it installed, create the wiki using
-
-    tiddlywiki mywiki --init tw5tank          # create wiki from template
-
-This creates a wiki intended for use with [Tank](https://tank.peermore.com/), which is built on top of TiddlyWeb. From here, you should look in `mywiki/tiddlers/system` which contain the entries for `SiteTitle`, `SiteSubtitle`, `DefaultTiddlers`, and `tiddlyweb-host`. The first 3 should be configured however you want. These are necessary because they're needed before the wiki can load them from the server. `tiddlyweb-host` contains the location of the TiddlyWeb server, this should be `http://localhost:8080/` if you're just testing locally. With everything configured, you can build the new wiki by running
-
-    tiddlywiki mywiki --build
-
-This will output the wiki to `mywiki/output/tw5tank.html`. You can now serve it using your favorite local webserver, like `python -m http.server`.
-
-## Setting Up TiddlyWeb
-
-The TiddlyWeb tutorial recommends using `tiddlywebwiki` which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren't really needed, so we won't go with that. So first, we'll need to install TiddlyWeb and any plugins we might want to use.
-
-    pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
-
-Next, we'll need the tiddlyweb configuration in `tiddlywebconfig.py`
-
-    # A basic configuration.
-    # `pydoc tiddlyweb.config` for details on configuration items.
-
-    import tiddlywebplugins.status
-
-    config = {
-        'system_plugins': ['tiddlywebplugins.status', 'tiddlywebplugins.cors'],
-        'secret': '36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0',
-        'wsgi_server': 'tiddlywebplugins.cherrypy',
-        'cors.enable_non_simple': True
-    }
-
-    original_gather_data = tiddlywebplugins.status._gather_data
-
-    def _status_gather_data(environ):
-        data = original_gather_data(environ)
-        data['space'] = {'recipe': 'default'}
-        return data
-
-    tiddlywebplugins.status._gather_data = _status_gather_data
-
-The tweaks involved are:
-
- * using the status plugin which the wiki requires
- * monkeypatching the status plugin for the wiki to use the correct "recipe"
- * using cherrypy server instead of the buggy default one
- * using cors since we're not hosting the wiki itself on the same server
-
-With that, we just need to create the store that will hold our data
-
-    twanager recipe default <<EOF
-    desc: standard TiddlyWebWiki environment
-    policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
-
-    /bags/default/tiddlers
-    EOF
-
-    twanager bag default <<EOF
-    {"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
-    EOF
-
-Finally, we can start the TiddlyWeb server
-
-    twanager server
-
-## Putting it all together
-
-Once you have the TiddlyWeb server running, you can just go to wherever you're hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that's done it's saved. You can refresh your browser and your posts should still be there.
-
-At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won't need CORS anymore.
-
-TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.

+ 135 - 115
output/posts/transit-wand.html

@@ -1,123 +1,143 @@
 <!DOCTYPE html>
-<html prefix="og: http://ogp.me/ns# article: http://ogp.me/ns/article# " vocab="http://ogp.me/ns" lang="en">
+<html lang="en-us">
 <head>
-<meta charset="utf-8">
-<meta name="viewport" content="width=device-width">
-<title>Transit Wand | Pleasant Programmer</title>
-<link href="../assets/css/rst.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/code.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/theme.css" rel="stylesheet" type="text/css">
-<link href="../assets/css/custom.css" rel="stylesheet" type="text/css">
-<link rel="alternate" type="application/rss+xml" title="RSS" href="../rss.xml">
-<link rel="canonical" href="http://pleasantprogrammer.com/posts/transit-wand.html">
-<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script><script type="text/javascript">try{Typekit.load();}catch(e){}</script><!--[if lt IE 9]><script src="../assets/js/html5.js"></script><![endif]--><meta name="author" content="Thomas Dy">
-<link rel="prev" href="fare-data.html" title="Fare Data" type="text/html">
-<link rel="next" href="graphserver.html" title="GraphServer" type="text/html">
-<meta property="og:site_name" content="Pleasant Programmer">
-<meta property="og:title" content="Transit Wand">
-<meta property="og:url" content="http://pleasantprogrammer.com/posts/transit-wand.html">
-<meta property="og:description" content="Link: http://transitwand.com
-Overall, this was the simplest of the open-source transit tools to actually get up and running. There's already a deployed instance of the server, and you can easily downl">
-<meta property="og:type" content="article">
-<meta property="article:published_time" content="2013-07-15T22:45:20+08:00">
-<meta property="article:tag" content="philippine-transit-app">
-<meta property="article:tag" content="programming">
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.15" />
+	<meta name="viewport" content="width=device-width, initial-scale=1">
+	<link rel="stylesheet" href="/assets/css/theme.css">
+	<link rel="alternate" href="/rss.xml" type="application/rss+xml" title="Pleasant Programmer">
+	<script type="text/javascript" src="//use.typekit.net/iwm5axp.js"></script>
+	<script type="text/javascript">try{Typekit.load();}catch(e){}</script>
+	<title>Transit Wand - Pleasant Programmer</title>
 </head>
+
 <body>
-<a href="#content" class="sr-only sr-only-focusable">Skip to main content</a>
-    
-    <header id="header" role="banner"><div class="thomas">
-            <img src="../assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS"><img src="../assets/img/thomas.png" alt="Pleasant Programmer">
-</div>
-        
-    <h1 id="brand"><a href="http://pleasantprogrammer.com/" title="Pleasant Programmer" rel="home">
-
-        <span id="blog-title">Pleasant Programmer</span>
-    </a></h1>
-
-        
-
-        
-    <nav id="menu" role="navigation"><ul>
-<li class="twitter"><a href="http://twitter.com/pleasantprog">@pleasantprog</a></li>
-                <li><a href="../archive.html">Archives</a></li>
-                <li><a href="../categories/index.html">Tags</a></li>
-                <li><a href="../rss.xml">RSS</a></li>
-    
-    
-    </ul></nav></header><div id="container">
-         <main id="content" role="main"><article class="post-text h-entry hentry postpage" itemscope="itemscope" itemtype="http://schema.org/Article"><header><h1 class="p-name entry-title" itemprop="headline name"><a href="#" class="u-url">Transit Wand</a></h1>
-
-        <small>
-        <span class="dateline">Posted: <a href="#" rel="bookmark"><time class="published dt-published" datetime="2013-07-15T22:45:20+08:00" itemprop="datePublished" title="2013-07-15 22:45">2013-07-15 22:45</time></a></span>
-        |
-        More posts about
-        
-           <a class="tag p-category" href="../categories/philippine-transit-app.html" rel="tag">philippine-transit-app</a>
-           <a class="tag p-category" href="../categories/programming.html" rel="tag">programming</a>
-
-        </small>
-        
-
-    </header><div class="e-content entry-content" itemprop="articleBody text">
-    <div>
-<p>Link: <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">http://transitwand.com</a></p>
-<p>Overall, this was the simplest of the <a href="http://philippine-transit.hackathome.com/use-this-code/">open-source transit tools</a> to actually get up and running. There's already a deployed instance of the server, and you can easily download the phone app via the <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">Play Store</a>. Even running the server by yourself didn't have any of the hiccups I had with GTFS Editor.</p>
+	<header id="header" role="banner">
+		<div id="thomas">
+			<img src="/assets/img/thomas.gif" alt="DJ THOMAS IN DA HAUS">
+			<img src="/assets/img/thomas.png" alt="Pleasant Programmer">
+		</div>
+		<h1 class="site-title"><a href="/">Pleasant Programmer</a></h1>
+		<nav id="menu" role="navigation">
+			<ul>
+				<li class="twitter">
+					<a href="http://twitter.com/pleasantprog">@pleasantprog</a>
+				</li>
+				<li><a href="/posts.html">archives</a></li>
+				<li><a href="/tags/index.html">tags</a></li>
+				<li><a href="/rss.xml">rss</a></li>
+			</ul>
+		</nav>
+	</header>
+	<div id="container">
+
+
+<main id="content" role="main">
+<article itemscope itemtype="http://schema.org/BlogPosting">
+	<h1 class="p-name entry-title" itemprop="headline name">
+		<a href="/posts/transit-wand.html">Transit Wand</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2013-07-15">2013-07-15</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/philippine-transit-app.html" rel="tag">
+			philippine-transit-app
+		</a>
+		
+		<a class="tag p-category" href="/tags/programming.html" rel="tag">
+			programming
+		</a>
+		
+	</small>
+	<div class="e-content entry-content" itemprop="entry-text">
+		<p>Link: <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">http://transitwand.com</a></p>
+
+<p>Overall, this was the simplest of the <a href="http://philippine-transit.hackathome.com/use-this-code/">open-source transit tools</a> to actually get up and running. There&rsquo;s already a deployed instance of the server, and you can easily download the phone app via the <a href="https://play.google.com/store/apps/details?id=com.conveyal.transitwand">Play Store</a>. Even running the server by yourself didn&rsquo;t have any of the hiccups I had with GTFS Editor.</p>
+
 <p>The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.</p>
-<p>After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it's free and you don't even actually need to put in a username or anything. It simply registers the phone's IMEI on the server and gives you a 6-digit identifier.</p>
-<p>You can then use the 6-digit identifier to view the data on Transit Wand's server, which is good since uploading any data automatically deletes it from the phone. There really isn't much else you can do with it though. It just allows you to view the data, and export it as a <a href="https://en.wikipedia.org/wiki/Shapefile">Shapefile</a>.</p>
-<p>As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There's also no way to extract the ridership information from the server yet. This isn't to say that the data won't eventually go public though.</p>
-<p>An interesting thing you <em>can</em> do with the Transit Wand data is import it into GTFS Editor to make a new route. You don't even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you've captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.</p>
-<p>I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don't understand is why the shape data isn't present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can't easily move stops, you have to input coordinates to change the position.</p>
-<p>It <em>might</em> also be possible that when the DOTC was still collecting the data, the route collection or editing features weren't present yet. That would just be lame and depressing though.</p>
-<p>Overall, Transit Wand does what it's supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.</p>
-</div>
-    </div>
-    <aside class="postpromonav"><nav><ul class="pager clearfix">
-<li class="previous">
-                <a href="fare-data.html" rel="prev" title="Fare Data">← Previous post</a>
-            </li>
-            <li class="next">
-                <a href="graphserver.html" rel="next" title="GraphServer">Next post →</a>
-            </li>
-        </ul></nav></aside><section class="comments"><div id="disqus_thread"></div>
-        <script>
-        var disqus_shortname ="pleasantprog",
-            disqus_url="http://pleasantprogrammer.com/posts/transit-wand.html",
-        disqus_title="Transit Wand",
-        disqus_identifier="cache/posts/transit-wand.html",
-        disqus_config = function () {
-            this.language = "en";
-        };
-        (function() {
-            var dsq = document.createElement('script'); dsq.async = true;
-            dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
-            (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
-        })();
-    </script><noscript>Please enable JavaScript to view the <a href="//disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a>
-</noscript>
-    <a href="//disqus.com" class="dsq-brlink" rel="nofollow">Comments powered by <span class="logo-disqus">Disqus</span></a>
-
-
-        </section></article><script>var disqus_shortname="pleasantprog";(function(){var a=document.createElement("script");a.async=true;a.src="//"+disqus_shortname+".disqus.com/count.js";(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]).appendChild(a)}());</script></main><footer id="footer" role="contentinfo"><p><a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US"><img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png"></a> © 2015 Thomas Dy - Powered by <a href="http://getnikola.com">Nikola</a></p>
-            
-        </footer>
+
+<p>After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it&rsquo;s free and you don&rsquo;t even actually need to put in a username or anything. It simply registers the phone&rsquo;s IMEI on the server and gives you a 6-digit identifier.</p>
+
+<p>You can then use the 6-digit identifier to view the data on Transit Wand&rsquo;s server, which is good since uploading any data automatically deletes it from the phone. There really isn&rsquo;t much else you can do with it though. It just allows you to view the data, and export it as a <a href="https://en.wikipedia.org/wiki/Shapefile">Shapefile</a>.</p>
+
+<p>As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There&rsquo;s also no way to extract the ridership information from the server yet. This isn&rsquo;t to say that the data won&rsquo;t eventually go public though.</p>
+
+<p>An interesting thing you <em>can</em> do with the Transit Wand data is import it into GTFS Editor to make a new route. You don&rsquo;t even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you&rsquo;ve captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.</p>
+
+<p>I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don&rsquo;t understand is why the shape data isn&rsquo;t present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can&rsquo;t easily move stops, you have to input coordinates to change the position.</p>
+
+<p>It <em>might</em> also be possible that when the DOTC was still collecting the data, the route collection or editing features weren&rsquo;t present yet. That would just be lame and depressing though.</p>
+
+<p>Overall, Transit Wand does what it&rsquo;s supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/graphserver.html" rel="prev" title="GraphServer">&larr; Previous post</a>
+				</li>
+				
+				
+				<li class="next">
+					<a href="/posts/fare-data.html" rel="next" title="Fare Data">Next post &rarr;</a>
+				</li>
+				
+			</ul>
+		</nav>
+	</aside>
+	<section class="comments">
+		<div id="disqus_thread"></div>
+<script type="text/javascript">
+var disqus_shortname = 'pleasantprog';
+var disqus_url = 'http:\/\/pleasantprogrammer.com\/posts\/transit-wand.html';
+var disqus_title = 'Transit Wand';
+var disqus_identifier = 'cache/posts/transit-wand.html';
+
+(function() {
+    var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
+    dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
+    (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
+})();
+</script>
+<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
+<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
+
+	</section>
+</article>
+</main>
+
+
+	<footer id="footer" role="contentinfo">
+		<p>
+		<a rel="license" href="http://creativecommons.org/licenses/by-sa/3.0/deed.en_US">
+			<img alt="CC-BY-SA" style="border-width:0" src="http://i.creativecommons.org/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2015 Thomas Dy - Powered by <a href="http://gohugo.io">Hugo</a></p>
+	</footer>
 </div>
-    
-    
-    
-    
-
-    <script src="../assets/js/konami.js"></script><script src="http://code.jquery.com/jquery-2.0.3.min.js"></script><script>
-        var easter_egg = new Konami();
-        easter_egg.code = function() {
-            $(".thomas").toggleClass("whoa");
-            $("body").scrollTop(0);
-        }
-        easter_egg.load();
-
-        // love you, thomas!
-        // yours, @_phi + @meggykawsek
-    </script>
+
+<script src="/assets/js/konami.js"></script>
+<script>
+var easter_egg = new Konami();
+easter_egg.code = function() {
+	var el = document.getElementById('thomas');
+	if(el.className == "whoa") {
+		el.className = "";
+	}
+	else {
+		el.className = "whoa";
+	}
+	document.body.scrollTop = document.documentElement.scrollTop = 0;
+}
+easter_egg.load();
+
+
+
+</script>
+
+
+
 </body>
 </html>
+

+ 0 - 28
output/posts/transit-wand.md

@@ -1,28 +0,0 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/15 22:45:20
-.. title: Transit Wand
-.. slug: transit-wand
--->
-
-Link: [http://transitwand.com](https://play.google.com/store/apps/details?id=com.conveyal.transitwand)
-
-Overall, this was the simplest of the [open-source transit tools](http://philippine-transit.hackathome.com/use-this-code/) to actually get up and running. There's already a deployed instance of the server, and you can easily download the phone app via the [Play Store](https://play.google.com/store/apps/details?id=com.conveyal.transitwand). Even running the server by yourself didn't have any of the hiccups I had with GTFS Editor.
-
-The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.
-
-After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it's free and you don't even actually need to put in a username or anything. It simply registers the phone's IMEI on the server and gives you a 6-digit identifier.
-
-You can then use the 6-digit identifier to view the data on Transit Wand's server, which is good since uploading any data automatically deletes it from the phone. There really isn't much else you can do with it though. It just allows you to view the data, and export it as a [Shapefile](https://en.wikipedia.org/wiki/Shapefile).
-
-As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There's also no way to extract the ridership information from the server yet. This isn't to say that the data won't eventually go public though.
-
-An interesting thing you *can* do with the Transit Wand data is import it into GTFS Editor to make a new route. You don't even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you've captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.
-
-I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don't understand is why the shape data isn't present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can't easily move stops, you have to input coordinates to change the position.
-
-It *might* also be possible that when the DOTC was still collecting the data, the route collection or editing features weren't present yet. That would just be lame and depressing though.
-
-Overall, Transit Wand does what it's supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.

+ 0 - 4
output/robots.txt

@@ -1,4 +0,0 @@
-Sitemap: http://pleasantprogrammer.com/sitemapindex.xml
-
-User-Agent: *
-Host: pleasantprogrammer.com

+ 727 - 175
output/rss.xml

@@ -1,232 +1,784 @@
-<?xml version="1.0" encoding="utf-8"?>
-<?xml-stylesheet type="text/xsl" href="assets/xml/rss.xsl" media="all"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Pleasant Programmer</title><link>http://pleasantprogrammer.com/</link><description></description><atom:link type="application/rss+xml" rel="self" href="http://pleasantprogrammer.com/rss.xml"></atom:link><language>en</language><lastBuildDate>Fri, 25 Dec 2015 07:29:48 GMT</lastBuildDate><generator>https://getnikola.com/</generator><docs>http://blogs.law.harvard.edu/tech/rss</docs><item><title>Cloudflare Shenanigans</title><link>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.&lt;/p&gt;
-&lt;p&gt;Now the problem is that Cloudflare can put you behind &lt;a href="https://www.cloudflare.com/ips/"&gt;any IP they own&lt;/a&gt;, which is a huge range. There's no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.&lt;/p&gt;
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
+  <channel>
+    <title>Pleasant Programmer</title>
+    <link>http://pleasantprogrammer.com/</link>
+    <description>Recent content on Pleasant Programmer</description>
+    <generator>Hugo -- gohugo.io</generator>
+    <language>en-us</language>
+    <lastBuildDate>Fri, 25 Dec 2015 00:00:00 +0000</lastBuildDate>
+    <atom:link href="http://pleasantprogrammer.com/rss.xml" rel="self" type="application/rss+xml" />
+    
+    <item>
+      <title>Cloudflare Shenanigans</title>
+      <link>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</link>
+      <pubDate>Fri, 25 Dec 2015 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</guid>
+      <description>&lt;p&gt;An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.&lt;/p&gt;
+
+&lt;p&gt;Now the problem is that Cloudflare can put you behind &lt;a href=&#34;https://www.cloudflare.com/ips/&#34;&gt;any IP they own&lt;/a&gt;, which is a huge range. There&amp;rsquo;s no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.&lt;/p&gt;
+
 &lt;p&gt;We never actually empirically tested whether other sites hosted on Cloudflare were also actually zero-rated. But I like to think that we saved a lot of people on their data costs from browsing Reddit and 4chan. But alas, good things must come to an end.&lt;/p&gt;
-&lt;p&gt;A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn't want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn't really afford that, so we looked for other options.&lt;/p&gt;
-&lt;p&gt;Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn't have its own certificate.&lt;/p&gt;
+
+&lt;p&gt;A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn&amp;rsquo;t want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn&amp;rsquo;t really afford that, so we looked for other options.&lt;/p&gt;
+
+&lt;p&gt;Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn&amp;rsquo;t have its own certificate.&lt;/p&gt;
+
 &lt;p&gt;After more testing, we figured out that you could actually use any Cloudflare backed domain so long as we properly set the Host header. We just needed to find one still in the old range. Coincidentally, 4chan.org was. Which led to this wonderful commit&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;commit 123456789abcdef
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;commit 123456789abcdef
 Author: ~~~~~~
 Date:   ~~~~~~
 
     4chan hack
 
-&lt;span class="gh"&gt;diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gd"&gt;--- a/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gi"&gt;+++ b/src/com/client/common/Util.java&lt;/span&gt;
-&lt;span class="gu"&gt;@@ -210,7 +210,8 @@ public class Util {&lt;/span&gt;
+&lt;span style=&#34;color: #000080; font-weight: bold&#34;&gt;diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java&lt;/span&gt;
+&lt;span style=&#34;color: #A00000&#34;&gt;--- a/src/com/client/common/Util.java&lt;/span&gt;
+&lt;span style=&#34;color: #00A000&#34;&gt;+++ b/src/com/client/common/Util.java&lt;/span&gt;
+&lt;span style=&#34;color: #800080; font-weight: bold&#34;&gt;@@ -210,7 +210,8 @@ public class Util {&lt;/span&gt;
         }
 
         public static String getServerAddress(Context context) {
-&lt;span class="gd"&gt;-               String address = "https://backend.client.com";&lt;/span&gt;
-&lt;span class="gi"&gt;+               // String address = "https://backend.client.com";&lt;/span&gt;
-&lt;span class="gi"&gt;+               String address = "https://4chan.org";&lt;/span&gt;
+&lt;span style=&#34;color: #A00000&#34;&gt;-               String address = &amp;quot;https://backend.client.com&amp;quot;;&lt;/span&gt;
+&lt;span style=&#34;color: #00A000&#34;&gt;+               // String address = &amp;quot;https://backend.client.com&amp;quot;;&lt;/span&gt;
+&lt;span style=&#34;color: #00A000&#34;&gt;+               String address = &amp;quot;https://4chan.org&amp;quot;;&lt;/span&gt;
                 if(!isDebug(context)) return address;
                 try {
-&lt;span class="gh"&gt;diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gd"&gt;--- a/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gi"&gt;+++ b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
-&lt;span class="gu"&gt;@@ -101,6 +101,7 @@ public class APIClient {&lt;/span&gt;
+&lt;span style=&#34;color: #000080; font-weight: bold&#34;&gt;diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
+&lt;span style=&#34;color: #A00000&#34;&gt;--- a/src/com/client/common/logging/APIClient.java&lt;/span&gt;
+&lt;span style=&#34;color: #00A000&#34;&gt;+++ b/src/com/client/common/logging/APIClient.java&lt;/span&gt;
+&lt;span style=&#34;color: #800080; font-weight: bold&#34;&gt;@@ -101,6 +101,7 @@ public class APIClient {&lt;/span&gt;
         private HttpResponse postInternal(String url, List&amp;lt;NameValuePair&amp;gt; data, boolean forRegistration) throws ClientProtocolException, IOException {
-                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+"/api/"+url);
-                request.setHeader("X-API-VERSION", apiVersion);
-&lt;span class="gi"&gt;+               request.setHeader("Host", "backend.client.com");&lt;/span&gt;
+                HttpPost request = new HttpPost(Util.getServerAddress(mContext)+&amp;quot;/api/&amp;quot;+url);
+                request.setHeader(&amp;quot;X-API-VERSION&amp;quot;, apiVersion);
+&lt;span style=&#34;color: #00A000&#34;&gt;+               request.setHeader(&amp;quot;Host&amp;quot;, &amp;quot;backend.client.com&amp;quot;);&lt;/span&gt;
 
                 if(data == null) {
                         data = new ArrayList&amp;lt;NameValuePair&amp;gt;();
-&lt;/pre&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Eventually, we did decide to just abandon Cloudflare for the server. We probably weren&amp;rsquo;t going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.&lt;/p&gt;
+
+&lt;p&gt;I just still find it funny we were making people&amp;rsquo;s phones go to 4chan.org everyday for more than a year.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>TiddlyWiki in the Sky (or TiddlyWeb for TW5)</title>
+      <link>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</link>
+      <pubDate>Thu, 24 Dec 2015 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</guid>
+      <description>
+
+&lt;p&gt;I&amp;rsquo;ve always liked &lt;a href=&#34;http://tiddlywiki.com&#34;&gt;TiddlyWiki&lt;/a&gt;. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn&amp;rsquo;t need a backend, it would just save itself as an all new HTML file with all your posts inside. I&amp;rsquo;ve used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.&lt;/p&gt;
+
+&lt;p&gt;Now, there&amp;rsquo;s TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.&lt;/p&gt;
 
+&lt;p&gt;If you&amp;rsquo;re just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There&amp;rsquo;s plenty of documentation on the site. But if you&amp;rsquo;re looking for more advanced features (like storing your posts in git or a database), then you&amp;rsquo;ll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.&lt;/p&gt;
 
-&lt;p&gt;Eventually, we did decide to just abandon Cloudflare for the server. We probably weren't going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.&lt;/p&gt;
-&lt;p&gt;I just still find it funny we were making people's phones go to 4chan.org everyday for more than a year.&lt;/p&gt;&lt;/div&gt;</description><category>cloudflare</category><category>sysadmin</category><guid>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</guid><pubDate>Fri, 25 Dec 2015 06:13:26 GMT</pubDate></item><item><title>TiddlyWiki in the Sky (or TiddlyWeb for TW5)</title><link>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;I've always liked &lt;a href="http://tiddlywiki.com"&gt;TiddlyWiki&lt;/a&gt;. Back when it first came out, it was really amazing. A wiki all in one file, that worked in the browser. It didn't need a backend, it would just save itself as an all new HTML file with all your posts inside. I've used it a lot over the years, as a personal wiki/journal and a class notebook. I even had a blog with it at one point using one of the server-side forks.&lt;/p&gt;
-&lt;p&gt;Now, there's TiddlyWiki5 which is a rewrite of the original TiddlyWiki that looks a whole lot snazzier, and I assume has better architecture overall. It also has experimental support for all the server-side platforms (particularly TiddlyWeb) that have cropped up.&lt;/p&gt;
-&lt;p&gt;If you're just looking for a simple server setup for TiddlyWiki5, it has native support for that on its own. There's plenty of documentation on the site. But if you're looking for more advanced features (like storing your posts in git or a database), then you'll need to use it with TiddlyWeb. The problem is that most of the documentation for TiddlyWeb still refers to the old TiddlyWiki.&lt;/p&gt;
-&lt;p&gt;To support TiddlyWiki5, we'll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.&lt;/p&gt;
-&lt;h3&gt;Setting Up TiddlyWiki&lt;/h3&gt;
-&lt;p&gt;TiddlyWiki5 provides a command line tool via &lt;code&gt;npm&lt;/code&gt; that allows building custom versions of the wiki. In fact, it comes with templates, called "editions", that we can use for our setup. Assuming you already have it installed, create the wiki using&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;tiddlywiki mywiki --init tw5tank          # create wiki from template
-&lt;/pre&gt;
+&lt;p&gt;To support TiddlyWiki5, we&amp;rsquo;ll need a version of the wiki which has the TiddlyWeb plugin already installed and configured. After that, some tweaking is necessary to get TiddlyWeb to provide what the wiki requires.&lt;/p&gt;
 
+&lt;h2 id=&#34;setting-up-tiddlywiki:1f502be524b8b2be2ec53e61b7c9a5cf&#34;&gt;Setting Up TiddlyWiki&lt;/h2&gt;
 
-&lt;p&gt;This creates a wiki intended for use with &lt;a href="https://tank.peermore.com/"&gt;Tank&lt;/a&gt;, which is built on top of TiddlyWeb. From here, you should look in &lt;code&gt;mywiki/tiddlers/system&lt;/code&gt; which contain the entries for &lt;code&gt;SiteTitle&lt;/code&gt;, &lt;code&gt;SiteSubtitle&lt;/code&gt;, &lt;code&gt;DefaultTiddlers&lt;/code&gt;, and &lt;code&gt;tiddlyweb-host&lt;/code&gt;. The first 3 should be configured however you want. These are necessary because they're needed before the wiki can load them from the server. &lt;code&gt;tiddlyweb-host&lt;/code&gt; contains the location of the TiddlyWeb server, this should be &lt;code&gt;http://localhost:8080/&lt;/code&gt; if you're just testing locally. With everything configured, you can build the new wiki by running&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;tiddlywiki mywiki --build
-&lt;/pre&gt;
+&lt;p&gt;TiddlyWiki5 provides a command line tool via &lt;code&gt;npm&lt;/code&gt; that allows building custom versions of the wiki. In fact, it comes with templates, called &amp;ldquo;editions&amp;rdquo;, that we can use for our setup. Assuming you already have it installed, create the wiki using&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;tiddlywiki mywiki --init tw5tank          &lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# create wiki from template&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
 
+&lt;p&gt;This creates a wiki intended for use with &lt;a href=&#34;https://tank.peermore.com/&#34;&gt;Tank&lt;/a&gt;, which is built on top of TiddlyWeb. From here, you should look in &lt;code&gt;mywiki/tiddlers/system&lt;/code&gt; which contain the entries for &lt;code&gt;SiteTitle&lt;/code&gt;, &lt;code&gt;SiteSubtitle&lt;/code&gt;, &lt;code&gt;DefaultTiddlers&lt;/code&gt;, and &lt;code&gt;tiddlyweb-host&lt;/code&gt;. The first 3 should be configured however you want. These are necessary because they&amp;rsquo;re needed before the wiki can load them from the server. &lt;code&gt;tiddlyweb-host&lt;/code&gt; contains the location of the TiddlyWeb server, this should be &lt;code&gt;http://localhost:8080/&lt;/code&gt; if you&amp;rsquo;re just testing locally. With everything configured, you can build the new wiki by running&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;tiddlywiki mywiki --build
+&lt;/pre&gt;&lt;/div&gt;
 
 &lt;p&gt;This will output the wiki to &lt;code&gt;mywiki/output/tw5tank.html&lt;/code&gt;. You can now serve it using your favorite local webserver, like &lt;code&gt;python -m http.server&lt;/code&gt;.&lt;/p&gt;
-&lt;h3&gt;Setting Up TiddlyWeb&lt;/h3&gt;
-&lt;p&gt;The TiddlyWeb tutorial recommends using &lt;code&gt;tiddlywebwiki&lt;/code&gt; which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren't really needed, so we won't go with that. So first, we'll need to install TiddlyWeb and any plugins we might want to use.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
-&lt;/pre&gt;
 
+&lt;h2 id=&#34;setting-up-tiddlyweb:1f502be524b8b2be2ec53e61b7c9a5cf&#34;&gt;Setting Up TiddlyWeb&lt;/h2&gt;
 
-&lt;p&gt;Next, we'll need the tiddlyweb configuration in &lt;code&gt;tiddlywebconfig.py&lt;/code&gt;&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# A basic configuration.&lt;/span&gt;
-&lt;span class="c"&gt;# `pydoc tiddlyweb.config` for details on configuration items.&lt;/span&gt;
+&lt;p&gt;The TiddlyWeb tutorial recommends using &lt;code&gt;tiddlywebwiki&lt;/code&gt; which has all the plugins setup for a nice wiki instance for the old TiddlyWiki. It has a lot of features that aren&amp;rsquo;t really needed, so we won&amp;rsquo;t go with that. So first, we&amp;rsquo;ll need to install TiddlyWeb and any plugins we might want to use.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;pip install tiddlyweb tiddlywebplugins.status tiddlywebplugins.cherrypy tiddlywebplugins.cors
+&lt;/pre&gt;&lt;/div&gt;
 
-&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;tiddlywebplugins.status&lt;/span&gt;
+&lt;p&gt;Next, we&amp;rsquo;ll need the tiddlyweb configuration in &lt;code&gt;tiddlywebconfig.py&lt;/code&gt;&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# A basic configuration.&lt;/span&gt;
+&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# `pydoc tiddlyweb.config` for details on configuration items.&lt;/span&gt;
 
-&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
-    &lt;span class="s"&gt;'system_plugins'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'tiddlywebplugins.status'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'tiddlywebplugins.cors'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
-    &lt;span class="s"&gt;'secret'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
-    &lt;span class="s"&gt;'wsgi_server'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'tiddlywebplugins.cherrypy'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
-    &lt;span class="s"&gt;'cors.enable_non_simple'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="bp"&gt;True&lt;/span&gt;
-&lt;span class="p"&gt;}&lt;/span&gt;
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;import&lt;/span&gt; &lt;span style=&#34;color: #0000FF; font-weight: bold&#34;&gt;tiddlywebplugins.status&lt;/span&gt;
 
-&lt;span class="n"&gt;original_gather_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tiddlywebplugins&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_gather_data&lt;/span&gt;
+config &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; {
+    &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;system_plugins&amp;#39;&lt;/span&gt;: [&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;tiddlywebplugins.status&amp;#39;&lt;/span&gt;, &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;tiddlywebplugins.cors&amp;#39;&lt;/span&gt;],
+    &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;secret&amp;#39;&lt;/span&gt;: &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;36c98d6d14618c79f0ed2d49cd1b9e272d8d4bd0&amp;#39;&lt;/span&gt;,
+    &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;wsgi_server&amp;#39;&lt;/span&gt;: &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;tiddlywebplugins.cherrypy&amp;#39;&lt;/span&gt;,
+    &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;cors.enable_non_simple&amp;#39;&lt;/span&gt;: &lt;span style=&#34;color: #008000&#34;&gt;True&lt;/span&gt;
+}
 
-&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;_status_gather_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
-    &lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;original_gather_data&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;environ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
-    &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s"&gt;'space'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s"&gt;'recipe'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s"&gt;'default'&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
-    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;
+original_gather_data &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; tiddlywebplugins&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;status&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;_gather_data
 
-&lt;span class="n"&gt;tiddlywebplugins&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_gather_data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;_status_gather_data&lt;/span&gt;
-&lt;/pre&gt;
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;def&lt;/span&gt; &lt;span style=&#34;color: #0000FF&#34;&gt;_status_gather_data&lt;/span&gt;(environ):
+    data &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; original_gather_data(environ)
+    data[&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;space&amp;#39;&lt;/span&gt;] &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; {&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;recipe&amp;#39;&lt;/span&gt;: &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;default&amp;#39;&lt;/span&gt;}
+    &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;return&lt;/span&gt; data
 
+tiddlywebplugins&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;status&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;_gather_data &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; _status_gather_data
+&lt;/pre&gt;&lt;/div&gt;
 
 &lt;p&gt;The tweaks involved are:&lt;/p&gt;
+
 &lt;ul&gt;
 &lt;li&gt;using the status plugin which the wiki requires&lt;/li&gt;
-&lt;li&gt;monkeypatching the status plugin for the wiki to use the correct "recipe"&lt;/li&gt;
+&lt;li&gt;monkeypatching the status plugin for the wiki to use the correct &amp;ldquo;recipe&amp;rdquo;&lt;/li&gt;
 &lt;li&gt;using cherrypy server instead of the buggy default one&lt;/li&gt;
-&lt;li&gt;using cors since we're not hosting the wiki itself on the same server&lt;/li&gt;
+&lt;li&gt;using cors since we&amp;rsquo;re not hosting the wiki itself on the same server&lt;/li&gt;
 &lt;/ul&gt;
-&lt;p&gt;With that, we just need to create the store that will hold our data&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;twanager recipe default &amp;lt;&amp;lt;EOF
-desc: standard TiddlyWebWiki environment
-policy: {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": ["R:ADMIN"], "owner": "administrator", "delete": ["R:ADMIN"]}
 
-/bags/default/tiddlers
-EOF
+&lt;p&gt;With that, we just need to create the store that will hold our data&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;twanager recipe default &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;lt;&amp;lt;EOF&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;desc: standard TiddlyWebWiki environment&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;policy: {&amp;quot;read&amp;quot;: [], &amp;quot;create&amp;quot;: [], &amp;quot;manage&amp;quot;: [&amp;quot;R:ADMIN&amp;quot;], &amp;quot;accept&amp;quot;: [], &amp;quot;write&amp;quot;: [&amp;quot;R:ADMIN&amp;quot;], &amp;quot;owner&amp;quot;: &amp;quot;administrator&amp;quot;, &amp;quot;delete&amp;quot;: [&amp;quot;R:ADMIN&amp;quot;]}&lt;/span&gt;
 
-twanager bag default &amp;lt;&amp;lt;EOF
-{"policy": {"read": [], "create": [], "manage": ["R:ADMIN"], "accept": [], "write": [], "owner": "administrator", "delete": []}}
-EOF
-&lt;/pre&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;/bags/default/tiddlers&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;EOF&lt;/span&gt;
 
+twanager bag default &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;lt;&amp;lt;EOF&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;{&amp;quot;policy&amp;quot;: {&amp;quot;read&amp;quot;: [], &amp;quot;create&amp;quot;: [], &amp;quot;manage&amp;quot;: [&amp;quot;R:ADMIN&amp;quot;], &amp;quot;accept&amp;quot;: [], &amp;quot;write&amp;quot;: [], &amp;quot;owner&amp;quot;: &amp;quot;administrator&amp;quot;, &amp;quot;delete&amp;quot;: []}}&lt;/span&gt;
+&lt;span style=&#34;color: #BA2121&#34;&gt;EOF&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
 
 &lt;p&gt;Finally, we can start the TiddlyWeb server&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;twanager server
-&lt;/pre&gt;
-
-
-&lt;h3&gt;Putting it all together&lt;/h3&gt;
-&lt;p&gt;Once you have the TiddlyWeb server running, you can just go to wherever you're hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that's done it's saved. You can refresh your browser and your posts should still be there.&lt;/p&gt;
-&lt;p&gt;At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won't need CORS anymore.&lt;/p&gt;
-&lt;p&gt;TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.&lt;/p&gt;&lt;/div&gt;</description><category>sysadmin</category><category>tiddlywiki</category><guid>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</guid><pubDate>Thu, 24 Dec 2015 06:48:20 GMT</pubDate></item><item><title>Is My Terminal Window Active?</title><link>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;I've been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is &lt;a href="https://github.com/marzocchi/zsh-notify"&gt;zsh-notify&lt;/a&gt;. It's a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.&lt;/p&gt;
-&lt;p&gt;It's pretty convenient when you're compiling something and then go on to browse reddit while waiting. Usually, I spend too much time just reading and forget about the compilation entirely. With the plugin, I get the notification and maybe go back to work.&lt;/p&gt;
-&lt;p&gt;One nice feature it has is that if you're currently looking at the terminal window of the job that just finished, it won't notify you. It only notifies on windows that aren't currently in focus. To do this, it has to actually talk to Terminal.app or iTerm2 to see if the window and tab are active.&lt;/p&gt;
-&lt;p&gt;This is alright in OSX since those 2 are the generally most used terminal emulators. On Linux though, everyone has their own favorite terminal. Given that, I figured I could probably rely on talking to X to see if the window is active instead of each single terminal emulator. X can't tell if the tab is active though, but I don't use tabs in my current setup so it should still be good.&lt;/p&gt;
-&lt;h3&gt;xdotool&lt;/h3&gt;
-&lt;p&gt;&lt;a href="http://superuser.com/questions/382616/detecting-currently-active-window"&gt;Preliminary research&lt;/a&gt; reveals that we can easily get what the active window is with xdotool. &lt;code&gt;xdotool getactivewindow&lt;/code&gt; gives us the X window id of the active one. Now all we need is a way to get the window id of the terminal we're in.&lt;/p&gt;
-&lt;h3&gt;First Attempt: $WINDOWID&lt;/h3&gt;
-&lt;p&gt;Apparently, xterm and similar terminal emulators define an environment variable called &lt;code&gt;$WINDOWID&lt;/code&gt; with the window id of the terminal. Obviously, this is too good to be true. In xterm and konsole the &lt;code&gt;$WINDOWID&lt;/code&gt; was correct, but in VTE-based terminal emulators, &lt;code&gt;$WINDOWID&lt;/code&gt; had the wrong value. In terminology, it didn't define &lt;code&gt;$WINDOWID&lt;/code&gt; altogether. So &lt;code&gt;$WINDOWID&lt;/code&gt; wasn't going to work.&lt;/p&gt;
-&lt;h3&gt;Second Attempt: xdotool search $MAGIC&lt;/h3&gt;
-&lt;p&gt;My second idea was that you can use zsh to change the window title to a magic number and then just check if the active window is the same one as the window with the magic number. This sort of worked for most terminals, except konsole which does whatever it wants with the window title. There's also the problem of some zsh configs automatically settings the window title to the current command.&lt;/p&gt;
-&lt;p&gt;In hindsight, I could probably have just done &lt;code&gt;xdotool search --name xdotool&lt;/code&gt; since in most cases, when you run the search, zsh or konsole will set the window name to the current command. Maybe that's another option I can explore some day.&lt;/p&gt;
-&lt;h3&gt;Third Attempt: $PPID&lt;/h3&gt;
-&lt;p&gt;My third idea was another environment variable called &lt;code&gt;$PPID&lt;/code&gt;, which is the process id of the parent of the shell. As it happens, the parent is the window containing the zsh instance. This is actually pretty consistent across most terminals. The only problem was if you launched zsh from another shell since your new zsh's parent will now be another zsh instance instead of an X window.&lt;/p&gt;
-&lt;p&gt;At first glance, launching zsh within zsh doesn't seem like something most people would do, but this is what happens when you run screen or tmux. To work around this, we can actually just save the original &lt;code&gt;$PPID&lt;/code&gt; in a different variable and use that instead.&lt;/p&gt;
-&lt;p&gt;Now that we have the PID of the window from zsh, we can once again use xdotool to get the PID of the current active window with &lt;code&gt;xdotool getactivewindow getwindowpid&lt;/code&gt;. We just simply compare that with our &lt;code&gt;$PPID&lt;/code&gt; and we can tell if we're in an active window or not. Overall, this approach worked surprisingly well so that's the final solution I went with.&lt;/p&gt;&lt;/div&gt;</description><category>programming</category><guid>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</guid><pubDate>Sun, 07 Jun 2015 08:20:45 GMT</pubDate></item><item><title>Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</title><link>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;I've always thought that people were just too lazy to change their SSIDs when I see "PLDTMyDSLBizCafeJapan". It became apparent when we got our own PLDT line that it was because the bundled router/modem &lt;em&gt;does not&lt;/em&gt; allow you to remove the prefix.&lt;/p&gt;
-&lt;p&gt;This is not the kind of thing you expect as a business customer. Even for home customers, I feel it's still a bit dishonest. I'd be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.&lt;/p&gt;
-&lt;p&gt;Of course, we couldn't just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the &lt;a href="http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html"&gt;Prolink H5004N&lt;/a&gt; or the &lt;a href="http://www.symbianize.com/showthread.php?t=730091"&gt;ZyXEL P-660HN-T1A&lt;/a&gt; but not for the one we got which was the ZyXEL P-2612HNU-F1F.&lt;/p&gt;
-&lt;p&gt;We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the "PLDTMyDSLBiz". We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.&lt;/p&gt;
-&lt;p&gt;The backup is actually just an XML file. You can search for SSID and change the parameter there. It's a bit annoying because the router has to restart after restoring the configuration, but it works!&lt;/p&gt;
-&lt;p&gt;A minor note, the router doesn't seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.&lt;/p&gt;&lt;/div&gt;</description><category>sysadmin</category><guid>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</guid><pubDate>Wed, 27 Nov 2013 02:12:31 GMT</pubDate></item><item><title>Console Keymap Switching</title><link>http://pleasantprogrammer.com/posts/console-keymap-switching.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;At the office, we have some people who use DVORAK. Normally, this isn't a problem. To each his own after all. It does become a bit problematic though, when we're dealing with the servers around the office.&lt;/p&gt;
-&lt;p&gt;We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it's apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.&lt;/p&gt;
-&lt;p&gt;For the console, they'd typically do &lt;code&gt;sudo loadkeys dvorak&lt;/code&gt; after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can't even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn't a readily available thing for the console.&lt;/p&gt;
-&lt;p&gt;I googled around for solutions and came across &lt;a href="http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux"&gt;a nice idea&lt;/a&gt;. You could alias &lt;code&gt;asdf&lt;/code&gt; to load the DVORAK mapping and &lt;code&gt;aoeu&lt;/code&gt; (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don't really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.&lt;/p&gt;
-&lt;p&gt;After some further searching, I found &lt;a href="http://unix.stackexchange.com/questions/2884/toggle-between-dvorak-and-qwerty"&gt;something close to what I wanted&lt;/a&gt;. Apparently, Alt+Up sends a KeyboardSignal keycode to the init process, which can act on that. It also works anywhere, even before being logged in. For SysVinit systems, you can just add a line to your inittab for a command to be run when Alt+Up is pressed.&lt;/p&gt;
-&lt;p&gt;In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. &lt;code&gt;kbrequest.target&lt;/code&gt; is normally aliased to run the rescue service though, so you have to manually create the file in &lt;code&gt;/etc/systemd/system/kbrequest.target&lt;/code&gt; and fill it with a description:&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
-&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;kbrequest target&lt;/span&gt;
-&lt;/pre&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;twanager server
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;h2 id=&#34;putting-it-all-together:1f502be524b8b2be2ec53e61b7c9a5cf&#34;&gt;Putting it all together&lt;/h2&gt;
+
+&lt;p&gt;Once you have the TiddlyWeb server running, you can just go to wherever you&amp;rsquo;re hosting the wiki html and it should work. You can try creating some posts, and the check mark on the sidebar should be red for a while and then turn black. Once that&amp;rsquo;s done it&amp;rsquo;s saved. You can refresh your browser and your posts should still be there.&lt;/p&gt;
+
+&lt;p&gt;At this point, you can start customizing your TiddlyWeb instance, by changing your store to something like a database, or adding authorization. You can also tweak the server setup so you won&amp;rsquo;t need CORS anymore.&lt;/p&gt;
+
+&lt;p&gt;TiddlyWiki5 is still relatively new. I hope that eventually, support for server-side and the plugin ecosystem grows to be as great as the old TiddlyWiki.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Is My Terminal Window Active?</title>
+      <link>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</link>
+      <pubDate>Sun, 07 Jun 2015 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</guid>
+      <description>
+
+&lt;p&gt;I&amp;rsquo;ve been working in OSX for almost 3 years now, but I recently switched back to Linux because of all the problems people encountered with Yosemite. There are some things I missed from OSX though. One of which is &lt;a href=&#34;https://github.com/marzocchi/zsh-notify&#34;&gt;zsh-notify&lt;/a&gt;. It&amp;rsquo;s a zsh plugin that alerts you if your long-running task is complete, and whether it failed or not.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s pretty convenient when you&amp;rsquo;re compiling something and then go on to browse reddit while waiting. Usually, I spend too much time just reading and forget about the compilation entirely. With the plugin, I get the notification and maybe go back to work.&lt;/p&gt;
+
+&lt;p&gt;One nice feature it has is that if you&amp;rsquo;re currently looking at the terminal window of the job that just finished, it won&amp;rsquo;t notify you. It only notifies on windows that aren&amp;rsquo;t currently in focus. To do this, it has to actually talk to Terminal.app or iTerm2 to see if the window and tab are active.&lt;/p&gt;
+
+&lt;p&gt;This is alright in OSX since those 2 are the generally most used terminal emulators. On Linux though, everyone has their own favorite terminal. Given that, I figured I could probably rely on talking to X to see if the window is active instead of each single terminal emulator. X can&amp;rsquo;t tell if the tab is active though, but I don&amp;rsquo;t use tabs in my current setup so it should still be good.&lt;/p&gt;
+
+&lt;h2 id=&#34;xdotool:bfade06d39f7975f041a61de11ad4d4f&#34;&gt;xdotool&lt;/h2&gt;
+
+&lt;p&gt;&lt;a href=&#34;http://superuser.com/questions/382616/detecting-currently-active-window&#34;&gt;Preliminary research&lt;/a&gt; reveals that we can easily get what the active window is with xdotool. &lt;code&gt;xdotool getactivewindow&lt;/code&gt; gives us the X window id of the active one. Now all we need is a way to get the window id of the terminal we&amp;rsquo;re in.&lt;/p&gt;
+
+&lt;h2 id=&#34;first-attempt-windowid:bfade06d39f7975f041a61de11ad4d4f&#34;&gt;First Attempt: $WINDOWID&lt;/h2&gt;
+
+&lt;p&gt;Apparently, xterm and similar terminal emulators define an environment variable called &lt;code&gt;$WINDOWID&lt;/code&gt; with the window id of the terminal. Obviously, this is too good to be true. In xterm and konsole the &lt;code&gt;$WINDOWID&lt;/code&gt; was correct, but in VTE-based terminal emulators, &lt;code&gt;$WINDOWID&lt;/code&gt; had the wrong value. In terminology, it didn&amp;rsquo;t define &lt;code&gt;$WINDOWID&lt;/code&gt; altogether. So &lt;code&gt;$WINDOWID&lt;/code&gt; wasn&amp;rsquo;t going to work.&lt;/p&gt;
+
+&lt;h2 id=&#34;second-attempt-xdotool-search-magic:bfade06d39f7975f041a61de11ad4d4f&#34;&gt;Second Attempt: xdotool search $MAGIC&lt;/h2&gt;
+
+&lt;p&gt;My second idea was that you can use zsh to change the window title to a magic number and then just check if the active window is the same one as the window with the magic number. This sort of worked for most terminals, except konsole which does whatever it wants with the window title. There&amp;rsquo;s also the problem of some zsh configs automatically settings the window title to the current command.&lt;/p&gt;
+
+&lt;p&gt;In hindsight, I could probably have just done &lt;code&gt;xdotool search --name xdotool&lt;/code&gt; since in most cases, when you run the search, zsh or konsole will set the window name to the current command. Maybe that&amp;rsquo;s another option I can explore some day.&lt;/p&gt;
+
+&lt;h2 id=&#34;third-attempt-ppid:bfade06d39f7975f041a61de11ad4d4f&#34;&gt;Third Attempt: $PPID&lt;/h2&gt;
+
+&lt;p&gt;My third idea was another environment variable called &lt;code&gt;$PPID&lt;/code&gt;, which is the process id of the parent of the shell. As it happens, the parent is the window containing the zsh instance. This is actually pretty consistent across most terminals. The only problem was if you launched zsh from another shell since your new zsh&amp;rsquo;s parent will now be another zsh instance instead of an X window.&lt;/p&gt;
+
+&lt;p&gt;At first glance, launching zsh within zsh doesn&amp;rsquo;t seem like something most people would do, but this is what happens when you run screen or tmux. To work around this, we can actually just save the original &lt;code&gt;$PPID&lt;/code&gt; in a different variable and use that instead.&lt;/p&gt;
 
+&lt;p&gt;Now that we have the PID of the window from zsh, we can once again use xdotool to get the PID of the current active window with &lt;code&gt;xdotool getactivewindow getwindowpid&lt;/code&gt;. We just simply compare that with our &lt;code&gt;$PPID&lt;/code&gt; and we can tell if we&amp;rsquo;re in an active window or not. Overall, this approach worked surprisingly well so that&amp;rsquo;s the final solution I went with.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Removing PLDTMyDSLBiz from the ZyXEL P-2612HNU</title>
+      <link>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</link>
+      <pubDate>Wed, 27 Nov 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</guid>
+      <description>&lt;p&gt;I&amp;rsquo;ve always thought that people were just too lazy to change their SSIDs when I see &amp;ldquo;PLDTMyDSLBizCafeJapan&amp;rdquo;. It became apparent when we got our own PLDT line that it was because the bundled router/modem &lt;em&gt;does not&lt;/em&gt; allow you to remove the prefix.&lt;/p&gt;
+
+&lt;p&gt;This is not the kind of thing you expect as a business customer. Even for home customers, I feel it&amp;rsquo;s still a bit dishonest. I&amp;rsquo;d be fine if it was just the default SSID, but forcing people to have it as part of their SSID is like advertising that your company (I mean PLDT) is a douche.&lt;/p&gt;
+
+&lt;p&gt;Of course, we couldn&amp;rsquo;t just leave the SSID prefix there, so we tried a number of things to get rid of it. There are articles for removing it from the &lt;a href=&#34;http://www.phandroidinternet.com/2013/06/how-to-remove-on-wifi-name-or-ssid-on.html&#34;&gt;Prolink H5004N&lt;/a&gt; or the &lt;a href=&#34;http://www.symbianize.com/showthread.php?t=730091&#34;&gt;ZyXEL P-660HN-T1A&lt;/a&gt; but not for the one we got which was the ZyXEL P-2612HNU-F1F.&lt;/p&gt;
+
+&lt;p&gt;We did still try the firebug/inspector tricks, but it seems that there is a server-side check that adds in the &amp;ldquo;PLDTMyDSLBiz&amp;rdquo;. We tried a number of things, but the one that ultimately worked (and we had a good laugh about) was to backup the configuration, edit the dumped file and restore it.&lt;/p&gt;
+
+&lt;p&gt;The backup is actually just an XML file. You can search for SSID and change the parameter there. It&amp;rsquo;s a bit annoying because the router has to restart after restoring the configuration, but it works!&lt;/p&gt;
+
+&lt;p&gt;A minor note, the router doesn&amp;rsquo;t seem to support SSIDs with a comma (,) well. It just gets everything before the comma as the SSID for some reason.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Console Keymap Switching</title>
+      <link>http://pleasantprogrammer.com/posts/console-keymap-switching.html</link>
+      <pubDate>Tue, 29 Oct 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/console-keymap-switching.html</guid>
+      <description>&lt;p&gt;At the office, we have some people who use DVORAK. Normally, this isn&amp;rsquo;t a problem. To each his own after all. It does become a bit problematic though, when we&amp;rsquo;re dealing with the servers around the office.&lt;/p&gt;
+
+&lt;p&gt;We normally leave the servers on QWERTY. After all, most people start off as QWERTY typists and migrate to something else. That said, it&amp;rsquo;s apparently difficult to stay fluent in both. People tend to forget how to type in QWERTY once they learn DVORAK or something else. While it is true that they can just look a the keyboard while typing, my coworkers would prefer it to just be in DVORAK.&lt;/p&gt;
+
+&lt;p&gt;For the console, they&amp;rsquo;d typically do &lt;code&gt;sudo loadkeys dvorak&lt;/code&gt; after logging in. The problem with this is, after they logout, the keymapping is still on DVORAK. This has been quite annoying for a few times since I can&amp;rsquo;t even login to change the keymap. What I wanted was something like you get in the graphical login screens where you can pick your keymap before logging in. Apparently, there isn&amp;rsquo;t a readily available thing for the console.&lt;/p&gt;
+
+&lt;p&gt;I googled around for solutions and came across &lt;a href=&#34;http://superuser.com/questions/548234/how-can-i-easily-toggle-between-dvorak-and-qwerty-keyboard-layouts-from-a-linux&#34;&gt;a nice idea&lt;/a&gt;. You could alias &lt;code&gt;asdf&lt;/code&gt; to load the DVORAK mapping and &lt;code&gt;aoeu&lt;/code&gt; (the equivalent to asdf in DVORAK) to load the QWERTY mapping. This actually makes sense since you don&amp;rsquo;t really have to know where the letters are. The only problem is, you once again have to be logged in to change the key mappings.&lt;/p&gt;
+
+&lt;p&gt;After some further searching, I found &lt;a href=&#34;http://unix.stackexchange.com/questions/2884/toggle-between-dvorak-and-qwerty&#34;&gt;something close to what I wanted&lt;/a&gt;. Apparently, Alt+Up sends a KeyboardSignal keycode to the init process, which can act on that. It also works anywhere, even before being logged in. For SysVinit systems, you can just add a line to your inittab for a command to be run when Alt+Up is pressed.&lt;/p&gt;
+
+&lt;p&gt;In the office, however, we generally use Arch Linux which uses SystemD. But apparently, it also has a mechanism of accepting the Alt+Up press. It runs the kbrequest target whenever it gets the keypress. &lt;code&gt;kbrequest.target&lt;/code&gt; is normally aliased to run the rescue service though, so you have to manually create the file in &lt;code&gt;/etc/systemd/system/kbrequest.target&lt;/code&gt; and fill it with a description:&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;[Unit]&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;Description&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;kbrequest target&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
 
 &lt;p&gt;We can then add a service to be run whenever the target is called. Something like &lt;code&gt;/etc/systemd/system/keymap-switch.service&lt;/code&gt;:&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="k"&gt;[Unit]&lt;/span&gt;
-&lt;span class="na"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;Keymap Switch Service&lt;/span&gt;
-
-&lt;span class="k"&gt;[Service]&lt;/span&gt;
-&lt;span class="na"&gt;Type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;oneshot&lt;/span&gt;
-&lt;span class="na"&gt;ExecStart&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;/usr/local/bin/keymap-switch&lt;/span&gt;
-
-&lt;span class="k"&gt;[Install]&lt;/span&gt;
-&lt;span class="na"&gt;WantedBy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;kbrequest.target&lt;/span&gt;
-&lt;/pre&gt;
-
-
-&lt;p&gt;After enabling said service, we only need the actual keymap switcher, &lt;code&gt;/usr/local/bin/keymap-switch&lt;/code&gt;. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we're using SystemD, we can use that instead for managing which keymap we're actually using. It stores the current settings inside &lt;code&gt;/etc/vconsole.conf&lt;/code&gt;. We can also then switch keymaps by using &lt;code&gt;localectl set-keymap&lt;/code&gt;.&lt;/p&gt;
-&lt;table class="codehilitetable"&gt;&lt;tr&gt;&lt;td class="linenos"&gt;&lt;div class="linenodiv"&gt;&lt;pre&gt; 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10&lt;/pre&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class="code"&gt;&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;#!/bin/sh&lt;/span&gt;
-&lt;span class="nb"&gt;source&lt;/span&gt; /etc/vconsole.conf
-
-&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$TERM&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"dumb"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
-  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;$KEYMAP&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"dvorak"&lt;/span&gt; &lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;then&lt;/span&gt;
-    localectl &lt;span class="nb"&gt;set&lt;/span&gt;-keymap us
-  &lt;span class="k"&gt;else&lt;/span&gt;
-    localectl &lt;span class="nb"&gt;set&lt;/span&gt;-keymap dvorak
-  &lt;span class="k"&gt;fi&lt;/span&gt;
-&lt;span class="k"&gt;fi&lt;/span&gt;
-&lt;/pre&gt;
-&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
-
-&lt;p&gt;After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.&lt;/p&gt;&lt;/div&gt;</description><category>sysadmin</category><category>systemd</category><guid>http://pleasantprogrammer.com/posts/console-keymap-switching.html</guid><pubDate>Tue, 29 Oct 2013 12:02:06 GMT</pubDate></item><item><title>Geocoding Services</title><link>http://pleasantprogrammer.com/posts/geocoding-services.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don't know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.&lt;/p&gt;
-&lt;p&gt;The gold standard for doing geocoding right now is Google Maps. It's hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn't be &lt;em&gt;that&lt;/em&gt; much you could do for the competition.&lt;/p&gt;
-&lt;p&gt;When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called &lt;a href="http://nominatim.openstreetmap.org"&gt;Nominatim&lt;/a&gt;.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;[Unit]&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;Description&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;Keymap Switch Service&lt;/span&gt;
+
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;[Service]&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;Type&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;oneshot&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;ExecStart&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;/usr/local/bin/keymap-switch&lt;/span&gt;
+
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;[Install]&lt;/span&gt;
+&lt;span style=&#34;color: #7D9029&#34;&gt;WantedBy&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;kbrequest.target&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;After enabling said service, we only need the actual keymap switcher, &lt;code&gt;/usr/local/bin/keymap-switch&lt;/code&gt;. The StackOverflow answer provides different ways of detecting the current keymap so we know which one to switch to. Since we&amp;rsquo;re using SystemD, we can use that instead for managing which keymap we&amp;rsquo;re actually using. It stores the current settings inside &lt;code&gt;/etc/vconsole.conf&lt;/code&gt;. We can also then switch keymaps by using &lt;code&gt;localectl set-keymap&lt;/code&gt;.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;#!/bin/sh&lt;/span&gt;
+&lt;span style=&#34;color: #008000&#34;&gt;source&lt;/span&gt; /etc/vconsole.conf
+
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;[&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #19177C&#34;&gt;$TERM&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;dumb&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;]&lt;/span&gt;; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;then&lt;/span&gt;
+  &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;[&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #19177C&#34;&gt;$KEYMAP&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;dvorak&amp;quot;&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;]&lt;/span&gt;; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;then&lt;/span&gt;
+    localectl &lt;span style=&#34;color: #008000&#34;&gt;set&lt;/span&gt;-keymap us
+  &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;else&lt;/span&gt;
+    localectl &lt;span style=&#34;color: #008000&#34;&gt;set&lt;/span&gt;-keymap dvorak
+  &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;fi&lt;/span&gt;
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;fi&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;After putting it all together, it works! We can switch keymaps on the fly by simply pressing Alt+Up.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Geocoding Services</title>
+      <link>http://pleasantprogrammer.com/posts/geocoding-services.html</link>
+      <pubDate>Wed, 25 Sep 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/geocoding-services.html</guid>
+      <description>&lt;p&gt;A key component for any routing service is being able to do geocoding. Most people who are looking for routes most probably don&amp;rsquo;t know exactly where their start and end points are on the map. Even then, manually looking for a location on a map is a time-consuming task.&lt;/p&gt;
+
+&lt;p&gt;The gold standard for doing geocoding right now is Google Maps. It&amp;rsquo;s hard to find a better location search experience. If they actually provided routing for jeeps here in the Philippines, I imagine there wouldn&amp;rsquo;t be &lt;em&gt;that&lt;/em&gt; much you could do for the competition.&lt;/p&gt;
+
+&lt;p&gt;When the competition started though, I took it as a challenge to avoid Google Maps as much as possible. I wanted to see how much is currently possible with other options such as OpenStreetMap. In fact, OSM does have a geocoding service called &lt;a href=&#34;http://nominatim.openstreetmap.org&#34;&gt;Nominatim&lt;/a&gt;.&lt;/p&gt;
+
 &lt;p&gt;Sadly, for a mapping app, what you want to do is not simply just geocoding. With geocoding, you take an address and turn it into coordinates. When you want to search for a place in a mapping app, you take part of an address, infer the rest of it, and give the user options to choose from.&lt;/p&gt;
-&lt;p&gt;Given a typical mapping app, you might type in "ateneo" and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google's &lt;a href="https://developers.google.com/maps/documentation/javascript/geocoding"&gt;geocoding API&lt;/a&gt;, you probably won't get any result for this. What you want to use is the &lt;a href="https://developers.google.com/maps/documentation/javascript/places"&gt;Places API&lt;/a&gt; which provides an autocomplete search box. Using it, when you type in "ateneo", it automatically suggests in the dropdown, "Ateneo de Manila University".&lt;/p&gt;
-&lt;p&gt;A downside to using the Places API is that it's against the terms of service to use it with something that isn't Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap's data will probably be a better long term solution.&lt;/p&gt;
-&lt;p&gt;For now, since the competition's deadline is just a few days away, I'll be using Google Maps.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/geocoding-services.html</guid><pubDate>Wed, 25 Sep 2013 04:26:59 GMT</pubDate></item><item><title>Jeep and Bus Schedules</title><link>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Wouldn't it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist's paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn't worry. I can assure you, it's still a death sentence.&lt;/p&gt;
+
+&lt;p&gt;Given a typical mapping app, you might type in &amp;ldquo;ateneo&amp;rdquo; and expect it to give you Ateneo de Manila University. With typical geocoding services like Nominatim or even Google&amp;rsquo;s &lt;a href=&#34;https://developers.google.com/maps/documentation/javascript/geocoding&#34;&gt;geocoding API&lt;/a&gt;, you probably won&amp;rsquo;t get any result for this. What you want to use is the &lt;a href=&#34;https://developers.google.com/maps/documentation/javascript/places&#34;&gt;Places API&lt;/a&gt; which provides an autocomplete search box. Using it, when you type in &amp;ldquo;ateneo&amp;rdquo;, it automatically suggests in the dropdown, &amp;ldquo;Ateneo de Manila University&amp;rdquo;.&lt;/p&gt;
+
+&lt;p&gt;A downside to using the Places API is that it&amp;rsquo;s against the terms of service to use it with something that isn&amp;rsquo;t Google Maps, which means no OpenStreetMap. If there were more time, writing your own autocompletion engine using OpenStreetMap&amp;rsquo;s data will probably be a better long term solution.&lt;/p&gt;
+
+&lt;p&gt;For now, since the competition&amp;rsquo;s deadline is just a few days away, I&amp;rsquo;ll be using Google Maps.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Jeep and Bus Schedules</title>
+      <link>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</link>
+      <pubDate>Sun, 28 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</guid>
+      <description>&lt;p&gt;Wouldn&amp;rsquo;t it be wonderful if there were no buses or jeepneys in the Philippines over the weekends? It would truly be a cyclist&amp;rsquo;s paradise. Imagine biking along EDSA, normally that would be a death sentence, but according to the GTFS data, you shouldn&amp;rsquo;t worry. I can assure you, it&amp;rsquo;s still a death sentence.&lt;/p&gt;
+
 &lt;p&gt;The GTFS spec defines 2 ways of statically specifying trip schedules. You can define the exact times that a service will arrive at a stop. You can also specify between what times the service is active and how often a new bus or jeep leaves the first stop. You also define which days those rules apply. You could say every MWF, the bus operates from 9:00AM to 9:00PM and every TTH, the bus services from 3:00AM to 11:00PM.&lt;/p&gt;
-&lt;p&gt;This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there's another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.&lt;/p&gt;
-&lt;p&gt;Like much everything else about the Philippine transit system, there aren't really any "schedules" to speak of. It's generally whenever the buses or jeeps feel like it. So we have no static schedules. We don't have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.&lt;/p&gt;
-&lt;p&gt;Ideally, we shouldn't bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn't work without it. So we have to add a reasonable trip schedule for jeeps and buses.&lt;/p&gt;
+
+&lt;p&gt;This should be sufficient in theory, but real world conditions like traffic or the weather could throw the schedules off. To solve this, there&amp;rsquo;s another spec, GTFS-realtime. This allows transit agencies to push temporary schedule updates and service announcements.&lt;/p&gt;
+
+&lt;p&gt;Like much everything else about the Philippine transit system, there aren&amp;rsquo;t really any &amp;ldquo;schedules&amp;rdquo; to speak of. It&amp;rsquo;s generally whenever the buses or jeeps feel like it. So we have no static schedules. We don&amp;rsquo;t have a central agency or the tracking technology to make it feasible to push updates via GTFS-RT.&lt;/p&gt;
+
+&lt;p&gt;Ideally, we shouldn&amp;rsquo;t bother inputting the schedule information into GTFS. Only the route data is really important for jeeps and buses. However, the schedule information is required in the GTFS, and routing apps wouldn&amp;rsquo;t work without it. So we have to add a reasonable trip schedule for jeeps and buses.&lt;/p&gt;
+
 &lt;p&gt;The current GTFS data does define these trip schedules. We assume that jeeps and buses operate between 6:00AM and 11:00PM and a new jeep passes by every 10 minutes. Also, jeeps and buses are defined to only operate on weekdays.&lt;/p&gt;
-&lt;p&gt;While there might be jeeps who change routes or don't operate on weekends, I'm pretty sure that jeeps and buses run on weekends. We'll have to fix it ourselves temporarily since there's no central GTFS feed yet.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# 724594 seems to be the service id used by jeeps and buses&lt;/span&gt;
-sed -i .bak &lt;span class="s1"&gt;'/^724594/ s/0,0/1,1/'&lt;/span&gt; calendar.txt
-&lt;/pre&gt;
 
+&lt;p&gt;While there might be jeeps who change routes or don&amp;rsquo;t operate on weekends, I&amp;rsquo;m pretty sure that jeeps and buses run on weekends. We&amp;rsquo;ll have to fix it ourselves temporarily since there&amp;rsquo;s no central GTFS feed yet.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# 724594 seems to be the service id used by jeeps and buses&lt;/span&gt;
+sed -i .bak &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;/^724594/ s/0,0/1,1/&amp;#39;&lt;/span&gt; calendar.txt
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you&amp;rsquo;re sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.&lt;/p&gt;
+
+&lt;p&gt;If we set the frequency to one minute, it &lt;em&gt;might&lt;/em&gt; give better routes by eliminating the timing issue. Or not, it&amp;rsquo;s kind of hard to tell.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;# jeep and bus route ids tend to start with 72&lt;/span&gt;
+sed -i .bak &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;/^72/ s/,600/,60/&amp;#39;&lt;/span&gt; frequencies.txt
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Overall, the problems we&amp;rsquo;re having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don&amp;rsquo;t need to do hackish things for it to fit the GTFS, but that&amp;rsquo;s still a dream. For now, all we can really do is fit a triangle into a square hole.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Highways in OTP</title>
+      <link>http://pleasantprogrammer.com/posts/highways-in-otp.html</link>
+      <pubDate>Wed, 24 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/highways-in-otp.html</guid>
+      <description>&lt;p&gt;One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP&amp;rsquo;s suggested route for walking from UP to Ateneo:&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;../galleries/transit/otproundabout.png&#34; alt=&#34;Roundabout route from UP to Ateneo&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;This is just so hilariously wrong. It&amp;rsquo;s much simpler to just walk along Katipunan Avenue.&lt;/p&gt;
+
+&lt;p&gt;OTP couldn&amp;rsquo;t possibly be that dumb though, so there must be something we&amp;rsquo;re doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the &amp;ldquo;road type&amp;rdquo; designated to Katipunan.&lt;/p&gt;
+
+&lt;p&gt;Apparently, by default OTP will consider roads of type &lt;code&gt;trunk&lt;/code&gt; to be non-walkable and non-bikable. This is documented in the &lt;a href=&#34;http://wiki.openstreetmap.org/wiki/OpenTripPlanner&#34;&gt;OpenStreetMap wiki&lt;/a&gt; and the &lt;a href=&#34;https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety&#34;&gt;OTP wiki&lt;/a&gt; as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;sed -i .bak s/trunk/primary/g manila.osm
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;And rebuild the graph. It doesn&amp;rsquo;t really matter much because the OSM data isn&amp;rsquo;t used to render the maps. It&amp;rsquo;s just used to build the routing data. This is actually what I did for &lt;a href=&#34;http://maps.pleasantprogrammer.com&#34;&gt;maps.pleasantprogrammer.com&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s also possible to set the default way properties in OTP. Instead of disallowing walking and biking on &lt;code&gt;highway=trunk&lt;/code&gt; we could allow that. This is not much better than the &lt;code&gt;sed&lt;/code&gt; solution though. It&amp;rsquo;s better since you keep the weighting done by OTP, but you&amp;rsquo;re still saying that all trunks are walkable which might not be the case.&lt;/p&gt;
+
+&lt;p&gt;The most correct way to actually fix this is to go through each of the trunks and specifying &lt;code&gt;foot=yes&lt;/code&gt; and &lt;code&gt;bicycle=yes&lt;/code&gt; for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I&amp;rsquo;m not sure on the particulars with updating OSM though.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Elevation Data in OTP</title>
+      <link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link>
+      <pubDate>Tue, 23 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</guid>
+      <description>&lt;p&gt;&lt;img src=&#34;../galleries/transit/otpelevation.png&#34; alt=&#34;OpenTripPlanner showing elevation data&#34; /&gt;&lt;/p&gt;
 
-&lt;p&gt;Another thing we could do is to adjust the time between buses, although the improvement is arguable. With the current 10 minutes between jeeps, it might provide some routes a significant advantage just because the timing is right. So you might get differing route suggestions depending on what time you planned the route. This makes sense when you're sure what the times are, so you can minimize the wait, but with jeeps, you never really know how long the wait will actually be.&lt;/p&gt;
-&lt;p&gt;If we set the frequency to one minute, it &lt;em&gt;might&lt;/em&gt; give better routes by eliminating the timing issue. Or not, it's kind of hard to tell.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;&lt;span class="c"&gt;# jeep and bus route ids tend to start with 72&lt;/span&gt;
-sed -i .bak &lt;span class="s1"&gt;'/^72/ s/,600/,60/'&lt;/span&gt; frequencies.txt
-&lt;/pre&gt;
+&lt;p&gt;One thing I hadn&amp;rsquo;t tested out last time was OTP&amp;rsquo;s support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.&lt;/p&gt;
 
+&lt;p&gt;The &lt;a href=&#34;https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes&#34;&gt;5 minute tutorial&lt;/a&gt; actually discusses the elevation data briefly, but a more in-depth thing you can look at is the &lt;a href=&#34;https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data&#34;&gt;GraphBuilder documentation&lt;/a&gt;. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the &lt;a href=&#34;http://www.philgis.org/freegisdata.htm&#34;&gt;PhilGIS website&lt;/a&gt;.&lt;/p&gt;
 
-&lt;p&gt;Overall, the problems we're having is a symptom of the mismatch between our transit system and the GTFS. It would be great if our transit system gets better and we don't need to do hackish things for it to fit the GTFS, but that's still a dream. For now, all we can really do is fit a triangle into a square hole.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</guid><pubDate>Sun, 28 Jul 2013 08:26:31 GMT</pubDate></item><item><title>Highways in OTP</title><link>http://pleasantprogrammer.com/posts/highways-in-otp.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;One of the weird things that happens with OTP is sometimes it gives absurdly roundabout routes. Here is OTP's suggested route for walking from UP to Ateneo:&lt;/p&gt;
-&lt;p&gt;&lt;img alt="Roundabout route from UP to Ateneo" src="http://pleasantprogrammer.com/galleries/transit/otproundabout.png"&gt;&lt;/p&gt;
-&lt;p&gt;This is just so hilariously wrong. It's much simpler to just walk along Katipunan Avenue.&lt;/p&gt;
-&lt;p&gt;OTP couldn't possibly be that dumb though, so there must be something we're doing wrong. If you notice, Katipunan Avenue is colored red compared to the other streets. OTP seems to be avoiding any path that goes along Katipunan Avenue. The problem might have something to do with the "road type" designated to Katipunan.&lt;/p&gt;
-&lt;p&gt;Apparently, by default OTP will consider roads of type &lt;code&gt;trunk&lt;/code&gt; to be non-walkable and non-bikable. This is documented in the &lt;a href="http://wiki.openstreetmap.org/wiki/OpenTripPlanner"&gt;OpenStreetMap wiki&lt;/a&gt; and the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#permissions-and-bicycle-safety"&gt;OTP wiki&lt;/a&gt; as well. There are actually multiple ways to go about this then. The first solution that came to mind was to just edit the original OSM XML file.&lt;/p&gt;
-&lt;pre class="code literal-block"&gt;sed -i .bak s/trunk/primary/g manila.osm
-&lt;/pre&gt;
+&lt;p&gt;I don&amp;rsquo;t know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use &lt;a href=&#34;http://www.gdal.org/&#34;&gt;GDAL&lt;/a&gt; for this. You&amp;rsquo;d just then run,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;gdal_translate srtm41_90m_phl.img phil.tiff
+&lt;/pre&gt;&lt;/div&gt;
 
+&lt;p&gt;Afterwards, it&amp;rsquo;s just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you&amp;rsquo;re running on limited RAM.&lt;/p&gt;
 
-&lt;p&gt;And rebuild the graph. It doesn't really matter much because the OSM data isn't used to render the maps. It's just used to build the routing data. This is actually what I did for &lt;a href="http://maps.pleasantprogrammer.com"&gt;maps.pleasantprogrammer.com&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;It's also possible to set the default way properties in OTP. Instead of disallowing walking and biking on &lt;code&gt;highway=trunk&lt;/code&gt; we could allow that. This is not much better than the &lt;code&gt;sed&lt;/code&gt; solution though. It's better since you keep the weighting done by OTP, but you're still saying that all trunks are walkable which might not be the case.&lt;/p&gt;
-&lt;p&gt;The most correct way to actually fix this is to go through each of the trunks and specifying &lt;code&gt;foot=yes&lt;/code&gt; and &lt;code&gt;bicycle=yes&lt;/code&gt; for those trunks that are actually walkable. You could either do this locally with the dumped data, or contribute it directly to OSM. I'm not sure on the particulars with updating OSM though.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/highways-in-otp.html</guid><pubDate>Wed, 24 Jul 2013 15:15:57 GMT</pubDate></item><item><title>Elevation Data in OTP</title><link>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;&lt;img alt="OpenTripPlanner showing elevation data" src="http://pleasantprogrammer.com/galleries/transit/otpelevation.png"&gt;&lt;/p&gt;
-&lt;p&gt;One thing I hadn't tested out last time was OTP's support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.&lt;/p&gt;
-&lt;p&gt;The &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes"&gt;5 minute tutorial&lt;/a&gt; actually discusses the elevation data briefly, but a more in-depth thing you can look at is the &lt;a href="https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data"&gt;GraphBuilder documentation&lt;/a&gt;. It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the &lt;a href="http://www.philgis.org/freegisdata.htm"&gt;PhilGIS website&lt;/a&gt;.&lt;/p&gt;
-&lt;p&gt;I don't know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use &lt;a href="http://www.gdal.org/"&gt;GDAL&lt;/a&gt; for this. You'd just then run,&lt;/p&gt;
-&lt;pre class="code literal-block"&gt; gdal_translate srtm41_90m_phl.img phil.tiff
-&lt;/pre&gt;
+&lt;p&gt;I&amp;rsquo;ve actually hosted a &lt;a href=&#34;http://maps.pleasantprogrammer.com&#34;&gt;working example&lt;/a&gt;. It&amp;rsquo;s pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don&amp;rsquo;t abuse it though.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>GraphServer</title>
+      <link>http://pleasantprogrammer.com/posts/graphserver.html</link>
+      <pubDate>Tue, 23 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/graphserver.html</guid>
+      <description>&lt;p&gt;Link: &lt;a href=&#34;http://graphserver.github.io/graphserver/&#34;&gt;http://graphserver.github.io/graphserver/&lt;/a&gt;&lt;/p&gt;
 
+&lt;p&gt;One other routing webapp I saw was GraphServer. It&amp;rsquo;s actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It&amp;rsquo;s also based off python and C instead of Java, so it feels a lot less heavy.&lt;/p&gt;
 
-&lt;p&gt;Afterwards, it's just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you're running on limited RAM.&lt;/p&gt;
-&lt;p&gt;I've actually hosted a &lt;a href="http://maps.pleasantprogrammer.com"&gt;working example&lt;/a&gt;. It's pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don't abuse it though.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</guid><pubDate>Tue, 23 Jul 2013 10:23:00 GMT</pubDate></item><item><title>GraphServer</title><link>http://pleasantprogrammer.com/posts/graphserver.html</link><dc:creator>Thomas Dy</dc:creator><description>&lt;div&gt;&lt;p&gt;Link: &lt;a href="http://graphserver.github.io/graphserver/"&gt;http://graphserver.github.io/graphserver/&lt;/a&gt;&lt;/p&gt;
-&lt;p&gt;One other routing webapp I saw was GraphServer. It's actually more of a general purpose Graph library which supports GTFS and OSM data than an actual dedicated routing software like OpenTripPlanner. It's also based off python and C instead of Java, so it feels a lot less heavy.&lt;/p&gt;
 &lt;p&gt;The instructions on the website are already pretty good. There are just some minor errors with it. Where it says &lt;code&gt;gs_gtfsdb_build&lt;/code&gt;, you should actually use &lt;code&gt;gs_gtfsdb_compile&lt;/code&gt;. Also, when running &lt;code&gt;gs_osmdb_compile&lt;/code&gt; you might need to use &lt;code&gt;-t&lt;/code&gt; for tolerant in case you follow the instructions on chopping up the original OSM data.&lt;/p&gt;
-&lt;p&gt;A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn't support 64-bit ids. The &lt;a href="http://wiki.openstreetmap.org/wiki/Osmosis"&gt;latest version of Osmosis&lt;/a&gt; easily did the job though.&lt;/p&gt;
-&lt;p&gt;The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn't provide any alternate routes aside from that one. I'm not sure if it's a limitation of the provided routeserver, but I didn't bother checking if it supported parameters which might provide better routes.&lt;/p&gt;
-&lt;p&gt;I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.&lt;/p&gt;&lt;/div&gt;</description><category>philippine-transit-app</category><category>programming</category><guid>http://pleasantprogrammer.com/posts/graphserver.html</guid><pubDate>Tue, 23 Jul 2013 06:48:29 GMT</pubDate></item></channel></rss>
+
+&lt;p&gt;A nice suggestion from the GraphServer instructions was to crop the OSM data to minimize the graph size. This is actually quite helpful if you downloaded the entire Philippine OSM dump. It reduced the original 900MB file to 135MB which was a lot more workable. I did hit a problem with their instructions though. The linked version of osmosis is an old one, which doesn&amp;rsquo;t support 64-bit ids. The &lt;a href=&#34;http://wiki.openstreetmap.org/wiki/Osmosis&#34;&gt;latest version of Osmosis&lt;/a&gt; easily did the job though.&lt;/p&gt;
+
+&lt;p&gt;The actual routing though, was not exactly good. I only tried one route which should normally take 1-2 transfers, it suggested a route which involved 4+ transfers. It also didn&amp;rsquo;t provide any alternate routes aside from that one. I&amp;rsquo;m not sure if it&amp;rsquo;s a limitation of the provided routeserver, but I didn&amp;rsquo;t bother checking if it supported parameters which might provide better routes.&lt;/p&gt;
+
+&lt;p&gt;I think graphserver could be useful, but it seems more involved than say OpenTripPlanner. There do seem to be people who use graphserver for their routing apps, but for the bounds of the contest, or just as a side project, it might require too much effort.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Transit Wand</title>
+      <link>http://pleasantprogrammer.com/posts/transit-wand.html</link>
+      <pubDate>Mon, 15 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/transit-wand.html</guid>
+      <description>&lt;p&gt;Link: &lt;a href=&#34;https://play.google.com/store/apps/details?id=com.conveyal.transitwand&#34;&gt;http://transitwand.com&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;Overall, this was the simplest of the &lt;a href=&#34;http://philippine-transit.hackathome.com/use-this-code/&#34;&gt;open-source transit tools&lt;/a&gt; to actually get up and running. There&amp;rsquo;s already a deployed instance of the server, and you can easily download the phone app via the &lt;a href=&#34;https://play.google.com/store/apps/details?id=com.conveyal.transitwand&#34;&gt;Play Store&lt;/a&gt;. Even running the server by yourself didn&amp;rsquo;t have any of the hiccups I had with GTFS Editor.&lt;/p&gt;
+
+&lt;p&gt;The phone app is actually quite simple. It allows you to capture a trip, which will record your GPS coordinates as you ride public transit. It also allows you to mark points of the trip where you stop and also how long the stop took. Lastly, it allows you to record embarking and disembarking passengers which is potentially useful for ridership data.&lt;/p&gt;
+
+&lt;p&gt;After doing a capture session, you can review the data on the phone. It will plot out the route on a map, with markers for the stops. You then either delete the data if it looks wrong, or you can upload it to the Transit Wand server. Uploading involves registering an account, but it&amp;rsquo;s free and you don&amp;rsquo;t even actually need to put in a username or anything. It simply registers the phone&amp;rsquo;s IMEI on the server and gives you a 6-digit identifier.&lt;/p&gt;
+
+&lt;p&gt;You can then use the 6-digit identifier to view the data on Transit Wand&amp;rsquo;s server, which is good since uploading any data automatically deletes it from the phone. There really isn&amp;rsquo;t much else you can do with it though. It just allows you to view the data, and export it as a &lt;a href=&#34;https://en.wikipedia.org/wiki/Shapefile&#34;&gt;Shapefile&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;As is, this is purely a data collection client-server app. Barring looking at the database, there is no way to get a list of phones which have collected data. Only the person who initiated the data collection knows the 6-digit code to view their data. There&amp;rsquo;s also no way to extract the ridership information from the server yet. This isn&amp;rsquo;t to say that the data won&amp;rsquo;t eventually go public though.&lt;/p&gt;
+
+&lt;p&gt;An interesting thing you &lt;em&gt;can&lt;/em&gt; do with the Transit Wand data is import it into GTFS Editor to make a new route. You don&amp;rsquo;t even have to manually download and upload the data. Just type in your 6-digit identifier and it will give you a list of routes you&amp;rsquo;ve captured via Transit Wand. This is wonderful as you get all the stop data, as well as the shape of the route.&lt;/p&gt;
+
+&lt;p&gt;I imagine these two tools were how the DOTC came up with all the GTFS data we have now. What I don&amp;rsquo;t understand is why the shape data isn&amp;rsquo;t present. Importing from Transit Wand already gets you shape data. There are even facilities to edit the shape within the editor if clean up is necessary. The only problem I saw was the fact that you can&amp;rsquo;t easily move stops, you have to input coordinates to change the position.&lt;/p&gt;
+
+&lt;p&gt;It &lt;em&gt;might&lt;/em&gt; also be possible that when the DOTC was still collecting the data, the route collection or editing features weren&amp;rsquo;t present yet. That would just be lame and depressing though.&lt;/p&gt;
+
+&lt;p&gt;Overall, Transit Wand does what it&amp;rsquo;s supposed to do. You collect data, and then upload it to a server. There is a lot of room for improvement though. It would be nice to have a better API that allows access to more of the data. Building in analysis tools for the ridership data might also be a welcome thing. I imagine it would also be great if you could encourage people to use the app and upload their own trips.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Fare Data</title>
+      <link>http://pleasantprogrammer.com/posts/fare-data.html</link>
+      <pubDate>Sat, 13 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/fare-data.html</guid>
+      <description>
+
+&lt;p&gt;As part of the data released by the DOTC, we also have the &lt;a href=&#34;http://philippine-transit.hackathome.com/dataset-philippines-transit-information-service-gtfs/&#34;&gt;fare matrix&lt;/a&gt; for aircon buses, ordinary buses and jeeps. All as wonderful images. The data is also actually available from the &lt;a href=&#34;http://ltfrb.gov.ph/main/farerates&#34;&gt;LTFRB website&lt;/a&gt;. Generally, the fare scheme is represented as &amp;ldquo;pay &lt;em&gt;X&lt;/em&gt; pesos for the first &lt;em&gt;Y&lt;/em&gt; kilometers, pay &lt;em&gt;Z&lt;/em&gt; for every succeeding kilometer.&amp;rdquo; Instead of a table, we can simply represent this as a formula instead,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;base_fare + (distance - initial) * per_km
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;The relevant values for the three services are:&lt;/p&gt;
+
+&lt;table&gt;
+&lt;thead&gt;
+  &lt;tr&gt;
+    &lt;td&gt;type&lt;/td&gt;
+    &lt;td&gt;base_fare&lt;/td&gt;
+    &lt;td&gt;initial&lt;/td&gt;
+    &lt;td&gt;per_km&lt;/td&gt;
+  &lt;/tr&gt;
+&lt;/thead&gt;
+&lt;tbody&gt;
+  &lt;tr&gt;
+    &lt;td&gt;bus aircon&lt;/td&gt;
+    &lt;td&gt;12.00&lt;/td&gt;
+    &lt;td&gt;5 km&lt;/td&gt;
+    &lt;td&gt;2.20&lt;/td&gt;
+  &lt;/tr&gt;
+  &lt;tr&gt;
+    &lt;td&gt;bus ordinary&lt;/td&gt;
+    &lt;td&gt;10.00&lt;/td&gt;
+    &lt;td&gt;5 km&lt;/td&gt;
+    &lt;td&gt;1.85&lt;/td&gt;
+  &lt;/tr&gt;
+  &lt;tr&gt;
+    &lt;td&gt;jeep aircon&lt;/td&gt;
+    &lt;td&gt;8.00&lt;/td&gt;
+    &lt;td&gt;4 km&lt;/td&gt;
+    &lt;td&gt;1.40&lt;/td&gt;
+  &lt;/tr&gt;
+&lt;/tbody&gt;
+&lt;/table&gt;
+
+&lt;p&gt;It isn&amp;rsquo;t as simple as that though. Fares are also rounded to the nearest 25 centavos. So we&amp;rsquo;d need to round them off correctly. This can be achieved by doing,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;round(calculated_fare * 4.0)/4.0
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;There&amp;rsquo;s also the discounted fare for students, senior citizens and persons with disability. They get 20% off the fare (prior to rounding) and the resulting fare is rounded off as well.&lt;/p&gt;
+
+&lt;p&gt;Doing just this, we actually do get the same results as the fare matrices in the image for the most part. There are some discrepancies with the discounted jeep fares. I&amp;rsquo;ve tried to resolve it by tweaking around with the formulas, but it really doesn&amp;rsquo;t make sense in any way. I presume these were manually adjusted for one reason or another.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s a &lt;a href=&#34;../uploads/farematrix.rb&#34;&gt;script&lt;/a&gt; that generates CSVs of all the three fare matrices. If you&amp;rsquo;re too lazy to run it, here are links to the &lt;a href=&#34;../uploads/pub_aircon.csv&#34;&gt;aircon bus&lt;/a&gt;, &lt;a href=&#34;../uploads/pub_ordinary.csv&#34;&gt;ordinary bus&lt;/a&gt; and &lt;a href=&#34;../uploads/puj.csv&#34;&gt;jeep&lt;/a&gt; fare matrices.&lt;/p&gt;
+
+&lt;h3 id=&#34;gtfs-compatibility:a6ffa536f572175993ee2d6ec342ac72&#34;&gt;GTFS compatibility&lt;/h3&gt;
+
+&lt;p&gt;As is, the provided GTFS data does not have any fare data. I imagine this is because the existing spec doesn&amp;rsquo;t have good support for distance-based fares like we have in the Philippines. Judging from the &lt;a href=&#34;https://code.google.com/p/googletransitdatafeed/wiki/FareExamples&#34;&gt;fare examples&lt;/a&gt;, the only reasonable way we could implement distance-based fares is following example 6. This would involve setting a fare for each possible pair of stops based on the distance between them. This isn&amp;rsquo;t exactly ideal. In fact, the people originally working on the DOTC project have voiced &lt;a href=&#34;https://groups.google.com/forum/#!topic/gtfs-fare-wg/V63xRSnQJGw&#34;&gt;issues&lt;/a&gt; and made &lt;a href=&#34;https://groups.google.com/forum/#!msg/gtfs-changes/uybrAokZ9Cg/rqlzXdMypUgJ&#34;&gt;proposals&lt;/a&gt; for having distance-based fares included into GTFS.&lt;/p&gt;
+
+&lt;p&gt;Apparently, public transit fares are a really complicated thing. You have fares based on distance, number of stops passed through, and transfers which may or may not cost extra. Not only that, you might have discounted fares, or first-class vs economy fares. The community will want to get it right before it&amp;rsquo;s formally included in the spec. You can see the current state of the consolidated &lt;a href=&#34;https://docs.google.com/document/d/1mK3--o5g4-3cCXaqmch92U63JTwChh0L2VCmcDViIlM/edit&#34;&gt;GTFS fare proposal here&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Even in it&amp;rsquo;s proposal form though, we might have hope of being able to see these being used. There&amp;rsquo;s currently a &lt;a href=&#34;https://github.com/OneBusAway/onebusaway-gtfs-modules/pull/30&#34;&gt;pull request&lt;/a&gt; for supporting the distance-based fare scheme into the OneBusAway libraries. The libraries actually used by GTFS Editor and OpenTripPlanner for working with GTFS data.&lt;/p&gt;
+
+&lt;h3 id=&#34;remaining-problems:a6ffa536f572175993ee2d6ec342ac72&#34;&gt;Remaining Problems&lt;/h3&gt;
+
+&lt;p&gt;Given all that, it would probably still be a long way before this allows us to make a really good routing app. We still don&amp;rsquo;t have shape data, so the distance estimates would really be rough estimates at best. There&amp;rsquo;s no support for rounding to the nearest centavo. I realize that&amp;rsquo;s just nitpicking, but if we want something truly polished, even that has to be taken care of.&lt;/p&gt;
+
+&lt;p&gt;We also don&amp;rsquo;t know if the jeeps or buses strictly follow the distance-based scheme. After all, if you can get on and off anywhere, you can&amp;rsquo;t really measure distance that exactly. I assume they generally work off the notion of &amp;ldquo;zones&amp;rdquo; than actual distance travelled. In that sense, they work more similarly to the LRT which has fares based on how many stops you pass. For jeeps and buses, your fare is probably based more on how many &amp;ldquo;zones&amp;rdquo; you pass through.&lt;/p&gt;
+
+&lt;h3 id=&#34;conclusion:a6ffa536f572175993ee2d6ec342ac72&#34;&gt;Conclusion&lt;/h3&gt;
+
+&lt;p&gt;Philip, a co-worker of mine at By Implication, had suggested that we might want to use a different model than what the GTFS proposes. I have to agree with him. At this point, the GTFS doesn&amp;rsquo;t really fit with our system. But I do think that open data and standards are great. In fact, I applaud the developers who made proposals for the fare system, as those are great first steps towards making the GTFS a more universal standard.&lt;/p&gt;
+
+&lt;p&gt;Side note: I&amp;rsquo;d also actually really like to hear about the DOTC developers&amp;rsquo; experience with the project. It would be nice if they had a devblog.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>GTFS Editor</title>
+      <link>http://pleasantprogrammer.com/posts/gtfs-editor.html</link>
+      <pubDate>Wed, 10 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/gtfs-editor.html</guid>
+      <description>
+
+&lt;p&gt;Link: &lt;a href=&#34;https://github.com/conveyal/gtfs-editor&#34;&gt;https://github.com/conveyal/gtfs-editor&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; they really meant under development&lt;/p&gt;
+
+&lt;p&gt;When I first saw the source of GTFS Editor, I was ecstatic. They used &lt;a href=&#34;http://playframework.com/&#34;&gt;Play framework&lt;/a&gt;!!! Not only that, they&amp;rsquo;re targeting PostgreSQL as the main database. Those are our favorite tools for building webapps at By Implication. I was a bit sad though, when I saw it was on the 1.x release of Play though. I did have some experience with that release, but not as much compared to 2.x.&lt;/p&gt;
+
+&lt;p&gt;Getting it to actually run though, wasn&amp;rsquo;t very pleasant. The initial setup was easy enough. Get &lt;a href=&#34;http://www.playframework.com/download&#34;&gt;Play 1.2.5&lt;/a&gt;, install Postgres with PostGIS, clone the repo and create backing database in Postgres. Some minor additional steps you need are to create the PostGIS extension on the database. The schema is automatically generated and applied by Play so that should be all that&amp;rsquo;s necessary. Wonderful. Then, run play, open a browser, go to &lt;a href=&#34;http://localhost:9000&#34;&gt;http://localhost:9000&lt;/a&gt;, compilation error. Fantastic.&lt;/p&gt;
+
+&lt;p&gt;If you don&amp;rsquo;t want to go through the technical details, you can just jump to the &lt;a href=&#34;#conclusion&#34;&gt;conclusion&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;let-s-debug:9dc7854b573f1a2be2b19d1bfe826d39&#34;&gt;Let&amp;rsquo;s Debug!&lt;/h2&gt;
+
+&lt;p&gt;I&amp;rsquo;ll be splitting the next section up into 2 parts. In the first pass, I&amp;rsquo;ll talk about what I did to just get the app to run but I won&amp;rsquo;t try hard to fix any bugs. This generally is what I do when I try to get apps to run. I&amp;rsquo;ll also be dropping enough information so that you can actually figure out what the real problem is. In the second pass, I&amp;rsquo;ll explain what the problems were and how I fixed them.&lt;/p&gt;
+
+&lt;h3 id=&#34;first-pass:9dc7854b573f1a2be2b19d1bfe826d39&#34;&gt;First Pass&lt;/h3&gt;
+
+&lt;p&gt;A thing to note about Play (and one of the reasons it&amp;rsquo;s a lovely Java framework) is that you don&amp;rsquo;t need to do manual compilation. Just edit some source files, refresh your browser and it will automatically do the compilation for you. One less argument for using PHP. It even shows you (in the browser!) the source and which line of code caused the compilation error. So that&amp;rsquo;s what I saw, &lt;code&gt;Error: type Check already defined&lt;/code&gt;&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #AA22FF&#34;&gt;@Retention&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;RetentionPolicy&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;RUNTIME&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;)&lt;/span&gt;
+&lt;span style=&#34;color: #AA22FF&#34;&gt;@Target&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;({&lt;/span&gt;ElementType&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;METHOD&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; ElementType&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;TYPE&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;})&lt;/span&gt;
+&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color: #AA22FF&#34;&gt;@interface&lt;/span&gt; Check &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;// error here&lt;/span&gt;
+
+    String&lt;span style=&#34;color: #666666&#34;&gt;[]&lt;/span&gt; &lt;span style=&#34;color: #0000FF&#34;&gt;value&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;();&lt;/span&gt;
+&lt;span style=&#34;color: #666666&#34;&gt;}&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;You also know that typical behavior among programmers where your program doesn&amp;rsquo;t compile, but you keep trying to compile it anyway hoping that it will magically just work. That&amp;rsquo;s what I did, and it actually ran. I couldn&amp;rsquo;t really just let this pass, so I decided to try deleting &lt;code&gt;Check.java&lt;/code&gt;. I got another compilation error, &lt;code&gt;Error: type Secure already defined&lt;/code&gt;&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;public&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;class&lt;/span&gt; &lt;span style=&#34;color: #0000FF; font-weight: bold&#34;&gt;Secure&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;extends&lt;/span&gt; Controller &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt; &lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;// error here&lt;/span&gt;
+
+    &lt;span style=&#34;color: #AA22FF&#34;&gt;@Before&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;unless&lt;span style=&#34;color: #666666&#34;&gt;={&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;login&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;authenticate&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;logout&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;})&lt;/span&gt;
+
+    &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;static&lt;/span&gt; &lt;span style=&#34;color: #B00040&#34;&gt;void&lt;/span&gt; &lt;span style=&#34;color: #0000FF&#34;&gt;checkAccess&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;throws&lt;/span&gt; Throwable &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;At that point, I just decided to just debug it later. It works by just forcing it anyway. So I put &lt;code&gt;Check.java&lt;/code&gt; back in and proceeded to just refresh until it compiled and ran.&lt;/p&gt;
+
+&lt;p&gt;The next problem is a sort of common thing most webapp developers have to solve one way or another. How do you set up the initial admin account? Phrased a different way, how do I login to this thing? The first thing I tried was just add a user into the &lt;code&gt;account&lt;/code&gt; table directly. One problem though was how to set the password correctly. Plaintext obviously wouldn&amp;rsquo;t work.&lt;/p&gt;
+
+&lt;p&gt;Another note regarding Play 1.x, it provides the &lt;a href=&#34;http://www.playframework.com/documentation/1.2.5/secure&#34;&gt;secure module&lt;/a&gt; which handles logins and keeping state, you simply need to implement the method &lt;code&gt;boolean authenticate(String username, String password)&lt;/code&gt;. It leaves the actual process of verifying the login to the programmer. This can be exploited by just making the method return &lt;code&gt;true&lt;/code&gt; and then any login would work. No need to actually set the password. Excellent.&lt;/p&gt;
+
+&lt;p&gt;And we&amp;rsquo;re logged in, just in time to encounter a runtime exception. This also works much like compilation errors in Play. It shows a page with the error and the relevant source lines. Now we get, &lt;code&gt;IndexOutOfBoundsException occured : Index: 0, Size: 0&lt;/code&gt;&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;session&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;get&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;agencyId&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;null&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt;
+
+    Agency agency &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; agencies&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;get&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(0);&lt;/span&gt; &lt;span style=&#34;color: #408080; font-style: italic&#34;&gt;// error here&lt;/span&gt;
+
+    session&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;put&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;agencyId&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; agency&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;id&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;);&lt;/span&gt;
+    session&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;put&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;agencyName&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; agency&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;name&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;);&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;Apparently, we need to have an agency. That&amp;rsquo;s generally simple enough. You just manually insert an agency into the &lt;code&gt;agency&lt;/code&gt; table. After that&amp;rsquo;s done, we finally have a view of the actual application. It&amp;rsquo;s very Bootstrap-y, but that&amp;rsquo;s just fine. The workflow though, is not perfectly intuitive, but I&amp;rsquo;ll talk about that some other day.&lt;/p&gt;
+
+&lt;p&gt;That&amp;rsquo;s not the end of it though, we still have to fix these bugs. The developer obviously didn&amp;rsquo;t have to put up with this when they were working, so what happened? Also, the log is showing some weird things,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;~        _            _
+~  _ __ | | __ _ _  _| |
+~ | &amp;#39;_ \| |/ _&amp;#39; | || |_|
+~ |  __/|_|\____|\__ (_)
+~ |_|            |__/
+~
+~ play! 1.2.5, http://www.playframework.org
+~
+~ Ctrl+C to stop
+~
+CompilerOracle: exclude jregex/Pretokenizer.next
+Listening for transport dt_socket at address: 8000
+23:32:14,943 INFO  ~ Starting /Users/thomas/Workspace/maps/gtfs-editor
+23:32:14,948 WARN  ~ Declaring modules in application.conf is deprecated. Use dependencies.yml instead (module.secure)
+23:32:14,948 INFO  ~ Module secure is available (/Users/thomas/.root/opt/play-1.2.5/modules/secure)
+23:32:15,830 WARN  ~ You&amp;#39;re running Play! in DEV mode
+23:32:15,952 INFO  ~ Listening for HTTP on port 9000 (Waiting a first request to start) ...
+23:32:28,792 ERROR ~
+
+@6f02fa9dd
+Internal Server Error (500) for request GET /
+
+Compilation error (In /app/controllers/Check.java around line 10)
+The file /app/controllers/Check.java could not be compiled. Error raised is : The type Check is already defined
+
+play.exceptions.CompilationException: The type Check is already defined
+	at play.classloading.ApplicationCompiler$2.acceptResult(ApplicationCompiler.java:246)
+	at org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:672)
+	at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:516)
+	at play.classloading.ApplicationCompiler.compile(ApplicationCompiler.java:282)
+	at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:426)
+	at play.Play.start(Play.java:516)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at Invocation.HTTP Request(Play!)
+23:32:31,551 INFO  ~ Connected to jdbc:postgresql://127.0.0.1/gtfs_editor
+SLF4J: Class path contains multiple SLF4J bindings.
+SLF4J: Found binding in [jar:file:/Users/thomas/Workspace/maps/gtfs-editor/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: Found binding in [jar:file:/Users/thomas/.root/opt/play-1.2.5/framework/lib/slf4j-log4j12-1.6.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
+SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
+23:32:32,490 INFO  ~ Initializing HBSpatialExtension
+23:32:32,492 INFO  ~ Attempting to load Hibernate Spatial Provider org.hibernatespatial.postgis.DialectProvider
+23:32:32,494 INFO  ~ Checking for default configuration file.
+23:32:32,496 INFO  ~ No configuration file hibernate-spatial.cfg.xml on the classpath.
+23:32:34,077 INFO  ~ Application &amp;#39;gtfs-editor&amp;#39; is now started !
+23:32:34,151 INFO  ~ Bootstrapping Database...
+23:32:34,297 DEBUG ~ select count(*) as col_0_0_ from Agency agency0_ limit ?
+play.exceptions.UnexpectedException: Unexpected Error
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:180)
+	at play.templates.TemplateLoader.load(TemplateLoader.java:78)
+	at play.test.Fixtures.loadModels(Fixtures.java:174)
+	at jobs.BootstrapDatabase.doJob(BootstrapDatabase.java:57)
+	at play.jobs.Job.doJobWithResult(Job.java:50)
+	at play.jobs.Job.call(Job.java:146)
+	at play.jobs.Job.run(Job.java:132)
+	at play.jobs.JobsPlugin.afterApplicationStart(JobsPlugin.java:116)
+	at play.plugins.PluginCollection.afterApplicationStart(PluginCollection.java:531)
+	at play.Play.start(Play.java:547)
+	at play.Play.detectChanges(Play.java:630)
+	at play.Invoker$Invocation.init(Invoker.java:198)
+	at play.server.PlayHandler$NettyInvocation.init(PlayHandler.java:189)
+	at play.Invoker$Invocation.run(Invoker.java:276)
+	at play.server.PlayHandler$NettyInvocation.run(PlayHandler.java:229)
+	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
+	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
+	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
+	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
+	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
+	at java.lang.Thread.run(Thread.java:680)
+Caused by: play.exceptions.UnexpectedException: Unexpected Error
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:111)
+	at play.vfs.VirtualFile.contentAsString(VirtualFile.java:178)
+	... 22 more
+Caused by: java.io.FileNotFoundException: /Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml (No such file or directory)
+	at java.io.FileInputStream.open(Native Method)
+	at java.io.FileInputStream.&amp;lt;init&amp;gt;(FileInputStream.java:120)
+	at play.vfs.VirtualFile.inputstream(VirtualFile.java:109)
+	... 23 more
+23:32:34,316 ERROR ~ java.lang.RuntimeException: Cannot load fixture initial-agencies-data.yml: Unexpected Error
+23:32:40,989 DEBUG ~ select account0_.id as id15_, account0_.active as active15_, account0_.admin as admin15_, account0_.agency_id as agency9_15_, account0_.email as email15_, account0_.lastLogin as lastLogin15_, account0_.password as password15_, account0_.passwordChangeToken as password7_15_, account0_.username as username15_ from Account account0_ where account0_.username=? limit ?
+23:32:40,994 DEBUG ~ select count(*) as col_0_0_ from Account account0_ limit ?
+23:32:40,999 DEBUG ~ select nextval (&amp;#39;hibernate_sequence&amp;#39;)
+23:32:41,051 DEBUG ~ insert into Account (active, admin, agency_id, email, lastLogin, password, passwordChangeToken, username, id) values (?, ?, ?, ?, ?, ?, ?, ?, ?)
+23:32:41,061 DEBUG ~ select agency0_.id as id24_, agency0_.color as color24_, agency0_.defaultLat as defaultLat24_, agency0_.defaultLon as defaultLon24_, agency0_.defaultRouteType_id as default12_24_, agency0_.gtfsAgencyId as gtfsAgen5_24_, agency0_.lang as lang24_, agency0_.name as name24_, agency0_.phone as phone24_, agency0_.systemMap as systemMap24_, agency0_.timezone as timezone24_, agency0_.url as url24_ from Agency agency0_ order by agency0_.name
+23:32:41,175 ERROR ~
+
+@6f02fa9dg
+Internal Server Error (500) for request GET /
+
+Execution exception (In /app/controllers/Application.java around line 57)
+IndexOutOfBoundsException occured : Index: 0, Size: 0
+
+play.exceptions.JavaExecutionException: Index: 0, Size: 0
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:237)
+	at Invocation.HTTP Request(Play!)
+Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
+	at java.util.ArrayList.RangeCheck(ArrayList.java:547)
+	at java.util.ArrayList.get(ArrayList.java:322)
+	at controllers.Application.initSession(Application.java:57)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:510)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:484)
+	at play.mvc.ActionInvoker.invokeControllerMethod(ActionInvoker.java:479)
+	at play.mvc.ActionInvoker.handleBefores(ActionInvoker.java:328)
+	at play.mvc.ActionInvoker.invoke(ActionInvoker.java:142)
+	... 1 more
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;After &lt;code&gt;23:32:34&lt;/code&gt; is when I get the login page. &lt;code&gt;23:32:40&lt;/code&gt; is after I&amp;rsquo;ve logged in.&lt;/p&gt;
+
+&lt;h3 id=&#34;second-pass:9dc7854b573f1a2be2b19d1bfe826d39&#34;&gt;Second Pass&lt;/h3&gt;
+
+&lt;p&gt;So how did you do? First, the error that &lt;code&gt;type Check already defined&lt;/code&gt; usually does mean that &lt;code&gt;Check&lt;/code&gt; was already defined elsewhere. Looking in the app folder though, there was nothing of the sort. It&amp;rsquo;s the only one there that was &lt;code&gt;Check.java&lt;/code&gt;. But remember the secure module? Modules work by providing source files and Play just compiles them all together. Bingo, &lt;code&gt;Check.java&lt;/code&gt;. Doing a diff shows nothing was changed. So the solution really was just simply delete &lt;code&gt;Check.java&lt;/code&gt; and also &lt;code&gt;Secure.java&lt;/code&gt;. No more compilation errors!&lt;/p&gt;
+
+&lt;p&gt;The next question is, how do you get the initial user? There actually is some code that looks like it creates the default admin user,&lt;/p&gt;
+&lt;div class=&#34;highlight&#34; style=&#34;background: #f8f8f8&#34;&gt;&lt;pre style=&#34;line-height: 125%&#34;&gt;&lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;Security&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;isConnected&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;())&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt;
+    &lt;span style=&#34;color: #666666&#34;&gt;...&lt;/span&gt;
+    Account account &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; Account&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;find&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;username = ?&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; Security&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;connected&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;()).&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;first&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;();&lt;/span&gt;
+    &lt;span style=&#34;color: #666666&#34;&gt;...&lt;/span&gt;
+    &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;if&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;account &lt;span style=&#34;color: #666666&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;null&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;&amp;amp;&amp;amp;&lt;/span&gt; Account&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;count&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;()&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;==&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;0)&lt;/span&gt; &lt;span style=&#34;color: #666666&#34;&gt;{&lt;/span&gt;
+        account &lt;span style=&#34;color: #666666&#34;&gt;=&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;new&lt;/span&gt; Account&lt;span style=&#34;color: #666666&#34;&gt;(&lt;/span&gt;&lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;admin&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;admin&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;quot;admin@test.com&amp;quot;&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;true&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;,&lt;/span&gt; &lt;span style=&#34;color: #008000; font-weight: bold&#34;&gt;null&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;);&lt;/span&gt;
+        account&lt;span style=&#34;color: #666666&#34;&gt;.&lt;/span&gt;&lt;span style=&#34;color: #7D9029&#34;&gt;save&lt;/span&gt;&lt;span style=&#34;color: #666666&#34;&gt;();&lt;/span&gt;
+    &lt;span style=&#34;color: #666666&#34;&gt;}&lt;/span&gt;
+    &lt;span style=&#34;color: #666666&#34;&gt;...&lt;/span&gt;
+&lt;span style=&#34;color: #666666&#34;&gt;}&lt;/span&gt;
+&lt;/pre&gt;&lt;/div&gt;
+
+&lt;p&gt;You can actually see this in action at &lt;code&gt;23:32:41,051&lt;/code&gt; in the log. So what&amp;rsquo;s wrong with all of this? The account creation happened after I&amp;rsquo;ve already logged in. In fact, &lt;code&gt;Security.isConnected()&lt;/code&gt; checks whether the user is already logged in or not. How does this even make sense?&lt;/p&gt;
+
+&lt;p&gt;Lastly, we have the problem of the agencies. Just by looking at the log, you can safely say we&amp;rsquo;re missing a file called &lt;code&gt;initial-agencies-data.yml&lt;/code&gt;. Ok, apparently it&amp;rsquo;s a &lt;a href=&#34;http://www.playframework.com/documentation/1.2.5/test#fixtures&#34;&gt;fixture&lt;/a&gt; like you would use for testing. It&amp;rsquo;s easy enough to infer what the file&amp;rsquo;s contents should be. We just copy it over from the GTFS data.&lt;/p&gt;
+
+&lt;p&gt;But then where do you put the file? If you look at the log, it says &lt;code&gt;/Users/thomas/.root/opt/play-1.2.5/modules/docviewer/app/initial-agencies-data.yml&lt;/code&gt; but that doesn&amp;rsquo;t look right. That&amp;rsquo;s in the Play distribution directory, probably not somewhere something app-specific should go into. Well, a fixture is used for testing, so maybe the &lt;code&gt;test/&lt;/code&gt; directory? No, that doesn&amp;rsquo;t work either since we&amp;rsquo;re not running a test.&lt;/p&gt;
+
+&lt;p&gt;What I ended up doing was just looking at the sources for &lt;code&gt;Fixtures.load&lt;/code&gt;. If you follow the stack trace, you end up finding &lt;code&gt;Play.javaPath&lt;/code&gt; which sort of works like PATH for Fixtures and some other things. So where can we put the file? &lt;code&gt;app/&lt;/code&gt; and &lt;code&gt;conf/&lt;/code&gt;. And with that, we&amp;rsquo;re done.&lt;/p&gt;
+
+&lt;h3 id=&#34;conclusion&#34;&gt;Conclusion&lt;/h3&gt;
+
+&lt;p&gt;GTFS Editor is very much in development. Just getting it to run was problematic. There also seem to be a lot of missing issues judging from the Github Issues page. If you want to try it out for yourself, I suggest you clone &lt;a href=&#34;https://github.com/thatsmydoing/gtfs-editor&#34;&gt;my branch&lt;/a&gt; as I&amp;rsquo;ve fixed the issues discussed earlier. The default login is &lt;code&gt;admin:admin&lt;/code&gt;.&lt;/p&gt;
+
+&lt;p&gt;Even after getting it to run, it&amp;rsquo;s still not quite usable. Not in the UX sense, but you really can&amp;rsquo;t do much with it. There is no way to import the GTFS data into the webapp. There is something like import from TransitWand but even that is unclear to me. And even if we do get that running as well, we still don&amp;rsquo;t have any data we can play around with. We would need database dumps from the already running tools for these to be of any use right now.&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>One Bus (or maybe Jeep) Away</title>
+      <link>http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html</link>
+      <pubDate>Tue, 09 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html</guid>
+      <description>&lt;p&gt;Link: &lt;a href=&#34;http://onebusaway.org/&#34;&gt;http://onebusaway.org/&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; no routing; useless in Philippines&lt;/p&gt;
+
+&lt;p&gt;OneBusAway is a transit information app. It provides data on what bus stops are near you, which buses pass by. You can also get schedules and the route of a particular bus given the number. It can also provide realtime updates like how many minutes until the next bus arrives. It does not, however, provide routing. There is no support for providing directions to get from point A to point B.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s comparable to what you get in some bus stops abroad. You&amp;rsquo;d get a vicinity map and a list of buses passing through the stop. You might also get the times when the next buses will pass. It&amp;rsquo;s useful for locals who already know how to get around, and want to avoid waiting for the bus. But it&amp;rsquo;s not particularly good for people who want to know how to get around the city.&lt;/p&gt;
+
+&lt;p&gt;OneBusAway is quite comprehensive in its platform support though. There is a webapp, apps for iOS, Android and Windows Phone, as well as SMS and Voice support. This would all be nice but we don&amp;rsquo;t have the necessary infrastructure yet in the Philippines. We don&amp;rsquo;t have bus or jeepney stops. We also wouldn&amp;rsquo;t have realtime data to make the app particularly useful.&lt;/p&gt;
+
+&lt;p&gt;You can try it out for yourself by following their &lt;a href=&#34;https://github.com/OneBusAway/onebusaway-application-modules/wiki/OneBusAway-Quickstart-Guide&#34;&gt;Quickstart Guide&lt;/a&gt;. One caveat is you will have to add &lt;code&gt;-P tripEntriesFactory.throwExceptionOnInvalidStopToShapeMappingException=false&lt;/code&gt; when building the bundle. This has to do with the OneBusAway having difficulty matching the &lt;a href=&#34;https://github.com/OneBusAway/onebusaway-application-modules/wiki/Stop-to-Shape-Matching&#34;&gt;stops to the shape data&lt;/a&gt;.&lt;/p&gt;
+
+&lt;p&gt;Here&amp;rsquo;s some screenshots of the app with the Philippine data. Notice how you only see the stops but there isn&amp;rsquo;t a line for the route. This is a problem with our GTFS data. Also, at some points it&amp;rsquo;s hard to tell where the jeep is going to pass since there isn&amp;rsquo;t any indication of order either. This is more of a OneBusAway problem. It usually expects there to be shape data available.&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;../galleries/transit/onebusaway1.png&#34;&gt;&lt;img src=&#34;../galleries/transit/onebusaway1.png&#34; alt=&#34;OneBusAway&#34; title=&#34;All the stops along Katipunan Avenue are named Katipunan Avenue.&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;It doesn&amp;rsquo;t really handle too many routes passing through a stop. The list just overflows past the bubble. You can still actually read it by panning the map. It&amp;rsquo;s just a bit weird though.&lt;/p&gt;
+
+&lt;p&gt;If you also noticed, there are usually 2 of each route. This is how the jeepney data was modeled as jeep routes might be different going one way and going back. This isn&amp;rsquo;t the case for all jeeps though, so it might also be an implementation issue with the GTFS editor.&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;../galleries/transit/onebusaway2.png&#34;&gt;&lt;img src=&#34;../galleries/transit/onebusaway2.png&#34; alt=&#34;OneBusAway&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;a href=&#34;../galleries/transit/onebusaway3.png&#34;&gt;&lt;img src=&#34;../galleries/transit/onebusaway3.png&#34; alt=&#34;OneBusAway&#34; /&gt;&lt;/a&gt;&lt;/p&gt;
+</description>
+    </item>
+    
+    <item>
+      <title>Open Trip Planner</title>
+      <link>http://pleasantprogrammer.com/posts/open-trip-planner.html</link>
+      <pubDate>Tue, 09 Jul 2013 00:00:00 +0000</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/open-trip-planner.html</guid>
+      <description>
+
+&lt;p&gt;Link: &lt;a href=&#34;http://www.opentripplanner.org&#34;&gt;http://www.opentripplanner.org&lt;/a&gt;&lt;/p&gt;
+
+&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; routes pretty well; data might cause weird issues&lt;/p&gt;
+
+&lt;p&gt;OpenTripPlanner, as the name implies, is a routing app. Given point A and point B, it can provide possible routes by taking transit, riding a bike, or a mix of both. You can also specify options on how much walking you&amp;rsquo;re willing to do or if you prefer fewer transfers over trip time. It could be a good competitor to the transit directions of Google Maps.&lt;/p&gt;
+
+&lt;p&gt;It&amp;rsquo;s actually in general use by the &lt;a href=&#34;http://maps.trimet.org/&#34;&gt;Trimet&lt;/a&gt;, Portland&amp;rsquo;s public transit system. I think a good reason why they deployed OpenTripPlanner is that Portland is a very bike friendly area. OpenTripPlanner&amp;rsquo;s support for multi-modal (bike + transit) routing is one thing that even Google Maps doesn&amp;rsquo;t have. This actually just screams &lt;a href=&#34;http://philippine-transit.hackathome.com/prizes/&#34;&gt;Inclusive Technology Award&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h3 id=&#34;setup:8052f9d579c0ac6326f58a643a8791fb&#34;&gt;Setup&lt;/h3&gt;
+
+&lt;p&gt;Getting OpenTripPlanner up and running involves a bit more downloading than OneBusAway. I&amp;rsquo;d suggest going through the &lt;a href=&#34;https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes&#34;&gt;5-minute introduction&lt;/a&gt; if you want to actually work with the Philippine data. You will also need to download the &lt;a href=&#34;http://download.geofabrik.de/asia/philippines.html&#34;&gt;Philippine data dump&lt;/a&gt; from OSM. You will want the &lt;code&gt;osm.bz2&lt;/code&gt; one (WARNING: 900MB unzipped).&lt;/p&gt;
+
+&lt;p&gt;Once you get the webapp running, you&amp;rsquo;ll notice the map tiles won&amp;rsquo;t load correctly. This is because the default tileset used is from Mapbox which doesn&amp;rsquo;t provide publicly free tilesets anymore. To actually see things on the map, you should click the + on the upper-right of the map and change the base layer to something like Open Street Map or OSM Mapquest. This has been fixed in their latest sources.&lt;/p&gt;
+
+&lt;h3 id=&#34;issues:8052f9d579c0ac6326f58a643a8791fb&#34;&gt;Issues&lt;/h3&gt;
+
+&lt;p&gt;The next thing you&amp;rsquo;ll notice is that you can&amp;rsquo;t search for a place. You can only just pick points on the map and route between those. I&amp;rsquo;m still not exactly sure if it&amp;rsquo;s supposed to have it, since the Trimet one has it. But even then adding it by using the Google Maps or MapQuest APIs shouldn&amp;rsquo;t be too difficult.&lt;/p&gt;
+
+&lt;p&gt;Another missing thing compared to the Trimet planner is being able to look at the routes akin to OneBusAway. And even then, Trimet&amp;rsquo;s implementation isn&amp;rsquo;t as good for exploring as OneBusAway is. Seeing the schedule or seeing which routes pass through a stop are left to an external site to do.&lt;/p&gt;
+
+&lt;p&gt;There have been some weird issues with the routing though. A common occurence is the steps are somewhat disconnected (see image below). The left half shows OpenTripPlanner, it shows that you get off at a &amp;ldquo;stop&amp;rdquo; in EDSA and you should magically teleport to Arguilla street and start walking. To be fair, Google Maps (right half) shows that there is a street from the &amp;ldquo;stop&amp;rdquo; to Arguilla.&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;../galleries/transit/otp1.png&#34; alt=&#34;OpenTripPlanner disconnected route&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;I can&amp;rsquo;t say this isn&amp;rsquo;t a bug. After all, OpenTripPlanner couldn&amp;rsquo;t have magically known there really was a street there. If it did, it wouldn&amp;rsquo;t just teleport you to the corner. I&amp;rsquo;m more inclined to think though that this is a result of not having any shape data. As a result, OpenTripPlanner might try to assume the stop could mean places within a certain radius of where it was defined.&lt;/p&gt;
+
+&lt;p&gt;Another weird issue that pops up sometimes is where it tells you to ride a jeep past the stop you want and then after a while, get off and ride a jeep back to your stop. A more general issue is that sometimes it won&amp;rsquo;t give you the best route because it thinks you have to loop around to get to where you want to be. I don&amp;rsquo;t really know how common this issue pops up though. It&amp;rsquo;s highly dependent on where you put the marker. If you just move the marker down a little bit, it actually does give the correct route.&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;../galleries/transit/otp2.png&#34; alt=&#34;OpenTripPlanner loopy route&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;Much like the earlier problem, I can&amp;rsquo;t tell if this is a bug or it&amp;rsquo;s a result of the bad data. Once again though, I think the issue is more of bad data. If you look at the plotted UP-Katipunan route, the stops aren&amp;rsquo;t even on the road. This probably makes it more difficult for OpenTripPlanner to actually tell if the stop and road are connected.&lt;/p&gt;
+
+&lt;p&gt;&lt;img src=&#34;../galleries/transit/upkatipunan.jpg&#34; alt=&#34;UP Katipunan Route&#34; /&gt;&lt;/p&gt;
+
+&lt;p&gt;From what they said during the launch, most of the route data was collected by getting a person to ride a jeep with a smartphone. That would explain why the coordinates aren&amp;rsquo;t that exact. Even then, it would have been nice if they at least cleaned up the data by moving the stops to the road. They would have had to go over them to name the stops anyway.&lt;/p&gt;
+
+&lt;h3 id=&#34;conclusion:8052f9d579c0ac6326f58a643a8791fb&#34;&gt;Conclusion&lt;/h3&gt;
+
+&lt;p&gt;Overall though, I really like OpenTripPlanner. It handles most of the hard parts of the challenge. It provides a REST API for doing routing with the GTFS + OSM data. There&amp;rsquo;s also a lot of potential for additional open source work. A lot can be done to improve the default webapp. Adding a default location searcher would greatly improve usability. Adding in the route viewing features of OneBusAway would also be nice. Alternatively, you could even write your own client that just interfaces with the API.&lt;/p&gt;
+</description>
+    </item>
+    
+  </channel>
+</rss>

+ 94 - 143
output/sitemap.xml

@@ -1,144 +1,95 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<urlset
-    xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
-    xmlns:xhtml="http://www.w3.org/1999/xhtml"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
-                        http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
- <url>
-  <loc>http://pleasantprogrammer.com/2013/index.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/2015/index.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/archive.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/categories/cloudflare.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/categories/index.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/categories/lets-debug.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/categories/philippine-transit-app.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/categories/programming.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/categories/sysadmin.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/categories/systemd.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/categories/tiddlywiki.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/galleries/index.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/galleries/transit/index.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/index-1.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/index-2.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/index-3.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/index.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/console-keymap-switching.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/fare-data.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/geocoding-services.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/graphserver.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/gtfs-editor.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/highways-in-otp.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/jeepney-and-bus-routes.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/open-trip-planner.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/philippine-transit-app-challenge.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
- <url>
-  <loc>http://pleasantprogrammer.com/posts/transit-wand.html</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </url>
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/</loc>
+    <lastmod>2015-12-25T00:00:00+00:00</lastmod>
+    <priority>0</priority>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/cloudflare-shenanigans.html</loc>
+    <lastmod>2015-12-25T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/tiddlywiki-in-the-sky-or-tiddlyweb-for-tw5.html</loc>
+    <lastmod>2015-12-24T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/is-my-terminal-window-active.html</loc>
+    <lastmod>2015-06-07T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/removing-pldtmydslbiz-from-the-zyxel-p-2612hnu.html</loc>
+    <lastmod>2013-11-27T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/console-keymap-switching.html</loc>
+    <lastmod>2013-10-29T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/geocoding-services.html</loc>
+    <lastmod>2013-09-25T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/jeep-and-bus-schedules.html</loc>
+    <lastmod>2013-07-28T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/highways-in-otp.html</loc>
+    <lastmod>2013-07-24T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/elevation-data-in-otp.html</loc>
+    <lastmod>2013-07-23T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/graphserver.html</loc>
+    <lastmod>2013-07-23T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/transit-wand.html</loc>
+    <lastmod>2013-07-15T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/fare-data.html</loc>
+    <lastmod>2013-07-13T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/gtfs-editor.html</loc>
+    <lastmod>2013-07-10T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/one-bus-or-maybe-jeep-away.html</loc>
+    <lastmod>2013-07-09T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/open-trip-planner.html</loc>
+    <lastmod>2013-07-09T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/jeepney-and-bus-routes.html</loc>
+    <lastmod>2013-07-07T00:00:00+00:00</lastmod>
+  </url>
+  
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/philippine-transit-app-challenge.html</loc>
+    <lastmod>2013-07-07T00:00:00+00:00</lastmod>
+  </url>
+  
 </urlset>

+ 0 - 52
output/sitemapindex.xml

@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<sitemapindex
-    xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
-    xmlns:xhtml="http://www.w3.org/1999/xhtml"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
-                        http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
- <sitemap>
-  <loc>http://pleasantprogrammer.com/categories/cloudflare.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/categories/lets-debug.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/categories/philippine-transit-app.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/categories/programming.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/categories/sysadmin.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/categories/systemd.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/categories/tiddlywiki.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/galleries/rss.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/galleries/transit/rss.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/rss.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
- <sitemap>
-  <loc>http://pleasantprogrammer.com/sitemap.xml</loc>
-  <lastmod>2015-12-25T07:29:00Z</lastmod>
- </sitemap>
-</sitemapindex>

+ 0 - 57
posts/cloudflare-shenanigans.md

@@ -1,57 +0,0 @@
-<!--
-.. title: Cloudflare Shenanigans
-.. slug: cloudflare-shenanigans
-.. date: 2015-12-25 14:13:26 UTC+08:00
-.. tags: sysadmin, cloudflare
-.. category:
-.. link:
-.. description:
-.. type: text
--->
-
-An old client of ours managed to convince a telco to zero-rate the data for their app. In order to whitelist it though, we needed to use plain HTTP for domain whitelisting. For HTTPS, they can only whitelist by IP address. Like any good developer, we were using HTTPS. Also, like any good developer, we put our server behind Cloudflare.
-
-Now the problem is that Cloudflare can put you behind [any IP they own](https://www.cloudflare.com/ips/), which is a huge range. There's no guarantee that the IP we have now is going to be the same later on. So we did the reasonable thing and asked them to whitelist all of the Cloudflare IPs. And the telco agreed! We were in total disbelief when that happened. But hey, if life gives you free internet, you take it.
-
-We never actually empirically tested whether other sites hosted on Cloudflare were also actually zero-rated. But I like to think that we saved a lot of people on their data costs from browsing Reddit and 4chan. But alas, good things must come to an end.
-
-A few months after we started beta testing the app, Cloudflare added more IPs to their range. Unfortunately, our server got moved to those new IPs which were not whitelisted yet. Apparently, the telco whitelisting process was incredibly convoluted and time consuming. Our client didn't want to bother asking them to whitelist more IPs. We also tried asking Cloudflare to move us back to the original IP range, but they could only do that if we were in their enterprise tier. We couldn't really afford that, so we looked for other options.
-
-Since Cloudflare was essentially just a giant reverse proxy, theoretically there should be no distinction between one IP address from another. The specific IP we get is probably just for load balancing. So we tried accessing the IPs in the range directly and just setting the Host header and it worked! But we get SSL errors because the IP itself doesn't have its own certificate.
-
-After more testing, we figured out that you could actually use any Cloudflare backed domain so long as we properly set the Host header. We just needed to find one still in the old range. Coincidentally, 4chan.org was. Which led to this wonderful commit
-
-    :::diff
-    commit 123456789abcdef
-    Author: ~~~~~~
-    Date:   ~~~~~~
-
-        4chan hack
-
-    diff --git a/src/com/client/common/Util.java b/src/com/client/common/Util.java
-    --- a/src/com/client/common/Util.java
-    +++ b/src/com/client/common/Util.java
-    @@ -210,7 +210,8 @@ public class Util {
-            }
-
-            public static String getServerAddress(Context context) {
-    -               String address = "https://backend.client.com";
-    +               // String address = "https://backend.client.com";
-    +               String address = "https://4chan.org";
-                    if(!isDebug(context)) return address;
-                    try {
-    diff --git a/src/com/client/common/logging/APIClient.java b/src/com/client/common/logging/APIClient.java
-    --- a/src/com/client/common/logging/APIClient.java
-    +++ b/src/com/client/common/logging/APIClient.java
-    @@ -101,6 +101,7 @@ public class APIClient {
-            private HttpResponse postInternal(String url, List<NameValuePair> data, boolean forRegistration) throws ClientProtocolException, IOException {
-                    HttpPost request = new HttpPost(Util.getServerAddress(mContext)+"/api/"+url);
-                    request.setHeader("X-API-VERSION", apiVersion);
-    +               request.setHeader("Host", "backend.client.com");
-
-                    if(data == null) {
-                            data = new ArrayList<NameValuePair>();
-
-Eventually, we did decide to just abandon Cloudflare for the server. We probably weren't going to be the target of a DDOS or anything. This also allowed us to do more secure things like pinning the server certificate in the application itself. Clearly, this is what we should have just done in the first place, but at the time we just wanted a stopgap solution.
-
-I just still find it funny we were making people's phones go to 4chan.org everyday for more than a year.

+ 0 - 22
posts/elevation-data-in-otp.md

@@ -1,22 +0,0 @@
-<!-- 
-.. link: 
-.. description: 
-.. tags: philippine-transit-app, programming
-.. date: 2013/07/23 18:23:00
-.. title: Elevation Data in OTP
-.. slug: elevation-data-in-otp
--->
-
-![OpenTripPlanner showing elevation data](../galleries/transit/otpelevation.png)
-
-One thing I hadn't tested out last time was OTP's support for elevation data. It makes use of this by showing the elevation you have to traverse while walking along the suggested route. It can also take it into account when suggesting bike routes.
-
-The [5 minute tutorial](https://github.com/openplans/OpenTripPlanner/wiki/FiveMinutes) actually discusses the elevation data briefly, but a more in-depth thing you can look at is the [GraphBuilder documentation](https://github.com/openplans/OpenTripPlanner/wiki/GraphBuilder#elevation-data). It suggests using the ASTER dataset which is free but requires registration. I just opted to use the SRTM data available from the [PhilGIS website](http://www.philgis.org/freegisdata.htm).
-
-I don't know about the ASTER dataset, but the PhilGIS data was in the ERDAS img format. OTP only supports GeoTIFF so there was a need to convert it beforehand. You can use [GDAL](http://www.gdal.org/) for this. You'd just then run,
-
-     gdal_translate srtm41_90m_phl.img phil.tiff
-
-Afterwards, it's just a matter of following the OTP instructions on using a local elevation dataset. The process actually doubled the size of the generated Graph.obj so it might not be ideal if you're running on limited RAM.
-
-I've actually hosted a [working example](http://maps.pleasantprogrammer.com). It's pretty much at the limits of the RAM so it might be slow and unreliable, but you can test it out just for fun. Please don't abuse it though.

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott