Jure Cuhalevhttp://www.jurecuhalev.com/blog
Code, data and visualizationsTue, 19 Jul 2016 05:49:40 +0000en-UShourly1https://wordpress.org/?v=4.7What I learned by becoming a Pokémon trainer for a weekhttp://www.jurecuhalev.com/blog/2016/07/19/what-i-learned-becoming-a-pokemon-trainer-for-a-week/
http://www.jurecuhalev.com/blog/2016/07/19/what-i-learned-becoming-a-pokemon-trainer-for-a-week/#commentsTue, 19 Jul 2016 05:47:21 +0000http://www.jurecuhalev.com/blog/?p=1958Continue reading What I learned by becoming a Pokémon trainer for a week→]]>I have just survived a week of the latest cultural phenomenon – Pokémon Go. It started innocently enough – with a US iTunes account and a couple of free hours on a Monday evening. Since I wanted to meet a few more players, I decided to create an event for the following Friday. Something simple – let’s meet at the Congress Square in Ljubljana to mingle. It exploded almost immediately. On the first day, 300 people indicated on Facebook that they would come. By the end of the week, this number rose to 750 with 2000+ interested.

Lesson 1: Facebook is still a great viral machine

Organising events is a lot like a horror movie. You never go alone into the woods. In this case Alja Isakovic co-hosted the event and provided the much-needed sanity check. As a consequence, we had a Facebook Event that looked official (correct style of announcement, good graphics, sane venue and time). But most importantly, it was about something that everyone was hearing about, but was still hard to get in Slovenia. With the basics in place, we just had to share it to our personal Facebook networks. This exposed the event to enough people that we got noticed by existing Facebook Pokémon Go communities. A couple of cross-promotion partnerships later, we 10x our reach. More importantly, we reached the right people – early Pokémon Go adopters.

Lesson 2: Journalists like a positive, feel-good story

Within a few hours of creating the event, we also got contacted by journalists. In my experience, once the first journalist gets in touch, others soon follow. Alja and I cleared our schedule for the next day and started explaining the game. The aspect that I liked the most is that we didn’t focus on the actual game content too much. We rather talked about the social and urban aspects of it. As it stands right now, the game itself is a pure antithesis of modern society. It encourages you to go out and explore the world around you, mingling with other players, and working together on the same goals. This explained the context for the global interest and makes it easier for journalists to explain it to the general audience. At some point, Alja also suggested that we need better titles. It was a light, summer-time story, so picking Pokémon trainer made complete sense. It’s just silly enough that it brings smile to people’s faces. It will also give me an opportunity to measure its reach and how long people will remember it.

Lesson 3: Letting it go

Pokémon Go is big at the moment and it’s going to have a huge following for months and years ahead. But high level of required engagement and battery drain on phones will be deal breakers for the general public. This will reduce the audience to the younger generation that will actually play the game. Discuss all the stats, trade Pokémon (once thats available) and battle each other. This will be a community of interest that needs enthusiastic leaders that will help them teach and organise follow-up events. I’m happy that many of them them came to the event in person and I’m sure they’ll figure out how to collaborate.

Conclusions

Facebook on its own is enough to get you traction, but you still need traditional media to get legitimacy and wider reach.

When 750 people on Facebook say they are going, 20% of that number will actually come (~150), as seen in our case. Still a huge success, just don’t plan your food budget based on that.

Just relax and go with the flow. Not everything has to have an immediate business value or a long term goal.

Thanks to Tamara Muhic, for proof-reading draft of this post.

]]>http://www.jurecuhalev.com/blog/2016/07/19/what-i-learned-becoming-a-pokemon-trainer-for-a-week/feed/2Example of ember-form-for and mirage server side validationhttp://www.jurecuhalev.com/blog/2016/07/06/example-of-ember-form-for-and-mirage-server-side-validation/
http://www.jurecuhalev.com/blog/2016/07/06/example-of-ember-form-for-and-mirage-server-side-validation/#respondWed, 06 Jul 2016 12:05:09 +0000http://www.jurecuhalev.com/blog/?p=1954Continue reading Example of ember-form-for and mirage server side validation→]]>At the time of writing, ember-form-for is the top Ember.js plugin for forms on Ember Observer. It provides a straightforward way to display form fields without having to write all the boilerplate HTML code around it.

