The most exciting thing about this world is its ever changing quality.

Wednesday, February 25, 2009

What's my problem with management

What's my problem with management - a question in my mind since early in my frenetic career. I realised that I can hardly agree on many well-spoken and broadly used management training material as golden rules. I thought I was alone until I read this book in (ex-) Symbian. Just in case, this is not a review to this book. There is no intention for me to speak for the (management) group, neither is my intention to generalise to all industries. 

There are a few things I feel quite strongly about, sometimes I do carry away a little,

  • Managers should not be doing the engineering work, either they will be intimidated because of the hat you are wearing or you will soon find yourself on multiple critical paths, instead of lubricating the machine, you stalk it. JP has mentioned this during one of our conversations, which I agree. However, what I do believe is, a mature enough and healthily established team which doesn't care too much about the basic needs and do value open opinion would be able to deal with people no matter what hat he or she is wearing. Also, I can have more than one hat cann't I? What everyone else need to do the same is try to forget about all my other hats when I am wearing this one, as do myself.
  • Managers should not be too handson, as this way you might neglect some other things where your energy and time would be much better spent, strategically, some might say. Handson and handsoff is really irrelevant, the more you think. I have seen a very efficient team with its director with exceptional talent and energy running like nuclear generator and his team operates around him providing information, executing tasks, find their own ways around. Only top priority things will be picked up by him and priority effect propagate through the whole team. This turns out to be a much more efficient way than typical way of submission-review-decision-agreement-... There is nothing wrong to confess some entity is good at generating stuff (although that means there is a good chance it will burn out sooner as I heard the best way to longevity apparently is doing nothing). Fancy organisation chart will show you how a matrix is supposed to work under ideal situation. On the contrary, I found it gives birth to bureaucracy and unclear responsibility.
  • Managers and engineers are two different types of people living in their own world. Even though sometime one type try to get face familiar and be friendly to the other, they are by nature conflicting groups. Reason being, one is managed by the other and manage means control, on our tiny planet and in our small minds (thanks Steve, for the nice quote). People are just people. There is difference in what we do because what we like. There is no golden rule to be a manager as far as I am concerned, only successful ones and failed ones. Management is not about control, not at least when you realise that there is a common goal, with shared resource. We just have different stands in where we are. You might feel great when your name gets mentioned in the board meeting and feel excited about it. This does mean probably you get more paid in what you do (in fact, this means you are supposed to take more responsibility and do more job!). This doesn't mean being a manager is superior. To really appreciate this is a philosophical challenge but to realise that being a manager you are not utilising resource to achieve your goal, on the contrary, you are supposed to maximise your strength and capacity within your role and health constraint to help the team achieving their goals. Unfair? Maybe, why you get paid more then?
  • Being a manager, the last thing you want to do is to assume and convince yourself that someone else is going to make tough decisions for you or things will evolve themselves to the nice shinny direction when you feel difficult to deal with right now. You need to kiss goodbye to these illusion if you ever want to be an exceptional manager, my opinion. Craig (faked name) worked for me before as a some project manager. He is a very energetic and likeable chap. He likes to be in control of things, which is nothing wrong. From the first day, people can see him everywhere, in every meeting, I mean, literaturely. Great, finally we have someone who cares about things, people talked about. However, after a while, quite obviously, it turned out that things were still things, which got talked about, put in hands and lips, and then put aside to different places or back to exactly the shelf where it came from. Why? Because to create an impression of being busy is a skill managers as a group has mastered for a long period of time, possibly from the beginning of management. At the end of day, what matters is how you would make things happen (or disappear which I prefer).

Sunday, February 22, 2009

My digital extension

Okay, here is my perfect development environment everytime when there is a new toy to play with.

  • OS & VM
Windows OS
Sun xVM Virtual box + Ubuntu or Debian as client OS
Cygwin
Java VM + SDK
CoLinux
  • Dev tools
CMake
GCC
Notepad++
Mono
Python
Jython
Ruby
WinHugs
Eclipse (+ Pydev) 
Latest MS Visual Studio
Sun Application Server PE 9
Windows PowerShell
EA
Wireshark
Google App Engine
Putty
CPPUnit
Lua

  • Code Quality & version control
