September 30, 2012

  • 人算不如天算

    五月時我曾經寫過,興幸唯一報讀的理工大學沒有回覆我。

    雖然學位是派到八月還有,但一般來說,過了七月後,學生就已不會再抱期望。

    人算不如天算。八月七日,當時我一邊在為副學士的新學期準備,一邊研究電腦遊戲引擎(又稱內核)設計。電話響起,原來是理工大學致電來,通知我已鑊取錄。通知突如其來,我想要點時間考慮。對方聽後諤然,似是從未想過有人會想考慮。最後,對方開出的期限是兩小時。

    這種通知方法,簡直就像在說:「大學取錄你,你沒有理由不要學位吧?你不要也無相干,我們有大量學生在你之後排隊等待來電。」可是,面對這樣的態度,你又能好有骨氣地拒絕嗎?對我來說,放棄學位背後的風險似乎太大,所以最後都只能屈服,接受取錄。

August 26, 2012

  • Setting Up Linux Mint on Fujitsu LH772

    Recently, I bought a new notebook from Fujitsu, the LH772. Before the purchase, I tested that Ubuntu 12.04 supports the computer’s function keys (mostly brightness and volume control), sound card and speakers. I decided to install Linux on it. There are a few problems, mostly regarding display card and wireless network, but I somehow am convinced that I can fix them or, at the least, work around them. This is the result of my research and journey.

    The on-board hard disk drive is preloaded with an OEM Windows 7 installer. I don’t want the Windows 7, mess up the boot loader or get caught installing a non-verified OS and void the warranty. So, I remove the drive and bought an SSD. The drive cover is secured by only two screws, the drive itself another two. Changing drive is very easy on the LH772.

    Original hard disk drive
    I heard you will install Windows on first boot. I won’t let you.

    SSD speed test
    555 MiB/s, about 10 times of what ordinary hard disk drives can achieve. I am impressed. SSDs’ performance varies greatly among different data and usage conditions. Reviews and benchmarks has shown that SP900′s read performance is between… 50MiB/s to 530 MiB/s.

    Wireless network card does not work out of the box. If that is your only way to the internet, feel free to jump to the section about wireless network.

    Display Card (NVIDIA GT640M LE)

    The notebook features an NVIDIA GT640M LE display card, which “supports” Optimus Technology[Wikipedia], a hybrid display and power-saving solution developed by NVIDIA. Essentially, Optimus turns off the discrete display card when you don’t need the processing power. Key benefits of using Optimus, according to NVIDIA, is:

    • completely automatic allowing you to experience longer battery life and amazing visuals without having to manually change settings;
    • behind the scenes and with no interference to what you’re doing, Optimus seamlessly figures out how to best optimize your notebook computing experience.

    The caveat is, the “automatic” and “no interference” part comes only if you are using Windows 7. If you look at the Wikipedia article, you will notice there is no Optimus support under Linux. That is, your discrete NVIDIA display card will run at full speed, draining battery life and overheating your computer. Ironically, at this stage, you cannot use the discrete card, even if you have driver installed.

    NVIDIA. Damn. You.

    So, if even official driver cannot help you, who can? The legendary Linux community. Introduce the Bumblebee Project, “a project aiming to support NVIDIA Optimus technology under Linux,” as stated by the website.

    Ubuntu has a ppa for Bumblebee. This simplifies installation a lot. However, I don’t like the Unity interface and where Ubuntu is going; that’s why I turn to Linux Mint, “Ubuntu done right” deemed by many. I was a Linux Mint Debian Edition (LMDE) user, but I failed to install Bumblebee on an older computer. I might try that again later.

    To get Bumblebee work on Linux Mint 13 Maya, we need to add the ppa into repository. Open a terminal and type
    sudo add-apt-repository ppa:bumblebee/stable

    GT640M LT works only on the official driver version 304 (some say 302) or above, which is not provided by the default repositories, so we need to add another ppa
    sudo add-apt-repository ppa:ubuntu-x-swat/x-updates

    If you did not add the x-swat ppa and got the wrong driver, just first uninstall everything about NVIDIA or Bumblebee: i.e. nvidia-settings, nvidia, nvidia-current, bumblebee and bumblebee-nvidia. bbswitch-dkms can stay as it doesn’t depend on driver.

    Then, install the package bumblebee. apt-get will get all the dependencies for you.

    If the NVIDIA driver changes your X server settings and mess up your resolution, just delete /etc/X11/xorg.conf (or, to be save, just rename it). Modern display drivers and X server don’t need the file.

    Now if you try to turn on the discrete card by, like,optirun glxspheres
    you might get an error message like this:[ 34.776889] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver

    [ 34.776919] [ERROR]Aborting because fallback start is disabled.

    That’s because a setting in bumblebee is wrong. Edit /etc/bumblebee/bumblebee.conf
    sudo nano /etc/bumblebee/bumblebee.confChange the line Driver= to Driver=nvidiaand in the section [driver-nvidia] change the lineKernelDriver=nvidia-currenttoKernelDriver=nvidiaAfter a reboot, optiun should work.

    Wireless LAN Card (Ralink RT3290 PCIe)

    Compared to display card, getting Wifi to work is much simpler. No, it’s not.

    Linux does not come with a driver for this wireless LAN card, so we have to *gasp* build it from source.

    First, download the driver from Ralink. If you don’t want to tell them your e-mail address, just type a@a.a like I did.

    Decompress the archive file to, say, ~/wireless_driver
    tar -xf //2012_0508_RT3290_Linux_STA_v2.6.0.0.bz2 ~/wireless_driver

    Before we can build the driver, we have to make a few changes to the source files.

    Open ~/wireless_driver/os/linux/config.mk

    Change line 27 fromHAS_NATIVE_WPA_SUPPLICANT_SUPPORT=nto HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y

    Some say this will not change the compilation, but I did not test what will happen if it is leaved untouched as n.

    In the same file, delete or comment out -DDBG on line 206. This will turn off debug mode. If debug mode is on, the driver will constantly display garbage message on dmesg, hiding real important information and messages. I have no idea why anyone will ship a driver with debug mode on as default.

    Apparently, the developers have not tested how normal users use a driver. With -DDBG flag removed, the source will not compile. What we need to do is open ~/wireless_driver/sta/sta_cfg.c and delete line 4674#endif /* DBG */ and line 4080#ifdef DBGto get the function definitions out of the ifdef block.

    Now the source is ready. Change to the directory of the source in case you are not in the in already:cd ~/wireless_driverIf you have install this driver previously, clean the compiled and installed files before re-installation:sudo make uninstall
    sudo make clean
    Compile and install:sudo make
    sudo make install

    The driver should start automatically when the computer restarts.

    IBus

    As a daily Chinese user, I need a Chinese input method. I have been using IBus since Ubuntu introduce it at version… (I have to check it) 9.10. IBus works flawlessly once installed, except for Skype. The reason is that Skype uses QT4 library, but a normal installation of IBus on Mint doesn’t include bindings (package ibus-qt4) for it. Start ibus (with its XIM server) by ibus-daemon -xEverything should work. If not, change the lineXIM=toXIM=ibusin the file /etc/X11/xinit/xinput/default
    Someone said that other files and options need to be set, but this is the one that did the magic for me.

    Unresolved Problems

    My Logitech M570 wireless trackball uses Logitech’s Unifying receiver. If the computer boots with the receiver plugged in, the mouse will not work. Re-plugging sometimes help, removing then re-adding the hid_logitech_dj module using modprobe sometimes help. Nothing is clear to me now.

    Function keys stop working after suspend. But if you have an SSD like I do, rebooting the computer takes only half a minute. So luckily it’s not that big an issue.

    Bluetooth is nowhere to be found except in lshw and lspci.

    Sound level / mute setting and brightness setting usually won’t survive a reboot.

    The slowest mouse speed is still too fast for my 3500 dpi Razer DeathAdder.

    Cinnamon is unstable with Hot corner enabled, particularly when scrolling fast in Firefox.

    Update (29-8-2012)

    I’m glad I have written this article. My SSD died just one day after I set everything up.