My friends are looking to buy an affordable house around Ljubljana. But what are their options, if they want to choose based on commute time? I decided to build a tool to visualise their options.

An isochrone map (isochrone plan, isochrone diagram) in science and urban planning is a map showing areas related to isochrones between different points. An isochrone is defined as “a line drawn on a map connecting points at which something occurs or arrives at the same time” (https://en.wikipedia.org/wiki/Isochrone_map)

Methodology and Technology

I’ve generated a grid of ~40.000 points in Slovenia and calculated travel time to it from a fixed point in Ljubljana Centre. Each point is displayed on a map with radius of 800 meters. It’s a tradeoff between number of points and realistic travel time with a car in a populated area.

For routing and time calculations, I used Project OSRM with OpenStreetMap database of Slovenia. A Python script connected all of this together into a static dataset for the the web site.

Lessons learned

I first coded a prototype with Google Maps Directions API. It turns out that 2500 requests/day isn’t enough to make such an application practical.

I then found OSRM and it allowed me to host directions API directly on my computer. It’s also really fast. On a single i7 core, it can do about 40 requests/second. In practice is almost as good as commercial API’s. Based on my tests, the difference of results is about +/- 5 minutes.

What is missing is traffic data. OSRM is returning travel time in optimal traffic conditions. While some of this data is openly available, I’m not sure how to incorporate it. It would also mean that the whole visualisation would need to display the time component too.

What’s next

I’d like to build a similar version for public transportation – both inside Ljubljana and in the greater Ljubljana region.

It wouldn’t be too hard to make this map dynamic – so you could select your own starting point.

I’ve also discovered that running your own directions API opens up a number of new possibilities. One of them would is potentially adding a layer of routing to Prevoz.org so we could calculate travel time and also suggest rides that pass through your city.

Do you have any ideas?

Let me know in the comments.

I now also have a newsletter so you can be notified when I release something new. Subscribe to it now .

]]>

http://www.jurecuhalev.com/blog/2016/07/02/travel-time-distances-from-ljubljana-center/feed/3Ember Server Side Form validation with Djangohttp://www.jurecuhalev.com/blog/2016/06/22/ember-server-side-form-validation-with-django/
http://www.jurecuhalev.com/blog/2016/06/22/ember-server-side-form-validation-with-django/#respondWed, 22 Jun 2016 14:48:28 +0000http://www.jurecuhalev.com/blog/?p=1936Continue reading Ember Server Side Form validation with Django→]]>In previous post (Ember Server Side Form validation with Mirage), I’ve looked at just the Ember.js side. In this article, I’ll connect it with Django so that we have an actual backend that’s returning our errors. It builds on top of previous Ember.js code. There are also full Github repositories at the end.

Another source of problems is that DS.RESTAdapter pluralises api endpoints. So instead of /api/registration/ it posts to /api/registrations/. To make it stop doing that we can define ‘registration’ as uncountable:
(ember generate drf-adapter application)

]]>http://www.jurecuhalev.com/blog/2016/06/22/ember-server-side-form-validation-with-django/feed/0Ember Server Side Form validation with Miragehttp://www.jurecuhalev.com/blog/2016/06/17/ember-server-side-form-validation-with-mirage/
http://www.jurecuhalev.com/blog/2016/06/17/ember-server-side-form-validation-with-mirage/#commentsFri, 17 Jun 2016 13:20:14 +0000http://www.jurecuhalev.com/blog/?p=1923Continue reading Ember Server Side Form validation with Mirage→]]>In this Ember.js example, I’ll show how to get ember-cli-mirage to return correct JSON-API response, so that Ember Data correctly processes Error message and makes it accessible inside the template.

Example repository

]]>http://www.jurecuhalev.com/blog/2016/06/17/ember-server-side-form-validation-with-mirage/feed/1Is it worth recording videos at Conferences and Meetups?http://www.jurecuhalev.com/blog/2016/02/21/is-it-worth-recording-videos-at-conferences-and-meetups/
http://www.jurecuhalev.com/blog/2016/02/21/is-it-worth-recording-videos-at-conferences-and-meetups/#commentsSun, 21 Feb 2016 13:18:08 +0000http://www.jurecuhalev.com/blog/?p=1908Continue reading Is it worth recording videos at Conferences and Meetups?→]]>We’re at the most busy point of organising WebCamp Ljubljana 2016. One of the questions we had to ask ourselves is – should we record the talks? It seemed that in previous years, did it because Kiberpipa and everyone else too. As organizers, we want to question decisions made in previous years. This is why we decided to investigate our decision to record the conference.

