Archive for the 'General' Category

Graffiti

Saturday, May 24th, 2008

Graffiti seen in Meguro

Seen in Meguro.

Please do it at home

Friday, May 23rd, 2008

家でやろう。
Please do it at home
Please refrain from putting on make-up in the train.

Seen on the Hibiya-line.

Enabled Disqus Comments

Saturday, May 17th, 2008

I’ve re-enabled comments on this blog. I had to disable them a while ago because the spam was getting out of control. This time the comments will be hosted by Disqus.



What I like about Disqus so far:

  • In order to leave a comment, you can create a Disqus account and edit your profile, but you don’t have to. Casual, anonymous comments are still possible. Disqus calls them “unverified”. I find this important because I never felt like creating an account for commenting on somebody else’s blog, so my readers shouldn’t have to do this, either.
  • Disqus lets me export all comments, so if I decide to stop using the service, I should be able to migrate all comments into whatever I’ll use next.
  • It has avatars, threaded comments, RSS feeds, mail notification, etc.
  • It has an API and plug-ins for various blog systems.
  • Alternatively, it supports integrating comments using JavaScript. This way, it’s possible to have comments even on a completely static web site. No CGI needs to run on the web-server. I’m planning to get rid of WordPress and make my blog completely static (more about that later), so this feature will be essential.
  • Hopefully I won’t have to deal with comment spam. Let’s see how that works out…

What I don’t like:

  • Disqus doesn’t have an import function yet, so for now I’ll have to live with a mix of old comments in WordPress and new comments in Disqus, such as in this post. Actually, it’s really not as bad as I first thought. In any case, this feature has been requested and promised, so we’ll see.

So, why don’t you give it a try, I’m looking forward to your comments!

Yakatabune

Monday, May 5th, 2008

Yakatabune on Tokyo Bay

Yakatabune (roofed pleasure boats) on Tokyo Bay, near Odaiba.

“Das Land ist schon wahnsinnig”

Sunday, March 9th, 2008

Elmar Wepper in einem Spiegel Online Interview über Dreharbeiten in Japan zum Film “Kirschblüten”:

Da fällt mir zum Beispiel ein Besuch in einer Nudelküche ein. Dort trifft man nur Japaner an und man sitzt dichtgedrängt, Schulter an Schulter. Dein Nachbar rechts von dir liest Mangas und hört gleichzeitig Musik mit seinem MP3-Player, und der links vor dir telefoniert ununterbrochen, während er seine Suppe schlürft. Das Land ist schon wahnsinnig.

Wahnsinn!

Richard Dawkins and Christian Singles

Sunday, January 28th, 2007

I made a typo while trying to reach the home page of Richard Dawkins and landed on this amusing typosquatting page:

Screen shot of a web site typosquatting on richarddawkins.net

Good Bye Friends…

Friday, January 19th, 2007

Cockroach

Seen at a supermarket in Osaki, Tokyo.

Key Moments in Japanese History

Sunday, November 5th, 2006

Key Moments in Japanese History: The invention of the anpan bean-jam bun

From the JAL in-flight entertainment guide.

Tian Tan Buddha

Sunday, November 5th, 2006

Tian Tan Buddha

Tian Tan Buddha near Po Lin Monastery, Lantau Island, Hong Kong.

SEO

Saturday, October 21st, 2006

I just came accross this quote on Google’s help page about “search engine optimization” (SEO):

Amazingly, we get these spam emails too:

“Dear google.com,

I visited your website and noticed that you are not listed in most of the major search engines and directories…”

STL Sudoku

Sunday, October 15th, 2006

Out of the (C++) loop: Great rant about using C++ STL iterators and algorithms instead of simple loops. My favorite quote:

If the C++ overlords believe that the construction of nearly every loop should be a sort of inline Sudoku puzzle, surely the problem must be that we are simply too stupid to use the language?

Shinjuku

Sunday, October 15th, 2006

Tokyo Metropolitan Government Buildings

Tokyo Metropolitan Government buildings in Shinjuku.

Tokyo Damage Report is Back!

Friday, October 6th, 2006

Self-proclaimed “American jerk” Schultz writes that he is back in Japan and that he will resume his excellent Tokyo Damage Report. Okaerinasai!

Inspirational Trash Bins

Monday, September 4th, 2006

Inspirational Trash Bins

Seen at an interior design shop in Marunouchi.

Select our Swordfish

Saturday, March 18th, 2006

Cool people with / The sence of /Mismatch who can / Enjoy mixed taste / And stylish joke / We wish these people / To select our/ SWORDFISH

Cool people with
The sence of
Mismatch who can
Enjoy mixed taste
And stylish joke
We wish these people
To select our
SWORDFISH

Billboard seen in Shibuya.

Mt Fuji

Saturday, March 18th, 2006

Mt Fuji

Why Do My Feet Hurt?

Wednesday, March 1st, 2006

Why do my feet hurt?

Seen in Akihabara.

Erann Gat’s Benchmark in Ruby: 11 Lines

Saturday, January 21st, 2006

codes = (words = File.new("words").read).downcase.gsub(/[^a-z\n]/, '');
%w{e jnq rwx dsy ft am civ bku lop ghz}.each_with_index { |g, i| codes.gsub!(/[#{g}]/, i.to_s) }
$dict = Hash.new { |hash, key| hash[key] = [] }
words.zip(codes) { |word, code| $dict[code.chomp] << " #{word.chomp}" }
def split(s) (1..s.length).each { |length| yield s[0...length], s[length..-1] } end
def match(number, out, digit = true)
  return puts(out) if number == ""
  split(number) { |pre, post| digit &= $dict[pre].each { |word| match(post, out+word) }.empty? }
  match(number[1..-1], "#{out} #{number[0..0]}", false) if digit
end
File.new("numbers").each { |number| match(number.gsub(/[^0-9]/, ''), "#{number.chomp}:") }
	

See here and here for the background.

11 lines of code, 1.5 hours to get a correct solution, 2 more hours to get an efficient solution, 1 more hour to minimize the number of lines.

It takes 16 seconds to crunch the sample data on a 1.67 GHz PowerPC G4.

Update:

This version drops all pretense of readability and aims for fewest lines of code (5 lines):

	
c=(w=IO.read("words")).upcase.delete("^A-Z\n");30.times{|i|c.gsub! "E--JNQR\
WXDSYFT-AM-CIVBKULOPGHZ"[i,1],"#{i/3}"};D=Hash.new{|h,k|h[k]=[]};w.zip(c){
|w,c|D[c.chop]<<w.chop};def m(n,o,d=true)puts o if n=="";n.size.times{|l|d&=
D[n[0..l]].each{|w|m(n[l+1..-1],o+" "+w)}==[]};m(n[1..-1],o+" "+n[0,1],nil
)if d&&n!=""end;IO.read("numbers").each{|n|m(n.delete("^0-9"),n.chop+":")}
	

Can you come up with a shorter version?