Pi has arrived

Received my Raspberry pi this weekend.

A Pi 2 and a Pi 1 Model B+

Booted up the Pi 2 since I ordered a starter kit with it from adafruit, everything worked right away, much easier than the beagleboard I ordered way back in 2010, but it could have been due to the fact I did not have an HDMI monitor.

But it has very cool potential, it looks like it will be pretty easy to take it anywhere, especially with the computing power of pi 2, I might even make it my dedicated box to dev my personal website at.

So far I’ve been looking at what I can do with the raspberry pi, and seems creating a pi 2 portable computer is definitely a viable option.

I’m not a creative maker like Machael is, I don’t even have space to get the power tools 🙂

But there are some ideas that I can definitely take. For example, his selection of battery and LCD screen.

With Pi 2, my plan for now is to run VNC on it and get a cheap tablet as my portable monitor, if there is a need, I can still use the HDMI port whenever I have access to a monitor.

The issue I’d like to solve is: Portable power, while Michael’s battery could potentially take care of a lot of the problems, adafruit again looks like they have some pretty awesome solutions, I remember when I first started shopping AT-mega chips there, the first version of Minty Boost just came out. Now they have so much more.

Suffice to say, I got my hands full with the pi 2. What will I do with the Model B+?

So far, I can’t decide whether I want to make it into an XBMC media centre, or a media display board, or something that will need the camera for.

It seems this pi day, I will be going through some code and figure out how to use the camera board with the model B+

I actually LIKE Javascript

So, I decided to make a personal website, and of course, that requires a little bit of javascripting.

This time, I didn’t jump into Angular or nodeJs or any of the tools cool kids now use, I started off with pure Javascript for a few utility and once I got a feel for it I moved on to JQuery.

And I actually came to LIKE Javascript.

I’ve always been a C++/C# guy, the flexibility C/C++ gives with loose type and pointers just make so much sense, but I also loved the library .Net provides. I guess I like C/C++ for their concepts, and C#/.Net for its practicality/productivity.

So, Javascript has never really been on my radar even though I do have to work with it from time to time.

This time, I decided to properly study javascript, learn how to use prototype, how to simulate OOP using javascript and decided that it’s a really cool language.

So here’s what I like most about Javascript

1) It’s flexible like C/C++

The one thing I missed about C/C++ the loose types, why do I now have to look up on Google/MSDN to remember

string value = ASCIIEncoding.ASCII.GetString(array);

when I could simply loop through the array and do something like this? Sorry, my memory with C/C++ is starting to be vague, I’m not even sure if it does give the right values, but the point is we could do something like this without having to memorize a bunch of other methods.

charVal[i] = byteVal[i];

Well, Javascript has that flexibility. I can use a variable without knowing what it is, I don’t need to unbox an object and get an InvalidCastException, I don’t need to convert the object to a string and then use TryParse to see if it worked.

With Javascript, it’s straight forward, I can even do this

var a = "12";
var b = "23";
var c = a * b; //c = 816
var d = a + b; //d = "1223"

Well, it’s not the best example, but at least it means I don’t need to do something like this

int selected = Convert.ToInt32(list.SelectedItem);

2) It’s simple.

Following the above point, we know exactly how to fix an issue because there is only so much details to javascript. On the other hand, with C# we’d probably have to put a try catch around Convert.To* method which always introduce scope issues and performance concerns when the code enters the catch block. Or we can look up on MSDN to find out about TryParse method.

With javascript, although I can’t find a good use case right now, the syntax will be simple. Most likely something like

if (isNaN(val))
{
}

3) It’s super extensible

People have been advocating design patterns with Java and C#, but I find it much easier to learn with Javascript, because with javascript, there is no Interface, there is no Delegate. You don’t have to worry about these constraints a framework imposes. You simply try to call the method, if it doesn’t exist, you implement it.

It makes learning the patterns much simpler because it just make sense.

In a way, I find javascript ENCOURAGES MV* like patterns because we get so tired of writing the same HTML code over and over again, it’s only nature to decide to add the method to prototype, or make it a jQuery plugin.

Yes, I’m bringing jQuery into this conversation. jQuery is proof why javascript is awesome not the other way around.

