Sunday, September 20, 2009

A feedback to NCIX regarding to Linksys router WRT160NL

I couldn't post the feedback to NCIX since its website is always under maintain, whenever I want to submit a Completely Unsatisfactory comment.

I have no time to do it again so paste it here. Hope it helps somebody to choose a right model of router.

And if I did something wrong, please let me know how to correct it and make this router work.
Strengths: beautiful outlook
Weaknesses: compatibility issue, some other problems
Summary:
I had an old netgear 802.11b router for over 5 years so changed to this model for a few days, intended to gain a faster intranet. The linksys is a famous brand and this model looks beautiful. That's why I choose it. But it turned to kind of annoying from that moment ... 1) It doesn't work fine with my linksys pap2 VOIP box. I can hardly hear others but they can hear me clearly. The VOIP service provider can't solve the problem. So I put the old netgear router back, connect the VOIP box and this router to the netgear as a workaround. In this way, I can use my VOIP phone with no problem and gain 802.11n intranet connection. But... 2) It keeps dropping the connection. I have 3 computers, 1 MacBook Pro, 2 PCs. They all have this problem. I tried to disable/enable NICs, manually release/renew IPs, even reboot my computers but nothing works. Reset the router does the trick. But I hate to reset it every 1-2 days. And... 3) The file sharing is kind of slow. I have a 8GB kingston USB key attached to the router and some music on it. Create the sharing folder is a painful job since the GUI and process are not intuitive (doesn't make sense somehow). After that, mount the sharing folder on computer is fine, play music is fine. But sometimes it suddenly stopped transferring the stream and the media player hung there or stopped. (Actually I myself didn't have this experience. It's my wife who played the baby music everyday reported to me.)
4) I tried to upgrade the firmware, twice. The first time hung there with no response for 24 hours. Guess my browser session had died already so asked around on the linksys support forum. Then I tried the second time and it worked. Finally I brought this router back to NCIX. They tested it carefully, then told me nothing wrong with the router and I couldn't return it since it had been more than 15 days. But I can't use it anyway. So the store manager helped to return it with 15% deducted. Well, that's the policy, fair enough. Just I don't trust linksys from now on...
Browsing the support forum of Linksys, I was asking myself: is Linksys good or not?

Thursday, September 17, 2009

How to make %date% compatible in DOS shell?

I have to create a shell script running in a DOS command on Windows 2003 Server. I need to log a time stamp as text string and parse it. Thanks google, I found a solution like this.

However, the output of DOS command echo %date% looks not compatible between 2 Windows 2003 server: it's Thu 09/17/2009 on one box and 09/17/2009 Thu on another one.

Finally I figured out a CHCP command should be called to set the active code page number. It's usage is:

CHCP [nnn]

nnn Specifies a code page number.
Type CHCP without a parameter to display the active code page number.

A test result is:
in code page 437, the output will be Thu 09/17/2009
in code page 936, the output will be 09/17/2009 Thu

So we know the trick now... :)

Wednesday, June 10, 2009

Code to get a menu item in Qt

There is no easy way to get a menu item in Qt, since its menu structure is something like:
QMenuBar->QAction->QMenu->QAction... So I wrote a piece of code to retrieve certain menu item with its label.

Suppose there's a menu structure [Tools|QA Tools|Memory Monitor], the usage will be something like this (notice that the "&" is required if you have shortcuts defined) :
QStringList path;
path << "&Tools" << "&QA Tools" << "&Memory Monitor"; searchMenuItem(path);
The real code is here:




QAction* MainWindow::searchMenuItem(QAction* submenu, QStringList& path, int layer)
{
QAction* target = NULL;

if(submenu->text() == path[layer]){
target = submenu;
if(path.count() > layer+1){
target = searchMenuItem(target, path, layer+1);
}
}else{
QMenu* menu = submenu->menu();
QList actions = menu->actions();
foreach(QAction* act, actions){
if(act->text() == path[layer]){
target = act;
if(path.count() > layer+1){ //need to go deep
target = searchMenuItem(act, path, layer+1);
}
break;
}else{
// "ignore action ";
}
}
}

return target;
}

QAction* MainWindow::searchMenuItem(QStringList path)
{
if(!path.count()){
return NULL;
}

QAction* target = NULL;

QMenuBar* menus = this->menuBar();
Q_ASSERT(menus);
if(menus){
QList actions = menus->actions();
int i=0;
int layer = 0;

QString mainMenuLabel = path[0];

foreach(QAction* act, actions){
if(act->text() == mainMenuLabel){ //found 1st level menu item
target = act;
if(path.count() > layer+1){ //need to go deep
target = searchMenuItem(act, path, layer+1);
}
break;
}else{
// "ignore action ";
}
}
}
return target;
}