August 5, 2012

July 31, 2012

  • Project α: portal

    我的寫作技巧仍有待改進。現在 Project α 還是只有剛成形的骨架,預計未來會有多次重寫,所以無論有什麼意見,或是見到有什麼錯誤或不滿之處的話,不管是遣詞用字、描寫、劇情、場景等等,甚至是錯別字,請務必提出。

    另外,如果現在有人估到主線情節去向,我願意請食一個月飯。

    還有一點,Project α 是以 Creative Common 授權形式刊出,所以如果你覺得我無法改到你滿意,或者喜歡世界設定而不滿劇情的話,歡迎分支 (fork)。當然,世界設定是怎樣,仍然未有人知,因為關鍵劇請要到好後期才會出現。

    至於為何叫這做 portal?好問題。


    距離更新 (上載第六章) 一年兩個月有多,第七章終於到步。

    也不知多久沒寫過字。與之前章節對比,我發現第七章的行文與時間流動都非常奇怪。我的一貫原則是先寫劇情後修飾,尤其在這種時候:劇情細節及文句皆會受我的經歷與周遭影響,如果現在不推進劇情,第二次章節斷層將很快再出現。再者,我也快忘記我之前所寫的章節了……

    本章及下章將交代更多背景及為未來鋪路,預計會比較悶。預計這兩章會由頭寫過。

    希望未來能每月更新 (就容我先奢望一下吧)。

    目錄:

    第一章:序篇一 – 修改於二零一零年十一月十四日

    第二章:序篇二 – 修改於二零一二年八月一日

    第二章:序篇三 – 修改於二零一一年五月十三日

    第四章:序篇四 – 修改於二零一零年十一月二十八日

    第五章:始篇一 – 修改於二零一二年八月一日

    第六章:始篇二 – 修改於二零一二年八月一日

    第七章:始篇三 – 上載於二零一二年八月一日

July 29, 2012

  • Android 4.1.1 Calendar Bug (or not)

    When I upgraded to Android 4.1.1 Jelly Bean via OTA earlier this month, the bundled Calendar application was upgraded to version 4.1.1-398337. After this, a bug appears.

    The bug only happens when default reminder time is set to None.

    After adding a new event, everything seems fine. Go into the event screen, everything is normal. But when you exit to month view mode, or exit the calendar, then go back to see the event, two reminders are set up automatically for you. One for (Android) notification, one for e-mail, both 10 minutes before the event commence.(See second last paragraph)

    If you set a default reminder time other than “None”, The reminder will be normal: just one notification reminder of designated time.

    Today, searched for the problem and found someone mentioned something with synchronisation. So, I logged in to Google Calendar on PC for the first time. Midway through the setup wizard is the default reminder setting. I immediately recognised some familiarities: a ten minute notification to phone and e-mail. I clear these two, save it, and create new events on my phone. No reminders, good.

    Then I create a new event for my other Google account, which I have never logged in to calendar on PC before. Not surprisingly, the unexpected reminders are here again.

    I changed the default reminder setting in Google account to 10 hours, then create a new event again on the phone. After syncing with the server, a 10-hour reminder appeared on the phone. Apparently, the initial 10-minute reminders came from the server, too. It looks like changing to month viewing mode or exiting the application will trigger the reminder generation, but it turns out it is just the delay of synchronisation.

    There seems to be two independent reminder systems in the 4.1.1 Calender application: one on the phone, one from the server. There is no way on phone to change settings on server, and vice versa, thus the annoyance I faced.

June 29, 2012

  • Anything that can go wrong…

    Anything that can go wrong will go wrong, as stated by Murphy’s Law.

    My father’s company has been developing a piece of application software. I do not know how much I can disclose, so I will just say that it is supposed to increase productivity, especially in the insurance industry. Anyway, this is just the background and it should not really matter.

    Learnt that a contractor will charge a few hundred thousand dollars (Hong Kong Dollars) for the product, the company decided to develop it in-house. Not previously having a developing department, the company built one from ground up, which had just a handful of programmers. The project manager is an acquaintance of my father. He operated a software firm, which was defunct due to mismanagement.

    The company based the department in Shenzhen, Mainland China to cut budget. Consequently, most of the programmers are Mainlanders.

    In a few short meetings, my father explained to the project manager the functions and requirements of the application. Every week, the whole team would gather, reflect what they have done in the past week, update the schedule, and plan on what to do in the next. However, most of the meetings were useless: nothing was discussed because nothing is achieved in the previous week. Even if something is discussed, it is mostly complaints from the management level that the application does not conform to the requirements, and complaints from the development team that the company constantly changes requirements.

    Two years later, in an expo, when the company was trying to promote the unfinished product and invite investors, they learnt that the application must be on-line. A set of data may even possibly be accessed simultaneously by different users, at different places. While keeping developing the current, single user version, the company started to develop a web-based version.

    Soon after that, the single user version is completed, and is shipped to several insurance managers. Not until then did the company find out that the software is incompatible with Windows in Traditional Chinese (and every other language except English and Simplified Chinese). Apart from that, the programme is very buggy: marketed features do not function properly, and crashing is a usual visitor. As a result, the company cancelled it and focused on the on-line version, which was still in its infant stage.

    Year after year, the development team worked on a moving target, and they saw no prosperity of either the project or themselves. As the new version slowly grew, developers started to leave. When the software is almost finished, the company lost all developers.

    When the company wanted to hire new developers to continue the project, they faced a serious problem: they can hire no one. The web-based version of the software used ASP as their back-end; the company simply cannot find programmers that know ASP. Deemed that ASP is outdated anyway, the company decided to hire new programmers to re-implement everything in a newer language / platform: C# / .Net. Another two years have passed without anything new came out.

    To date, few hundred thousand dollars are spent; the application is still remote from alpha stage.

    Still holding hope in the product, the company wants to complete it collaboratively with a software firm. Luckily, the company still holds the old source code and the rights of it. Hoping to smooth transition, I went to Shenzhen earlier this month to see what is salvageable. The answer is, unsurprisingly, not much. Maybe most of the code base can be reused, since only the framework is done in the .NET version; however, without any documentation, it is very hard to understand what the code does. We do not even know which part works and which part does not: A month or two might be needed just to figure that out.

    What went wrong?

    Almost everything went wrong with this project, right from the beginning.

    The first thing is totally underestimating the cost of the project. If you consult a professional software firm the cost of developing a piece of software, you should genuinely believe their answer. If you do not trust them, you can always consult another firm.

    Once you convince yourself that price offered is reasonable, however, do not think you can lower it, by whatever means. If it takes a professional firm that much to build the system, it will certainly cost you more if you do it yourself. Remember, you find those firms for their professionalism; otherwise you would not find them in the first place. Sadly, many people do not think software development is a serious business and hence a professional field.

    Of course, a software firm charge for is not the cost, but a price that will make them, as a company, profit. However, even considering this, you will still spend more money if you do it in-house, because you lack experience, knowledge, personnel, and professionalism.

    Compared to paying a software firm, the cost of developing in-house will likely be a double, at least. Again, do not ever think you can lower the cost by any means, inducing but not limited to hiring developers at lower salaries, cutting some “unnecessary” job positions, and neglecting “superfluous” software engineering practices. Actually, all these practices are what make cost surge and are what you need to avoid (although not all that you need to avoid). Incidentally, the company did all three.

    You do not want to pay low salaries to developers because they come in different grades: there are good programmers and bad programmers. Technicians and programmers in Mainland China are cheap for a reason. If you pay a high salary, no guarantee can you get to hire a good programmer. However, if you pay a low salary you are guaranteed to have a bad one. A bad programmer does not only lack the productivity of a good one; a bad programmer deprives productivity from others in the same team. Bad programmers might do something you would think to be unthinkable, such as refusing fixing bugs in their code, or introducing (not finding, but introducing) bugs in others’ code. If anyone has dependencies on these codes, progress will be hindered.

    Now imagine a team comprises just of bad programmers. This team will not only drag productivity of it to a lowest point, but also diminish efforts of future teams that work on this project or other related projects.

    By neglecting “unnecessary” personnel and procedures, the company removed everything connected to quality assurance, and consequently everything related to quality. See how the company has her programmers create a programme that is buggy, and ignorant of foreign languages and character encoding, yet no one notice the problem until the product is shipped. When there is no full-time, dedicated quality assurance team, problems will slip through the development process and find their way to the customers.

    You cannot rely on programmers to find bugs in their own code. Maybe they will find some, but that will not be comprehensive. When programmers write code, they think they have already considered every possible situation, which has been proved wrong so many times. Furthermore, they are preoccupied by many minor things already, such as requirements of client, constrain of hardware, software, and programming language. If you assign another job that requires attention and dedication to them, they will fail both.

    Things do not end here. The development team did not ever use version control system or bug tracking system. Without these, there is no way to figure out when and where did the team introduce feature and bug into the code base. This makes development and maintenance very slow, if not impossible, on any programme beyond a few thousand lines of code.

    One time, I was in horror when I saw the programme does not compile and a programmer uncomments a large chunk of code. Compilation was still not successful. The programmer made a dozen of changes and the programme still failed to compile. By that time, the source code was unrecognisable to what it was ten minutes ago. It was not until half an hour later did the programmer finally satisfy the compiler. The code compiled, but no one knew if it functions properly.

    No one knew if the programme functions properly, because no one agreed how the programme should behave. The team lack documentation: specification, schedule, code comment, everything. Without a spec, the team will always work against a moving target and disagree on functionality. Without a detail schedule, works are guaranteed to crash through deadlines. Without code comment, it is impossible to maintain code, both for who write the code and who does not.

    It is a miracle that the application got its current size.

