Homesick

Five months ago I was here. I threw away most of my worldly possessions, sent my remaining stuff home to my parents and cycled 2000 kilometers from Tokyo until the southernmost tip of Japan, carrying with me nothing but the bare necessities. Four side bags of survival items and a backpack of electronics. No time limit, no pre-set course to take. I have never before in my life felt so free, and I'm not sure if I will ever feel that free again. I really miss that time right now.

Two friends I made on the trip, relaxing in the shade

Of course I realize that most of that freedom is just an illusion. For one thing, it's pretty much impossible to get away from civilization in Japan. A second limitation was money and my visa status, which limited the duration of my trip, although I finished it long before either one became endangered.

A great area to walk around in

Leaving everything behind and going on a bare-necessities trip with no time limit. I'm not sure if I will ever be in a similar opportunity again, but to those of you who will: don't hesitate! It will be the best experience of your life!

Travel the path!

 

 

Posted in Cycling , Photography , Spirit of Japan , Thoughts , Travel | Tagged ,

Project Euler Problem 201

In preparation for a job interview I've been playing around a bit on Project Euler, which poses a lot of nice programming and mathematics challenges. Trying out problems at random (and solving them ^^) I eventually stumbled onto Problem 201. And that's where I stayed.

After some thinking I got a logically sound solution to the problem, but my algorithm was terrible. I basically ignored all the mathematical clues that were staring me in the face and chose to solve the problem programmatically. Having finished the naive algorithm I quickly realized that it would take eons for the bloody program to finish. I managed to devise a different algorithm that was faster than my original, and after optimizing it I shaved another few millennia off the runtime, but I was basically getting nowhere.

A friend then pointed me to the obvious math clues, which was that the array contained the squares of the first 100 natural numbers. Combining that with the fact that the obvious algorithm was obviously not the solution I thought about a better solution for a while. Unfortunately I couldn't find one, and I needed to move on, so I cheated. I looked up the solution online. I know, that's not a very educative thing to do, but I did use the opportunity to understand the correct algorithm and implement it myself.

Looking for a solution online, I first came across this Haskell implementation. I installed Haskell to confirm that it worked, which confirmed that this solution was just as slow as my flawed algorithm. It works on a list of 30 elements, but on a list of 100 elements you'll be waiting forever. Next I came across this ActionScript solution, which is absolutely brilliant. I would explain the algorithm here but I won't, for two reasons: 1. I'm not sure if I can explain it correctly and 2. if you see it in action you will realize why it's brilliant.

I ported the algorithm to Java (my 'home' language), added a GUI that shows the contents of the array and a Next button that allows you to skip through the program step by step. You can give this a try for yourself: here's the WebStart version. The program shows you step by step what happens for a list of 30 elements. I added some colors to make it more clear what's happening. The yellow blocks at the bottom of the array are the values that are used to get the final answer in the end. (Note that the scrolling is quite buggy. If you scroll back left, resize the window a bit to make it refresh properly >_<;)

Click here to see the Java source code.

Doing this problem made me realize that in some cases the choice of algorithm is absolutely vital, and understanding the problem and extracting the right bits of information is very important. A healthy background in math can also save your day, in this case the formula for the sum of the square of the first n integers. I leave you with this quote, which I will not soon forget:

Work with the definition of a set, not with the set itself.

Posted in Tech | Tagged , ,

Do I hate Japan?

A while back I received an e-mail from a Japanese person, telling me how much he disliked Japan. His perspective was an interesting counterpoint to my own, and I blogged about what I liked about being in Japan. Yesterday I received another e-mail from the person I'll refer to as T.

Do I hate Japan? The answer to the title is obviously a yes for me. I think Japan is not fun. This is the biggest problem. I used to live in America for 6 years. I thought it was heaven there. I  wouldn’t have had a problem living there for the rest of my life. Actually I wanted that. School is not fun at all. When I lived in America, my place always had dance parties like every month. Now if we have this every month, school would be a little better. And you would be able to work hard for that day. There is no goal here to make students work harder. Another one is that kids in Japan play games too much. I think one reason to that is Japan doesn’t have a backyard big enough to play outside. And even if we have parks there usually small and full of sand not grass. I think the environment is too different. People can’t make big backyards because Japan is too crammed and there is no space to make such place. Not just that. If you want a big backyard it would cost you a lot.  How do you think about it so far? Boring? That’s what I would think. Japan is a place that would be fun visiting but it’s not good to live here. The only good thing in Japan is probably the technology. (Which these days there not the best anymore.) In Japan everything is too strict. Maybe that’s another reason why Japan is not fun. We can’t get license when were sixteen. And wherever we go there’s something like a time limit set by parents. Maybe that’s not just Japan but still we don’t have much freedom as we do in America. In America I felt free. After writing this essay I realized how much I hate Japan again
Imagine that you're suddenly spending six years in a foreign country that does things very differently from your own, and you like it. Then you have to go back to where you came from, but suddenly everything seems different. You can't appreciate things in the same way that you could before living in a foreign country. I think a lot of ex-pats will recognize this feeling.