I haven’t seen any language that allows you to create a wrapper around an object to extend its functionalities as simply as jQuery does.  Sure “this” is confusing at times, but I’ve come to love it.

What I’ve seen people say about javascript and what I have to say about them

1) jQuery/NodeJS/Coffee Script etc… are 100X better.

I’ve seen people on the Internet saying there are so many frameworks that can do things 100X better, but to me. That’s EXACTLY what makes javascript AWESOME!

Its simplicity and extensibility is the reason why these libraries/frameworks can come into existence.

So, while people love using these new frameworks, I like to come back and think about what allows them to be so great.

2) You have to write a lot of ugly codes over and over again

Sure, DOM manipulation can get ugly, especially with the naming and classes, indexing. But that’s not a reason to dislike javascript, it’s these so-called weaknesses that encourages libraries like jQuery to come about.

Once prototype is understood, it only comes as a second nature to factor them away, and now there is jQuery, it’s as simple as wrapping this code around $.fn.name(){}

So maybe my view will change later as I work now more and more web oriented stuff at work, but so far, I like it.

Interesting personality test experiment started at work

Our company started a new initiative where we were asked to take personality test in hope to discover ways for us to work better as the company grows.

Which is very interesting, I always thought it would be useful information to determine how to best leverage ability of every team member.

However, I hope this experiment relies more on the intuition than a standard scientific formula.

From what I’ve been seeing with analytics in hockey, science makes everything hard. Because science always have to evolve to include new discoveries. It’s like the Rubrics cube, if you only piece together one side first, it makes it much much harder to solve the entire puzzle. And that’s knowing what the end result looks like.

For now I hope we still rely on our intuition and be flexible with this experiment. I see a lot of values in it, and I see how getting too scientific with it could defeat its purpose.

I still believe ancient Chinese wisdom touched on ways to get people working together, in much simpler terms, without having to know each individual and this was when war involved using flags as the major way of communication.

So these scientific data about our personality will help, but to actually make sense of them still require a lot of experimentation

[Quick Reminder]Telerik RadAjaxManager does not work well with RadAjaxPanel

Telerik says you should either use RadAjaxManager OR RadAjaxPanel, but not both.

The issue is, if you are using ASP.net web forms and have RadAjaxManager in the master page, it is not exactly ideal to add code to ajaxify your controls in every page as such:

RadAjaxManager.Getcurrent(Page).AjaxSettings.AddAjaxSettings();

The easy fix should be to replace RadAjaxPanel with <asp:panel> and ajaxify the panel through RadAjaxManager.

The second issue using RadAjaxManager and RadAjaxPanel together is that

RadAjaxManager.Getcurrent(Page).IsAjaxRequest almost always returns false

I have done my work to compare the HTML code, it is exactly the same as it would be if you used an asp:update panel, so it is simply the logic in the code behind. In which case, I find the asp.net ScriptManager to be sufficient

ScriptManager.Getcurrent(Page).IsInAsyncPostBack

Pretending to be a drinker

Stumbled upon a trick at the Christmas Party at the company last night.

Since I came early, I got to experiment with different mixes 🙂

Bartender refused to mix coca cola into my drink to ruin the flavor 🙂 the most they would do was Soda.

But it worked wonders!! Nobody could tell it was 80% soda 😀

So here are the steps

1) Go to the party early
2) Identify a clear drink
3) Ask bartenders to mix it with Soda

So later on, if anyone challenges you to drink, just go to the bartenders that know the trick and ask them to prepare a special treat 😀

[Reading notes]Huainanzi – Dao/Tao/Way of _____

Keep in mind these are just my reading notes, I do not wish to read the book over and over again to rediscover the key points so I’m just jotting down stuff I find important. They may or may not contradict with each other, but these are just my own understanding of the passage, not necessarily opinion. But hey, my own opinion can contradict too as time go by.

It is hard to find relevance in today’s world, but I wish to take notes and review them regularly and hopefully relate with future events


人生而静,天之性也;感而后动,性之害也;物至而神应,知之动也;知与物接,而好憎生焉。好憎成形,而知诱于外,不能反己,而天理灭矣。故达于道者,不以人易天,外与物化,而内不失其情,至无而供其求,时骋而要其宿。小大修短,各有其具,万物之至,腾踊肴乱而不失其数。是以处上而民弗重,居前而众弗害,天下归之,奸邪畏之,以其无争于万物也。故莫敢与之争。

