Wednesday, April 30, 2008

Setup Kubuntu 8.04 KDE 4 Remix on Toshiba Satellite 2450 Series

KDE 4 is finally released officially in Kubuntu 8.04, so it's time for me to reinstall stuff in the laptop (Toshiba Satellit 2450). Recently it's been running kubuntu 7.10 with 3d card fail to configure and I have no patience/time left to fix it. It was working in previus kubuntu, so I have a good hope that things will be better this time plus I have been itching to test KDE 4 (I had been staying away from previous betas). So, here's the recap.

The installation went really smooth. There's nothing new with ubuntu/kubuntu here, it's been known to have trouble-free installation process (although it's been known to cause a little pain afterwards :) ). Restart then login shows a welcoming KDE 4 experience, quite slick.

Now, the fun begin. The network is not working and there's no graphical setting that I can use anywhere to set the ip and stuff. It's been quite well-done in KDE 3-based system-settings, so this is quite a major drawback. A little googling "inspire" me doing things manually below :

put this on /etc/network/interfaces

auto eth0
iface eth0 inet static
address ...
gateway ...
netmask ...
network ....0
broadcast ....255

and this in /etc/resolv.conf

nameserver ...
nameserver ...


and finally execute this manually (and put in /etc/init.d/rc.local for auto-execution in booting)

route add default gw ...

Once the network works, it then quite typical fix, upgrade, install, remove, etc.. .

The next surprising thing was Firefox looked really really ugly. I remember this is the same case with the early days of kubuntu, the gtk use default look and feel (which is very bad). Easy enough, there's gtk-engine-kde4 to the rescue. Installing and setting it through SystemSetting->Appearance fixed it.

The next worth mentioning is about nvidia proprietary driver installation. I am a bit skeptical due to previous experience. But again, another round of googling, "inspire" me again (since I am not exactly doing what's in it nor the situation exactly the same).

In my case, it actually much more simpler (no need for Envy). There's a proprietary driver ready to be enabled (downloaded and configured) in the system. It's on DriverManager accessible form the StartMenu. Just need a click in enable checkbox and it automatically download and configure it. However to get it working, it still need one line in "Screen" section in /etc/X11/xorg.conf :

Option "UseDisplayDevice" "DFP"

After video card acceleration working, the rest of the time is spent playing with desktop effects, which is quite interesting and fun.

Kubuntu 8.04 with KDE 4 sure is worth it, although I really think the Network Configuration matter is a very very major flaw. It put people who isntalling it in a very difficult situation to troubleshoot. In a system where it's not a problem (preconfigured successfully in certain system?) it could be fine, but not in many cases, I think. Besides with no network configuration GUI available to play with, there's so little hint on what to do next.

Vista Firewall Block All Port Accesses Out of the Blue

I was working as usual when I suddenly cannot access the internet. Everybody else seems to have no problem with it. All my LAN access seems to not work either. I remember I got this case sometime ago and a reboot fixed it, but I have many work open on the desktop that I refuse to just give up this time.

Some diagnostic later, the result, strangely, was :

  • ping works, both LAN and internet.
  • Any access to any port anywhere fail. I can not even ssh to server in LAN that I usually able to access.
I then checked out the running tasks and there seems to be nothing out of the ordinary. The next potential trouble-maker would be Windows Firewall. The troubleshooting went :
  • Check the config, seems nothing wrong
  • Turn it off, It works!
  • Turn it on again, it still works ?!
What was that all about?. Well, at least now I know what to do when this thing happen again.

Monday, April 28, 2008

Menu and/vs Toolbar in .Net CF Development

Developing pocketpc application using .Net CF in Visual Studio gives you lots of easiness to get the job done but also give some not-exactly-expected result sometime. You feel like it's just another app development since everything looks familiar with desktop app development only with some stuff not available, but besides that things are feels like home for desktop developer. At least until you start playing something like toolbar.

In the beginning of development, you have this style of menu :




It fits with the use of device with common left and right action button.

However, after a while you most probably think about adding a toolbar for common operation. It will be the time you find out that you no longer have access to device's left-right action button since it will then looks like below :



The toolbar need to "share" space with the menu, so the shortcut buttons no longer makes sense . It happens the same way when you have three menu like below :



But I think for the toolbar it's not really "fair", since many would expect something like below :



The above is actually achievable with a "hack" with panel and picturebox. It gets the job done, but I wonder why it's not how the standard toolbar class behave. It probably has something to do with screen space matters. However, a better option would be to let the developer choose by providing option on where the toolbar can be located and let those who want to keep left-right button functional but still want the toolbar can get what he want.

I guess, for now, .Net CF developer would need to hack away his toolbar implementation if he would like to keep the standard menu. Otherwise, if it's OK for him to have the toolbar sharing space with menu or even desire it to save space for something else, then the using standard toolbar class would be quite pleasurable.

Saturday, April 26, 2008

Unit Test as a Documentation : The Case of PureMVC

I stumble upon PureMVC while searching for lightweight MVC framework for C#. The learning experience of it is not what I call pleasant one. The official documentation (which still based on ActionScript version) use very long narratives with very specific term used throughout the documentation assuming too much that the reader already familiar with it. To make matter worse, there's no executable code to try anywhere. There's no one to blame, of course, since the site already say :

Beta - Unit tests are compiled and running in target platforms, as well as a Silverlight Demo. There isn't much documentation yet, however.


However, things are changing once I take a peek at the existing unit test. This is exactly the experience that Unit-Testing proponent refer to when they say "Unit Test as an Executable Documentation". It is truly function as a documentation for me, even better than pages-after-pages narratives. It's like a "picture worth a thousand words" experience.

By relying on the unit test I can make things work in very short time. It also make the pdfs that I've read earlier starting to makes sense (despite I still think the narratives need much work to be humanely-readable). It explain how I should use certain class and how it interact with other class and most importantly, how it can produce the expected result. I don't even to compile and run them to know that it will works, it seems quite clear that it will work (in fact, I don't even bother compile the unit test, a little work of copy and pasting already show in short time that it work in my own code).

I rarely on the other side of Unit Testing world i.e: read them to makes sense of the code. I usually read my own or the co-woker (which the codebase I share and already familiarity with). Seeing their usefuleness from the purely-reader side (since it's truly "someone-else's" code) gives me deeper perspective on how they can make a difference in understanding and using the completely new code.

Call Event Handler Function Directly [.Net, WIndowsForms]

When you code Windows Forms application using Visual Studio (VS), your event handling function are generated automatically. Things are handled visually.

But let's say you have made a Menu and make it's event handler function using VS and you want make a toolbar that do the same function. Since you hate recoding everything, you'd like to call the previous event handling function on the menu directly.

It's quite easy when you understand what those parameters generated in event handling function is for. Well, assuming you don't have time to read C# book from the beginning and you need to start coding C# right after you code C++ or Java with tight deadline ahead, you just try to make sense of the code at the spot.

Generally, those function would looks like below :

private void eventHandlingFunction(object sender, EventArgs e)

It turn out that the two parameter above is

  • object sender : the object from which you call this function.
  • EventArgs e : stuff related to what's going on when this function is being called.
So, if you want to call them directly, just pass those two with whatever you see fit. Many times, I usually find that I just need to fill the first arg with "this" and the second one with "EventArgs.Empty", basically saying that :
  • "I (the form that own this funtion) call this myself " and
  • "There's nothing specific going on (that you need to know), I just need you to do the routine"
So, that's it, in simple situation you can just call

eventHandlingFunction(this, EventArgs.Empty);

Of course, you need to make the internal of the function can handle the situation with that kind of argument otherwise the caller need to provide a minimum necessary argument e.g: not just EventArgs.Empty, to get the function running.

Friday, April 25, 2008

Incremental Adoption of Software : From Generic App to Specialized One

Most of our software need is actually can be fulfilled by many already existing general Application. Take Text Editor and Spreadsheet for example, they are very general but highly useful piece of software. You could use them to store any kind of list or database if you can still accept the very generic feel of them and awkwardness when things get bigger. You can even utilize folder structure, file naming convention, markup convention, built-in search and replace capability to "emulate" an app.

I think we usually underestimate on how far we can go with the already-existing software and too quick to grab specialized software. But in this age of so many existing option, with many even free, who can blame us?. However, we need to also realize that adoption has it's own hidden-cost/restriction/negatives that sometime more generic application has better performance e.g: IDE vs. Emacs cases.

So, to take the best of both worlds, I guess the heuristic would be :

  • Being really comfortable with available generic application. To be concrete, master application like powerful Text Editor (I use JEdit, there are others who uses Emac's fanatically) and Spreadsheet. Use their advanced feature. You will encounter that when knowing them deeply you'll find many cases that they are just suffice.
  • Browse around and keep an eye on less widely used but powerful generic application. For example, despite it looks to have a specialized use, I find Freemind really useful in a wide variety of situation.
  • If it seems enough to use the generic one in certain case, try the generic one first rather then trying to find other more specialized app, you might find out that it is actually do enough.
  • When things get rough and you really feel that you need a more specialized app, shop around and pick the one with the most generic functionality. For example, when you only need to edit picture and Paintbrush looks plain, something like Paint.Net would be more suitable than beating yourself up trying to be graphic designer by using Gimp.
  • When you finally use the new app, push it to it's limits and see what else you could utilize from it. Later, you could mix and match your software based on what each can do. You will have less software to deal with but still get the job done.
I think it will be most fulfilling using software this way and in the case of commercial software, will be more economical.

From the perspective of developer, it is useful to see what existing software that already exist that already usable enough to solve the current problem you are trying to solve with developing this new software. Developing more specialized (or more robust) software will cost the user the utilities/familiarities that he/she has on the generic app so you'd better give something much better in return.

Thursday, April 10, 2008

Use Prism for Sites or Web Application that is Used/Behave as an App

Not so long ago I stumble upon Prism, a Mozilla project that aim to make using a site feels like using a desktop app. Of course, this means not all website would makes sense to be be used in Prism but for some it feels very natural.

Prism is (From the url above) :

Prism is an application that lets users split web applications out of their browser and run them directly on their desktop.

Altough technically speaking, currently it does :

  • Gives you shortcut (in Start Menu, Desktop or Quicklaunch) so you can fire an url like you fire an app.
  • Remove all the buttons and menu.
It might be not too impressive from this technical standpoint. But after using it for sometime I am starting to feel the difference in how I work. I put many "action"-based site to prism and now my Firefox is getting cleaner and has more focused used i.e: more research, reading, browsing. It kinda reminds of the old days :). Some monitoring and management url like Trac and XPlanner is quite helpful to be treat as prism.

Many times when I open certain site in one tab and I intend it to stick there for a while, it will then accidentally closed, which is quite annoying since I would then find myself reopening tab several times (I am quite a fan of "Close other tabs" command, so I guess this is to be expected). Now, I could just open those kinds of sites in Prism and has more freedom to do more hectic research in Firefox.

It's still really early technology, but it's already useful in my case and quite assimilated . I am looking forward for updates on this one especially highly important stuff like the use of Firefox extension (or Prism's own extension) since something like Adblock is almost de-facto standard for web accessing these days.

Thursday, April 03, 2008

Visual Trick for Icon-less Node in TreeView [.Net, Windows Forms]

I have been spending my recent spare time to code more on Pocket Freemind. One of the addition/fix is on the handling of iconless node in TreeView (which is left blank by the framework).

As I wrote in my previous post that I used a square to fill it, although it does not look really representative. Later it was removed and leaving it blank, with the cost that the node looks like floating like below :


I later stumble upon this screenshots of "competing" product and think "Hey, I think I know how that is being done". It seems to use the standard TreeView and widget and there should be an image space between where the line and that text start, so there must be an image that mimic the line and make the line virtually longer and reach nearer to the text.

Some experiment with taking small screenshots of the line, copy and pasting with Paint.Net proved it right (or at least working the same way). It result in below :


Now, the line looks longer and better suit my taste.

Other people can have a different taste, of course. But in my case, and in the the context of mindmapping, I think it's better this ways since it can be quite confusing when I open a crowded mindmap and there's blank spaces everywhere making the nodes does not instantly apparent where it attached/connected to.