Wednesday, November 05, 2014

Flex TextArea problem in DataGrid

Problem

Flex 4 TextArea does not take multi-line entry when used as editor in DataGrid.

Solution

Add editorUsesEnterKey="true" attribute to the column with TextArea editor.


P.S.

The solution is straightforward. But the route to finding this solution kind of proves open source or at least show your customer the source code is very important.

I first suspect the enter key is intercepted by DataGrid, but it appears that keydown event is intercepted by DataGrid before the TextArea. Some Googling with various keyword combination did not turn up anything interesting.

Not sure where to start, I added a itemEditEnd event handler to the DataGrid, and set a breakpoint there. After walking through the stack, I saw the following code segment, and thus the solution above pops out. Now I can simply go to documentation of editorUsedEnterKey and make sure this is what I want.

(Code of interest from DataGrid.as)
    /**
     *  @private
     */
    private function editorKeyDownHandler(event:KeyboardEvent):void
    {
        // ESC just kills the editor, no new data
        if (event.keyCode == Keyboard.ESCAPE)
        {
            endEdit(DataGridEventReason.CANCELLED);
        }
        else if (event.ctrlKey && event.charCode == 46)
        {   // Check for Ctrl-.
            endEdit(DataGridEventReason.CANCELLED);
        }
        else if (event.charCode == Keyboard.ENTER && event.keyCode != 229)
        {
            // multiline editors can take the enter key.
            if (!_editedItemPosition)
                return;

            if (columns[_editedItemPosition.columnIndex].editorUsesEnterKey)
                return;

            // Enter edits the item, moves down a row
            // The 229 keyCode is for IME compatability. When entering an IME expression,
            // the enter key is down, but the keyCode is 229 instead of the enter key code.
            // Thanks to Yukari for this little trick...
            if (endEdit(DataGridEventReason.NEW_ROW) && !dontEdit)
            {
                findNextEnterItemRenderer(event);
                if (focusManager)
                    focusManager.defaultButtonEnabled = false;
            }
        }
    }

Saturday, October 18, 2014

周浴德略传

周浴德略传

南昌 程时旭

