Wednesday, May 20, 2015

國際新聞:英國總理 David Cameron 在女王演講中,揭露對極端主義活動的新限制措施




國際新聞:英國總理 David Cameron 在女王演講中,揭露對極端主義活動的新限制措施

言論自由與國家安全中間的這條線真的不容易劃。

Q1. 極端主義如何定義?誰有權決定?
Q2. 怎樣界定極端主義與言論自由的界線?
Q3. 是否真的有國家存續的問題?

我們搬凳子看英國這個老牌民主國家,在愛爾蘭獨立運動的內戰多年之後,如何處理眼前的困境。
以及對言論自由的影響。

http://www.theguardian.com/uk-news/2015/may/13/counter-terrorism-bill-extremism-disruption-orders-david-cameron

新聞評論:柯P翻臉啦!北市府宣布:大巨蛋停工

柯P翻臉啦!北市府宣布:大巨蛋停工


大巨蛋興建前一定有做環境影響評估,而且捷運以及古蹟應該都有列入評估。關於現況,我一些疑惑與想法:

1. 為何興建到一半會出現比原本評估還要嚴重的問題?

2. 假設,不存在這些問題的修正辦法(或是修正的辦法昂貴或是修正的辦法極為昂貴),今天捷運沒有安全問題,那麼古蹟與大巨蛋誰重要?

3. 續 2,假設,那麼,捷運的妥善性與數百億的投資之間,誰重要?

第一題的答案我猜想北市府與遠雄應該都清楚,也有很多專業的評估,只是是否有追溯到根源,避免再次發生的後續追蹤呢?

第二題是假設性的問題。答案其實由價值觀決定,如果人民的價值觀以經濟利益為主要取向,那答案就昭然若揭。同時,我們也知道,以後當錢遇到古蹟時,會有什麼結果。

第三題也是假設性的問題,在現今的社會大部分的人會認同,捷運是個高運量的運輸系統,有安全問題,當然是不用談。這其實也反映出,大多數人已經認可,人的性命比錢重要。不過,如果財團老闆不坐捷運又剛好沒有同理心,那麼如果他的工程團隊認為出事的機率低,他當然會覺得拼一拼無妨。


Tuesday, September 18, 2012

台灣的困境


首先道歉, 小弟的文筆不好, 邏輯也不順, 寫這篇文章只是希望有幾個人可以看到, 可以想想, 如果影響到一些人, 就已經算是功德圓滿了。

--- 正片開始 ---

對於台灣的現況, 我的想法是, 台灣的現況不是一個可以用幾張 A4 作答的問答題. 這是一個陷入負循環中的一個環境, 要想把它轉正很困難, 絕不是幾個政策, 換幾個人, 幾年可以改變的.

在這裡, 每個環節都有它的問題, 而每個問題都貢獻了現況, 每個問題都不一樣, 解法也都不一樣, 因此雖然有許許多多的debate試著想要幫助這片土地上的人們, 但還沒有什麼共識與結論.

對於全部的問題, 我試著思考, 發現我的腦袋不夠, 沒辦法理解那麼多東西, 那麼多的專業. 因此, 我想找一個簡單通俗的方式, 讓大家了解每個人都在這條船上, 舵也是每個人共同掌握的, 每個人的一點點心力貢獻, 就可以完全改變現況, 也許船還是很慢, 但至少方向會對.

前面提到了, 不同的問題有不同的處理方法, 但這樣的討論無窮無盡, 而且治標不治本. 我對於台灣的問題的歸納, 只有兩個字 "鬆了".

在這個小小的島上

學生, 老師, 公務員, 上班族, 管理階層, 大老闆, 軍人, 商人, 政客, ...各行各業

"""大家都有一個權利, 就是不要讓自己成為整個環節中的鬆了的螺絲."""

