La Vita è Bella
Wednesday, April 05, 2006
What about an Error Code Management System?
UPDATED: about the name, according to wine (Wine Is Not an Emulator), I think we can call it sine (Sine Is Not an Error), or even cosine (COSine Is Not an Error). In fact, in Chinese, "cosine" is pronounced as "yuxian", which is very similar to my name "yuxuan" :P
Microsoft had maintained a huge KB of error codes, so if you met some error, you can always look it up in the MSDN by its error code.
For any project, it's important to keep your error codes unambiguous. If -1 means "no such file" in function A, but means "MySQL connection timeout" in function B, that's nightmare.
So what about a Error Code Management System? It maintain the whole error code database, automatically generate the error code header, and automatically generate the document.
It's supposed to be a simple PHP script, use MySQL as database back end, and support cvs/svn commit.
The work process is supposed to be like this:
- A programmer need to define a new error code.
- He opens the System, input number, macro name, description, etc.
- The System checks if the number is already taken. If not, accept the error code.
- Add it into database.
- Generate new header file, commit it.
- Generate the document. Or it may be another system, just read descriptions from database.
As usual, a project name is needed. :P
tags: error code, management, open source
18:44:28 by fishy - thought - Permanent Link
2 comments - no trackbacks yet - karma: 45 [+/-]
Tuesday, December 27, 2005
Why we should use open source
The project I'm working on used a 3rd party component, and it's not open source.
QA had found a defect today: in some case my program will hang for a long time. So I added many debug log into the position that may hang, but didn't find the defect.
So I can only add debug log between nearly every statements, and finally, I've found the hung statement: a function to dump some data onto hard disc, from the 3rd party component.
Sometimes, this statement will hang for 5 minutes (no more, no less, just 5 minutes), and then return SUCCESS.
I don't know why it hangs, there's enough spaces, and it has the privilege to write. It seems that 5 minutes is a time-out, but after 5 minutes, it return SUCCESS!
If I have the source of the 3rd party component, maybe I can fix it. But now, I can only leave this defect there, to wait the stupid 5 minutes.
We need open source, seriously.
tags: opensource
00:10:21 by fishy - thought - Permanent Link
Tuesday, December 13, 2005
Proposol for Thishit
I've bought a Treo 650 half a month ago (photo), but there's no free good-to-use Jabber clients (Chatopus is more or less good, but not perfect, and it's a shareware with $16.95). So I think maybe I can develop a open-source Jabber client for PalmOS.
I'll call it "Thishit" :) , and planning to implement the following features:
- Text chat, of course
- Gtalk support
- Good transports support
- Other services support (JUD, conference, etc.)
- Message history with offline reading and/or exporting to memo
- i18n support
- Multi accounts at the same time
- SSL support
- Background running
- Customizable status message
- Smileys support, if possible
- Avater support, if possible
tags: palm, palmos, jabber, thishit
22:54:29 by fishy - thought - Permanent Link
Tuesday, August 09, 2005
The power of stdin & stdout
I think we should develop softwares using stdin and stdout for input and output. With stdin and stdout, we'll get the following benefits:
- It's easy to port onto other platforms.
- It's easy to make GUI shells, and they are absolutely native!
- It's easy to make a automatically test and log the test input & outputs.
- It's easy to integrate various programs together.
Any more? To be continued :)
tags: stdin, stdout, communicate
23:58:00 by fishy - thought - Permanent Link
Friday, July 22, 2005
Brilliant software names
I've just read cathayan's introduction for moving local emails into GMail. In which he'd introduced a software to do that job: gExodus.
The name "gExodus" is brilliant. Under the leadership of Moses, the Hebrew slaves departe from Egypt, this is the Exodus. So our emails can also departe from local mbox, to GMail :)
Another brilliant name is the code-name of Borland Delphi 8: Octane. Octane is the "perfect" organic compound with eight carbons. But unfortunately, Delphi 8 is not perfect :)
Anyway, it's hard to find such a brilliant name for a unnative English speaker, just like me. I'm looking for a name for the next-next version of WinPNP, any good suggestion?
tags: delphi, octane, gexodus, name
00:46:00 by fishy - thought - Permanent Link
Friday, June 03, 2005
GTK & expat notes
I've just finished my senior project, which is a GTK program to display line chart, pie chart and some raw datas collected from a system status collector. It's part of the SkyEye project. It reads data from a XML document, so it's also used expat as XML parser.
The main reason I chose GTK and expat is that they are both written in plain C and can be used in a plain C program. I don't like C++ much.
Here's some notes.(I'm using GTK 1.x, not GTK 2)
- expat: expat is simple to use. First call XML_ParserCreate to create the parser and allocate memory, then call XML_SetElementHandler to mount handle functions. Here you can also us XML_SetUserData to point the data block of user data, which can avoid use of global variables. Then just read the xml file and feed into the parser use XML_Parse, and finally free it use XML_ParseFree.
- GTK overview: Use gtk_init to handle command line parameters, then create the main window, and the widgets of the main window, show it, and use gtk_main to start the message looping. Use gtk_main_quit to back to end the call of gtk_main.
- GTK tree: First create the main tree widget use gtk_tree_new, the the items use gtk_tree_item_new_with_label, and append the items into the tree use gtk_tree_append. To create subtrees, first use gtk_tree_new to create a tree, then use gtk_tree_item_set_subtree to set this tree a subtree of a tree item.
- GTK drawing area: A drawing area is used to draw a graph. Create a drawing area widget on to the window, and then use GDK functions to draw a graph on to it. There're 2 important signals: expose_event & configure_event. expose_event was trigged every time the drawing area is expose(in another word, showed out), and configure_event was trigged every time the drawing area is resized. You should handle this 2 signals to redraw the graph.
- GDK: GDK is the low-level drawing functions used by GTK. There are 2 important parameters for a gdk_draw_xxx function: pixmap & gc.
pixmap is the buffer. use the following statement to create a pixmap:pixmap = gdk_pixmap_new(d_area->window, d_area->allocation.width, d_area->allocation.height, -1);
gc = gdk_gc_new(d_area->window);
gdk_color_parse(rgbstring, &color);
gdk_colormap_alloc_color(gdk_colormap_get_system(), &color, FALSE, TRUE);
gdk_gc_set_foreground(gc, &color);
Once you've got pixmap and gc, you can use statement gdk_draw_xxx(pixmap, gc, ...) to draw something on to the pixmap, in which xxx can be line, arc, etc. Finally, usegdk_draw_pixmap( d_area->window, d_area->style->fg_gc[GTK_WIDGET_STATE(draw)], pixmap, 0, 0, 0, 0, draw->allocation.width, draw->allocation.height);
tags: gtk, expat, xml, gui
22:19:00 by fishy - thought - Permanent Link
Monday, May 02, 2005
P2P TVs in China
How do you watch TVs(for example, to watch a UEFA Champions League game) if you don't have a TV set? We have the Internet, so it's time for P2P TVs.
BitTorrent is such a revolution. Following its success, there's more and more P2P applications using its algorithm. P2P TVs is such a application: a source server to encode TV signal into some stream media, and all peers to broadcast it.
The first P2P TV I ever know is GridMedia, which is the official partner of CCTV now. But it wasn't a very successful solution. It's buggy, not so stable, and the TV programs are not so well.
In my opinion, the first successful one is CoolStreaming(no website now, cause it's watched by Hong Kong copyright bureau), the related thesis was accepted by IEEE INFOCOM 2005. It's stable, straight, & cross-platform(written in Python).
The best one today may be feidian(which means "boiling point" in Chinese). It's stable(maybe not so stable, but active), fast, optimized for cernet users, and there's a Mac version(not the latest version).
The biggest problem P2P TVs must face is the copyright(maybe the best solution is associate with TV stations). After fixing the problem, it will be a revolution!
tags: p2p, tv, china, coolstreaming, feidian, bittorrent
11:07:00 by fishy - thought - Permanent Link
Tuesday, February 22, 2005
Just remember a program I've wrote
I've wrote a PHP program to verify proxy servers in a MySQL db. It use wget to direct download a webpage, and then use the proxy to download the webpage, and diff them.
So I need 2 temp filename for the 2 downloaded file, I forgot the function &tmpfile&, so I generate 2 random numbers, and use the md5 hashs of the numbers as the filename...
tags: php, md5, random
12:08:00 by fishy - thought - Permanent Link