Diary of a Tinkerer http://johan.beyers.co.za/ Opinions and things en-us Wed, 22 Oct 2014 00:00:00 +0200 http://johan.beyers.co.za/2014/10/22/impressions_of_beijing.html http://johan.beyers.co.za/2014/10/22/impressions_of_beijing.html <![CDATA[Impressions of Beijing]]> Impressions of Beijing

Our family went on a 10-day trip to Beijing at the beginning of October. I won’t give a blow-by-blow account, just note some of my impressions.

We were invited by Astrid’s parents, and stayed with them. Her father is a guest professor at the Beijing Forestry University for a few months each year. While we did all the touristy things, we had a chance to experience some aspects of Beijing city life that the typical short-term tourist does not see.

Since we stayed in Beijing except for an outing to the Great Wall, our experience is limited, so these impressions should be taken in that context.

Pollution

The first few days we had good weather. Since it was their National Day Golden Week holiday, most of the factories were closed or not running at full capacity.

Towards the end of our stay, we saw how bad the pollution could be. Levels reached heights that only happen once or twice a year. The smog was so bad that most people wore masks. Apparently the masks do not help much. Visibility was down to 50-100 meters, and the sun looked like a red, angry moon.

The Chinese are very aware of the problem, and in conversations I got the idea that they consider cycling, electric bikes and public transportation as a duty to lessen it. However, this fact alone would deter me from spending a large amount of time in big Chinese cities.

Transport

On the streets, I was immediately struck by the amount of electric bicycles, mopeds and cargo trikes. Maybe one out of several thousand mopeds are powered by internal combustion. The cargo trikes, being mostly older and probably used for a much larger part of the day, were mostly non-electric. There were also a lot of electrified bicycles, consisting of a lengthened frame with space for a battery pack and an extra seat at the back. The battery packs are removable and are plugged into mains power for charging. Altogether a great system.

Cycling is also big, helped by the fact that Beijing is pretty flat. The underground is fast and cheap (2 yuan per trip irrespective of distance), so pretty full.

Cars are only allowed on the road on alternative days, determined according to the number plate. Apparently rich people have 2 cars to enable them to drive any day.

The traffic is chaotic. People push in front of you whenever they can, and give way easily. This actually results in remarkably smooth-flowing traffic, since it’s all predictable: There is no hesitation, trying to figure out what the other person will do: They will take any gap, without hesitation. The cars, bicycles and people intermingle and flow.

People

I found the chinese people very friendly, and very curious. The fact that Caucasian people are a relative rarity, and that we were generally the tallest people in the room, probably contributed to that. People asked us where we came from, asked to pose with us for photos (mostly with my daughters), and were clearly curious.

We spent one Friday evening at the Renmin University English corner, where people come to practice their english. We were questioned about our lifestyle (do we have cars?), animals (We are from Africa, after all), and on our impressions of China. Seems that the people are very proud of their country, with a strong desire to grow China as well as themselves.

Workdays are long, and many people work 6 or 7 days a week.

Food

We ate many things, a lot of which I could not identify. Staple is rice, with usually some stew over it. There is a lot of mushrooms and tofu, and some vegetables. We actually had donkey meat once.

The custom seems to be to have enormous amounts of food. Several times I could not finish a meal, even a takeaway, and this is something that happens very seldom to me. On the occasions we were invited to a meal by Chinese people, we generally managed to eat at most half of the food on the table. This is a cultural thing: Eating all the food implies that the host is stingy...

Food in general was cheap, except for Western fast food. Coffee is hideously expensive.

Although we had stir-fried food on occasion, I got the impression that food is mostly boiled or steamed, with very little of the panfried tastes that westerners are used to.

We never saw any seasoning like salt and pepper anywhere. The food usually comes with a sauce, which is spicy/tasty enough. I did miss the pepper on fried egg, though.

I think that the food has a lot less fat than Western food. The Chinese are generally slim, and the only dangerously obese people I saw were Western tourists.

Excercise

This is not a priority. From conversations I gathered that the concept of excercise for health is very foreign to the Chinese people.

On the other hand, a lot of people use public transport or cycle, which leads to a minimum of physical activity much higher than a car-bound western lifestyle. Maybe this is another reason you don’t see fat people.

Culture and history

This was simply astounding. It is weirdly different to the feeling you get in Europe. In Europe, you see various churches and cathedrals, in all kinds of different styles that indicates their relative ages.

In China, I was struck by how similar all the palaces and temples were. This starts to feel boring for a while, until you realise the implication: These people had a very consistent culture and way of doing things for a long, long time. It seems like their history is a lot more cohesive than western history, which makes you realise that the current communist government is a mere blip in their history.