只舉學生為例, 自己或身邊的同學, 看到這篇文的你, 看過多少次考試作弊? 做弊的學生本身當然有些責任, 但環境是更大的問題, 學生會作弊可能是受到家長的不合理期望, 同儕的壓力, 老師的期望..., 事實上, 現在每個環節都在採用這樣的思考模式, 覺得因為別人 (環境) 如何如何, 所以自己沒得選擇.

當彭明輝教授 (我個人很尊敬他) 指出政府的對於研究的管理方式不對時, 真是一針見血, 但告訴政府 "你這樣做不對, 應該這樣做才對" 是沒辦法解決真正的問題的, 因為真正的問題是執行者的心態, 他們的心態是 "我只是個公務員, 我只想準時下班", "我是個民主政治中的政治人物, 選票才是最重要的, 所以我口頭得應付得很漂亮, 但還是得顧選票", 只要這些鬆掉了的心態沒有改變, 再多的金玉良言也改變不了這片土地.

幾乎每個環節你都可以找到這種由於舵已經不正, 因此船怎麼開都不會直的現象。因為列舉太多只會更加的自曝其短 (畢竟所知不多), 所以, 其它的就省下來不一一列舉了。

請讓我直接跳到結論: 要讓這片土地改變, 我們真正的目標應該是心。

我想說的是, 改變必須由人的內心開始 (我猜想這時一定有人會覺得有個屁用, 然後就關掉browser), 每個人的一點點改變都不會帶來太大的影響, 但如果多數人的心態調整過來了, 這艘船一定不會離航道太遠的。如果每個人都願意相信這一點點改變雖然輕如鴻毛, 兩千三百萬根鴻毛在一起也不會太輕的!

每個人的心都將自己的本份視為理所當然, 把工作時的發條上緊, 願意多動腦筋把工作 (本份) 做好。如果, 每個做老闆的都認真思考將公司航向更寬廣的藍海而不是汲汲營營的榨取員工剩餘價值, 每個工務員都能視民如親, 每個員工都能將公司資源與上班時間視為自己私人時間一樣珍惜, 如果每個雙親都能付出時間學習做個好雙親, 每個學生都能誠實面對自己的學習成果, 老師都不放棄學科成績不好的學生, ...

最後, 請千萬不要誤會, 由 "鬆了" 變 "緊" 完全沒有叫大家卯起來上班的意思, 而是做事的態度的一點點改變. 大家在到公家機關辦事的時候, 你們會期望公務員要加班做嗎? (好啦, 還是有人恨不得健保局或中油員工加班) 不會, 你只會希望他們有友善的態度, 有願意主動幫助民眾解決問題的心態, 我相信這樣公部門就會有很大的改善了 (至少對我而言是這樣)。我們只是一個小島, 只有這些人, 也沒什麼資源, 更談不上有錢 (跟中國的有錢人比比看吧), 人是我們最大的資源, 如果人們的心的方向不對了, 那什麼事也對不了。

--- 正片結束 ---

Tuesday, August 23, 2011

Android patched QEMU NAT code architecture

Personal Project Android patched QEMU NAT

Intro: The emulator of Android SDK comes from Qemu and is modified to support features such as bandwidth shaping. It is good to most developers, but it seems to be lacking some features, I guess some people out there are also interested in tweaking it to fit your needs.

Technical Background:

Because Qemu runs guest OS, it naturally needs to manipulates packets when it is under NAT mode. And to provide some small utilities, it has tcp/udp IP support in itself by using SLiRP, which was originally designed for PPP back in 90s.

Three pictures are attached in case you want to know the key points of NAT of UDP in Android. Sorry, TCP is not my interest at the moment.




Friday, November 26, 2010

A Simple Flowchart for XML Parsing

I forget things easily. So I'd like to keep a note for my recent study about XML Document parsing and framing. Framing is easier as it is a controllable data source I provide. So I will focus on the parsing part of it.

I hereby is showing a flow chart I just drew for the XML parsing procedure. I guess I must have made some errors in it and it is not qualified to be good enough. However, like I said, this is a note I am trying to keep. If you know what can be improved, please don't hesitate.


