hit counter


My development logbook

Sensu Checklog Issue

My check log job suddenly fires a lot of exception:

ALERT - [MyServer/check_log] - Check failed to run: invalid byte sequence in US-ASCII, ["/etc/sensu/plugins/check-log.rb:187:in `match'", "/etc/sensu/plugins/check-log.rb:187:in `match'", "/etc/sensu/plugins/check-log.rb:187:in `block in search_log'", "/etc/sensu/plugins/check-log.rb:184:in `each_line'", "/etc/sensu/plugins/check-log.rb:184:in `search_log'", "/etc/sensu/plugins/check-log.rb:136:in `block in run'", "/etc/sensu/plugins/check-log.rb:130:in `each'", "/etc/sensu/plugins/check-log.rb:130:in `run'", "/opt/sensu/embedded/lib/ruby/gems/2.0.0/gems/sensu-plugin-1.1.0/lib/sensu-plugin/cli.rb:56:in `block in <class:cli>'"] .

But there is nothing wrong with the log file itself. No binary characters and any other rubbish.

I fixed it by removing the related file in the check log job’s state directory.

package.el and Projectile

I have installed cask to install projectile. But projectile projects says I need to use package.el. I have misunderstood the use of cask – It is for the dependency management of package development

Toastmaster Speech 5

Speech No. 5 – Getting Old

The goal of the #5 speech is about using body language and gesture to tell a story. I suppose the best way to do it is to talk about something exciting and uplifting. Then I can wave my arms like this. Maybe I can go around here truly excited. But somehow I want to set the a bar a bit higher. I want to do something different. I actually want to talk about boring, not-interesting. Something people don’t want to think too much about. Something rather depressing and sad.

Dear fellow toastmasters and guest, I would like to talk today is Getting Old. Yes, G-e-t-t-i-n-g O-l-d.

How many of you have looked forward to getting old when you are teenager? Exactly what I thought. None. When we are young, growing old is such an alien concept. To live like a 60 years old or older is simply beyond imagination.

But somehow, someone would like to remind you actually your biological clock is ticking.

This someone is none other than your passive aggressive … BODY!

I got my first notice not long ago: Hair is growing inside my ears! To me it is absolutely absurd for hair to grow inside my ears. What is point of having hair in the ears? I don’t even feel cold inside my ears! I will assert that hair has absolutely no business whatsoever inside the ears. That’s right. There I said it! [Wave fist] But somehow there they are. They are growing inside the ears. Then the hair in the nostril joins the party. Maybe somehow they don’t like the damp environment anymore. They start to grow longer and longer. Kind of feel like they want to retire and move to the sunshine coast and enjoy more sun.

The problem does not stop here. For the lucky ones gary hair starts to take over, “Snow on the roof” as you may call it. Not sure if they got snow in the basement too but I am not keen to find out.

I suppose to wink here but I think I gonna scare the ladies, since I am already on a rather uncomfortable, hairy subject here. I’ll probably look creepy.

For the unlucky ones, like me, the hair simply goes Missing in Action. The receding hair line is going backward like the French army in WWII. They are disappearing rapidly like the water in a water hole in a drought season. Looking myself in mirror I understand why hair growth industry is such a multi-billion dollar business. If nothing works, I can understand why to some combover is an option.

Of course, on a serious note, ageing is actually no a laughing matter. As a matter of fact, more and more resources are devoted to the study of ageing. I did a quick search on google scholar. Merely 30 years ago, there were roughly 50,000 medical papers on ageing. But in recent years, number of papers has grown to 200,000 ~ 250,000. The focus of research has changed as well. The focus has changed from longevity and life expectancy to more qualitative aspect of ageing such as quality of life. While modern medicine is capable of keeping us healthy for longer, degenerative disease like dementia can have huge impact on the patient and his/her carer. Another shift of focus is from addressing the symptom of ageing to deeper understanding of the mechanism of ageing. For example, the Sydney based biomedical researcher David Sinclair has made a breakthrough in the understanding of the ageing process at the DNA level. As we know, DNA controls the formation of cell by turning certain on and off. And depends on the gene expression we have different kind of cells like liver cell, skin cell and brain cell. Sinclair discovers that for human, our DNS is programmed to turn on all the genes when we ages. It causes damages to our gene. More importantly Sinclair discovered a molecules known as SIR2, which stands for Silent Information Regulator 2, that can turn off these genes that should not be turned on. Or in the other word, we can reverse the aging process!

Oh, wait a minute, there is a good news when talking about getting old after all! [Arm waving!]

In the end Aging is not just about your body, it is about you mind too. I would like share this saying about getting old with you: “You become old when all your dream and hope is replaced by regrets”

Find Out Parent HTML Element of a Webelement in Selenium

Sometimes you want to find out the parent HTML element of the current WebElement you are working on. The parent property of the WebElement, however, will give you an instance of WebDriver.

You can find this out by

parent = element.find_element_by_xpath('..')

Cats and Mice by Tommy Douglas

It’s the story of a place called Mouseland. Mouseland was a place where all the little mice lived and played, were born and died. And they lived much the same as you and I do.They even had a Parliament. And every four years they had an election. Used to walk to the polls and cast their ballots. Some of them even got a ride to the polls. And got a ride for the next four years afterwards too. Just like you and me. And every time on election day all the little mice used to go to the ballot box and they used to elect a government. A government made up of big, fat, black cats.

Now if you think it strange that mice should elect a government made up of cats, you just look at the history of Canada for last 90 years and maybe you’ll see that they weren’t any stupider than we are. Now I’m not saying anything against the cats… They passed good laws -– that is, laws that were good for cats. But the laws that were good for cats weren’t very good for mice… They voted the black cats out. They put in the white cats. Now the white cats had put up a terrific campaign. They said: “All that Mouseland needs is more vision.” They said:“The trouble with Mouseland is those round mouseholes we got. If you put us in we’ll establish square mouseholes.” And they did. And the square mouseholes were twice as big as the round mouseholes, and now the cat could get both his paws in. And life was tougher than ever… Presently there came along one little mouse who had an idea. My friends, watch out for the little fellow with an idea. And he said to the other mice, “Look fellows, why do we keep on electing a government made up of cats? Why don’t we elect a government made up of mice?” “Oh,” they said, “he’s a Bolshevik. Lock him up!” So they put him in jail.

But I want to remind you: that you can lock up a mouse or a man but you can’t lock up an idea.