The effort required

We have 3 concurrent tracks. That means we need 3 semi-professional cameras with tripods, external mics and all the electricity. To get all of this together, somebody has to prepare and source the equipment. The on the conference day, 3 people are recording and you usually need 1 person extra as a support. Then after everything is over, it has to be edited and published. A few more days of work.

How did we do in previous years?

I looked through the stats for the videos. I didn’t know what to expect, but our most viewed video had 650+ views and the second one over 500. Then it’s slowly dropping off but a number of videos with 50+ or 100+ is still not too bad.

The real impact

One of the questions was – isn’t all this already taught through blogs, books and other conference recordings? And I believe that this just isn’t true. We’re still recording only a small amount of tech content. In addition to that, some speakers resonate well with us, while others we just can’t stand. Numbers show that people are watching and sharing the videos and that we help speakers have longer lasting impact.

So that made it really easy to decide to invest the effort on recording this years WebCamp again.

]]>http://www.jurecuhalev.com/blog/2016/02/21/is-it-worth-recording-videos-at-conferences-and-meetups/feed/1What I learned building Open Education Week with Ember.jshttp://www.jurecuhalev.com/blog/2016/02/14/what-i-learned-building-open-education-week-with-ember-js/
Sun, 14 Feb 2016 15:36:55 +0000http://www.jurecuhalev.com/blog/?p=1902Continue reading What I learned building Open Education Week with Ember.js→]]>I am lucky that at the Open Education Consortium, I can work with technology of my choosing. For Open Education Week site, I decided to experiment with Ember.js. It was my first production Ember app and I learned some valuable lessons.

Project background

Open Education Week site enables educators to submit their events and resources.Visitors can then browse them. I used WordPress in previous years, and it worked fine to a point. It didn’t feel right when l I wanted to create more complex browsing interfaces.

Example of that would be: Show me all resources for colleges, that are in Spanish and have the following keywords in it. WordPress can do it, but it requires a lot of different taxonomies and custom queries.

I decided to build a thin Django API layer on top of existing data.

I tried using WP REST API, but it was hard to adopt. If I wanted to do more complex lookups, I still had to write complex WP_Query lookups. So that still wouldn’t help me on server side.

Good things about developing the site with Ember.js

Tooling is great

OEW is an Ember 2.3 application, written with ember-cli. This meant that I didn’t have to fight with grunt/gulp/etc. to get it to work. It just feels right, and it gives you things like real time reloading of CSS.

Components make things easy

It’s easy to make new components in Ember, that almost behave as Web Components. One example of that is my custom OEmbed component. I could reuse both in grid view and inside interactive map popup. (Demo)

Site feels fast

Once the page loads, the only requests you have to make are to the API. My other WordPress sites load fast, but requre refresh for every click. Single page app is fast.

Community

Community of people that hang out on Slack and IRC is incredible and helpful. I just wished that it would also extend to discussion forums. Real time nature of Slack and IRC just don’t make it easy to Google previous discussions on the same topic.

Not so good things

Site is slower to load

Current size is 400kb of gzipped JavaScript assets. Until it loads, you only get a blank screen. I didn’t find how to make it display some sort of initial loading indicator.

My final Javascript size is about 2x the size of vanilla Ember.js with Ember data. It would be good to have tools that would tell me which addon is taking the rest of the space.

Redirects and prerender.io

People rename website URLs all the time. This means that my API, has to keep history of all slug renames. The problem is then – how to communicate it to Google? Google parses JS apps, but doesn’t follow redirects.

I’m currently running preprender.io to solve some of these problems. It works, but it requires extra work via meta headers.

Outdated recipes

As far as I understand, ember-data assumes that I will want to query objects by their ID. If I want to retrieve them by slug, I have to make a query and then return first item of matching results. This works, but it means that records don’t get retrieved from cache.

