Friday, May 23, 2008

QuickTask for Snappy Task Addition on ICal-based calendar

I have been coding little application to make adding task in iCal fast and comfortable. I finally have a binary release today. Check out QuickTask here.

I find entering task using standard dialog provided by General Calendaring application quite uncomfortable. The dialog feels very "noisy" to me. I understand that most of them aim to enable user utilize ical-file standard as much as possible but for my usual use it's too bloated.

I made quicktask to make entering task to calendar more fit to my task-adding style and many others I think, especially GTD-follower who don't bother with dates, times and prioritizing task (at least when entering them).

It assume and simplify several things :

  • You only assign one task exactly one category
  • You only need to entery task name, description
It can be viewed as a facade to ical's task i.e: utilizing ical framework but only deal with stuff that match to our conceptual use of it.

I have been using for sometime now and hopefully it will be useful for others too.

Friday, May 16, 2008

Do "svn info" the TortoiseSVN Way

It's not directly obvious how you can do svn info from TortoiseSVN. I used to install separate command line svn client just to do this. However, I stumble upon this discussion :

> how could i find infos like command "svn info" ...
Right-click, choose "properties" in the explorer context menu. Then,
switch to the "SVN" tab.

Here's what I got while doing it :




I think it's pretty nice and easier compare to using separate command line client with which you need to go to console, go to that directory and type "svn info" (not to mention the hassle of installing the svn command line client). It's not that apparent for people who used to the command line command though although it seems quite consistent with how explorer arrange things i.e: Properties dialog is where the info about the selected item shown.

However, I think having some way in the main context menu of TortoiseSVN to show this info will feel straightforward and and natural for some people. info command is used just like update, commit and other typical command so they would normally expect to find it on the same place where they see those other common command.

Thursday, May 15, 2008

Use AnkhSVN to Avoid Forgotten File Addition in Visual Studio

If you use Subversion with Visual Studio chances are you have been in a situation where a file you added in VS and you forgot to "svn add"ed it, thus not committed to subversion. Things will still be ok on your side, you probably only aware of this when someone else shout "Hey, who broke the build ?!".

It's where the AnkhSVN come in. I still use TortoiseSVN for my main svn client but I also use AnkhSVN to avoid the case above. When I add stuff, it automatically "svn add" it. Another important use of it for me is the instant review of what's changed from within VS and the simple way to revert changes without having to go to the windows explorer and access TortoiseSVN from there.

In short, I think it's a good complement for main svn client although not to replace it.

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.

Tuesday, March 18, 2008

Coding Precondition

I think there are certain conditions that need to exist for a programmer to start coding. This is the condition that if not fulfilled can make the programming task harder, unfocused, distracted and will produce mostly suboptimal result.

This is different for everybody and depend on many factors like exposure to available technologies, experiences, working environment. However, the same theme here is that those things need to be available before we can do main task with flow and minimum distraction.

Here's an example on the things that I find as a precondition :

  • Roadmap. However vague, without it the coding feels like going nowhere, we are also have little structure to based our technical choices.
  • Issue Tracker. Beyond coding for practice, you will need some kind of tracking of what you want to achieve, what you currently are and what the next step is. It could range from a mere text file or something monstrous, pick your choice.
  • Revision Control. Coding without it will feels like coding in the middle of land-mines. The feeling of safety that if we make mistakes we could always mistake leverage the way our brain solve the current problem since it is now feel more free to experiment and explore solutions.
  • Integrated Environment. It could be several tools that you combine yourself and make work together or a full-blown IDE or any other combination. The key is to make them work seamless as from coding to running and work naturally as the extension of your thoughts to concrete implementation. This is also include the libraries you are depend on, it should be in-place, tested and integrated first.
  • References. Gather relevant core references of what you currently working on within short reach, it will speed things up compare to relying solely on just-in-time research.
The ideal to be achieved is the condition where the programmer would only do mostly : think about the problem, test, code, debug, commit with minimum unrelated task come up.

Programming precondition worth to be prioritized whenever any of them is a little broken. Personally, I think it's worth to stop whatever I am doing to get those precondition work/clear in top shape first before start moving on again with the main work.

Thursday, March 13, 2008

