2010-06-03

政府部門過去3年『僅』發生一宗電腦病毒感染事故

Am730@6月3日


各位有機會做過政府IT Projects的朋友,你相信嗎?

2010-04-17

My Facebook Friends' Profile

My original aim to us Facebook is to make reunion to my old school-mates and friends. It works (though I find some of my friends are very reluctant to open a Facebook account).

Now, I nearly log on Facebook every day. I find that my friends' activities are quite "strange":

- a few (less than 10%) are very active and makes postings every day
- many behave like a whale (surfacing to water a moment, makes comments) and disappear for months
- half of them actively play FB games (though I never try one)

Somehow, to my disappointment, I find that the posting on FB is just on acquaintance level and the communication level is very superficial.

2010-04-07

Creating Scrolling Banner using Gimp

This is my second Gimp script. (The first is 'Gimp Polaroid Filter' published in Dec 2009

Why I write this second script is triggered by my another very recent blog 'Scrolling Banner using CSS', in which I mentioned I have previously used animated GIF to give scrolling banner effect.

Yes, creating animated GIF is very tedious previously. But I can write Gimp Script-fu. Why not automate the process? So, I write my second Gimp script using the Scheme language.

Script filename: scroller.scm (the zipped form can be downloaded from here

Installation Steps: In my Windows environment, you can simply unzip the file and move it to 'C:\Program Files\Gimp-2.0\share\gimp\2.0\scripts'

Example of using the script:

I first create a new image with a 'Hello' text. The new script is accessible via Filter | Animation | Scroller.



In the screen dump above, you can see the Scroller item. But it is still dimmed because Gimp does not like the text layer. You need to flatten the image first.



The Scroller Script-Fu dialogue has the following options:

  • Work on Copy: If checked, the script will duplicate the image file so that you think it is safer. Anyway, even you do not check this box, you can still use Gimp's undo feature to roll back
  • Scrolling Vertical: If unchecked, the scrolling direction will be horizontal
  • Scrolling Up /Left: If unchecked, the scrolling direction will be scrolling down or right
  • Flatten image: This check box is useful in case your image has multiple layers before



After exaction of the script, you can see Gimp has created many layers (as down in the Layer Dock above



You can use Gimp's Playback feature to preview the effect as in the above menu.



If you are satisfied with the result, you can export the result to a GIF file. Please remember to select 'Save as Animation' (highlighted option)



For the frame disposal option, I recommend to select 'One frame per layer (replace) because in my script, each new layer is a full size layer. I find the delay per frame at 100 ms is usually acceptable. (By the way, sending a too low value may not be effective in many web browsers).

The following is final result (displayed as GIF)

IT consumer or IT producer

Sometime ago, I read an article on notebook PC product positioning. The product manager mentioned something like they have a series of notebook PC's for a wide spectrum of users - from consumers to producers. They think IT consumers takes activities like web surfing, video watching etc, while IT producers need more powerful PC for content generation etc etc.

I cannot totally agree with this simple demarcation because I think some gamers' PC configurations are even more powerful than some servers nowadays (e.g. in terms of graphical processing power, Hard disk capacity, etc) and they are still though at consumer - am I right?

But this division of consumer vs. producer let me recall my old memories of economy classes. Consumer and Producers only appears in different context. For example:
A factory worker of course is a producer in the conventional context. But during his/her course of manufacturing, he/she will also consume some raw materials, although we can argue that the 'net' economic value of his final product should be greater than the raw materials.

From another point of view, a factory worker, after taking his salary, will consume on food, entertainment and other services, which are provided by other so caller producers.

Okay, back to the IT world. In fact, I find actually the majority of the users are just consumers. Take Facebook as example. Facebook is a collaboration platform, in which users should contribute the contents symmetrically. However, in my groups of friends, more than 80% the content generated are created by less than 20% of my friends (so-called 80-20 rule). I also found that many of my friends has logged on (from the on-line status) but never says a word on the wall or comment other's status.

I have also an IT acquaintance, who is very good at IT skills, never joined any forum, Facebook groups etc. He will visit forums every night to see others' postings and blogs. He just remains as a silent user! He has many excuses - web security, political audit, etc etc. But I just see these are excuses.

2010-04-05

Scrolling Banner using CSS

I used to create animated GIF for scrolling web banners. However, this is very time-consuming.

Yes, I know there are the following alternatives:

  • commercial GIF creator with canned animation effect (but I do not want to pay)
  • free JavaScripts using CSS (My personal principle is "Simple is beautiful and while my understanding on the complicated codes is limited and I cannot be sure the compatibility of various browser versions. A final word, I do not like a white-out effect, which is a limitation I observe in many, if not all, of these JavaScripts.)

Therefore I start to resort to CSS and JavaScript.

My aim is very simple:
  • - the scrolling banner can be in either vertical or horizontal direction
  • - the codes (CSS or JavaScript) should be in a few lines only
  • - the scrolling should be repeating and there is no blank instance

I nearly forgot to tell one limitation of my solutions is that the banner content is in graphical (i.e. not text) format.

Implementation Procedure
(1) Create a graphical banner. My preference is GIF format because its lossless pixel compression (though color depth compression is lossy - but this is not a big problem because the banner is more poster like and should have not many colors.). Another advantage of GIF is its support of transparent color.

(2) In your html codes, insert a <div> like
<div id="'scroll_div'" style="display: block; width: 400px; height: 20px; background: url(banner.gif) repeat-y 0 0px;"></div>
Remarks:
  • scroll_div is the DIV id for subsequent JavaScript manipulation
  • width and height are the associated dimension of the graphical banner
  • banner.gif is the filename of the graphical banner
  • repeat-y: this attribute is very important, because, as I said before, I like the banners to scroll with continuous repeating pattern.

(3) Create the following JavaScripts
var cur_ypos;
var div_height;
function init_scroll(){
cur_ypos = 0;
div_height = parseInt(document.getElementById("scroll_div").style.height);
div_bgr_pos = document.getElementById("scroll_div").style.backgroundPosition;
window.setInterval('scroll_banner()', 150);
}
function scroll_banner() {
cur_ypos++;
if (cur_ypos == div_height) cur_ypos = 0;
document.getElementById("scroll_div").style.backgroundPosition = '0 -' + cur_ypos + 'px';
}
Remarks:
  • The variable div_height is just implemented for the sake of efficiency because I do not want to evaluate the division height on each call
  • The key scrolling mechanism is to modify the CSS vertical background-position by one pixel
  • The scrolling speed can be modified by changing the timer value (the example here is 150 mill-seconds). Please note that there is no point to set a too small values because most JavaScript implementation cannot afford a too short timer.

(4) Start the script using the Body onload
<body onload="init_scroll();">

Demonstration:
Sorry that I cannot demonstrate the effect in Blogspot because I find I cannot manipulate ad hoc JavaScript in the Blogspot environment. So, I use again animinated GIF for demonstration:

2010-04-03

大師,點解我每次感冒…我都會咳?

這個成藥廣告,是繼《你值得擁有》(見我另一編Blog)我最覺得反感的!由於主角引用宿命論云云,所以每次在電視看到這個廣告,我都會自己加插以下旁白:

大師,點解我每天吃飽飯後,都要上廁所?
點解我心情緊張,都會手心出汗?
點解我每次消化不良,都要放屁?
等等…
大師,這是不是宿命呀?

人就是這樣,對於一些生命常態,但自己主觀不能接受的,就抱怨是宿命,將自己在事件上的角色和責任抹掉。

相反,對於一些自己「有利」的現象,就歸功於自己的力量。

「宿命」真是這樣的嗎?

2010-02-25

密底算盤

見2010年2月25日的都市日報

2010-02-15

塔勒布 在 【黑天鵝】的名句

舊年(2009)在深圳書城買了本"THE BLACK SWAN: The Impact of the Highly Improbable"中譯本,發覺題材非常新鮮,有很多發人心醒的內容。但由於是中譯本,始終不知原著的語句。

上星期,終於在圖書館借到原英文本(2007年版),現節錄一些我覺得非常有意思的內容,和大家分享:

Page xviii
Black Swan is an event with the following three attributes:

  1. Rarity – It lies outside the realm of regular expectations
  2. Extreme Impact – It carries an extreme impact
  3. Retrospective predictability – Human nature makes us concoct explanations for its occurrence after the fact, making it explainable and predictable.
Page xix
Black Swan logic makes what you don't know far more relevant than what you do know.

Why does reading the newspaper actually decrease our knowledge of the world?

Life is the cumulative effect of a handful of significant shocks.

Page xx
Our inability to predict in environments subjected to the Black Swan, coupled with a general lack of the awareness of this stage of affairs, means that certain professionals, while believing they are experts, are in fact not.

Page xxvii
You need a story to displace a story.

Ideas comes and go, stories stay.


Page 3
History doesn't crawl; it jumps.

Page 8
The human mind suffers from three ailments as it comes into contact with history, what I call the triplets of opacity. They are:

  1. the illusion of understanding, or how everyone thinks he knows what is going on in a world that is more complicated (or random) then the realize;
  2. the retrospective distortion, or how we can assess matters only after the fact, as if they were in a rearview mirror (history seems clearer and more organized in history books than in empirical reality); and
  3. the curse of learning - the overvaluation of factual information and the handicap of authoritative and learned people, particularly when they create categories - when they "Platonifiy."
Page 10
These events were unexplainable, but intelligent people thought they were capable of providing convincing explanations for them – after the fact. Furthermore, the more intelligent the person, the better sounding the explanation.

Page 21
(Financial) independence is person-specific: I have always taken aback at the high number of people in whom an astonishingly high income led to additional sycophancy as they became more dependent on their clients and employers and more addicted to making even more money.

Page 25
Publishers now have a theory that "truck drivers who read books do not read books written for truck drivers"
香港有沒有這些出版商呢?

Page 40
The uberphilosopher Bertrand Russell presents a particularly toxic variant of my surprise jolt in his illustration of what people in his line of business call the Problem of Induction.

Page 54
An acronym used in the medical literature is NED, which stands for No Evidence of Disease. There is no such thing as END, Evidence of No Disease. Yet my experience discussing this matter with plenty of doctors even those who publish papers on their results, is that many slip into the round-trip fallacy during conversation.

Page 59 footnote
Once your mind is inhabited with a certain view of the world, you will tend to only consider instances proving you to be right. Paradoxically, the more information you have , the more justified you will feel in your views.

Page 80
One death is a tragedy; a million is a statistics.

Page 96
Some people are like the turkey, exposed to a major blowup without being aware of it, while others play reverse turkey, prepared for big events that might surprise others.

Page 111
Recall the confirmation fallacy: governments are great at telling you what they did, but not what they did not do. In fact, they engage in what can be labeled as phony "philanthropy," the activity of helping people in a visual and sensational way without taking into account the unseen cemetery of invisible consequences.
咁似香港D區議員!

Page 112
Our neglect of silent evidence kills people daily. Assume that a drug saves many people from a potentially dangerous ailment, but runs the risk of killing a few, with a net benefit to society. Would a doctor prescribe it? He has no incentive to do so... A life saved is a statistics; a person hurt is an anecdote.

Page 120
My biggest problem with the educational system lies precisely in that forces students to squeeze explanations out of subject matters and shames them for withholding judgment, for uttering that "I don't know."

Page 152
We humans are the victims of an asymmetry in the perception of random events. We attribute our success to our skills, and out failures to external events outside our control, namely to randomness.

Page 181
The only criticism one might have of Hayek is that he makes a hard and qualitative distinction between social sciences and physics. He shows that the methods of physics do not translate to its social science siblings, and he blames the engineering-oriented mentality for this. But he was writing at the time when physics, the queen of sciences, seemed to zoom into our world. It turns out that even the natural sciences are far more complicated than that. He was right about the social sciences, he is certainly right in trusting hard scientists more than social theorizers, but what he said about the weaknesses of social knowledge applies to all knowledge. All knowledge.

Page 198
Randomness, in the end, is just unknowledge. The world is opaque and appearances fool us.
好有佛理!

Page 222
Luck is the grand equalizer, because almost everyone can benefit from it.

Page 225 footnote
The giant firm J.P. Morgan put the entire world at risk by introducing in the nineties RiskMetrics, a phony method aiming at managing people's risk, causing the generalized use of the ludic fallacy.

Page 226
True, we now have fewer failures, but when they occur...I shiver at the thought. I rephrase here: we will have fewer but more severe crises. The rarer the event, the less we know about its odds. It means that we know less and less about the possibilities of a crisis.

希望大家有同感!

2010-01-28

不是小兒科的數字

近期在新聞報導常常聽到一些很大的數字,如多少百億興建高鐵,金融海嘯有關的天文數字等,令我覺得其實有多少人知道其真正「份量」?

有次在街上,聽到一母親教她的兒子數十進制:個、十、百、千、萬、十萬、百萬、千萬、億萬...我覺得愕然,為何會由千萬特跳到億萬呢?難怪現在的小孩不識理財了,因為連數數字也不懂!

我小學時學的,中國單位以萬為分位,西方則以千為分位,所以:

千萬以後是:萬萬(即億),十億,百億、千億、萬億、十萬億,百萬億、千萬億...

講起數數字,順便講一講「兆」。

中學時學十進制,知道兆是一百萬,所以電台FM頻道的兆赫是百萬Hertz。

但是台灣仍治用兆是萬億(即1012)(見維基百科 )

新聞報導員沒有加上附註,容易做成混亂!

2009-12-20

Gimp Polaroid Filter

To make my photo posting on my blog more interesting, I have usually resorted to use Gimp's "Round Corner" Script-Fu. I like this script because it drops a shadow so that my photos seems pop up from the background.

Later on, I encountered several blogs on internet like:
Gimp Making Border (in Chinese) (link)
Turn a digital photo into Polaroid with Gimp (link)

The idea is to make a digital photo resemble a photo-print and make it lay on a surface with some irregular shadows.

I very like this idea but find the steps clumsy if I have repeatedly do photo postings on my blog.

So... I start to write my first Gimp script!

Most of the Gimp macros are written in Script-Fu. It is said that it is a language called Scheme (however, I have learned Lisp before and I still cannot differentiate Scheme from Lisp because of their similarity!)

I hate Lisp because the proliferation of brackets and I have difficulties to make the opening and closing brackets match.

Anyway, after a one-day tutorial on learning the Script-Fu, my first Gimp script is born. It works as follows:
  • it adds a border to similar the print paper
  • it creates a shadow and then use the perspective effect to make the shadow irregular
  • it finally adds a background to match my blog background
I have tested my script in my two only Gimp environments, viz. version 2.2.17 (on Win98SE) and 2.6.2 (on Win XPP)

Installation steps:
  • download the script (link)
  • put it to the script directory (in my Windows environment, it is C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts)

Execution steps:

- open a photo, like


- run the script, which will solicit the following parameters


- the result is as follows: