Not a blog

Yet another pointless personal blog

Small Differences: Prepaid

Preface

We’ve been in Beijing for over a month by now. After that time I feel quite confident in saying, that Beijing is just another big city. It is quite western and very big. If you look at it from a high enough level, it is very similar to other big cities. There is public transportation. People have jobs. There is a large middle class. People buy designer clothes in huge malls. Just the usual.

It is the same shit like home, albeit some things are different. If you zoom in close enough, you can see lots of small differences. In the way, the city works, the society works. Really, it’s all over the place. In the Small Differences series of posts, I plan to point out those differences, I found noticeable.

Small Differences: Prepaid

Having a prepaid cell phone is a very common thing here in Beijing like in many other big cities all around the globe. However, cell phones are not the only thing coming as prepaid variant over here. A few days ago, we had to find out, that also gas, water and electricity are often prepaid in China. And how do you discover something like that? Of course by standing under the shower and enjoying a lack of warm water. We complained to the landlord and low and behold – the next day someone came with a smart card, shoved it somewhere into the gas-meter and everything was fine again.

They also showed us the cards. This is a bit useless since we have no idea at all how to recharge those cards. But I can at least show them here. In order from top to bottom: Water, electricity and gas.

If you think about it, it actually isn’t that bad of an idea. At least people can’t get in situations, where they all of a sudden have to repay huge sums because they used more gas then anticipated.

I will write about heating here another time. There is a small difference to heating as well, although it is not prepaid like gas, water and electricity.

Take a Deep Breath

A few weeks before we started our journey, a friend of mine gave me a link to an article in the german Tagesspiegel (link). The author of that article stayed a while in Beijing as well. And according to her, the quality of the air in Beijing is usually so bad, it took the author over a week to realize that her apartment had a view on the mountains.

When we arrived in Beijing, we had a clear blue sky. So naturally, I was thinking the author exaggerated a bit. That is, until yesterday, when I realized that our apartment had a view on the mountains as well. It took us just five days to realize that.

I took a picture from our window that morning. Today – also a nice day with lots of sun – I tried to take the same picutre again. Same ISO, same aperture, same shutter speed, roughly the same time of the day. I merged those images. This is the result:

To be honest, I made one mistake. I let the camera on auto-white-balance. This probably overstates the difference a bit. Anyways, take a deep breath and enjoy.

Elevator Rushhour

This morning, we encountered something, I didn’t knew existed: Elevator Rushhour. I’ve never lived in a 28 story building before. We now live on the 21st floor. If every floor is roughly the same as ours, there are 12 apartments on each floor.

1
2
=> (* 28 12)
; 336

So there are a good 300 apartments. The building currently has three working elevators. Even if we assume that not every apartment is inhabited and not every inhabitant has to get up in the morning to get to work, this leaves us with a lot of people that need to exit the building in a narrow timeframe.

We left at 8:00. And we waited for nearly 10 minutes to finally leave the building. The elevators were all basically stopping at every other floor on their way down. Then going all the way up again only to repeat the stop and go on their way down.

До Свидания Russia

We have arrived in Beijing and I could already write a lot about it. But I won’t do that now because I don’t want all of our Russia impressions to get lost in time and memory. This post is intended two give a rather brief overview about our time there (but fails to be brief). More detailed stories are following soon (I hope).

Stay Calm

Just a quick sign of life: There was a serious road accident near Beijing with german casualties. We are none of them. We have savely arrived in our Beijing hostel. Expect to hear from us more soon.

Berlin → Москва → Иркутск → 北京 → ???

On thrusday, in just a few short days, we will start quite a big travel. First stop will be Moscow, where we stay for a day before we head on to lake baikal for a week of hiking and vacation.

Next stop will be china. A. will be doing an internship in Beijing starting in October and I will give her company as long as I’m permitted to stay in China. Sadly it is not possible to stay in China as a tourist for as long as an intern.

When my permission to stay in China expires, we will have to part our ways for a few weeks. I will move on to South Korea and Japan (and maybe some more places where I don’t need a complicated visa).

At the end of december, we will rejoin at beijing airport to fly back home together. Or at least that is the plan.

All of this is surely going to be very exciting and we are looking forward to it a lot (although from time to time a bit nervously). Did I mention, we don’t really speak any chinese language?

As a result of our travels, over the next few weeks and months, the focus of this blog might shift a bit away from technical topics over to documenting our travels.

Since I’m not sure about the conditions of the intertube access along the way, this might be more or less complicated. I might have trouble posting to this blog, therefore I’ve also set up accounts over at tumblr and posterous. And be sure to also follow me on twitter if you want to stay up to date.

We will post pictures and status updates to at least one of those places in a semi regular fashion.

Type Hints

Today, Matthias Naber made me aware of IntelliJ type hints in JSF and JSP files.

IntelliJ does quite a good job in figuring out the types of EL variables itself, providing code completion and usage information. But there are situations where IDEA is unable determine the type of an EL variable. This usually occurs to me in a facelet composition where the variables are passed in as a param.

The following is a basic facelt composition invocation:

<ui:include src="toiletten.xhtml">
    <ui:param name="toilette" value="#{umkleide.toiletten}"/>
</ui:include>

In the file containing the invocation, IDEA is fully aware of the type of the EL variables. However in the included file (toiletten.xhtml), which might look something like this:

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html" 
  xmlns:ui="http://java.sun.com/jsf/facelets">
  <ui:composition>
    <h:outputLabel value="#{toilette.ppBecken}"/>
  </ui:composition>
</html>

IntelliJ is unable to infere the type of the EL variable toilette. It is therefore neither able to offer me code completion nor warn me about typos and errors. It might even mark the getter getPpBecken() in the Toilette as unused.

However, if you help IDEA a little bit by hinting the type, all the goodness is restored. Just add the following, proprietary comment somewhere in the file:

    <!--@elvariable id="toilette" type="com.notadomain.datamodel.Toiletten"-->

This comment tells IntelliJ the type of the EL variable, enabling autocompletion, usage indexing and of course only marking true errors in the file.

If you are using JSPs, the comment should probably look something like:

    <%--@elvariable id="toilette" type="com.notadomain.datamodel.Toiletten"--%>

If you are somehow worried about putting proprietary comments in your files, you have some weird issues. But nonetheless, those comments, at least in facelets, even work outside of the composition-tag, which will make them become ignored anyway.

<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:h="http://java.sun.com/jsf/html" 
  xmlns:ui="http://java.sun.com/jsf/facelets">
  <!--@elvariable id="toilette" type="com.notadomain.datamodel.Toiletten"-->
  <ui:composition>
    <h:outputLabel value="#{toilette.ppBecken}"/>
  </ui:composition>
</html>

A properly configured IntelliJ setup will help you so many times a day. You are going to be a lot more productive. It is absolutely worth, adding some comments and guides to make the warnings and analyzations of your IDE more precise and focussed.

If I had gotten a coin for every time, I fixed a bug, that was already underlined and critized by IDEA when I found it, I’d have an aweful lot of coins.

Use your tools to their full advance and don’t check in code that contains warnings! I really wish, there would be something like the -Werror flag in javac!

Reduced Maven Noise

I stumbled upon this quick post by Peter Veentjer about how to reduce maven test output. Highly recommended. Gives you the ability back to actually parse the output of maven by reducing the noise generated by tests to a minimum. Basically just add

<redirectTestOutputToFile>true</redirectTestOutputToFile>

to your surefire config.

JavaScript: The Good Parts

Thanks to David Völkel for pointing me to Doug Crockfords Talk about JavaScripts good parts. If you enjoyed my CoffeeScript talk not only for the entertainment, you probably gonna like that talk as well. Highly recommend watching it – well worth the hour.

Berlin Expert Days

This years Berlin Expert Days conference has come to an end. The BEDCon is a small tech conference in, you guessed it, Berlin. The focus is somewhere around the Java ecosystem but it is no LASER sharp focus.

This years BEDCon was full of high quality talks and interesting attendies. The conference sold out with somewhere around 350 people and although some talks were a bit crowded, the atmosphere was very nice and friendly! Thanks to everyone who contributed in one way or another! I had a great time.

Why Coffee is good for developers

This was the first conference, where I attended as a speaker. I gave a (hopefully) entertaining introduction to CoffeeScript on the second day titled Why Coffee is good for developers. And judging by the feedback I got in person and via twitter, the talk was a huge success. Thanks to everyone who attended! I hope you had as much fun listening as I had giving the talk!

I opened my talk with some facts about actual coffee as a pun on the title of the talk before spinning into CoffeeScript and the problems, it tries to solve. Some people told me, they liked the idea and also enjoyed my facts about coffee. Although one person aparently didn’t liked it at all. He left before I even got to the interesting parts probably thinking, I was talking about coffee for an hour. Maybe he is more of a tea guy :)

HTML slides are gaining traction

My slides are available online and the sources are on github too (Sorry, slides are in german.) The slides work best in Safari but should also work in Chrome. Non-WebKit Browsers are probably going to have some problems. Since a few people have asked me, I made the slides with my own custom fork of the fabulous impress.js. I rewrote it in CoffeeScript and modified it quite a bit for this presentation. If you plan to use it, at this moment, I have to recomment using impress.js over my fork. I plan to put some more effort into my fork and iron out many of the wrinkles. But at the moment, impress.js is more stable and more active. I’ll post here when there are news about my fork.

I was by far not the only speaker with HTML slides. An intersting trend, that I really do appreciate. HTML slides tend to be less bullet point ridden than powerpoint slides. The presentations are often more interactive and engaging. The slides are easier and faster to share after the talk and they discourage the stupid idea of printing out slides. But as impress.js calls out in its readme, they “may not help you if you have nothing interesting to say ;)”

One other framework for HTML slides, that looked very intersting was reveal.js. Alexander Reelsen used it for his slides and they looked great. But then again, he also hat something interesting to say…

If you have anything to do with the web at all, check out one of the options for HTML slides! Not only is it fun to create the slides, it is also a nice exercise for your web-fu! And you can use IntelliJ instead of PowerPoint for creating slides – how awesome is that?!