This passage talks about the nature of human and the benefit tao (I’m sure Tao te Jing is more popular, might be a familiar term, it means the way, the way universe works, the way we interact with nature, the way ____) brings.

It’s saying we are born still, in peace and calm; As we start experience this world our soul start becoming polluted:
When we receive material goods, our soul responds, and wisdom/intelligence start to develop.

(In tao te jing, Lao Tsu advocates suppression of intelligence, he believes intelligence is the source of evil, it tells us to do things the wrong way.)

This passage suggests when intelligence is associated with material goods, we develop opinions, a liking or distaste towards the things we touch, events we experience, over time, we lose ourselves in this material world.

But someone who follows the way of tao does not try to change the nature, and looks to be in harmony with the outside world but their inner self remains with them. Pure and in peace. When they require something, they will obtain it even if they have nothing, they will be invited to dwell even if they are always traveling. The point is, no matter how much they don’t have, such a person is always has what they need.

Because they do not fight with others, people will not be hurt by them, thus no one will compete either because they have no chance.

Now it all sounds very magical but I think it’s just an introduction on what we can expect if we follow the way. The passages that follow provide some examples of people who follow the way of tao as described in other passages and originally from Tao te jing.


夫临江而钓,旷日而不能盈罗,虽有钩箴芒距、微纶芳饵,加之以詹何、娟嬛之数,犹不能与网罟争得也。射鸟者捍鸟号之弓,弯棋卫之箭,重之羿、逢蒙子之巧,以要飞鸟,犹不能与罗者竞多。何则?以所持之小也。张天下以为之笼,因江海以为罟,又何亡鱼失鸟之有乎?故矢不若缴,缴不若无形之像。

No matter how good a fisherman’s fishing rod is. Even if he plants himself beside water all day, he cannot compete with how much he could get using a net. No matter how skillful a bowman is, they cannot catch as many birds with bows and arrows compared to using a net. Why? Because of the size of the tools. Now on this planet earth, what available resource is bigger than the heaven and earth? So if you follow the way of nature, you can catch as much fish and birds as you wish.


So now it is starting to make some sense, now historical examples

夫释大道而任小数,无以异于使蟹捕鼠,蟾蠩捕蚤,不足以禁奸塞邪,乱乃逾滋。…禹知天下之叛也,乃坏城平池,散财物,焚甲兵,施之以德,海外宾伏,四夷纳职,合诸侯于涂山,执玉帛者万国。故机械之心藏于胸中,则纯白不粹,神德不全。在身者不知,何远之所能怀?是故革坚则兵利,城成则冲生。若以汤沃沸,乱乃逾甚。是故鞭噬狗,策蹄马,而欲教之,虽伊尹、造父弗能化。欲𡧢之心亡于中,则饥虎可尾,何况狗马之类乎?故体道者逸而不穷,任数者劳而无功。

People who ignore the way but trusts their intelligent tricks are using the wrong tool for the wrong job.
Emperor Yu knew about the betrayals in his domain, what he did was not to strike. Instead he teared his defenses down, dismissed his army and spread his wealth with the kingdoms nearby. Now there is nothing to gain from him, and because of his generosity everyone respects him and gathered to honor him.

夫峭法刻诛者,非霸王之业也;棰策繁用者,非致远之术也。离朱之明,察箴末于百步之外,不能见渊中之鱼;师旷之聪,合八风之调,而不能听十里之外。故任一人之能,不足以治三亩之宅也。修道理之数,因天地之自然,则六合不足均也。是故禹之决渎也,因水以为师;神农之播谷也,因苗以为教。

The person with the best vision could barely see further than a hundred feet away, cannot see the fish in the deep blue see. The greatest hearing could not hear more than 10 km away. So no one person can manage the whole three hector of land (including residents). But by trusting the heaven and earth and follow its rule then nothing is impossible. Therefore when Emperor Yu treated flood, he dug new tunnels for water to go and let nature take its course. When Shen nong planted seeds, he used the nature as basis of his teaching.


I think this is important when running a business, and it’s right. We need more than just ourselves to be able to handle the difficulties this world throws at us. Although it is still hard to find a direct example, the underlying message does make sense