周浴德字子畏,南昌市人。其祖父经商,家资殷实。生一子一女,嫌子女单薄。后子生孙八人,孙女二人,子女共十人。老人高兴说:“我家子女,十全其美。今后封荊山(小住宅区)有房出售,我都买,我要谋得封荊山内无杂姓,都是我的子孙姓周的。”
浴德小时,天资聪颖。小学毕业,考入省立一中,一中毕业后,因江西当时无大学,遂携姐夫罗静远去湘北武昌,考入国立武昌商科大学。据他自己说:“我是学数理的脑袋,因数理科少,也只好读商科。”大学毕业后,在南昌医专等校教数学。
一九二八年,民生凋敝,百废待兴,教育也是一样,成立各种职业学校。罗静远任第二职业(商业)学校校长,便聘请周浴德为教员兼教务主任。周浴德因热爱数学,除教商业课程外,还教数学课。他教代数,举例通俗,学生易懂。一次讲数学,讲代数负负得正公式。他站在讲台上像表演似的说:“向后转”马上又说:“再向后转。”这不是负负得正了吗?
一九三七年抗日战争发生,日寇在南昌狂轰滥炸。学校奉命迁新建梅岭去上课。梅岭距南昌市约二十多公里,风景优美,遍山竹子。原来学校在山上竹林里做了旅游的木板房子,正好用作教室兼寝室。但几百学生的生活用水,便成问题。周浴德当时兼总务主任,他在山顶上找到几处有泉水,他便雇竹工把竹子像水管一样接起来,在厨房做一个大木桶储水,供厨房烧饭用。另外又在学生生活区做一个大木桶,供教职员工及学生浣洗物用。
年底,南京沦陷,学校又奉命迁出南昌地区,第二年春季开学,学校决定分迁靖安,安福两地上课,通知了学生随便选地去报到上课。校长罗静远主持福安本校,周浴德负责靖安分校。当时教员去安福的多,去靖安比较少。周浴德要管靖安学校的校务,又要多教课。如数学,高级会计学,统计学,他都要教。为对高级会计学的资金分析,分流动资金分析,运动资金分析,这都是不易讲好的部分,他能分析得很好。一学期后,靖安的分校集中安福,一学期后迁泰和,一学期后又迁兴国。
一九四一年,罗静远奉调离校,由周浴德接替校长。有个别教员多方攻击他,他也不计较,他做事勤勤恳恳,办法多,对学校经费,从不乱用一文。一九四六年周邦道任教育厅长,才离开学校。在这里补充谈一下,周邦道在未接事以前,周浴德思想上也产生一些想法。他写过一封信给我,要我活动一下这个校长。他的理由是:“这个学校(指省立高商)是你的母校,你是中正大学毕业的,你又是高等考试财政金融人员考试及格,又得到中央政治大学毕业文凭。更主要的,现在教育厅长周邦道也是高等考试及格的,听说并同你很要好。”我那时正在天津财务部税务局做罗静远局长的秘书,我将信给罗静远看,罗说:“你不能走。”我也就回了周浴德的信,不活动回江西了。
一九四八年,周浴德任南昌大孚银行经理,一九四九年南昌解放,银行停业。原来省立高商改名为财经学校,聘周浴德为教员,他欣然应聘,担任中专数学教员。但当时政治运动不断,反右后,周浴德被辞退。一九六六年,文化大革命爆发,周浴德与老伴于一九六八年下方新建流湖劳动,一个七十多岁的老人,老伴又双目失明,在农村劳动,连吃饭都困难。其它生产劳动,委实受不了。不久患肝癌于一九七二年逝世,终年七十五岁。临终前他对子女说:“捡骨灰撒在赣江。”子女也按遗嘱这样做了。
周浴德一生尽瘁教育事业,他热爱学生,关心学生,日寇占领南昌,新建后,很多学生断了家庭经济来源,他想尽一切办法来解决。如会写字的学生,找他们写讲义。有些厨房劳动,校内卫生,找家庭困难的学生半工半读,补助伙食费。他的大女,就是由他做主,许配给学生。学生说:“家里断了经济来源,一个钱也没有。”他对学生说:“你们是毕业班的学生,马上由政府分配工作。你们结婚的衣被,都由我办,结婚的酒食,也由我办。”那时学校放暑假,有些学生虽放假,而回家不了。他组织学生每人送五毛钱礼,全部吃酒。酒食上每桌有一鸡一鸭,酒菜很丰富。政府对毕业学生的工作,也不是都有工作分配,他总是向各有关单位联系,让学生能尽量能做到工作。那时江西省政府会计处用了不少学生。罗静远在天津做税务局长,介绍了大批学生去天津工作,有些学生在天津落户,至今还没有回江西。

周浴德对私有财产也看得很轻,他家祖上的房产,在文化大革命时,亲自用书面送给政府。后改革开放,政府落实各项政策,也给了一点钱给他们子女。

Wednesday, December 03, 2008

Hiu Lui Ng

See the story here:
http://www.nytimes.com/2008/08/13/nyregion/13detain.html

This guy is an illegal immigrant with a house and a family (wife and children) in New York. He wasted years of his life in immigration prison and eventually died of cancer in the prison. He is not a criminal, why cannot CIS treat him at least like a criminal? Allow bail-out/probation while the case is pending, and allow out-patient service if this guy is complaining.

Monday, September 29, 2008

700 Billion bailout rejected for the best

In my opinion that rejection of 700 billion bailout is for the best. It it better to wait for 3 months and let the new leadership decide on matters like this. Instead of let someone who only have 100 days in their mind to lead this effort, I'd rather someone who is looking at least 4 years or even 8 years ahead to do it.

Remember the pardons and commutations signed on final day in office by the former president Bill Clinton? It is very hard to imagine that you can get any responsible long term plan from person who is gonna leave office in a little more than 100 days.

In sports, it is so much easier to use illegal drugs which can give you an edge for a few hours or even a few days. Which in long term, can put you in worse shape. This bailout may be just something like that. It will make some one looks good in the next 100 days, but who cares what happens afterwards? If the economy is going down mid year 2009, it may even make the current leadership look good. Isn't it?

The pitch:

Because the government would be purchasing troubled assets and selling them once the market recovers, it is likely that many of the assets would go up in value over time. Ultimately, we expect that much - if not all - of the tax dollars we invest will be paid back.
The questions:
  1. Who is going to benefit from this without out all the ifs and expects?
  2. Who is going to pay for this? The government or more like the people?
  3. If I lost my car, and I don't have insurance. Will US government buy the right of my car, and hoping that one day my car maybe found, and the tax dollars "may" be paid back?
  4. And there is also the question whether a leadership that rushes to a war looking for "WMD" based on misinformation is capable to get it right this time?

