Dependent Origination

Archive for July 2012

user@hostname:~/$ ifconfig
bash: ifconfig: command not found

it turns out that you need sudo to do it on xfce.

* make sure you run sudo apt-cache search net-tools so that net-tools is installed on the machine

Haven’t done this for a long time: a collection of recent skincare products I have used — none of them were strikingly good — in fact most of them were not as good as some of my stellar products in the past. I like the Clarins eye contour balm, which I bought and used up several times.

Image

I am spending less time on an airplane to read so the amount of reading is dropping significantly — it used to be a plane ride = a book read. I came across this guide on weibo about how you should kill the however many hours of flight between China and US — i cannot stop feeling fidgetting after reading it — do people lose their capabilities of spending sometime with themselves??? I don’t understand why you need a guide to kill time and I don’t understand why that ten, twelve, fifteen hours can be so intolerable to some people that after reading what they write i feel as if i was spending some intolerable time myself.

Anyway, back to the novel. The first chapter or so was a bit dragging, with a young hand at writing — I think this gotta be an early work in Murdoch’s career that you can sense the naivety with which she wrote and planted plot devices. However, everything changed a few chapters into the book and it became a page turner, plot wise. I don’t exactly like the ending, since it is too much, too impossible for a person to be in such position. All in all, I like the Bell a lot better but I will keep on reading Murdoch since she appears to be writing about our weaknesses more frequent than other people.

date +%s

This solution isn’t found by me — it is found by my teammate. But since we have spent quite some hours trying to get our thing compiled together, I took the liberty of writing it down here 🙂

The problem is when we include header files from mongo they have macros defined and undefined in their module. Classes are fine since they are in a separate namespace. Macros are really messy. I tried to include our own headers after theirs so we have those macros available after they undefined theirs (which have the same name as ours, such as LOG!). But it only works to a certain extent, we soon faced mysterious error messages that a template parameter is not instantialized or something like that. My teammate realized that instead of using their classes, you can use them as pointers and that way you only need to forward declaration without include the actual header files. Then you include the actual header files in the implementation files. This way their module is only pulled in during compile time which isn’t polluting everyone else’s namespace with their macros. Well that is the theory we will probably encounter more problems but I think the solution got us really far and is clever and warrants a note 🙂

I saw code like this in a header file:

namespace X {

class Y;

}

I thought that was wieldy and changed it to

class X::Y;

Guess what? It wouldn’t compile!

The reason? Here. In short, C++ only allows fully-qualified names refering to existing (previously declared) entities. They cannot be used to declare new entities. Once you have this wieldy forward declaration, you can reference it in fully qualified name subsequently. I guess the tricky point here is the compiler couldn’t figure out whether X is a class or a namespace for a form of X::Y.

After I came back from vacation, alas, my team members changed our source control system from svn to git. While I have always wanted to learn git for two years, now it is really thrown upon my face 🙂 I discovered git tutorials and git books are better written (more understandable) than two years ago when I tried the first time late 2009. At that time they were using indexing instead of staging area and i am not sure after reading and experimenting i really got what indexing was for.

Now it is all different. Here is a great summary of Git in 5 minutes.

This page of the tutorial that comes with git is really helpful when you merge branches.

Hence, this is ‘Git in 1 minute’ 🙂

The power outage of Amazon last weekend put all our machines out and by Saturday afternoon all was fine except our database instance, which was never recovered in the end 😦 I thought our MongoDB was working on Saturday but only discovered on Monday that a weird mongod process was running and I couldn’t start up our usual setup with config servers, shard servers and the mongos process. mongos would always complain about ‘cannot upgrade from 3 to 2’ and just quit.

It puzzled me for quite some hours — we have tried many things trying to identify what is the root cause. At first I thought the process cannot find ‘localhost’ but telnet localhost worked fine. Then we digged into those logs trying to get more useful error messages. I started the config servers and mongos on a different machine talking to the same shard server and that worked fine so I felt like the machine itself was the problem after reboot. Finally googling the error message solidified my suspicion that the package I have installed onto the machine might undergo an incomplete update or something so I removed the package and used the binaries downloaded from mongo’s own website directly. Everything works fine since. Phew.

This page has a complete list of manipulating packages.

Here is a direct command line on how to remove an installed package using apt-get.

apt-cache search SearchTerm [search for a package from the source depot] which isn’t very useful in our case but listed here for sake of completeness.

Note: the removed package is the mongodb package installed from apt-get. The mongo site has instructions installing mongodb-10gen, which I haven’t tried so I don’t know if mongodb-10gen is a better package.

The benefits of installing a package is (1) easy removal; (2) they install mongo as a service for you. Installing mongo as a service has the automatic restart coming for free — you can edit a bunch of configuration files so the mongod’s, mongos’s will start up the way you want them to be. Here is someone’s configuration files for a sharded cluster with replica sets.

I haven’t gone down that route for now either since I have the startup script in rc.local and we are having a one-shard setup which is really simple. I am probably going to change the setup soon so more updates on that front later.

Major lessons learned:

1. think more during an outage — don’t just think everything is fine even if on the surface things are fine — give it more thought

2. always try to prove your own conclusions — like if you think localhost isn’t being recognized, there are plenty of ways of verifying that speculation.

3. read the logs — read all the logs you can find

4. be persistent and ask for help — one person has limitations and other people can offer helpful and different ways of thinking about the problem