NUnit
Subversion
SlikSvn
TortoiseCVS
Lint
Beyond Compare
.Net Memory Profiler
CLRProfiler
WinDbg
WinPcap
fitnesse
MobaSSH
Code Coverage

  • Research framework
Matlab
Weka
LabView
Lti-Lib
SigmaPlot

  • Database
MySQL
MS SQL Express

  • Mobile dev
Android SDK
Blackberry JDE
Blackberry MDS
Windows Mobile 5.0 SDK

  • Office
ScrumDesk
OpenOffice
Ghostscript
Google set
Skype
RealVNC
SSH Secure Shell
DAEMON Tools
7-Zip
K-Lite Codec Pack
Chrome
Firefox
PDFCreator
WinDjView
  • Game
NFS Carbon
Blood
FIFA

Saturday, February 14, 2009

Lua in .Net

ALthough I have mentioned before that there are a few options to enable scripting in .Net projects, I was thinking write a interface library to wrap up the unmanaged C style Lua library into a CLR compliant module. It is actually pretty straightforward process. Some nice people have already written ref class LuaDLL to solve the marshalling between unmanaged functions to unmanaged APIs. Essentially, you could use LuaDLL directly within your .Net project. To simplify things, what I was looking for is to wrap Lua into an object oriented way, as some OO nuts like to brand it. What LuaDLL does not do is to offer an easy way allowing Lua script accessing CLR type objects.

Without too much efforts, to pack all the fancy Lua interpreter, table, function and user data into classes, and some counter-effective strings to be executed by Lua runtime to set the meta data. Here we are, a nice interface class - LuaInterface, which defeats my original plan to be the first integrator ... And, it was done long time before my consciousness.

Anyway, to use this interface could not be easier. You can access CLR objects from Lua scripts which essentially will be string format to be executable by Lua runtime and manipulated from CLR objects vice versa. What I like about this is to hook up event handler and use delegate just as easily. On the contrary, I could not locate any good summary on this subject thus I listed in this post.

  • Define delegate in C# to use Lua functions:

// Lua interpreter
private Lua lua;
// function pointers to functions in Lua
public delegate double PlusDelegate(double a, double b);