Monday, December 03, 2007

Fix a Sony Trinitron TV for 75 cents

Even one week after the TV is fixed, I still cannot believe that I did it: fixed my TV for 75 cents. Of course, I have to do it myself.

My TV experienced a sudden death this summer. It was working perfectly. Then one day, it is just dead. Does not respond to anything, and there are no lights blinking.

After 6 months, and feeling the urge to watch some TV programs over the holiday season, I decided to try to replace the fuse and see if it works. So, I opened the back-cover, and found a fuse right behind the point where the power cord enters the box. I found the fuse is indeed blown. According to the markings on the fuse, it is 6.3A, 250V, slow-blow type. I went to RadioShack, where the sales person found a replacement within 30 seconds. Yes! Just like that, he squinted at the fuse I brought in, and walk right to a drawer to extract a package. It's a package of 4 fuses costing $2.99. I went home and put one new fuse (75¢) into the fuse holder, and you know the rest of the story.

Warning:
Residual charges in the TV can cause serious injury to you.
Static charge on your body can also cause serious injury to your TV.
A blown fuse can be caused by fault in the TV's circuit. In which case, installing a new fuse can cause additional damages.
If the new fuse blows shortly after installation. Stop! And find a professional to look at your TV (if you think it is worth the effort and $$$$).
This article does not in anyway suggest you should open the back-cover of a TV by yourself.

More for those who are interested:
The fuse listed on RadioShack's website:
http://www.radioshack.com/product/index.jsp?productId=2102764&cp=&sr=1&origkw=slow+blow+fuse&kw=slow+blow+fuse&parentPage=search

The original fuse is a "BUSS GCD", "T6.3AL250V", 5×20 mm, slow-blow, glass fuse (see the picture below).
Sony Fuse T6.3AL250V BUSS GCD

Thursday, June 28, 2007

Millionaire Wannabes

Want to be a millionaire?

Here are a few web sites or blogs that I find useful:

Yahoo Finance: http://finance.yahoo.com
This is the absolute number 1 site for finance 101, and stock research. I learned the basics of 401K, stock trade, bond, ... all from its "Education" section. And, I read finance news, check stock prices on this web site every day. When Google finance was first out a year or two ago, I was attracted to that web site for a few weeks mostly for its flashy charts and auto-fill text boxes. But Yahoo provides more solid finance data, powerful stock screening tools, convenient export functions and plenty of educational material. Now that Yahoo finance also has flash based chart, I never look at Google finance again.

Personal Finance Blog: http://pfblog.com
On his journey to a millionaire by the age of 40, the writer decided to share some of his financial secrets with the whole world. You can see detailed monthly, and annual net-worth break-down (sometimes down to single stocks he owns). Also there are real-life experiences with many financial products, tax strategy for people working in foreign country, tips for For-Sale-By-Owner (FSBO), and more. These are all first hand experience, not like the usual articles by the so-caller experts who has never done FSBO or work outside of US. This blog is simply fabulous. The first time I found this blog, I spent a whole week-end (48 hours) to read each and every post he's written, and took several action items the following week.

Millionaires in the Making: http://millionaires.blogs.cnnmoney.com/
A blog written by David Ellis, a CNN staff writer. Are you a millionaire in the making? If you answer yes, the writer might want to hear your story and post it on the blog.
Want to be a millionaire? Middle class? In your 30s or 40s? Has kids? Then you might feel related to the stories posted on this blog.

Thursday, May 24, 2007

Moving from Yahoo! Photos to Picasa

"Heard the News? Yahoo! Photos will be closing this fall...". This is the headline on Yahoo! Photos. Yahoo provided a few alternatives such as Flickr, Kodak Gallery, Shutterfly, Snapfish and Photobucket. After some investigation, I decided to used Picasa from Google instead. Below are pros and cons I found about Picasa.

Pros:
1. Direct support for blogger, you can blog about a picture and view pictures in blog posts directly in Picasa Web Album;
2. Picasa, a 5MB installation is a fantastic free photo editing and organizing software for amateurs like myself;
3. "Hello" photo sharing service;
4. Support image formats: JPG, PNG, GIF, PSD, TIF, RAW ...;
5. Support video formats: AVI, ...;
5. Web album allow setup of Public and Private albums;

Cons:
1. Available only to Windows 2000 and above (Linux version is available in Google Labs);
2. Web album does not seems to support download of original pictures (original files can be transferred using P2P);