May 30, 2012

  • 大學夢

    自從高考後,也很少寫過文章。如今,最後一屆高考及第一屆中學文憑試亦已完結。或者我也該要有一點更新。

    高考幾乎光頭,出路不多。幾經轉折下,最後入讀理工大學轄下香港專上學院 (HKCC),修讀資訊科技副學士課程。對,是一但不能升讀大學就衰過中七畢業的副學士。

    自會考以來,就從未想過入讀中文大學。加上聽說中文大學工程和電腦科目的工作量大、壓力大,所以無論是中七時的「聯招」,還是現在副學士要報的「非聯招」收生,我都沒有選中文大學。這個想法,到今年有一點改變。

    三月,一個入讀中文大學的中學同學,邀請我作一個活動的攝影師。當日活動前,我們經過球場看到正為比賽練習的學生,看過春天還未有蚊的水池,到過飯堂吃十一元的「頹飯」。這裏的生活節奏、氣氛,很引人入勝。

    活動大多圍繞大學校園生活,令我有點懷疑這是一個局。不過,考慮到全個活動大概只有我一個與中大 (其實是崇基學院) 無關,明顯是我多心。若被現場其他人知道我有這樣想過,他們一定會說 (至少會在心裏想) 這是神的旨意。

    回火車站的路上,不時見到載滿學生的校巴駛過。這種交通模式,活活呈現中文大學遠離塵世、自成一角的一面。我不禁想拿外國的大學城 (college town) 與之比較。

    我已愛上這個地方,開始無法想像缺乏這種大學生活的人生。

    車站廣播說列車快將抵站。站在路軌旁,我在想,如果我注定一生與這無緣,那麼現在縱身躍下,又有何妨?腦中的我已經觸碰到碎石,而然現實的我卻未有踏出一步。

    離開幻想,我步入車廂。往南的列車,載我回到現實。

    今年唯一有報讀的理工大學,至今仍未收到回覆,我其實有點安心。

January 18, 2012

  • CG – 20120119

    I am not satisfied by the effect, but I will not work on this any more. My computer is choking on the scene so much that I can barely work on it.

    Click on image for larger version.
    Picture: Marble Hong Kong

    I was trying to use the scratch marks as bump-maps, in hope of making the scratches more like scratches. Sadly, I don’t know how to do it when using texture nodes. After few hours of messing around, I eventually gave up.

    I don’t think many will get what the picture is portraying, because of my bad skill, So I will explain it a bit. The marble pieces are Hong Kong Island and Lamma Island. I used them to represent Hong Kong, since I think that they are quite recognisable (which might actually not be). The red smoke on the left is a sandstorm, in red. The marble piece is being scratched and damaged by the sandstorm.