Shopping

Of course, China can be a shopping experience of note. Since I’m not into many of the typical wares available, I found the shopping not as enjoyable as I would have liked. I think it helps in bargaining to know some Mandarin.

Conclusion

This was a fascinating trip. We saw, did and experienced so much, and came back enriched by the experience. Seeing a different culture and way of life both broadens my perspective on my own life, and makes me very glad to be living where I do.

]]>
Wed, 22 Oct 2014 00:00:00 +0200
http://johan.beyers.co.za/2014/09/26/using_pocket.html http://johan.beyers.co.za/2014/09/26/using_pocket.html <![CDATA[Using Pocket]]> Using Pocket

I’ve been using Pocket (formerly Readitlater) for a few years now, and I find it indispensable. It’s simple and fits easily into the way I handle links.

Bookmarking and baggage

Putting bookmarks into a browser bookmarking hierarchy is the digital equivalent of hoarding. I never go back to the bookmarks, so they just become a mental burden. Every few years, I move to a different browser and either lose all the bookmarks, or copy them over, never to be looked at again. When I started my Pocket system, I imported 1600 links into pocket, many of which were not active anymore, and most of which I could not even remember having added.

So what about other online bookmarking services? While they are more portable, they suffer from the same basic problem: I never go back, they are cumbersome to organise and they require me to categorise.

Enter Pocket

Pocket has a few advantages compared to other systems:

  • It’s designed around a single stream of information, organised by the date you place the link into Pocket.
  • It has browser plugins and Android actions.
  • It has offline readers for Android and iOS.
  • It has an API, so I can get access to my queue from scripts.

Getting stuff in

I have 2 ways to get info into pocket: Sharing from my phone and saving from the browser.

On my phone I usually save items directly from my twitter feed. Pocket places a sharing option on the Android context menu, so I can save tweets with links directly from my timeline. The only problem I have with this is the case where a tweet has 2 links. Pocket then only saves the first one.

In my browsers on my computer I have the Pocket addons, so I just hit the button to save a page for later viewing. Firefox is really nice here: The tab closes automatically when I save a page to Pocket, so it’s a quick one-click operation.

The thing to note here is that I don’t do any filtering or categorising when putting content into the list. If I might want to look at something later, it goes into the list. Takes less than a second.

Getting stuff out

If I only used Pocket as a general reading list, it would have been OK, but I would sit with the same problem: Too many links, neglected and forgotten. Instead, I have a system that automatically recycles the links, courtesy of some scripts I set up:

Every day, some time after 5pm, my browser automatically opens between 10 and 20 links from my Pocket queue. These are the oldest links in the queue. I then have some choices:

If I don’t want to spend time on these links, I just close the tabs quickly. This keeps the links and they will re-open the next day.

If I have time, I read through them. The plugin automatically removes them from Pocket if I view a tab for more than 5 seconds.

If I want to keep the link around for a while, I just push it back into Pocket. This puts it back into the queue as a new link, so I’ll only see it when it comes round again.

The end result

Using this system, I cycle through the full queue roughly every two to three weeks. It blocks out time for reading them, and is not distracting at any other time. I can confidently just push things into Pocket and forget about them, knowing that I’ll get around to them soon.

Since the Pocket list is searchable, I can refer back to items on it if I recall something that piqued my interest recently.

An interesting side effect is the serendipity of random connections: Every so often I see a link that triggers some insight, just at the right time. It’s a bit like putting your music on shuffle and listening to a song that randomly captures the exact mood.

]]>
Fri, 26 Sep 2014 00:00:00 +0200
http://johan.beyers.co.za/2014/09/21/a_trick_to_autonumber_in_zpt.html http://johan.beyers.co.za/2014/09/21/a_trick_to_autonumber_in_zpt.html <![CDATA[A trick to autonumber in ZPT]]> A trick to autonumber in ZPT

I had an interesting issue a few months ago. I was doing some work where I needed to create a pdf from a template. This was a numbered legal document with optional clauses. The problem is this:

How do you make some clauses conditional, but then autonumber the rest?

Normally, you would hardcode clause numbers into the paragraphs, but if you did that, the paragraphs following on the optional ones would be incorrectly numbered.

My coworker came up with the idea of using python’s ‘next’ functionality to just increment an iterator. I was skeptical, since I did not think of a page template as an environment where python objects would be able to keep state outside of tal statements. I was wrong.

The final solution is remarkably simple. In this case, the numbers for the first 20 clauses were hardcoded. We start off with a tal statement to get an iterator:

<body tal:define=”clause_numbers python:iter(range(21,28));”>