PascalCase and camelCase Convention (in C#)

Coming from C++ world I am a bit disturbed with how things written/named in C# world. The IDE, code samples, books write something that I have been learn to avoid : write function name starting with capital.

I used to follow a convention that only use name beginning capital very sparingly i.e: for Class names. Suddenly seeing capitals everywhere got me wondering didn't they read stroustrup books and other C++ guru?. Overtime I learn to accept it although I still many times, by reflex, naming properties and functions starting with lower case but I can live with generated code and keep up with whatever convention already existing in the code I am working on.

I mainly thought there some kind of convention that these guys are following although I haven't read it explicitly somewhere. Until today, when reading book "C# in a Nutshell, 3rd Edition", I stumble upon this

By convention, arguments, local variables, and private fields should be in camel case (e.g., myVariable ), and all other identifiers should be in Pascal case (e.g., MyMethod ).

I still wonder where there's come from initially, but at least I now saw it written explicitly that, somehow, it's a convention. Thinking that all those people "incidentally" have the same urge to broke the rules and naming things by Capital Letter is kinda creepy, so it's better like this :).

I don't mind following them, although my brain now have to keep two convention inside it since I still keep the other convention in C++. There's still some nagging feeling that you broke something sacred when you try to start name of something beside class with capital in C++.

PascalCase is ok, (Lower)camelCase is ok too, as long as it gets the job done, I guess.

Monday, March 10, 2008

Using Jude : Seperate Model and View


Jude is a UML tools that I find very flexible since let the user do the way he likes it to without forcing certain structure. The user could determine what certain structure of the components and diagrams are meant to himself.

Here's one way of using it that is quite useful to me : make a separate model and diagram folder. I put all the UML components e.g: Class, under model and make all diagrams under diagram folder. With this I could reuse the same classes definition on several different diagrams. Any change to the class will be reflected automatically to others.

It's a bit more work since you have to do things in several steps :
  • add any model under folder model e.g: right click on the folder -> Create Model -> Add Class
  • Open the diagram and drag the Class there from structure view
With standard way of drawing, I could just click on the toolbar and I got the model I want in that diagram instantly. It's quick but it makes the model less reusable/centralized.

It's not always seems practical to do so though, for quick "drawing" I just use the toolbar and let everything e.g: classes and diagrams on the same folder. However, for relatively serious UML Diagramming separating models and diagrams is more convenient.

Thursday, March 06, 2008

Using (Manually-Generated) UML to Track Code's Conceptual Growth

One of the usefulness of drawingUML ourselves (as oppose to rely on automatically-generated ones) is to track classes growth (it's numbers, associations among themselves). It's refreshing to occasionally pause a little from coding work and update those dusty old diagrams that we've updated last week/month. It helps us to review and maintain the integrity of the code and, somehow, feel still in control of all of it.

There are things that does not appear on source code or IDE in apparent manner and without tracking in high level view there can be trouble related to conceptual integrity of the code that creep up and accumulate over time. Even with lots of features that help to get a high level view of classes e.g: ctag-based tools, or automatically generated diagrams, nothing can replace manually-drawn visual diagram role on this.

Somehow it's not really about the diagram itself but the act of clarifying what's inside our head in a more visible manner for us to digest, the byproduct, the diagram, is just a nice bonus. It's not really the diagram that we've updated but it's our view about the whole thing that got refreshed periodically. It gives fresh view and the feel that we are still in-touch with the code. Also, in the process where we see, stare (and reflect) on associations that could fuel another insights, breakthroughs or just clarifying our already-outdated understanding.

Conceptual integrity can deteriorate over time and taking occasional visual view could help in dealing with it.

Tuesday, March 04, 2008

Script/Executable-Based Application

There is a certain model application that function as a wrapper to an already-established/existing script/executable. I already stumble upon many applications written this way, even wrote one myself sometime ago (a gui wrapper for certain cli app in-house). There are even application that is written from the start by writing scripts first then wrap them in application-style user interface e.g: kalva.

It's not a sin, of course, to write this kind of application. I think it's a good way to go given conditions :

  • The executable/script is well-established
  • There's no library that wrap the functionality in a modular way
  • You have little time on your hand
However, visually, you'll have quite a monolithic application that looks like :


Which ideally can be made more modular and testable architecture like below :



If you have the resources and chance your 2-tier application can be made to evolve like the above. You start by extracting the executable into library step by step until all the necessary logic are on the lib and the script is merely a caller to it. Once you have library, you can link your application to it which make your app relatively cleaner and more cohesive.

Still, despite my preference for cleaner, more cohesive application, Script/Executable-Based Application is quite an interesting approach to rapidly develop something and/or reuse an established CommandLineInterface.

Monday, March 03, 2008

Tools for Server-Related Development

Here's some (free) tools I use in server-related development in Windows. The combination of them ease the development considerably, almost like all related-things are on local.

  • Putty. This one is the most basic. It's an SSH client, got you connected to the shell where you can do virtually everything on the server. However, for operation that related to file/directory management, you'll need...
  • WinSCP. It's an SFTP/FTP client with the look and feel of midnight commander, very handy for file/directory-related operation. It has a large number of feature that I find really useful e.g: shell command execution (you send the whole command instead of typing each character to server), directory synchronization (this sync feature has large number of option with convinient interface).
  • JEdit with FTP and SshConsole plugin. Despite it's name, FTP plugin could also connect using SFTP and enable you to deal with the file in the server like you do with the local one. SshConsole work together with the FTP Plugin to enable you to send command with the current opened dir as working dir. You don't know what you've missed until you try this one. It's very helpful if you edit lots of files on the server e.g: working with several configuration files. Within JEdit, almost every aspect of editing file on the server feels like working the local ones, from browsing/opening, speed (it's cached on local buffer), savings, highlighting, history, etc.
As an addition, I think you'll find network monitoring tools would come in handy too when something does not look right. Here are two of them that I have ready to be used :
  • NetLimiter free version. The free one enable you to monitor the traffic of your connection e.g: how many bandwidth certain application used, overall bandwidth usage also the detail of what kind of connections (ip, port) that certain application open.
  • Whiteshark. Very advanced tool to monitor your network packets. It takes time to get used to this one, but really useful once you get the hang of it.
Given the right setup and some mix and match of tools, server-related development could still be fun and convenient.

Wednesday, February 27, 2008

No "clear" Command in Cygwin Default Installation

My Cygwin installation does nothing when I type "clear", it say it does not know this command or something. It is quite basic operation to be unavailable. Oh well, that's just life, nothing that a little googling couldn't help.

This blog's post clears up things for me : I need to install ncurses package. It is fixed now but I still think it should be available by default though.

Monday, February 25, 2008

The Useful "tail -f"

"tail" is a program in UNIX-like system to print a little part of the end of a file (it's counterpart is easy to guess : "head" to print the beginning instead). At first, I didn't find this program anything special, just some program that I think I might use someday when I need it.

I find a more useful use of it when quite a long time ago I try to setup my tv-tuner to work on linux , which is quite painful to do at that time. Thanks to one reference that on the net (which I lost the link, unfortunately) that use "tail -f" to view the change in log file in realtime (it was used to watch the loading/unloading of the driver to see the effect of different parameters, pure "fun" ;) ), I got myself one very handy tool to watch log file (or any file with the same nature) since then.

When you have trouble with servers or system in general, you could troubleshoot better with this. However, "tail -f" could be really handy for programming too. When you want to trace program as a work around when you have some problem to show them in screen, just print them to file and watch it's changes/appending in realtime and you can avoid having to scan the whole log file after-the-fact.

It's available on most of the system e.g: Cygwin for windows. So, you can rely on it most of the time.

Wednesday, February 20, 2008

Refactoring to Make Code More Human Readable, a Little Example

I code a little tool in .Net today and need to initiate something different based on whether the second argument is given or not. The program would go something like (to protect the innocent, I'll use very generic name here) :

myProgram arg0

or

myProgram arg0 arg 1

First, doing the simplest things first, the arguments handling goes something like

   1:
2:if (args.Length > 1)
3:{
4: //initiate something the standard way
5:}
6:else
7:{
8: //initiate diffrently
9:}
10:


Its works ok but the conditional above left something to be desire, so I refactor it by extracting checking argument length into function :

   1:
2:if(!supportFileIsGiven(ref args))
3:{
4:
//initiate something the standard way
5:}
6:else
7:{
8: //initiate things differently
9:}
10:


Suddenly the code become a more readable english. It tells more story and deliver meaning. Given a choice, I'll choose code with the style of the second one to work on anytime of day.