Browse Source

Add audventure post

Thomas Dy 7 years ago
parent
commit
f131c929c3

+ 99 - 0
content/posts/audventure.md

@@ -0,0 +1,99 @@
++++
+tags = [ "games", "programming" ]
+date = "2017-11-19T22:00:00+08:00"
+title = "Audventure"
+slug = "audventure"
++++
+
+Sometime around 2013 I wrote a clone of the GBA game [bit Generations
+SoundVoyager](https://www.nintendo.co.jp/n08/bit_g/) called
+[audventure](https://audventure.pleasantprogrammer.com). SoundVoyager is
+actually a collection of mini-games where sound is the main focus. You can
+actually play the game blind, and at some point, that's pretty much what
+happens.
+
+## sound catcher
+
+The signature mini-game in SoundVoyager is sound catcher. In the mini-game, you
+can only move left and right at the bottom of the stage, while a "sound" falls
+from the top. Your goal is to catch the sound which is signified by a green dot.
+When you catch it, the sound or beat becomes part of the BGM and a new dot
+appears with a different sound.
+
+You can of course use your eyes and move accordingly, but if you put on
+earphones, you can actually hear where the dot is, either on your left or right,
+with it getting louder as it gets close to you. As you collect more sounds, the
+dot gets more and more transparent. Eventually (and this is where it gets fun),
+you won't be able to see the sounds anymore and will have to rely mostly on your
+ears.
+
+You can see what the original game looks like in [this
+video](https://www.youtube.com/watch?v=C12WRgfIOC8) or you can play it under
+*sound safari* in [audventure](https://audventure.pleasantprogrammer.com).
+
+## WebAudio vs Flash
+
+At the time I wrote audventure, only Chrome supported WebAudio. Also, the API
+looked (and still looks) quite complicated. Flash on the other hand, was
+starting to die, but still well-supported so I went with that. For the most
+part, it worked okay though Chrome actually had timing issues when playing
+sounds. Now, it doesn't work in any browser. I tried to debug the issues but
+ultimately ended up just rewriting it to use WebAudio instead.
+
+For the game, I needed to simulate the source of the sound in 2D/3D space. Flash
+only really gives you stereo panning and volume control. With some maths, we can
+actually get an acceptable solution. Less importantly, I needed to be able to
+get frequency data of the currently playing "sound" to pulse the background. For
+this, I actually had to implement the feature in the Flash library I was using.
+
+With WebAudio, spatial audio is already built-in and you can simply give it the
+coordinates of the sounds and the listener. There are some other options to
+tweak, but for the most part, no complex math is needed. Getting frequency data
+for a sound is also actually built-in and didn't take too long to integrate.
+
+Overall, I was impressed by how much you can do with WebAudio out-of-the-box. I
+kind of understand why it's complicated, but there's some simple functionality
+that I wish was included. For example, there is no API to pause and then resume
+playing an audio buffer. You have to manually save the elapsed time and play
+from there.
+
+## Other mini-games
+
+So far I've only actually implemented the sound catcher mini-game. There are
+around 4 different categories with slight variations in between.
+
+### sound catcher / sound slalom
+
+I've explained sound catcher a while ago; sound slalom is a minor variation on
+that. Instead of waiting for the "sound" to reach you, you now have to guide
+yourself in between 2 "poles" of sound, as in [slalom
+skiing](https://en.wikipedia.org/wiki/Slalom_skiing). But this time, you can
+also accelerate forward. The goal is to finish the course before the time runs
+out.
+
+### sound drive / sound chase
+
+In sound drive, you're driving against the flow on a 5 lane road. You have to
+avoid oncoming cars, trucks and animals until you reach the end. You're allowed
+to change lanes and accelerate, and the game tracks your best time. Sound chase
+is pretty much the same, except you're trying to catch up to a "sound".
+
+### sound cannon
+
+In sound cannon, you're immobile but can rotate within a 180 degree angle. Your
+goal is too shoot down "sounds" which are heading your way. If a sound reaches
+you, it's game over. You win when you kill all the sounds.
+
+### sound picker / sound cock
+
+In sound picker, you can move in a giant square field where various sounds are
+scattered around. Your goal is to pick up all the sounds within the time limit.
+Sound cock is similar, except the sounds are chickens and you have to chase them
+around.
+
+## Source Code
+
+If you want to see the source code, you can check it out
+[here](https://git.pleasantprogrammer.com/games/audventure). The sound files
+aren't in the repo though, since I'm not quite sure about the licensing. If you
+want to contribute music or sound effects, I'd gladly appreciate it.

+ 108 - 45
output/index.html

@@ -35,6 +35,114 @@
 <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/audventure.html" class="u-url">Audventure</a>
+			</h1>
+		</header>
+		<div class="e-content entry-content">
+			
+
+<p>Sometime around 2013 I wrote a clone of the GBA game <a href="https://www.nintendo.co.jp/n08/bit_g/">bit Generations
+SoundVoyager</a> called
+<a href="https://audventure.pleasantprogrammer.com">audventure</a>. SoundVoyager is
+actually a collection of mini-games where sound is the main focus. You can
+actually play the game blind, and at some point, that&rsquo;s pretty much what
+happens.</p>
+
+<h2 id="sound-catcher">sound catcher</h2>
+
+<p>The signature mini-game in SoundVoyager is sound catcher. In the mini-game, you
+can only move left and right at the bottom of the stage, while a &ldquo;sound&rdquo; falls
+from the top. Your goal is to catch the sound which is signified by a green dot.
+When you catch it, the sound or beat becomes part of the BGM and a new dot
+appears with a different sound.</p>
+
+<p>You can of course use your eyes and move accordingly, but if you put on
+earphones, you can actually hear where the dot is, either on your left or right,
+with it getting louder as it gets close to you. As you collect more sounds, the
+dot gets more and more transparent. Eventually (and this is where it gets fun),
+you won&rsquo;t be able to see the sounds anymore and will have to rely mostly on your
+ears.</p>
+
+<p>You can see what the original game looks like in <a href="https://www.youtube.com/watch?v=C12WRgfIOC8">this
+video</a> or you can play it under
+<em>sound safari</em> in <a href="https://audventure.pleasantprogrammer.com">audventure</a>.</p>
+
+<h2 id="webaudio-vs-flash">WebAudio vs Flash</h2>
+
+<p>At the time I wrote audventure, only Chrome supported WebAudio. Also, the API
+looked (and still looks) quite complicated. Flash on the other hand, was
+starting to die, but still well-supported so I went with that. For the most
+part, it worked okay though Chrome actually had timing issues when playing
+sounds. Now, it doesn&rsquo;t work in any browser. I tried to debug the issues but
+ultimately ended up just rewriting it to use WebAudio instead.</p>
+
+<p>For the game, I needed to simulate the source of the sound in 2D/3D space. Flash
+only really gives you stereo panning and volume control. With some maths, we can
+actually get an acceptable solution. Less importantly, I needed to be able to
+get frequency data of the currently playing &ldquo;sound&rdquo; to pulse the background. For
+this, I actually had to implement the feature in the Flash library I was using.</p>
+
+<p>With WebAudio, spatial audio is already built-in and you can simply give it the
+coordinates of the sounds and the listener. There are some other options to
+tweak, but for the most part, no complex math is needed. Getting frequency data
+for a sound is also actually built-in and didn&rsquo;t take too long to integrate.</p>
+
+<p>Overall, I was impressed by how much you can do with WebAudio out-of-the-box. I
+kind of understand why it&rsquo;s complicated, but there&rsquo;s some simple functionality
+that I wish was included. For example, there is no API to pause and then resume
+playing an audio buffer. You have to manually save the elapsed time and play
+from there.</p>
+
+<h2 id="other-mini-games">Other mini-games</h2>
+
+<p>So far I&rsquo;ve only actually implemented the sound catcher mini-game. There are
+around 4 different categories with slight variations in between.</p>
+
+<h3 id="sound-catcher-sound-slalom">sound catcher / sound slalom</h3>
+
+<p>I&rsquo;ve explained sound catcher a while ago; sound slalom is a minor variation on
+that. Instead of waiting for the &ldquo;sound&rdquo; to reach you, you now have to guide
+yourself in between 2 &ldquo;poles&rdquo; of sound, as in <a href="https://en.wikipedia.org/wiki/Slalom_skiing">slalom
+skiing</a>. But this time, you can
+also accelerate forward. The goal is to finish the course before the time runs
+out.</p>
+
+<h3 id="sound-drive-sound-chase">sound drive / sound chase</h3>
+
+<p>In sound drive, you&rsquo;re driving against the flow on a 5 lane road. You have to
+avoid oncoming cars, trucks and animals until you reach the end. You&rsquo;re allowed
+to change lanes and accelerate, and the game tracks your best time. Sound chase
+is pretty much the same, except you&rsquo;re trying to catch up to a &ldquo;sound&rdquo;.</p>
+
+<h3 id="sound-cannon">sound cannon</h3>
+
+<p>In sound cannon, you&rsquo;re immobile but can rotate within a 180 degree angle. Your
+goal is too shoot down &ldquo;sounds&rdquo; which are heading your way. If a sound reaches
+you, it&rsquo;s game over. You win when you kill all the sounds.</p>
+
+<h3 id="sound-picker-sound-cock">sound picker / sound cock</h3>
+
+<p>In sound picker, you can move in a giant square field where various sounds are
+scattered around. Your goal is to pick up all the sounds within the time limit.
+Sound cock is similar, except the sounds are chickens and you have to chase them
+around.</p>
+
+<h2 id="source-code">Source Code</h2>
+
+<p>If you want to see the source code, you can check it out
+<a href="https://git.pleasantprogrammer.com/games/audventure">here</a>. The sound files
+aren&rsquo;t in the repo though, since I&rsquo;m not quite sure about the licensing. If you
+want to contribute music or sound effects, I&rsquo;d gladly appreciate it.</p>
+
+		</div>
+		<small class="dateline">Posted: <time class="published dt-published" itemprop="datePublished" datetime="2017-11-19">2017-11-19</time></small>
+		| <small class="commentline"><a href="/posts/audventure.html#disqus_thread" data-disqus-identifier="cache/posts/audventure.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">
@@ -392,51 +500,6 @@ twanager bag default <span style="color: #BA2121">&lt;&lt;EOF</span>
 	</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">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">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">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">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>
-	
 </div>
 <nav class="postindexpager">
 	<ul class="pager clearfix">

+ 45 - 31
output/page/2.html

@@ -35,6 +35,51 @@
 <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/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">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">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">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">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">
@@ -181,37 +226,6 @@ sed -i .bak <span style="color: #BA2121">&#39;/^72/ s/,600/,60/&#39;</span> freq
 	</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%"><span></span>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>
-	
 </div>
 <nav class="postindexpager">
 	<ul class="pager clearfix">

+ 31 - 208
output/page/3.html

@@ -35,6 +35,37 @@
 <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/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%"><span></span>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">
@@ -202,214 +233,6 @@
 	</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">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">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></span><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></span><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></span><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%"><span></span>~        _            _
-~  _ __ | | __ _ _  _| |
-~ | &#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">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></span><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>
-	
 </div>
 <nav class="postindexpager">
 	<ul class="pager clearfix">

+ 208 - 0
output/page/4.html

@@ -35,6 +35,214 @@
 <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/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">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">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></span><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></span><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></span><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%"><span></span>~        _            _
+~  _ __ | | __ _ _  _| |
+~ | &#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">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></span><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">

+ 5 - 0
output/posts.html

@@ -39,6 +39,11 @@
 	</header>
 	<ul class="postlist">
 		
+		<li>
+			<a class="listtitle" href="/posts/audventure.html">Audventure</a>
+			<span class="entry-meta"><time itemprop="datePublished" datetime="2017-11-19">2017-11-19</time></span>
+		</li>
+		
 		<li>
 			<a class="listtitle" href="/posts/openpreppad.html">OpenPrepPad</a>
 			<span class="entry-meta"><time itemprop="datePublished" datetime="2017-01-15">2017-01-15</time></span>

+ 214 - 0
output/posts/audventure.html

@@ -0,0 +1,214 @@
+<!DOCTYPE html>
+<html lang="en-us">
+<head>
+	<meta charset="utf-8">
+	<meta name="generator" content="Hugo 0.18.1" />
+	<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>Audventure - 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.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/audventure.html">Audventure</a></h1>
+	<small>
+		<span class="dateline">Posted: <time itemprop="datePublished" datetime="2017-11-19">2017-11-19</time></span>
+		| More posts about
+		
+		<a class="tag p-category" href="/tags/games.html" rel="tag">
+			games
+		</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>Sometime around 2013 I wrote a clone of the GBA game <a href="https://www.nintendo.co.jp/n08/bit_g/">bit Generations
+SoundVoyager</a> called
+<a href="https://audventure.pleasantprogrammer.com">audventure</a>. SoundVoyager is
+actually a collection of mini-games where sound is the main focus. You can
+actually play the game blind, and at some point, that&rsquo;s pretty much what
+happens.</p>
+
+<h2 id="sound-catcher">sound catcher</h2>
+
+<p>The signature mini-game in SoundVoyager is sound catcher. In the mini-game, you
+can only move left and right at the bottom of the stage, while a &ldquo;sound&rdquo; falls
+from the top. Your goal is to catch the sound which is signified by a green dot.
+When you catch it, the sound or beat becomes part of the BGM and a new dot
+appears with a different sound.</p>
+
+<p>You can of course use your eyes and move accordingly, but if you put on
+earphones, you can actually hear where the dot is, either on your left or right,
+with it getting louder as it gets close to you. As you collect more sounds, the
+dot gets more and more transparent. Eventually (and this is where it gets fun),
+you won&rsquo;t be able to see the sounds anymore and will have to rely mostly on your
+ears.</p>
+
+<p>You can see what the original game looks like in <a href="https://www.youtube.com/watch?v=C12WRgfIOC8">this
+video</a> or you can play it under
+<em>sound safari</em> in <a href="https://audventure.pleasantprogrammer.com">audventure</a>.</p>
+
+<h2 id="webaudio-vs-flash">WebAudio vs Flash</h2>
+
+<p>At the time I wrote audventure, only Chrome supported WebAudio. Also, the API
+looked (and still looks) quite complicated. Flash on the other hand, was
+starting to die, but still well-supported so I went with that. For the most
+part, it worked okay though Chrome actually had timing issues when playing
+sounds. Now, it doesn&rsquo;t work in any browser. I tried to debug the issues but
+ultimately ended up just rewriting it to use WebAudio instead.</p>
+
+<p>For the game, I needed to simulate the source of the sound in 2D/3D space. Flash
+only really gives you stereo panning and volume control. With some maths, we can
+actually get an acceptable solution. Less importantly, I needed to be able to
+get frequency data of the currently playing &ldquo;sound&rdquo; to pulse the background. For
+this, I actually had to implement the feature in the Flash library I was using.</p>
+
+<p>With WebAudio, spatial audio is already built-in and you can simply give it the
+coordinates of the sounds and the listener. There are some other options to
+tweak, but for the most part, no complex math is needed. Getting frequency data
+for a sound is also actually built-in and didn&rsquo;t take too long to integrate.</p>
+
+<p>Overall, I was impressed by how much you can do with WebAudio out-of-the-box. I
+kind of understand why it&rsquo;s complicated, but there&rsquo;s some simple functionality
+that I wish was included. For example, there is no API to pause and then resume
+playing an audio buffer. You have to manually save the elapsed time and play
+from there.</p>
+
+<h2 id="other-mini-games">Other mini-games</h2>
+
+<p>So far I&rsquo;ve only actually implemented the sound catcher mini-game. There are
+around 4 different categories with slight variations in between.</p>
+
+<h3 id="sound-catcher-sound-slalom">sound catcher / sound slalom</h3>
+
+<p>I&rsquo;ve explained sound catcher a while ago; sound slalom is a minor variation on
+that. Instead of waiting for the &ldquo;sound&rdquo; to reach you, you now have to guide
+yourself in between 2 &ldquo;poles&rdquo; of sound, as in <a href="https://en.wikipedia.org/wiki/Slalom_skiing">slalom
+skiing</a>. But this time, you can
+also accelerate forward. The goal is to finish the course before the time runs
+out.</p>
+
+<h3 id="sound-drive-sound-chase">sound drive / sound chase</h3>
+
+<p>In sound drive, you&rsquo;re driving against the flow on a 5 lane road. You have to
+avoid oncoming cars, trucks and animals until you reach the end. You&rsquo;re allowed
+to change lanes and accelerate, and the game tracks your best time. Sound chase
+is pretty much the same, except you&rsquo;re trying to catch up to a &ldquo;sound&rdquo;.</p>
+
+<h3 id="sound-cannon">sound cannon</h3>
+
+<p>In sound cannon, you&rsquo;re immobile but can rotate within a 180 degree angle. Your
+goal is too shoot down &ldquo;sounds&rdquo; which are heading your way. If a sound reaches
+you, it&rsquo;s game over. You win when you kill all the sounds.</p>
+
+<h3 id="sound-picker-sound-cock">sound picker / sound cock</h3>
+
+<p>In sound picker, you can move in a giant square field where various sounds are
+scattered around. Your goal is to pick up all the sounds within the time limit.
+Sound cock is similar, except the sounds are chickens and you have to chase them
+around.</p>
+
+<h2 id="source-code">Source Code</h2>
+
+<p>If you want to see the source code, you can check it out
+<a href="https://git.pleasantprogrammer.com/games/audventure">here</a>. The sound files
+aren&rsquo;t in the repo though, since I&rsquo;m not quite sure about the licensing. If you
+want to contribute music or sound effects, I&rsquo;d gladly appreciate it.</p>
+
+	</div>
+	<aside class="postpromonav">
+		<nav>
+			<ul class="pager clearfix">
+				
+				<li class="previous">
+					<a href="/posts/openpreppad.html" rel="prev" title="OpenPrepPad">&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\/audventure.html';
+var disqus_title = 'Audventure';
+var disqus_identifier = 'cache/posts/audventure.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="https://licensebuttons.net/l/by-sa/3.0/80x15.png">
+		</a> &copy; 2017 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>
+

+ 4 - 0
output/posts/openpreppad.html

@@ -220,6 +220,10 @@ are good, I might not even need to finish it.</p>
 				</li>
 				
 				
+				<li class="next">
+					<a href="/posts/audventure.html" rel="next" title="Audventure">Next post &rarr;</a>
+				</li>
+				
 			</ul>
 		</nav>
 	</aside>

+ 104 - 204
output/posts/rss.xml

@@ -6,9 +6,112 @@
     <description>Recent content in Posts on Pleasant Programmer</description>
     <generator>Hugo -- gohugo.io</generator>
     <language>en-us</language>
-    <lastBuildDate>Sun, 15 Jan 2017 19:31:00 +0800</lastBuildDate>
+    <lastBuildDate>Sun, 19 Nov 2017 22:00:00 +0800</lastBuildDate>
     <atom:link href="http://pleasantprogrammer.com/posts/rss.xml" rel="self" type="application/rss+xml" />
     
+    <item>
+      <title>Audventure</title>
+      <link>http://pleasantprogrammer.com/posts/audventure.html</link>
+      <pubDate>Sun, 19 Nov 2017 22:00:00 +0800</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/audventure.html</guid>
+      <description>
+
+&lt;p&gt;Sometime around 2013 I wrote a clone of the GBA game &lt;a href=&#34;https://www.nintendo.co.jp/n08/bit_g/&#34;&gt;bit Generations
+SoundVoyager&lt;/a&gt; called
+&lt;a href=&#34;https://audventure.pleasantprogrammer.com&#34;&gt;audventure&lt;/a&gt;. SoundVoyager is
+actually a collection of mini-games where sound is the main focus. You can
+actually play the game blind, and at some point, that&amp;rsquo;s pretty much what
+happens.&lt;/p&gt;
+
+&lt;h2 id=&#34;sound-catcher&#34;&gt;sound catcher&lt;/h2&gt;
+
+&lt;p&gt;The signature mini-game in SoundVoyager is sound catcher. In the mini-game, you
+can only move left and right at the bottom of the stage, while a &amp;ldquo;sound&amp;rdquo; falls
+from the top. Your goal is to catch the sound which is signified by a green dot.
+When you catch it, the sound or beat becomes part of the BGM and a new dot
+appears with a different sound.&lt;/p&gt;
+
+&lt;p&gt;You can of course use your eyes and move accordingly, but if you put on
+earphones, you can actually hear where the dot is, either on your left or right,
+with it getting louder as it gets close to you. As you collect more sounds, the
+dot gets more and more transparent. Eventually (and this is where it gets fun),
+you won&amp;rsquo;t be able to see the sounds anymore and will have to rely mostly on your
+ears.&lt;/p&gt;
+
+&lt;p&gt;You can see what the original game looks like in &lt;a href=&#34;https://www.youtube.com/watch?v=C12WRgfIOC8&#34;&gt;this
+video&lt;/a&gt; or you can play it under
+&lt;em&gt;sound safari&lt;/em&gt; in &lt;a href=&#34;https://audventure.pleasantprogrammer.com&#34;&gt;audventure&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;webaudio-vs-flash&#34;&gt;WebAudio vs Flash&lt;/h2&gt;
+
+&lt;p&gt;At the time I wrote audventure, only Chrome supported WebAudio. Also, the API
+looked (and still looks) quite complicated. Flash on the other hand, was
+starting to die, but still well-supported so I went with that. For the most
+part, it worked okay though Chrome actually had timing issues when playing
+sounds. Now, it doesn&amp;rsquo;t work in any browser. I tried to debug the issues but
+ultimately ended up just rewriting it to use WebAudio instead.&lt;/p&gt;
+
+&lt;p&gt;For the game, I needed to simulate the source of the sound in 2D/3D space. Flash
+only really gives you stereo panning and volume control. With some maths, we can
+actually get an acceptable solution. Less importantly, I needed to be able to
+get frequency data of the currently playing &amp;ldquo;sound&amp;rdquo; to pulse the background. For
+this, I actually had to implement the feature in the Flash library I was using.&lt;/p&gt;
+
+&lt;p&gt;With WebAudio, spatial audio is already built-in and you can simply give it the
+coordinates of the sounds and the listener. There are some other options to
+tweak, but for the most part, no complex math is needed. Getting frequency data
+for a sound is also actually built-in and didn&amp;rsquo;t take too long to integrate.&lt;/p&gt;
+
+&lt;p&gt;Overall, I was impressed by how much you can do with WebAudio out-of-the-box. I
+kind of understand why it&amp;rsquo;s complicated, but there&amp;rsquo;s some simple functionality
+that I wish was included. For example, there is no API to pause and then resume
+playing an audio buffer. You have to manually save the elapsed time and play
+from there.&lt;/p&gt;
+
+&lt;h2 id=&#34;other-mini-games&#34;&gt;Other mini-games&lt;/h2&gt;
+
+&lt;p&gt;So far I&amp;rsquo;ve only actually implemented the sound catcher mini-game. There are
+around 4 different categories with slight variations in between.&lt;/p&gt;
+
+&lt;h3 id=&#34;sound-catcher-sound-slalom&#34;&gt;sound catcher / sound slalom&lt;/h3&gt;
+
+&lt;p&gt;I&amp;rsquo;ve explained sound catcher a while ago; sound slalom is a minor variation on
+that. Instead of waiting for the &amp;ldquo;sound&amp;rdquo; to reach you, you now have to guide
+yourself in between 2 &amp;ldquo;poles&amp;rdquo; of sound, as in &lt;a href=&#34;https://en.wikipedia.org/wiki/Slalom_skiing&#34;&gt;slalom
+skiing&lt;/a&gt;. But this time, you can
+also accelerate forward. The goal is to finish the course before the time runs
+out.&lt;/p&gt;
+
+&lt;h3 id=&#34;sound-drive-sound-chase&#34;&gt;sound drive / sound chase&lt;/h3&gt;
+
+&lt;p&gt;In sound drive, you&amp;rsquo;re driving against the flow on a 5 lane road. You have to
+avoid oncoming cars, trucks and animals until you reach the end. You&amp;rsquo;re allowed
+to change lanes and accelerate, and the game tracks your best time. Sound chase
+is pretty much the same, except you&amp;rsquo;re trying to catch up to a &amp;ldquo;sound&amp;rdquo;.&lt;/p&gt;
+
+&lt;h3 id=&#34;sound-cannon&#34;&gt;sound cannon&lt;/h3&gt;
+
+&lt;p&gt;In sound cannon, you&amp;rsquo;re immobile but can rotate within a 180 degree angle. Your
+goal is too shoot down &amp;ldquo;sounds&amp;rdquo; which are heading your way. If a sound reaches
+you, it&amp;rsquo;s game over. You win when you kill all the sounds.&lt;/p&gt;
+
+&lt;h3 id=&#34;sound-picker-sound-cock&#34;&gt;sound picker / sound cock&lt;/h3&gt;
+
+&lt;p&gt;In sound picker, you can move in a giant square field where various sounds are
+scattered around. Your goal is to pick up all the sounds within the time limit.
+Sound cock is similar, except the sounds are chickens and you have to chase them
+around.&lt;/p&gt;
+
+&lt;h2 id=&#34;source-code&#34;&gt;Source Code&lt;/h2&gt;
+
+&lt;p&gt;If you want to see the source code, you can check it out
+&lt;a href=&#34;https://git.pleasantprogrammer.com/games/audventure&#34;&gt;here&lt;/a&gt;. The sound files
+aren&amp;rsquo;t in the repo though, since I&amp;rsquo;m not quite sure about the licensing. If you
+want to contribute music or sound effects, I&amp;rsquo;d gladly appreciate it.&lt;/p&gt;
+</description>
+    </item>
+    
     <item>
       <title>OpenPrepPad</title>
       <link>http://pleasantprogrammer.com/posts/openpreppad.html</link>
@@ -682,209 +785,6 @@ sed -i .bak &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;/^72/ s/,600/,60
 &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&#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&#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&gt;&lt;/span&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&gt;&lt;/span&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&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;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;&lt;span&gt;&lt;/span&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&#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&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;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>
     

+ 104 - 204
output/rss.xml

@@ -6,9 +6,112 @@
     <description>Recent content on Pleasant Programmer</description>
     <generator>Hugo -- gohugo.io</generator>
     <language>en-us</language>
-    <lastBuildDate>Sun, 15 Jan 2017 19:31:00 +0800</lastBuildDate>
+    <lastBuildDate>Sun, 19 Nov 2017 22:00:00 +0800</lastBuildDate>
     <atom:link href="http://pleasantprogrammer.com/rss.xml" rel="self" type="application/rss+xml" />
     
+    <item>
+      <title>Audventure</title>
+      <link>http://pleasantprogrammer.com/posts/audventure.html</link>
+      <pubDate>Sun, 19 Nov 2017 22:00:00 +0800</pubDate>
+      
+      <guid>http://pleasantprogrammer.com/posts/audventure.html</guid>
+      <description>
+
+&lt;p&gt;Sometime around 2013 I wrote a clone of the GBA game &lt;a href=&#34;https://www.nintendo.co.jp/n08/bit_g/&#34;&gt;bit Generations
+SoundVoyager&lt;/a&gt; called
+&lt;a href=&#34;https://audventure.pleasantprogrammer.com&#34;&gt;audventure&lt;/a&gt;. SoundVoyager is
+actually a collection of mini-games where sound is the main focus. You can
+actually play the game blind, and at some point, that&amp;rsquo;s pretty much what
+happens.&lt;/p&gt;
+
+&lt;h2 id=&#34;sound-catcher&#34;&gt;sound catcher&lt;/h2&gt;
+
+&lt;p&gt;The signature mini-game in SoundVoyager is sound catcher. In the mini-game, you
+can only move left and right at the bottom of the stage, while a &amp;ldquo;sound&amp;rdquo; falls
+from the top. Your goal is to catch the sound which is signified by a green dot.
+When you catch it, the sound or beat becomes part of the BGM and a new dot
+appears with a different sound.&lt;/p&gt;
+
+&lt;p&gt;You can of course use your eyes and move accordingly, but if you put on
+earphones, you can actually hear where the dot is, either on your left or right,
+with it getting louder as it gets close to you. As you collect more sounds, the
+dot gets more and more transparent. Eventually (and this is where it gets fun),
+you won&amp;rsquo;t be able to see the sounds anymore and will have to rely mostly on your
+ears.&lt;/p&gt;
+
+&lt;p&gt;You can see what the original game looks like in &lt;a href=&#34;https://www.youtube.com/watch?v=C12WRgfIOC8&#34;&gt;this
+video&lt;/a&gt; or you can play it under
+&lt;em&gt;sound safari&lt;/em&gt; in &lt;a href=&#34;https://audventure.pleasantprogrammer.com&#34;&gt;audventure&lt;/a&gt;.&lt;/p&gt;
+
+&lt;h2 id=&#34;webaudio-vs-flash&#34;&gt;WebAudio vs Flash&lt;/h2&gt;
+
+&lt;p&gt;At the time I wrote audventure, only Chrome supported WebAudio. Also, the API
+looked (and still looks) quite complicated. Flash on the other hand, was
+starting to die, but still well-supported so I went with that. For the most
+part, it worked okay though Chrome actually had timing issues when playing
+sounds. Now, it doesn&amp;rsquo;t work in any browser. I tried to debug the issues but
+ultimately ended up just rewriting it to use WebAudio instead.&lt;/p&gt;
+
+&lt;p&gt;For the game, I needed to simulate the source of the sound in 2D/3D space. Flash
+only really gives you stereo panning and volume control. With some maths, we can
+actually get an acceptable solution. Less importantly, I needed to be able to
+get frequency data of the currently playing &amp;ldquo;sound&amp;rdquo; to pulse the background. For
+this, I actually had to implement the feature in the Flash library I was using.&lt;/p&gt;
+
+&lt;p&gt;With WebAudio, spatial audio is already built-in and you can simply give it the
+coordinates of the sounds and the listener. There are some other options to
+tweak, but for the most part, no complex math is needed. Getting frequency data
+for a sound is also actually built-in and didn&amp;rsquo;t take too long to integrate.&lt;/p&gt;
+
+&lt;p&gt;Overall, I was impressed by how much you can do with WebAudio out-of-the-box. I
+kind of understand why it&amp;rsquo;s complicated, but there&amp;rsquo;s some simple functionality
+that I wish was included. For example, there is no API to pause and then resume
+playing an audio buffer. You have to manually save the elapsed time and play
+from there.&lt;/p&gt;
+
+&lt;h2 id=&#34;other-mini-games&#34;&gt;Other mini-games&lt;/h2&gt;
+
+&lt;p&gt;So far I&amp;rsquo;ve only actually implemented the sound catcher mini-game. There are
+around 4 different categories with slight variations in between.&lt;/p&gt;
+
+&lt;h3 id=&#34;sound-catcher-sound-slalom&#34;&gt;sound catcher / sound slalom&lt;/h3&gt;
+
+&lt;p&gt;I&amp;rsquo;ve explained sound catcher a while ago; sound slalom is a minor variation on
+that. Instead of waiting for the &amp;ldquo;sound&amp;rdquo; to reach you, you now have to guide
+yourself in between 2 &amp;ldquo;poles&amp;rdquo; of sound, as in &lt;a href=&#34;https://en.wikipedia.org/wiki/Slalom_skiing&#34;&gt;slalom
+skiing&lt;/a&gt;. But this time, you can
+also accelerate forward. The goal is to finish the course before the time runs
+out.&lt;/p&gt;
+
+&lt;h3 id=&#34;sound-drive-sound-chase&#34;&gt;sound drive / sound chase&lt;/h3&gt;
+
+&lt;p&gt;In sound drive, you&amp;rsquo;re driving against the flow on a 5 lane road. You have to
+avoid oncoming cars, trucks and animals until you reach the end. You&amp;rsquo;re allowed
+to change lanes and accelerate, and the game tracks your best time. Sound chase
+is pretty much the same, except you&amp;rsquo;re trying to catch up to a &amp;ldquo;sound&amp;rdquo;.&lt;/p&gt;
+
+&lt;h3 id=&#34;sound-cannon&#34;&gt;sound cannon&lt;/h3&gt;
+
+&lt;p&gt;In sound cannon, you&amp;rsquo;re immobile but can rotate within a 180 degree angle. Your
+goal is too shoot down &amp;ldquo;sounds&amp;rdquo; which are heading your way. If a sound reaches
+you, it&amp;rsquo;s game over. You win when you kill all the sounds.&lt;/p&gt;
+
+&lt;h3 id=&#34;sound-picker-sound-cock&#34;&gt;sound picker / sound cock&lt;/h3&gt;
+
+&lt;p&gt;In sound picker, you can move in a giant square field where various sounds are
+scattered around. Your goal is to pick up all the sounds within the time limit.
+Sound cock is similar, except the sounds are chickens and you have to chase them
+around.&lt;/p&gt;
+
+&lt;h2 id=&#34;source-code&#34;&gt;Source Code&lt;/h2&gt;
+
+&lt;p&gt;If you want to see the source code, you can check it out
+&lt;a href=&#34;https://git.pleasantprogrammer.com/games/audventure&#34;&gt;here&lt;/a&gt;. The sound files
+aren&amp;rsquo;t in the repo though, since I&amp;rsquo;m not quite sure about the licensing. If you
+want to contribute music or sound effects, I&amp;rsquo;d gladly appreciate it.&lt;/p&gt;
+</description>
+    </item>
+    
     <item>
       <title>OpenPrepPad</title>
       <link>http://pleasantprogrammer.com/posts/openpreppad.html</link>
@@ -682,209 +785,6 @@ sed -i .bak &lt;span style=&#34;color: #BA2121&#34;&gt;&amp;#39;/^72/ s/,600/,60
 &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&#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&#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&gt;&lt;/span&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&gt;&lt;/span&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&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;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;&lt;span&gt;&lt;/span&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&#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&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;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>
     

+ 14 - 3
output/sitemap.xml

@@ -1,6 +1,11 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes" ?>
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
   
+  <url>
+    <loc>http://pleasantprogrammer.com/posts/audventure.html</loc>
+    <lastmod>2017-11-19T22:00:00+08:00</lastmod>
+  </url>
+  
   <url>
     <loc>http://pleasantprogrammer.com/posts/openpreppad.html</loc>
     <lastmod>2017-01-15T19:31:00+08:00</lastmod>
@@ -108,6 +113,12 @@
     <priority>0</priority>
   </url>
   
+  <url>
+    <loc>http://pleasantprogrammer.com/tags/games.html</loc>
+    <lastmod>2017-11-19T22:00:00+08:00</lastmod>
+    <priority>0</priority>
+  </url>
+  
   <url>
     <loc>http://pleasantprogrammer.com/tags/haproxy.html</loc>
     <lastmod>2016-06-24T00:00:00+00:00</lastmod>
@@ -134,19 +145,19 @@
   
   <url>
     <loc>http://pleasantprogrammer.com/</loc>
-    <lastmod>2017-01-15T19:31:00+08:00</lastmod>
+    <lastmod>2017-11-19T22:00:00+08:00</lastmod>
     <priority>0</priority>
   </url>
   
   <url>
     <loc>http://pleasantprogrammer.com/posts.html</loc>
-    <lastmod>2017-01-15T19:31:00+08:00</lastmod>
+    <lastmod>2017-11-19T22:00:00+08:00</lastmod>
     <priority>0</priority>
   </url>
   
   <url>
     <loc>http://pleasantprogrammer.com/tags/programming.html</loc>
-    <lastmod>2015-06-07T00:00:00+00:00</lastmod>
+    <lastmod>2017-11-19T22:00:00+08:00</lastmod>
     <priority>0</priority>
   </url>
   

+ 3 - 1
output/tags.html

@@ -45,6 +45,8 @@
 		
 		<li><a class="reference listtitle" href="/tags/cloudflare.html">cloudflare</a> (1)</li>
 		
+		<li><a class="reference listtitle" href="/tags/games.html">games</a> (1)</li>
+		
 		<li><a class="reference listtitle" href="/tags/haproxy.html">haproxy</a> (1)</li>
 		
 		<li><a class="reference listtitle" href="/tags/hardware.html">hardware</a> (1)</li>
@@ -53,7 +55,7 @@
 		
 		<li><a class="reference listtitle" href="/tags/philippine-transit-app.html">philippine-transit-app</a> (12)</li>
 		
-		<li><a class="reference listtitle" href="/tags/programming.html">programming</a> (13)</li>
+		<li><a class="reference listtitle" href="/tags/programming.html">programming</a> (14)</li>
 		
 		<li><a class="reference listtitle" href="/tags/sysadmin.html">sysadmin</a> (5)</li>