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 😀