That is just one approach, but others did’t seem much better. When I Googled: “Ember.js query by slug”, I got a lot of different threads and discussions with varying approaches. The problem is that a lot of them are from 2013. How do I know if this is still the right approach in 2016?

It’s still early in addon ecosystem

When `ember install [addon-name]` just works, it feels magical. The problem I had is that a lot addons at this point assume good knowledge of Ember. I wish they would bundle demo applications and have more documentation. It reminds me a lot about Django’s ecosystem about 6 years ago. Then we got Read the docs and more mature plugins and things go a lot easier.

Is this site ambitious enough?

Ember’s tagline is: “A framework for creating ambitious web applications”.The ambitious part is often quoted, when people want to use Ember.js only in part. It’s rarely explained what ambitious means.

Conclusion

Fastboot will fix most of my problems, but it’s still a few months away. The rest of my problems should go away as the community grows.

Would I build this site again with Ember.js? I think I would, because it gives me a much better foundation than a WordPress theme.

]]>We need more mentors in our communitieshttp://www.jurecuhalev.com/blog/2015/12/31/importance-of-mentorship-in-our-communities/
Thu, 31 Dec 2015 16:01:12 +0000http://www.jurecuhalev.com/blog/?p=1889Continue reading We need more mentors in our communities→]]>Meritocracy is now a bad word. It’s increasingly used to describe communities that are built around outspoken individuals. They often don’t have clear rules and code of conduct.

Alternative to that, is mentorship or apprenticeship driven community. In this model, new members are given clear roles and are presented with the expectation and rules. They are also assigned a mentor that makes it their priority for them to succeed.

This model doesn’t necessary clash with the idea of meritocracy, but it makes it much less likely. In order to make on-boarding new members efficient, itrequires that these processes are written down. This removes a lot of power from individual members, as they can’t arbitrarily decide on what they want from new members.

I believe that such model also allows for greater diversity inside the group. Removing individuals’ discretion forces community to make it easier for more diverse group of members to participate.

Code of Conduct

I think that having a Code of Conduct is a basic building block of such a community. It doesn’t mean it’s welcoming or healthy, but it greatly increases the chances when coupled with clear on-boarding path.

Further Work

15 years ago we got the Joel Test. It presents 12 questions to ask your prospective employer. Since it came, a lot of these are given and things improved a lot.

I think we could benefit from having a similar test for online and offline communities. I sure don’t want to waste any more time with larger communities without CoC and without designed onboarding process.

]]>3 things I learned at Creative Corner in Londonhttp://www.jurecuhalev.com/blog/2015/11/02/3-things-i-learned-at-creative-corner-in-london/
Mon, 02 Nov 2015 13:15:43 +0000http://www.jurecuhalev.com/blog/?p=1874Continue reading 3 things I learned at Creative Corner in London→]]>Last week I gave a talk at Creative Corner in London. Most event attendees were in the creative industries: design and music.
Listening to talks of Simon and Patrick, I learned that our experiences are not so different.

1. Coding process is not much different from creating Music or Designing a book

They all need their own time and focus. We are all distracted by external stimuli. That’s why it’s important that carve out that piece of the day, when create our most important work. Paraphrasing Patrick: “If you’re creating music, that’s your work. Don’t spend all your time, creating marketing content on social media.”

2. We all want to push the boundaries of our work

Simon shared promising designs, that got rejected by his clients. They ended up delivering much more bland and safe options. This is something I see often, when I explain the potential of web sites to my clients. Sometimes it works, but most often they don’t feel like innovating.

3. Our own work matters the most

At the end of the day, we’re most proud of our own work. The one where we could decided that safe, is not an option. It’s also often the case, that this is one of our best work that we end up showing for years to come. But the only way we can do it, is if we ruthlessly make time for it.

I really enjoyed the event and discussions afterwards. Make sure you attend next month!

]]>Creative Corner London – Tearing up the Ruleshttp://www.jurecuhalev.com/blog/2015/10/28/creative-corner-london-tearing-up-the-rules/
Wed, 28 Oct 2015 20:56:52 +0000http://www.jurecuhalev.com/blog/?p=1872I’m giving a talk in London this week, at Creative Corner. I’m going to talk about the potential for improved user experience, when you can use a dedicated search engine.