Friday, March 27, 2009

Vim: line number trick

I have 89 line of code and would like to add the line number in it. E.g., change
hashImages.insert("CPE_GRAY_POWERLINE_NORMAL",

into:
hashImages.insert("CPE_GRAY_POWERLINE_NORMAL", mImageList[0]);
till:
hashImages.insert("SUBSTATION_YELLOW_ANY_COLLAPSED", mImageList[88]);

A vim trick to do this is:
g/^/exe ":s/$/mImageList[".line(".")."]);"


I got the idea from here.

Friday, February 06, 2009

Make CVS service available in pserver mode

This process applied on Fedora.

1. Create a CVS repository, suppose the location is /home/cvs and configuration file will be /home/cvs/CVSROOT/config.

2. Edit /etc/services file to allow tcp/udp port 2401.
cvspserver 2401/tcp # CVS client/server operations
cvspserver 2401/udp # CVS client/server operations
cvsup 5999/tcp CVSup # CVSup file transfer/John Polstra/FreeBSD
cvsup 5999/udp CVSup # CVSup file transfer/John Polstra/FreeBSD
ssm-cvs 2477/tcp # SecurSight Certificate Valifation Service
ssm-cvs 2477/udp # SecurSight Certificate Valifation Service
Well, the first 2 lines should be enough.

3. Edit /etc/xinetd.d/cvs file to enable the CVS pserver.
[root@host]# cat /etc/xinetd.d/cvs
service cvspserver
{
disable = no
port = 2401
socket_type = stream
protocol = tcp
wait = no
user = root
passenv = PATH
server = /usr/bin/cvs
env = HOME=/home/cvs
server_args = -f --allow-root=/home/cvs pserver
}
4. Restart xinetd by running "/etc/init.d/xinetd restart".

5. Edit /etc/sysconfig/iptables to allow network packages pass through port 2401. Notice that the order of the rules is important.
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2401 -j ACCEPT
6. If necessary, run "/usr/sbin/setenforce 0" to put SELinux to Permissive mode. See "man setenforce" for details. Or edit the /etc/selinux/config file to persist the change.

7. When necessary, create a /home/cvs/CVSROOT/passwd file to authenticate user logins. Details will be available in CVS document.

That's probably all necessary steps.

References:
[1] http://forums.fedoraforum.org/archive/index.php/t-54342.html
[2] http://kelvinchufei.blogspot.com/2007/03/how-to-setup-cvs-server-on-fedora-core.html
[3] http://www.mail-archive.com/info-cvs@nongnu.org/msg02106.html
[4] http://ximbiot.com/cvs/manual/cvs-1.11.23/cvs_18.html#SEC195

Friday, January 23, 2009

How to iSync Nokia 3500c with iSync Bluetooth?

Well, the tip comes from Apple forum.

Generally speaking, hacking the plugins of iSync works for most phone models. My comment is in the bottom: (It's strange that it thought I'm on a PowerBook running 10.5.6...)

Hi,

Thanks for the helpful tip. I just made iSync work with my Nokia 3500c. Somebody who had tried this model but failed please try this:

1. Keep your phone name identical. If the phone is discovered as 3500 (BlueTooth), then use 3500 in the plist file, and if it's set to 3500c, then use 3500c in plist file.

2. Also replace 6131 with 3500(c) in the Info.plist, which is in the upper level of that folder.

3. If iSync can't connect to your 3500c, just use BlueTooth browser to read the file on device, then try again with iSync. At least it works for me. Good Luck!

Again, thanks for sharing!

Calvin

PowerBook Mac OS X (10.5.6)

Sunday, November 23, 2008

Is my computer 64-bit support?

Well, one thing is when we're talking about 64bits system, actually we are talking about 2 separate things: 64-bit hardware support and 64-bit OS support.

In my understanding, if you can see 4GB or more memory in your system profile, then you have a 64-bit computer. (Whatever OS you use, there should be some system utils can help you to monitor the system status in runtime, e.g., system monitor for mac/u*x/, task manager for Windowz, etc.)

You may not really feel how 64-bit benefits you. But at least it's compatible with most of your current applications so you don't need to pay extra money to get the 64-bit edition for them.

Want to know more about 64-bit? Take a few minutes to read the following links:
- What kind of performance increase can I expect in going from 32-bit to 64-bit Stata?
- First Look: Leopard first looks: 64-bit support
- Is Leopard truly 64-bit?