My Rail Journey from Kłodzko to Kudowa Zdrój

Posted by Ryan Kaskel on 21 May 2014

In a post I wrote last year, I mentioned an "abandoned railway" in southwestern Poland that roughly follows route E67 from Kłodzko to Kudowa Zdrój.

This stretch of track is called line 309, and it turns out that it wasn't abandoned at all! The branch's track had to be rebuilt in certain areas which required the service be temporarily suspended. A joint venture between the EU and the Lower Silesian government funded the project.

PKP PLK finished line 309's modernisation at the end of 2013 and on a bitterly cold morning in early February 2014, I traveled from Kłodzko Miasto to Kudowa Zdrój and back.

Below are some pictures I snapped along the way and some of my thoughts about the line's current condition and potential. I took the photos with my mobile so the quality isn't great.


Kłodzko Miasto, as the name implies, is a bit closer to the town center than Kłodzko Główne ("miasto" means town). I walked to the station to catch the 7:41 train to Kudowa.

Twierdza Kłodzko (The Kłodzko Fortress) hovers over the town's skyline.

View from Kłodzko Miasto...

Continue reading...

A Different Approach to AngularJS Navigation Menus

Posted by Ryan Kaskel on 27 May 2013

A minor issue that frequently comes up when using AngularJS's routing is how to apply styles to navigation menus.

Specifically, how do you go about changing the background color of an <a> or <li> element in a navigation menu for the currently active route?

For example, the "Home" <a> in the below navigation menu needs to have its background color changed when the root of the site (/) is loaded or the link is clicked when on another "page."

A simple navigation menu.

I had the same question a few weeks ago and found many answers on blogs and StackOverflow. A lot of the approaches I found were similar. For example, this snippet from codef0rmer:

<ul class="nav nav-list" ng-controller="navCtrl">
  <li ng-class="navClass('home')"><a href='#/home'>Home</a></li>
  <li ng-class="navClass('about')"><a href='#/about'>About Us</a></li>
  <li ng-class="navClass('contact')"><a href='#/contact'>Contact Us</a></li>
</ul>

These examples come from Stack Overflow:

<ul class="nav">
  <li ng-class="getClass('/')"><a href="#/">Home</a></li>
  <li ng-class="getClass('/contents/')"><a href="#/contests/">Contents</a></li>
  <li ng-class="getClass('/data/')"><a href="#/data/">Your data</a></li>
</ul>

<div ng-app="link">
  <a href="#/one" active-link="active">One</a>
  <a href="#/two" active-link="active">One</a>
  <a href="#" active-link="active">home</a>
</div>

The issue I have with these approaches is that there is a lot of directive duplication. Notice that Angular directives are applied to each list element or route link.

Furthermore, in the first two examples, the ngClass directive uses a function that takes the route's path as an argument even though this information is in the child <a> element's href attribute....

Continue reading...

Exploring Kłodzko Główne Railway Station

Posted by Ryan Kaskel on 18 February 2013

Over Christmas 2012, I fulfilled one of my wishes from the past few years: explore the railroads in and around Kłodzko, Poland.

Kłodzko is a small town in Lower Silesia in south-western Poland. It lies in the center of a valley that on the map appears to carve out a chunk of the Czech Republic. The region's principle city of Wrocław is 90 km to the north and to the south, east, and west lies the Czech republic.

This unique location makes it ideal for a transport hub. The European route E67 highway winds its way from Náchod, Czech Republic, through the picturesque mountain spa towns of Kudowa-Zdrój, Dusznicki-Zdrój, and Polanica-Zdrój before reaching Kłodzko.

Dancing around this important highway, barely visible from the road, is a single-track, abandoned railway line that cuts through the surrounding forest. Service ceased a few years ago and the inevitable overgrowth has begun to swallow its rusting rails.

It was this line that first piqued my interest in Polish railways and it seemed to indicate that all was not well with the region's rail transport system.

On 27 December 2012, I braved the cold weather and drove down to Kłodzko Główne railway station. I was surprised to find a rather busy station with quite a few arrivals and departures during the hour or so I was there. Whatever the bigger picture is with rail in Lower Silesia, my trip to the station that cloudy Thursday morning revealed that life on the track does indeed live on.

I apologize for the quality of the pictures. I took them with my mobile phone and its camera isn't great.


Kłodzko Główne (Kłodzko Central) is one of two stations in the town, the other being Kłodzko Miasto (Kłodzko Town). Despite being further from the town center, Kłodzko Główne seems to be the busier of the pair.

