La Vita è Bella
Friday, July 11, 2008
Don't try to fool compilers
There's a macro in ACE to eliminate a compiler warning:
379 // Some compilers complain about "statement with no effect" with (a).
380 // This eliminates the warnings, and no code is generated for the null
381 // conditional statement. @note that may only be true if -O is enabled,
382 // such as with GreenHills (ghs) 1.8.8.
383 # define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0)
But when I use this macro, gcc 4.3 will complain:
warning: the address of ‘a’ will never be NULL
tags: dev, compiler, gcc, warning, ace
12:25:52 by fishy - dev - Permanent Link
Monday, May 26, 2008
Miao cancelled
I've started the Miao project one year ago, aim to build a smart pinyin input method for Mac. But I just got a new job 2 weeks after I started this project. This is quite a busy year, and I haven't really wrote much code for it.
A month ago Yong Sun from Sun begin to port SunPinyin to Mac, and now it's more than just works. I'm satisfied with the Mac port and use it everyday. As the Miao project is scratching my own itch, and I'm not itchy anymore, I should call it a day.
Sorry for anyone who waits for Miao, but I'm not going to reinvent the wheel.
tags: miao, pinyin, input, method, mac, osx, sunpinyin
20:29:46 by fishy - opensource - Permanent Link
Wednesday, May 07, 2008
Some facts about Apple Time Capsule performance
On the Mac side, the initial backup takes me about 6 hours to backup 126GB data, by ethernet cable, so the speed is about 20GB/hr.
The writing speed via 802.11n wireless is as below:
fishy@Makelele:~/Video$ dd if=Pixar\ -\ Lifted.wmv of=/Volumes/Cacapa-1/foo.wmv
91582+1 records in
91582+1 records out
46890385 bytes transferred in 15.478993 secs (3029292 bytes/sec)
That's about 3MB/s. So I think the speed on Mac is acceptable, but it should be faster.
On the Linux side, I use Debian Lenny, with samba, afpfs-ng and a 100M ethernet cable (my Linux machine didn't come with a Gigabit ethernet port). The facts are:
Writing via AFP:
root@deBoer:~# dd if=prog03.mdb of=foo/foo.mdb
8736+0 records in
8736+0 records out
4472832 bytes (4.5 MB) copied, 6.89061 s, 649 kB/s
Writing via SMB:
root@deBoer:~# dd if=prog03.mdb of=/media/cacapa/bar.mdb
8736+0 records in
8736+0 records out
4472832 bytes (4.5 MB) copied, 6.57683 s, 680 kB/s
Reading via AFP:
root@deBoer:~# dd if=foo/bar.mdb of=bar.mdb
8736+0 records in
8736+0 records out
4472832 bytes (4.5 MB) copied, 8.87068 s, 504 kB/s
Reading via SMB:
root@deBoer:~# dd if=/media/cacapa/foo.mdb of=foo.mdb
8736+0 records in
8736+0 records out
4472832 bytes (4.5 MB) copied, 0.919922 s, 4.9 MB/s
So the conclusion is that, for writing, AFP and SMB are both slow. But for reading, SMB is much much faster than AFP, so you should use SMB to connect a Time Capsule on Linux.
tags: apple, time capsule, performance, test, mac, linux, smb, afp, speed
23:19:25 by fishy - General - Permanent Link
Tuesday, April 29, 2008
Apple Time Capsule hand on
After long waiting, I got one finally.
The box:
Unboxing:
And then working!
And here's a note, the command to limit my 1TB Time Capsule use only 500G for backup (so that I can use the other 500G for other stuffs), according to the comment of this hint:
hdiutil resize -size 500g -shrinkonly /Volumes/path/to/sparsebundle/
But the speed of backup is really really slow, that disappointed me. What a shame! It would be perfect if the backup speed up.
tags: apple, time, capsule, time, machine, mac, osx
20:28:59 by fishy - General - Permanent Link
Monday, April 14, 2008
Flickr Video vs. Youtube
Finally, Video on Flickr!
I've uploaded a test video:
And here's the same video on youtube, to be compared:
So here's the comparison:
- Speed: youtube is much much faster than flickr, anyway, youtube consumed half of California's bandwidth, so it's no surprise.
- Who can upload: everybody, every free users can upload to youtube, but only pro users ($24.95/y) can upload videos to flickr now.
- Geotag: you can geotag your video on flickr, but seems that you can't do it on youtube.
- Original file: you can download the original file of your video in flickr's embed page, so in case you lost your original file, it's a way to get it back.
- Sizes: there's only 1 size on youtube, but many sizes on flickr to embed.
- Group: on flickr, you can group your videos along with your photos, so the photos/videos can be grouped together.
- Privacy control: you can filter viewers with your flickr contacts, as I already have a community on flickr, but not on youtube.
So, from now on, I may move from youtube to flickr, flickr rocks!
tags: youtube, flickr, internet, video
22:03:36 by fishy - General - Permanent Link
Sunday, December 02, 2007
Yet another NP_Trackback hack
I've got an email from my host administrator to warn me that one of my MySQL table consumed lots of system load, and the table is nucleus_trackback.
But I haven't got any "real" trackbacks, so they are all spams, and more accurate, crazy spams, that simply too much to overload my DB.
So I have to wrote this patch to add an option to NP_Trackback: drop blocked trackbacks directly. After enabled, trackbacks that blocked by NP_Trackback (failed spam test or no link) will not be stored into the DB.
tags: nucleus, trackback, patch, spam, db, mysql, php
12:35:40 by fishy - opensource - Permanent Link
Monday, November 19, 2007
AFP versus SMB
I have a Linux file server in my home running Debian Lenny, and I always use SMB for file sharing, it have a very very bad performance. Today I suddenly remember Apple have an AFP protocol, so gave it a try.
I use "apt-cache search afp" to find out that there's a package named "netatalk" can provide AFP file sharing, so install it. But I can only login use guest account, not my system user, from Leopard.
I googled it and found that the problem is: on the Debian side, as a license issue, the Debian package didn't come with SSL support; on the Leopard side, it didn't allow you exchange your password with AFP server without SSL. So the solution is build netatalk yourself, with SSL.
The building steps are described on this blog, and I also disabled atalkd as the author suggested, it caused netatalk to start-up much faster than before.
So finally I got a AFP server for my Mac (compare this icon to the famous BSOD icon for SMB servers in Leopard
):
And as expected, AFP is much much faster than SMB, here's the write test:
For AFP:
fishy@McManaman:~$ dd if=/dev/zero of=/Volumes/Home\ Directory/foo ^C57345+0 records in 57345+0 records out 29360640 bytes (29 MB) copied, 11.0833 s, 2.6 MB/s
And for SMB:
fishy@McManaman:~$ dd if=/dev/zero of=/Volumes/fishy/bar ^C4235+0 records in 4235+0 records out 2168320 bytes (2.2 MB) copied, 10.6889 s, 203 kB/s
I'm impressed!
tags: mac, osx, linux, debian, afp, netatalk, leopard
22:38:32 by fishy - linux - Permanent Link
4 comments - no trackbacks yet - karma: 4 [+/-]
Saturday, October 27, 2007
Gmail IMAP and Date in emails
UPDATE: As in RFC 2822, the format Gmail used is "obsolete", which means although it's not recommended, clients such as Thunderbird should support it.
Finally I've got my Gmail account with IMAP access. I use Thunderbird as the mail client, and find that the "date" of many mails are the time I retrieved them via IMAP, which is incorrect.
These mails including gtalk chat logs and Gmail invitation accepted responses, that means most of the mails are sent/generated by Gmail.
An incorrect date mail have a Date line in the headers like this:
Date: Fri, 1 Dec 2006 05:35:25 -0800 (PST)
And a normal mail have a Date line in the headers like this:
Date: Thu, 21 Dec 2006 19:16:34 +0800
Seems that the problem is, Thunderbird didn't recognize a Date line with a 3-letter timezone description(the "PST" in this example), so it use the date retrieved instead.
As most of mail clients (even Gmail itself) didn't add this timezone description in the Date line while sending a mail, I guess it's Gmail's fault to add it into the chat logs and invitation responses to make it unstandard? Anyone can tell me what's the definition in the RFC?
tags: gmail, imap, thunderbird, date, mail
16:54:37 by fishy - General - Permanent Link
Sunday, September 16, 2007
Patches to make NucleusCMS plugins multi-blog ready
I was struggling to find a good multi-blog system to replace LifeType used on buddie5.com in the past few weeks. I've tried Movable Type but didn't feel satisfy with it. Finally I found that NucleusCMS, which is used here, have good support for multi-blog, so I think it's the solution for me.
Although NucleusCMS itself have good support for multi-blog, as it's mainly used as a single blog system like WordPress, nearly none of the plugins considered the multi-blog situation.
So I made patches for the plugins I used, to make them multi-blog ready.
These patches generally move some option from global to blog, so that every blog can have its own setting. And for some plugins that have an admin area, I also filtered the things it can admin to avoid security risk.
- patch for NP_TrackBack 2.1.0:
- move notify options into blog settings (Notify, NotifyEmail and NoNotifyBlocked)
- show admin area when user is blog admin (copied from NP_Referer 1.0 code
) - in admin area, user can only see/manage the trackbacks in a blog he have admin privilege
- patch for NP_Referrer 1.0.1:
- roll back to 1.0 to show admin area for non-admin users
- in admin area, user can only see/modify the referrers in a blog he have admin privilege
- patch for NP_Calendar: move the locale option into blog option
- patch for NP_RSSItem: move lang, RSSLink and RSSImage option into blog option.
- patch for NP_WeatherReport: move city_name, city_id and unit option into blog option.
tags: nucleus, nucleuscms, plugin, trackback, referrer, calendar, rssitem, weatherreport, patch, multiblog
22:06:35 by fishy - opensource - Permanent Link
9 comments - no trackbacks yet - karma: 6 [+/-]
Tuesday, August 14, 2007
Sync your Lightning with your iCal
I love Thunderbird, so I use Thunderbird + Lightning instead of Mail.app + iCal as my personal schedule and mail solution.
Also it's promised to have a syncing feature, it didn't have now. But I need the ability to sync my schedule with my Palm Treo 680. I can sync my Palm with iCal, so getting the linkage between Lightning and iCal is a good way to do this.
First, I installed the Provider for Google Calendar extension to get the bidirectional access to Google Calendar to Lightning.
Then, I use GCALDaemon to sync my iCal with Google Calendar. It can also sync Google Calendar with Lightning, but Provider for Google Calendar is much better at this.
Now if I add/modify/remove an event in Lightning, Provider for Google Calendar will update my Google Calendar immediately. Later, GCALDaemon will find the update, and update iCal. Now I sync my Palm with my computer, it will get the update.
If I update an event in my Palm, and sync it to iCal, GCALDaemon will update Google Calendar later, and then Lightning will update it later.
So it works.
Make a symbolic link with the ics file of Lightning and iCal may also work, but I can't find the ics file for Lightning
You can subscribe my busy/available status on Google Calendar now
This should also works for Mozilla Sunbird.
tags: lightning, sunbird, google, calendar, palm, ical, sync
21:18:25 by fishy - mac - Permanent Link
3 comments - no trackbacks yet - karma: -9 [+/-]