brief_encounters_with_che_guevara

I came across this book through this article from New Yorker: Late Boomers. It is an article on why we think genius has to equate to precocity. I find it ringing so many bells with lots of things I want to say for a while. It is especially true with Chinese people: every time I talked to someone newly met, they would check up on your schools, years, then estimate your net worth, and how far you have made milestones in life such as house and kids. It is miserable talking with these people. They usually end their inquiries with a look that says oh so you are normal, even a bit behind schedule (in terms of kids), so no big shots. Sometimes they would launch into this talk on which big shots they know, and why they are big shots. The “big shots” are usually younger, or at least younger than their class/generation, reached money, or kids earlier than everyone else, and kept that step ahead until last time they heard of them (which is more likely through a friend of a friend of a friend of a friend …). It is as if there is a single race in life, and you not only are evaluated by it singlehandedly, you have to reach finish a lot earlier than other people. Otherwise you are doomed, or at least not worth discussion, or worth getting to know as a person.

I feel so confused by all those underlying assumptions. Isn’t life expectancy reaching 80’s? Shouldn’t our generation be expecting to live into old age with much better life quality than our previous generations? Doesn’t that mean you have to keep inventing yourself until the end? Even if life is a race with everyone shooting for the same finish line, isn’t it more like marathon that you have to keep at it for a LONG time? Those people made you feel as long you are get out of the start line faster than other people, and reached the first mile marker earlier, you will be good for life. How wrong.

Enough lashing out. That is why I like that article. It says most people reach their personal best, no matter what they are, through hard working, through years of practicing. That is more like me. The article named a writer, Ben Fountain, who started writing after law school and stayed at home and did nothing for the next ten or fifteen years and finally having his work published recently, which is the book we are reviewing here. Of the ten or fifteen years, his wife (they met in law school) took on the lawyer job in a small town so a single salary can have them live rather comfortably. His wife lets him do what he wants to do most and never gave him anything about money, not a single time. It is another Lee Ang story, essentially.

I like the article (it is from author of Blink btw) so I picked up the book before our Japan trip. Unfortunately I have to report, writing is something that needs talent. The stories feel a bit flat. I might remember one thing or the other of a tiny detail of a story, but not enough to be really impressed by it. Characters are distant people, except the title story with the hero probably writer himself. It is only when the writer writes about himself that I feel a somewhat draw. In other words, he is not that successful in constructing a believable world inhabited by lovable people. So despite I have lamented so much about hardworking, the book just says the opposite: at least in artistic expression, talent probably comes foremost.

This is not to say the people of less talent should stop practicing their craft in the hope of perfecting it along the way. But we should set realistic expectations on what we can achieve in the end, with the cost in mind.

Day 0: sfo -> ewr -> zrh -> ath

arriving ath 1:30pm, stayed at Centrotel

rode the Metro to Piraeus to buy ferry tickets (suggested by the hotel staff)

rode the Metro to Monastratiki and walked around Acropolis perimeters

ate dinner at ? (forgot name), we were so sleepy by the time food was on the table 🙂

Day 1: Syntagma Square, National Garden, Temple of Olympian Zeus, Walking around Athens Downtown

Blue Star 1 @ 7pm, leaving for Santorini

(there is a separate bus inside the harbor area that is free for ticket holders, ride it,

since Piraeus station is by Gate 6 and Blue Star 1 departs from Gate 1)

arriving Santorini 1am, stayed at San Giorgio Villa, they picked us up from the port

brunch at the cafe in Victoria Square, ate ice creams etc, dinner on ferry (club sandwiches)

Day 2: Santorini, stayed at San Giorgio Villa

ride bus to Perissa (for black beach), bus back to town, get our backpack

boat tour for volcano, three hours (lunch huge sandwich bought from the old port)

hike from Fira to Oia (rode last stretch on bus)

bus back from Oia to Fira, dinner in Skala

Day 3: Santorini, leaving on ferry for Athens in the evening (18:40pm SuperJet)

rode bus to Akrotiri, hiked to the red beach, then Akrotiri, then back to Fira

hotel dropped us off at the old port

SuperJet is a smaller boat but much faster than Blue Star — unpleasant trip

arrived Piraeus at Gate 9, stayed at Faros 1 hotel (Gate 10)

Day 4: Metro to airport, flight to Larnaca, Cyprus

airport shuttle to Limassol, taxi arranged by shuttle driver to Estella Hotel Apartments

walked around hotel, bus to San Rafael Resort, wedding reception at Sailor’s Rest

Day 5: taxi, then bus back to Larnaca, flight back to Athens

stayed at Centrotel, ate late lunch at cafe in Victoria Square (2ish)

went to Acropolis 3ish, too hot, toured the Acropolis Mesuem for two hours,

still too hot, stayed in shade until 7pm and started walking around Acropolis

dinner @ a cafe by the Acropolis metro station

Day 6: train to Kalampaka, breakfast at train station, ate sandwich on the train

taxi to St Stephen and walked to Holy Trinity

dinner at this fantastic restaurant in the third square from our hotel, Hotel Famissi

Day 7: bus to Meteora, Great Meteoron and Varlaam

breakfast at hotel, lunch in town (air conditioned cafe), bought gyros for dinner on the train

5:30pm train back to Athens (arriving 11:10pm)

stayed at Centrotel

Day 8:  ath -> tor -> sfo


July 2012
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Twitter

Flickr Photos