Some notes that everyone should know:
  1. The most frustrating thing I found is there is *NO* single package that can provide me parsing, framing, validating, data-binding code generation in C language while this is the language we used in most embedded systems.
  2. Some of the steps in this flowchart be merged into one single step.
  3. There are commercial products available with all the needed functions. Even with HTTP client/server in case you need to use XML over Web.
  4. Links on Wikipedia about data-binding: http://en.wikipedia.org/wiki/XML_data_binding.
  5. The most comprehensive list of resources about XML data binding: http://www.rpbourret.com/xml/XMLDataBinding.htm

ps. Drawn with Dia 0.97.1 Windows version.

Saturday, November 13, 2010

Android ListActivity Problem

I met these error messages last night and found the cause was I did not read document thorough. :)

11-12 14:33:19.976: WARN/ActivityManager(73): Launch timeout has expired, giving up wake lock!
11-12 14:33:20.164: WARN/ActivityManager(73): Activity idle timeout for HistoryRecord{44f542b8 com.demo.wally/.listview}

ListActivity is another kind of Activity that has a built-in ListView. I called the method: setContentView, under a ListActivity context, so I was destined for this problem.

In this ListActivity, a fullscreen ListView is used. To customize my own screen, I need to either take advantage of possible ListView options or create another view with ListView in it and use a normal Activity to create data adapters, and so on.

Friday, November 12, 2010

XML File Indentation

I copied contents from a PDF file (I can't find its original version with proper indentation) and pasted into an XML file. The resulting file is flat with no indentation at all. After trying to fix it using vim and other text editors. I decide to give it a try to find a formatter. And I found one:


Useful to me a least.

Thursday, November 11, 2010

Cookie Flag: HttpOnly

Today when I am trying to understand how cookies work in libcurl (). I found some cookies from Google has a strange flag behind it: HttpOnly.

I know this is a common sense to every web developer. As an embedded system engineer that never dealt with any web programming in last 9 years, I think I am eligible to not knowing it...

Anyway, it is shown by an example source code of libcurl as:

[1]: .google.com.tw TRUE / FALSE 1352547231 PREF ID=id_removed:FF=0:TM=1289474431:LM=1289475431:S=oLGFV.....
[2]: #HttpOnly_.google.com.tw TRUE / FALSE 1305286631 NID 40=T9tf9Y.....

This #HttpOnly_ confused me. After some research, I found that because malicious Javascript code may be able to access other website's cookies and transfer them to its site. This is a cookie theft as described in Wikipedia (http://en.wikipedia.org/wiki/HTTP_cookie#Cookie_theft).

This flag blocks cookies flagged as HttpOnly being accessed by any scripts from originating website and hence prevents injected malicious code from sending important cookies to another site.

Wednesday, September 01, 2010

Python PyGtk + Multi-thread

I chose Python language to make UI development easier. With Glade, a buggy but still functionally okay utility, I can design UI in a short time and load it up with my Python program.

I am doing some socket operations in this program, but found that multi-threading in this program seems to be malfunctioning. And the socket accept action never returns and continue and running my code. After some hours research, I found that GTK will lockout all other threads if I do not perform proper init.

So here is the trick when using PyGtk + multi-thread:

1. import gtk
2. gtk.gdk.threads_init()

With these two lines of code, the thread works happily. Note that multi-threaded applications need to add UI related actions to GTK main loop instead of touching them directly.

Monday, August 16, 2010

Interesting Question

Maybe not so interesting to most people. But it is good to have a chance to dig a hole and jump into it by myself. I am implementing this and hopefully get it resolved elegantly.


Target:


Design a data structure + algorithm to be able to respond to query requests in a timely manner.


1. Assume you have a set of string, say N strings.
2. The lengths of the N strings vary from 1 byte to X bytes.
3. Design a data structure + algorithm to provide a fast query based on:
4. If a string S is provided, we want to be able to find out all strings containing S as their substring in O (log (N)) time.

Conditions:

A. Pre-processing time to make the data structure ready for query need not be considered. We can improve it later on. This is to simply the answer at beginning. I started with rigid requirement of this part and had trouble to have an answer quickly at beginning.

B. Assuming we to run the query many times, and hence first priority is to optimize complexity of the query.

C. You can use hash table in design at beginning. But it is really a memory hogger, so eventually you need to change it to something else.

Monday, May 17, 2010

Adding Logging Support to MaxiCom 0.2

I wanted a neat serial console tool. I hate pressing combination keys so minicom's full capability and key combos are not what I want. I am not used to the separated command line of CuteCom, either.

I found MaxiCom's simple and intuitive GUI fits my needs perfectly when I have access to desktop GUI interface. But my job routinely requires capturing console logs. So its lacking of this feature made me add this feature.


When you click on the "LOG" button, it generates a file under $HOME with filename containing the date and time the log file is started. When you finished the capture, click log again. The file is then completed. When the file is created, the date and time will be written to the log file and when it ends, the date and time are also written.

Sunday, May 09, 2010

Mike deGruy: Hooked by an octopus

This guys is really passionate about what he does. And all of us should try to think about what we can do to our backyard. (Although I do not have one.)

Monday, April 05, 2010

200 Dollors

What can 200 dollars do?

Sally told us yesterday, she is a kid for sale for $200. I asked her why should I buy her? She told me the reason is then I can buy milk powder for her.

I then asked her why I should buy her to be able to buy milk powder for her, that seems not a good business.

She then told us that she can take care of us after she has grown up, "if we (her parents) were still alive".

Tuesday, March 09, 2010

Git via Proxy

1. Create ~/bin and export path in .bashrc
2. Compile the connect.c and place binary to ~/bin
3. Create script for wrapping up "connect.c".
4. Set GIT variables to look for script.
export GIT_SSH="${HOME}/bin/socks-ssh"
export GIT_PROXY_COMMAND="${HOME}/bin/socks-gw"

http://threebytesfull.com/2008/04/git-with-and-without-proxy/

Friday, February 26, 2010

Apple's Survival Plan

The comments in this post is purely biased. :)