This allows you to number up to clause 27.

In each clause, just do the following:

<span tal:content=”python:clause_numbers.next();”></span>

and it works!

In retrospect, this does make sense, since the template is backed by persistent code objects, so an iterator should do the job.

]]>
Sun, 21 Sep 2014 00:00:00 +0200
http://johan.beyers.co.za/2013/09/24/configuration_tools__a_few_thoughts.html http://johan.beyers.co.za/2013/09/24/configuration_tools__a_few_thoughts.html <![CDATA[Configuration tools: A few thoughts]]> Configuration tools: A few thoughts

I just found a post in my drafts folder, summing up my thoughts about CM (Configuration Management) tools from a little under a year ago. Since then, I’ve started using Ansible to set up servers. I’m still not fully converted, but I find Ansible a very useful tool. I have 7 active machines at home, and running my update scripts on each of those is a pain. Ansible makes it a lot easier.

Read more...

]]>
Tue, 24 Sep 2013 00:00:00 +0200
http://johan.beyers.co.za/2013/01/26/setting_up_a_simple_smtp_server_for_testing.html http://johan.beyers.co.za/2013/01/26/setting_up_a_simple_smtp_server_for_testing.html <![CDATA[Setting up a simple smtp server for testing]]> Setting up a simple smtp server for testing

On many websites, there is a need for sending mail from the webserver. While testing, it’s sometimes painful to get a working smtp server to test this.

I’ve used this script for a while now, since it’s the simplest way to get a mailserver running. It will accept any smtp connection and print the mail to the terminal where you started it from.

The script:

import smtpd, asyncore
print 'Mailserver is on port 8025. Press ctrl-c to stop.'
server = smtpd.DebuggingServer(('localhost', 8025), None)
asyncore.loop()

Place those four lines into a python file (I used dummymailserver.py) and then run the python file:

python dummymailserver.py

And you’re done!

]]>
Sat, 26 Jan 2013 00:00:00 +0200
http://johan.beyers.co.za/2012/10/21/plone_conference__a_great_experience.html http://johan.beyers.co.za/2012/10/21/plone_conference__a_great_experience.html <![CDATA[Plone Conference: A great experience]]> Plone Conference: A great experience

I went to the Plone Conf 2012 in October. This was my first Plone conference, although I’ve been working on Plone since 2006. The conference was from Wednesday 10 to Friday 12 October in Arnhem in the Netherlands. I also stayed for the coding sprint on the 13th and 14th.

TL;DR: The conference was awesome. I had an incredible time, learned a lot and came back energised and enthusiastic about contributing to Plone and the community.

Read more...

]]>
Sun, 21 Oct 2012 00:00:00 +0200
http://johan.beyers.co.za/2012/09/28/100_words.html http://johan.beyers.co.za/2012/09/28/100_words.html <![CDATA[100 Words]]> 100 Words

100 words each day. That’s the goal.

I have almost started a blog for a few years now. I get going with a post, and then the impetus to finish just kind of peters out.

So I’ve decided to take another tack: Just write consistently each day.

Read more...

]]>
Fri, 28 Sep 2012 00:00:00 +0200
http://johan.beyers.co.za/2012/09/23/using_fabric_to_manage_your_deployments.html http://johan.beyers.co.za/2012/09/23/using_fabric_to_manage_your_deployments.html <![CDATA[Using Fabric to manage your deployments]]> Using Fabric to manage your deployments

I’m using Fabric very successfully to manage deployments of projects on my servers. Fabric is simple enough that it does not add extra layers of complexity to the setup, and easy enough to use that it makes deployments easy and much less error-prone. This blogpost is an updated and expanded version of a presentation that I did at the local Plone users group.

Read more...

]]>
Sun, 23 Sep 2012 00:00:00 +0200
http://johan.beyers.co.za/2012/08/23/polycaprolactone__wonderful_stuff.html http://johan.beyers.co.za/2012/08/23/polycaprolactone__wonderful_stuff.html <![CDATA[Polycaprolactone: Wonderful stuff]]> Polycaprolactone: Wonderful stuff

I recently got my hands on some polycaprolactone, and I’m really enjoying playing with it. It is one of the most useful materials I’ve seen in a long time.

This is a summary of a talk I gave at #HackSTB on 21 August.

Read more...

]]>
Thu, 23 Aug 2012 00:00:00 +0200
http://johan.beyers.co.za/2012/07/26/hello_world_.html http://johan.beyers.co.za/2012/07/26/hello_world_.html <![CDATA[Hello World!]]> Hello World!

Well, first post. Let’s see what develops...

]]>
Thu, 26 Jul 2012 00:00:00 +0200