public Script()
{
lua = new Lua();
// define variables in Lua
lua["num"] = 2;
lua["str"] = "a string";
// define functions in Lua

lua.DoString(@"
function plus(x, y)
return x + y
end
");

// use functions defined in Lua
PlusDelegate plus = lua.GetFunction(typeof(PlusDelegate), "plus") as PlusDelegate;

if (IsDefinedInLua(add))
{
double res = plus(10, 2);
rtbOutput.Text = (String.Format("result: {0}", res));
}
}

private bool IsDefinedInLua(Delegate delegateOfFunction)
{
if (delegateOfFunction.Target is LuaDelegate)
return (delegateOfFunction.Target as LuaDelegate).function != null;

return false;
}

  • Define 'delegate' in Lua to use C# functions:

public void CallCSharp(string s)
{
rtbOutput.Text += ;
}
lua.RegisterFunction("callCSharp", this, this.GetType().GetMethod("CallCSharp"));

Just to be aware that the function has to be public to be registered into Lua. You could also use Lua function by instance as:

// use a Lua function by instance
LuaFunction luaFunction = lua.GetFunction("minus");
double ret = (double) luaFunction.Call(10,2).GetValue(0);


  • Implement event defined in C# from Lua, a.k.a bind events to scripted handlers.

public delegate void RaiseAttentionEventHandler(object sender, EventArgs e);
public event RaiseAttentionEventHandler RaiseAttention;

lua.DoString(@"
function clickMe (sender)
sender.Text = 'It worked'
end
");

lua.DoString(@"
newPanel = ScriptPanel('aNewPanel')
newPanel.RaiseAttention:Add(clickMe)
");
if (this.RaiseAttention != null)
RaiseAttention(sender, null);

  • Implement event defined in Lua from C# is a little twisted logic. I could not think of a good use case right now but for the sake of completeness sake, I did a little trial and error. Before moving on, you might want to refresh a little about the event support in Lua here. Another good event module implementation using C library could be found here. The easiest way I found is to register C# functions into Lua as global function and use them to handle the events in Lua. 

private void btLua_Click(object sender, EventArgs e)
{
// Implement event defined in Lua from C# and trigger it in Lua
LuaEventHandler handler = new LuaEventHandler();
lua.RegisterFunction("eventInLua", this, this.GetType().GetMethod("EventInLua"));
handler.handler = lua.GetFunction("eventInLua");
handler.handleEvent(sender, e);
}

public void EventInLua(object sender, EventArgs e)
{
rtbOutput.Text = ("Trigger from Lua ");
return;
}

Magic calendar

Rands has laid out his system of keeping things organised, a nice synergy with David's GTD. I do not have a fantastic or well organised and maintained system to do list as such to keep me going. What I have been using is Calendar, one of the best and cruelest interpretation of time.

So, what is the matter? Everyone uses calendar, what is the fuss?

We all know concentration helps. If you believe otherwise, try to get some eggs from your fridge and see how many you can handle at the same time. (Btw, here is a great tutorial if you are really interested.) A self contained efficient entity knows to perform its tasks to fulfil its destiny, in the same time allowing asynchronous event driven mechanism to respond to coninuous incoming changes from interactions with outside world. I dump everything onto my calendar so I can spare an empty while highly efficient mind when it comes down to event handling. This mind dumping is really a prioritise and planning process. However, it is only a prediciton, a guess or best intention of what the future would and should be like.

To dump eveything is probably a good start to relieve yourself from remembering the context and remind you for possible on time switching when the timer is triggerred. I bet you feel certain level of satisfaction by crossing some items on whatever list you hold and proudly mark, done. The trap is you need the spirit and habit to actually get those things done, other than comfortably move on by thinking that you have a box of stuff which 'have been dealt with'. Not long enough, you would realise many items start to pile up against the due dates. It is only a matter of time for you to bin the whole item list. What I have learnt is do not put anything can not be done in that time frame on to your calendar and if you can not get that item done at the time it is supposed to completed, you have probably missed the only opportunity to get that done. So, it is a serious business when you are making committment with your time. You will always have more than what you could do, hopefully. So it is ok to let things go. Sometimes this kind of choice makes sure you are spending your resource (time) in things that matters, rather than those just to fill the 8 hours of day time.

One thing I also do is to update the item with necessary information after it is done. I found it particularly useful when I have the luxury and bored enough to try to dig out what the heck I have spent last two months of my life on.

I have seen some of the scary ones - calendars full of stuff, I mean, they are not items as such, they are stuffed! Many overlapping tasks with fancy big names such as meditating to seek the purpose of life or restructure engineering process. I mean, come on. Who are you kidding with? I could not believe that would make anyone feel better by knowing that I am gonna have to delete this without any updates when time comes. Plus, there are better platform for this type of gestures - twitter.

Wednesday, February 11, 2009

Viigo 3.0 Kudos!

Just upgraded to 3.0 Beta upon receiving a buzz from Viigo.
To put more meat on the bone, Viigo adopted iPhone style and offers a much nicer UI. As usual, you could organise your RSS feeds. Nice thing about the feeds is that you can now easily scroll to the bottom of the article to post to your twitter or del.icio.us. Now you have new features such as push weather, sports, stock & finance, even channels for craiglist. Also from this version Viigo integrates flights and travel information. Audio & podcast seem coming when the formal release is out. That would be a very nice hit I think.
One important thing to mention is that it seems Viigo's ads model is now much more mature and content-based (not quite).

Sunday, February 08, 2009

Lightweight messaging middleware

I have been thinking about having an extreme lightweight messaging middleware. It has to be low latency to the point it could almost offer real-time message delivery with minimum arbitration in between end to end communications; it also should allow an easy way of service directory depository management; it should be built on top of the de facto networking protocol and infrastructure; it should be very easy to configure and deploy; it also need to have a set of simple low level api to manipulate message, processes and communication channel; it must be OS-independent. 

0MQ has released its 0.5 version, and it is an absolutely enjoyable experience when I played with this such a small package, and it does seem to fill in the bill! 

You could easily customerise your own desirable messaging structure based on the dual channel in/out messaging model. The separation from user space thread (which handles the high level messaging) and de-/encoder engine in the kernel space saves us from worrying about efficiency in IP level packets transfer.

One thing though, 0MQ seems still have not adopt any formal directory service standard yet, but I see that coming probably in the near future.

Finally, yes, it is claimed as OS- independent. As yet, it works for me on Ubuntu 8.04 and Windows XP (although its latest windows 0.5 trunk needs slightly tweak in the windows version macro to pass the compilation). I' ll probably try on an ARM9E next time and post my result here. Btw, test on Ubuntu does give following results on my crappy laptop:
Ubuntu 8.04
latency test 100000 msgs, 1B - 105.9 us
throughtput test 10000000 msgs, 1B - 3.5Mmsg/s

Monday, February 02, 2009

Blackberry apps and more

Finally, writing a LBS program on BB pops up on my todo list. It is quite straightforward to setup development environment for BB. Officially, there are three different ways you could develop your apps with, browser mode, standard J2ME programs, MDS apps. I am not going to those what you can easily find out from BB developer zone. A few thoughts occur to me on mobile services, LBS content-sensitive apps and BB's offerings to achieve these. One way or another BB server sits as a service arbitrator. So programmability in this unit should be fairly important I would think, for real business solution. 

It is pretty easier to say hello to the rest of the world from either a native java program (with BB JDE or any types of UI supporting keyboard entry), or MDS program (with plugin for eclipse or Visual Studio). There were essentially the same thing other than MDS is a layer of middleware provided by RIM to facilitate web service development via on-device MDS runtime support and server end MDS service components. Although I have to say MDS alone only offers quite limited API support. Browser type BB apps present flexibility to extend traditional HTML based applications. The level of scripting support within the BB browser is actually quite impressive. Of course when you consider porting browser such as chrome, firefox or opera to BB, these would need careful scrutinising. It is worth mentioning that BB enterprise sever and client is claimed to support plugin modules implementing transcode interface to customerise information on both end. I have not yet played with this yet, probably worth another chapter. The other thing also has many merits is that many of the device capabilities such as GPS, bluetooth are accessible from the embedded scripts. RIM does suggest some best practices in developing each type of BB apps and the various ways of deployment.

Let's imagine that you are a service provider company. What you normally do is to provide your service via traditional dispatch channels to your customer, whether the implementation of these services are physical goods or not. Now you have setup a web service to dispatch that service, allowing it to be integrated with the rest of your facilities and third parties more easily and hopefully establish new, more efficient business models. Just because you realised, hopefully not too late, that 20% of your customers are normally using your service on the road, via some sort of mobile devices. Part of these devices are sold by you originally as the service deal; other part, however of your customers are using self-purchased devices, some of them supports similar platform as yours do, some of them not. I guess you see where we are going with this and how in BB world this could fit in the picture right now. MDS, native programs for mobile C/S extension, browser apps for B/S extension. Have we forgot anything?

Yes, we did. In a simple term, there is not really anything stopping a mobile device to be the source of computation and information, given there are means of powering it. The winner of android application competition has demonstrated to us how a mobile phone became a content-sensitive information retrieval device. Pointing your visual sensor - in this case video camera - fused with other information, you can pretty much explore the world, with a bit of help from service provider who holds the bigger picture (navigation map data, not position info). Current mobile social applications mostly still remain as a logic extension to PC world. In a situation, and era, where mobile information holder becomes the source of computation service and information suppliers to others, how would our application architecture is going to satisfy and what needs to be done to make this happen?

Push seems to be a nice start on this. Slightly change the viewpoint you will notice under push mode, BB device becomes the service provider, i.e. server. In fact, you could refer to the public push method (exposed by [DeviceMethod] similar to [WebMethod]) same way to standard web service.