It is currently being renovated and construction was ongoing during my visit. The project promises to bring back some of station's historical charm, including the installment of a period clock, while improving access for the disabled.

Measures are also being taken against graffiti which is unfortunately a big problem, especially at its sister station, Kłodzko Miasto.

This picture comes from a return trip to the station on 29 December 2012. It was a beautiful, crisp winter day. The blue signs seem new.

Kłodzko Główne platform sign...

Continue reading...

Thoughts on Foreign Language Learning Hacks

Posted by Ryan Kaskel on 27 December 2012

Tags: language, polish

I came across an interesting blog post a few weeks ago on Hacker News called "Foreign Language Learning Hacks" (read the HN comments). Some of the hacks suggested include:

  • Memorizing lists of the most frequently used words in the language
  • Having regular chats with someone who speaks the language natively
  • Reading dual language magazines
  • Memorizing phrases, movie titles, and idioms
  • Listening to music in the language

The post resonated with me not because of the specific tips, but because it seems that, like me, most language students have an arsenal of "hacks" they use to try to speed up and/or improve the effectiveness of their language learning.

How useful are these hacks? Do they really help you learn more quickly?

Reflections on Studying Polish

I've just spent my second Christmas in Poland and last night I found myself sitting at a table with six Poles chatting and eating delicious cakes for three hours. Towards the end, my mind drifted away from the conversation and I began to reflect on my Polish language learning experience....

Continue reading...

Announcing django-discoverage

Posted by Ryan Kaskel on 10 December 2012

At PyCon 2012, Carl Meyer gave an excellent talk on testing with Django (watch the video or view the slides). Right off the bat he calls out Django's rather odd test runner. He notes that:

  • Django runs whatever tests it finds in INSTALLED_APPS. This includes all apps in django.contrib (e.g. auth and contenttypes ). It also includes the tests from pluggable apps you've installed from PyPI or elsewhere. This is a waste of time because we trust these have been tested before being released by the developers who created them. (Also note that test failures for apps in django.contrib when run alongside third-party apps have historically been the source of much pain prior to Django releases. See ticket #17848 for at least one example)
  • Tests have to be in a tests module in the app (or a tests subpackage that requires you to import your test cases into tests/__init__.py. This is unlike the rest of the Python ecosystem (or that of most other languages I've seen), where tests typically live in a separate package.
  • Test code lives alongside production code.

Django also requires you to specify which tests to run using app.TestCase notation instead of just specifying the path to the module and test case (i.e.app.tests.TestCase), which I think is more intuitive.

To remedy this situation, Carl suggests using a simple DjangoTestSuiteRunner subclass he calls DiscoveryRunner. It uses the newer test discovery mechanism incorporated into Python's unittest package in Python 2.7. If you are using an earlier version of Python, you're covered. Django includes its own copy of the unittest package in django.utils.unittest. Jannis Leidel later packaged up the runner and made it available under the name django-discover-runner.

For my latest Django project, I adopted this test runner and so far I've been very pleased. There are no longer any tests modules in my apps. Instead, tests live "far away" in a separate package alongside the main project (e.g. my-project/project and my-project/tests)....

Continue reading...

End to End Testing with AngularJS and Flask

Posted by Ryan Kaskel on 25 November 2012

AngularJS is an awesome Javascript framework that helps you build slick web apps. Today I started working through its tutorial and was happy to find that the authors really emphasized testing from the get-go.

Unlike the Django tutorial, for example, which unfortunately doesn't mention testing at all, Angular introduces you to its testing facilities in the third section. It makes it clear that testing is an integral part of the "Angular way," and this is something I really love about the framework.

One of Angular's coolest features is end-to-end ("E2E") testing. You create a bunch of scenarios and write behavior-driven development (BDD) style tests in Javascript that are then tested in the browser.

Angular's end-to-end test runner Angular's end-to-end test runner after a successful test.

While doing the tutorial, I thought about how I would integrate the end-to-end testing feature into an existing Flask app. Most of the available Angular resources assume you are working with static HTML/Javascript/CSS files served by a web server. Indeed, Angular seems to prefer a static front-end talking to a separate back-end via a REST interface.

For whatever reason, I'm not quite ready to go that route. My Angular app is delivered to the browser via Jinja2 templates and I needed to find a way to integrate the end-to-end test runner template into my Flask app....

Continue reading...

Older »