Part 1. Apple's original plot.

To me, at least until I read this news, Apple stands no chance in the fight of mobile device with Android. Steve Jobs criticized Google entering mobile phone market was a strong sign of risk that Apple is facing or will be facing.

Apple is indeed good at creating maybe the best product of a kind in the world. The original plot was to have a very good product and sequels of it to dominate the market. Competitors may be able to create similar products after a few years of chase. But the S/W app store richness and MP3 purchase channel will keep Apple the winner for as long as it does not make a fatal mistake.

Apple's ecosystem would become an ever since mobile empire if the plot goes on as planned.

Part 2. Google's disruptive plot.

No threaten can be seen in this plot until Google joins the game. The best thing Google does is creative disruptions, creating me too products were never the strength of it. Google's targets are like this: creating an open platform, free Internet access, free (to Internet users) search engine creates healthy ad revenue from transforming mobile phone users to smart phone users.

The tricky part is no existing mobile phone manufacturers have enough power to disrupt this game, they are simply fighting each other and will not accept any creative ideas from each other. If Nokia creates its app store, Samsung, LG, and Sony will all have their own ones. In the end, this competition is still zero summed.

Even Nokia is willing to offer its Symbian OS for free, it is unlikely others will adapt it from their deepest heart because when it comes to a new feature rich upgrade, Nokia will definitely be the first to enjoy it. Google isn't so, fortunately.

- Google creates an App store that all mobile phone manufacturers are able to have their share.
- Google maintains an open OS for every one without license fees.
- Google evolves the platform/desktop/GUI and so on to make every manufacturers happy and be able to catch up Apple's UI design without investing much resource.

The plot became that Google/Android powered mobile devices blooms and overwhelms Apple's ecosystem in the end, it may take several years before the fight ends.

Part 3. Apple's plan to survive through this.