While reading the e-mail I was already preparing myself to defend Japan against whatever arguments he would offer, but I gradually realized that our situations are just too different. I think a lot of the points mentioned by T are in fact very valid. Children would have a very different childhood in the US compared to Japan. I've heard a lot of expats in Japan complain about the education in Japan not being up to modern standards. I've never had children in Japan myself so I can't really comment about the practicalities. If anyone was in such a situation, feel free to reply.

Thinking back to my own childhood, we did have a huge backyard. I did have a lot of freedom when I was young. But I would definitely not say that my education was fun. It did have its highs and its lows, but on average it was pretty boring. I got my first dose of true freedom in Japan, which is why I have a very positive image of it. As a foreigner I did not have to try to fit in because I would always be an outsider. Society did not impose high standards on me the way it did on Japanese people.

So really, the issue T has with Japan is understandable. The US and Japan are two very different cultures, and being raised in either one of them will form you as a person, in a very specific way. I think everyone who has ever spent time as an expat in a foreign country can appreciate the experience of being able to see the world from a different perspective. After seeing that life can indeed be lived in a different way, we each draw our own conclusions about how this will affect us. For some, like T and myself, it means that it's become harder to appreciate the country we were born in. What does it mean to you?

Posted in Japan , Thoughts | Tagged ,

Dartmoor

Went to Dartmoor national park and nearby Plymouth last week. Today I finally spent some time to upload the remaining photos. Picasa holds all my Dartmoor pics.

I've been annoyed at my attempts at producing decent HDR images recently. Either my valuation of HDR changed, or I am producing photos that are simply not suited for HDR. The above photo is in fact HDR, but the colors were so messed up that I decided to sepialize it instead, which fit the grainy nature of the original. The full size image is a bit abysmal though. Here's another gritty one.

And here's two panoramas of Plymouth, a very agreeable city.

Nice park. Quite cold though.

I like the UK. It has more character than the Netherlands. I think it's the hills.

 

Posted in Photography , Travel | Tagged , , ,

Wide screen is happy screen

Hard coding is good coding :P

Yes, I do realize there's a spatial distortion taking place in the center of my screen.

Today's topic: Red-Black trees. A bit like Christmas trees, but then not. I figured the best way to learn this stuff was with a hands-on approach. As I started writing code the whole thing rapidly got more complex, so I finally added unit tests to confirm that whatever it is that I'm doing is correct. Interesting how a tiny little project can get out of hand so quickly...

Hardware-related note: my 8800GT graphics card is dying. I'm getting more and more flickering red pixels on my screen. It might be my imagination but it seems like when it's hot the card has less errors than when it's cold. Too bad winter is coming, that'll kill it for sure. Hardware forums are telling me to bake the card in an oven to fix it. Might give that a try.

 

 

 

Posted in Tech

Still busy gaah

I'm studying up on all things algorithmy to prepare for my next interview. It's amazing how many important things I've forgotten since university, and it's even more amazing how many important CS topics weren't even taught or not properly emphasized during my education. Fortunately we have the internets to help solve that deficiency.

Also, here's another Dartmoor photo.

Posted in Photography , Tech | Tagged

Must study!

The stakes are getting higher and higher the past couple of days. I'm meeting so many people who just seem so much smarter than me, I feel I must improve myself. Fast. I know there's no shortcut to gaining knowledge, but surely there is a long way round that should be avoided. I must try harder, and be better.

 

Posted in Tech , Thoughts

Dartmoor

So much photos to sort. Please have patience my friends. I will give you your grin eventually.

Posted in Photography | Tagged

So busy!

Haven't updated recently, although there's a lot of stuff going on right now in my life. Had a very agreeable trip to Dartmoor national park over the weekend, and today I had another job interview, the most challenging yet. I still have a bunch of pictures to sort out and a whole lot of things to prepare for my return to Holland tomorrow. Feels good to be busy again.

More later!

Posted in Daily Life

A squirrel!

Saw this funny little creature near Staines, on the way to the train station. There were a lot of them, but this little guy just sat there looking at me. We had a bit of a Mexican stand-off, with me trying to reach for my camera and snap a photo before he disappeared. He was sitting right in front of me but I wasn't fast enough and he climbed higher up in the tree.

 

 

Posted in Photography | Tagged ,