Apple knows what risks Android is putting onto its empire and is smart enough to not simply been stubborn (as it did with Mac computers at IBM PC era) again.

This time it is opening a job to port iPhone OS to new platforms. The description is not explicit enough to know all the details and the interesting part is everyone can have their speculations. My theory is Apple has not figure everything out yet because of the following logical contradictions:

- Apple knows it has to let manufacturers join its camp to survive.
- Apple has always been enjoying and will not give up its healthy margin. But Google's Nexus One is breaking neck of smart phone prices. Apple will have to let go its iPhone margin and stop making money on its iPhone. Letting other manufacturers to sell ultra low cost iPhone clones.
- Apple will no be able to license its iPhone OS at sky high price, otherwise it becomes harder to make every manufacturer to join Apple's empire.
- Its past culture was never licensing stuff to external vendors. And it will suffer from this re-habitation. And this is exactly why it is looking for a manager externally for this. But I think it still will be harder than Apple's expectation.
- Apple has been a skeptical customer to its vendors and the culture will not be able to transform easily to co-work with other vendors.
- To spread its OS to enough devices is the key to win this fight between ants and an elephant. However, the quality will become hard to control.
- Current iPhone OS is tailored to and optimized on specific H/W, it is hard to maintain its elegance while been adapted to various H/W platforms.

Part N. The rest mobile alliances.

Please note that I am skipping all other alliances because I simply do not believe any one of them will be able to have a major share in this game. Period.


Wednesday, February 24, 2010

Targetted Cancer Therapy Medicine - PLX4032

Just read a report about PLX4032.

I was against any gene based medications. However, watching people to have their second chance of life is really encouraging. It is so encouraging that most of us forgets the side effects we may face in the future and the backfire from the nature.

I have a few unanswered questions:

  1. If one day a medicine was invented to revert aging and subsequently keeping people alive forever, what would the consequence be?
  2. As all other technologies human developed in the history, powerful technology *will* be misused at some point in time. For example, due to the justified development for medication, the maturing gene based technologies can be used to create super solders, superman (and if superman becomes a super stucker..). How do we prevent that?
  3. The evolution involves adapting to ever changing climate, environment, threats, and so on. With gene medications, will it become that human become un-adaptive in the end?

The attractiveness of PLX4032 is infinite to those who needs it. History suggests it is impossible to stop it in a capitalism market. So maybe we should try to define the boundary of gene based technologies?!

Can't Set Default Printer on Vista Home Edition

When trying to print stuff from Chrome browser, it keeps saying no printer found. Because the printer is there and can be printed in other S/W, I can't escape from the problem I found previously which is unable to set a default printer.

After some research, I found an article that fixes my problem perfectly. I can now print stuff perfectly...

Tuesday, February 23, 2010

Kite Runner

I finished reading this book "Kite Runner" a few weeks ago and like it a lot. Though it is not as subtle as my last read book, it is still good to read as an adult. It contains sexual descriptions and *maybe* biased against Taliban authority.

But I like the descriptions of Amir who is kinda coward. He is a mirror of some part of us. In the end, he resolved/faced his weakness with his blood, which is the encouraging part of the story. With stupidness/bravery, he eventually transformed to someone else internally.

I bought it for a long time ago and yes: I buy books but not reading them. I'm glad I finished reading it.
A Tiny Web Server for R&D or Local File Share


Very tiny, it really is. Taking advantages of Java's existing libraries, its size is: 4095 bytes. Yes, it is BYTES. Not Kilobytes. I am wondering whether it is possible to implement a smaller one without using assembly.

- On Windows, if filename extension is associated properly, you can double-click it in Explorer and get it up and running.

- On Linux, you need to use java -jar SimpleWebServer.jar.

The root dir is the directory you started it with. All interfaces are listened. Port 80 is used.

As a supplement, on Debian derivatives (including Ubuntu), you need to add sudo to make it possible to bind to TCP port 80. Otherwise you will suffer from permission problems.