My Rambling Thoughts

Quote:

Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.

Brian W. Kernighan

News:

Date: . Source: .

The PS3 is cracked?

One of the last news of 2010: the PS3 is cracked — again.

It was claimed the hackers were fired up after Sony removed the OtherOS feature. The group that cracked it and got one of the private keys (sufficient to boot Linux, but not run pirated games) said the PS3 security was "terrible".

Apparently the PS3 lasted so long for two reasons: (i) the skilled "white-hat" hackers were happy with Linux, (ii) the PS3 does have decent first-line of defense:

  • No JTAG exposing the CPU (XBox 360)
  • Not assuming the CD-ROM is secure (XBox 360)
  • Data cannot be executed (NX bit; no buffer overflow tricks via saved games / graphics)

The same group hacked the Wii 2 years ago. Both their videos are very enlightening. Search for Console Hacking 2008 — Wii Fail and Console Hacking 2010 — PS3 Fail.

The XBox 360 remains locked down, although ironically it can run pirated games. (And Microsoft continues its yearly banning ritual.)

Notebook sleeps while downloading

So I left my notebook on so that it can finish downloading some files while I go to sleep.

When I woke up, I found that my notebook has gone to sleep before the files are fully downloaded.

Why doesn't Windows automatically delay sleep mode while downloading is in progress? Does it even know an app is downloading files?

(Quick access to the current settings will be nice as a compromise.)

How green are you tonight?

Sodagreen concert

First time in a concert. My ear drums are still ringing.

Not a very popular group; just one performance and 1st tier seats at $200. (I didn't buy that, though. I still found it expensive.)

Very nice songs! They played a lot more "fast" songs than I remember they have. (Their CDs are mostly slow songs.)

The crowd is mostly energetic young folks (ratio of 7 girls to 3 guys). They stood up to sing and dance along with the songs many times.

Another gambler at credit limit

News: MBS sues customer for $250,000

Date: 7 December 2010. Source: AsiaOne.com.

In a first-of-its-kind case over here, Marina Bay Sands(MBS) is suing a casino patron who they claim to be one of the 'premium' players.

30-year-old Lester Ong Boon Lin allegedly owes the casino $240,868 in credit extension, but he claims that he owes the casino nothing.

The casino claims that the credit extension was offered to him as he was a premium player with a minimum deposit of $100,000, reported a local news agency.

Mr Ong is said to be the son of a famous Nasi Lemak businessman. The first thing that comes to mind is whether his family business pay tax properly. :lol: It is an open secret that most small-time businessmen try to avoid tax.

$250k = 62,500 packets of Nasi Lemak. Assuming a net profit of $2 each and 200 packets/day, it takes 1.7 years to earn back the money.

Hard to earn, easy to lose.

I wonder if PAP considered this when they allowed the casinos. It takes money from people who otherwise escape being taxed.

Talk about crazy prices

transport
Cat A (up to 1.6L)$47,604
Cat B (>1.6L)$62,502
Cat C (van)$32,001
Cat D (bikes)$1,701
Cat E (Open)$64,900

Too much liquidity around?

Are we in inflation, deflation or even stagflation?

From what I observe, goods limited in quantity (such as flats and cars) will be inflated, whereas common commodities will be deflated. This is because consumers can always opt for cheaper stuff.

(Note that the race to the bottom applies to jobs too. Employers can always opt for cheaper staff. There are many qualified professionals in neighbouring third-world countries.)

Fraud as a business model

From an online forum:

  • Investment banks — securities fraud
  • Mortgage lenders — widespread fraud
  • Rating agencies — junk science
  • CDO "managers" — crash test dummies & accomplices
  • Certain hedge funds — shorted CDOs they "managed"
  • Bond insurers — money for nothing
  • Regulators — poseurs and enablers

Extend and pretend. It can last for years, but it will end one day. And that day is looming closer and closer.

The US national debt is US$13.83 trillion. Even at 1% interest, it is $138.3 billion a year, or $378 million a day.

I sometimes wonder how the current era compares to ~300AD, when the Roman empire was near its end.

Only in America

Taken from a forum.

Only in America.

Lawyers can fraudulently introduce paperwork to the court — no repercussions.

Clerks can forge signatures — no repercussions.

Banks can defraud the entire population — no repercussions.

TSA agents can feel up little kids — no repercussions.

Wall street can steal the life savings of entire demographics — no repercussions.

Santa cracks a joke? Fire the Bastard!!!

It's hard to believe some of the things coming out of America today.

  • QE2 and perhaps QE3 in the future.
  • Tax cuts extended for 2 years.
  • 99-week unemployment benefits extended for another year.

With no real money behind them.

The end is near.

Call me a plumber

My kitchen basin couldn't drain water anymore. It was getting from bad to worse and now it has gone past the threshold. Time for Mr Fix-It!

(Alert: plumbing can be dirty and smelly. Don't try this at home.)

Drain basket

After two days of struggling with the basin and pipes and breaking even more parts in the process, I finally fixed it for good.

The water now drains faster than I can fill the basin. No more water problems!

A quick P6100 benchmark

Windows Experience Index for the dual-core 2.0 GHz Pentium P6100, compared to the dual-core 1.8 GHz Atom D525:

P6100D525
Processor5.73.5
Memory5.95.0
Graphics4.43.2
3D graphics5.23.7
HD5.85.9

Not bad at all.

The notebook doesn't boot up very fast, though. It feels slower than my Asus 1215N — must be too much junk during startup. Time to uninstall all of them!

A good deal!

While walking around SITEX 2010, I came across a row of refurbished HP EliteBook 2510p for just $399 each. Holy cow, that's what I'm using in office; I like this notebook very much. A chance to own it for just $399 is very tempting!

But it'll require much scrutiny to make sure the unit is as "perfect" as can be.

I decided to skip it for now, especially now that I already have the Asus 1215N. Otherwise, I would have leapt at it.

The best budget notebook

My mother wants her own computer all of a sudden. Since she's just going to use it at home to surf net and to write documents, I just look for the cheapest 14+" notebook for her.

Looking around SLS, I found the cheapest notebook with an Intel CPU was around $800-$850. That's not very cheap.

(I would have gotten a netbook for my mother if she didn't mind the small screen. But I know she wants a reasonable-size screen.)

Just nice, the SITEX 2010 was on. I browsed through the brochures and found a good fit: the Acer Aspire 5742-372G32Mn.

CPU2.4 GHz i3-370M
RAM2 GB
HD320 GB
GraphicsIntegrated
LCD15.6"
Weight2.6 kg

A 15.6" for just $849. I think that's reasonable.

But it was already out of stock by the time I went down. It was a limited offer. (According to one brochure, just 20 units were available.) The model with dedicated graphics card (w/ 1 GB RAM) was still available at $899, but it was an overkill for my mother.

Time for plan B. The Acer Aspire 4738Z-P622G50Mn quickly caught my eyes:

CPU2.13 GHz P6200
RAM2 GB
HD500 GB
GraphicsIntegrated
LCD14"
Weight2.2 kg

For just $649. Now, that's much more reasonably priced!

I had earlier dismissed it because it was selling for S$799 and it uses the P6200 CPU, which is just a stripped-down i3. It should be equally capable/fast for normal tasks. But I'm willing to pay $50 more for an i3.

(The P6000-series notebooks are meant for the third-world countries — that's why they are so cheap. Google and you'll find hits in several Asian languages. :lol:)

The only flaw was that it came with just 2 GB RAM. It wouldn't be enough for the bundled 64-bit Windows Home Premium. An upgrade would cost $30.

I continued to walk around and found another bargain in the most unlikely place, at the Toshiba booth, the Toshiba Satellite L640-1060U:

CPU2.0 GHz P6100
RAM4 GB
HD500 GB
GraphicsIntegrated
LCD14"
Weight2.4 kg

For $699. It was marked down from $859, which was why I didn't notice it earlier. Toshiba was supposed to be expensive, but it looks like they want to compete in the low-end segment too.

It is slower, but negligibly so. It is also $20 more expensive, but Toshiba is also more branded than Acer. It also comes with a boatload of cheap free gifts. I decided to buy it.

The search is over.

(To be fair to the other brands, they too have models selling at $699. However, I was fixated by the Acer at $649 until I saw the Toshiba notebook.)

Yet another variant: the Asus 1215T

1215T1215N
CPUK125 1.7 GHzD525 1.8 GHz
VideoRadeon HD4250ION2
HD320 GB250 GB
Battery>4 hours>5 hours
PriceUS$450US$500

The 1215T uses the single-core AMD Athlon II Neo K125 CPU. However, it is still slightly faster than the D525 for most tasks.

The ATI Radeon HD4250 uses shared memory.

Hopefully the 1215T can use 3.5 GB RAM on Windows 7 and the full 4 GB on a 64-bit OS.

How Intel crippled the D525 (and hence the 1215N)

  • 4 GB physically addressable memory. This gives a max 3.25-3.5 GB RAM due to the graphics card. 1215N has a max of 2.74 GB due to the dedicated 512 MB ION2 RAM.
  • Single channel RAM. Dual-channel and triple-channel are only faster by less than 2%, so no big deal.
  • Crippled IGP (Integrated Graphics Processor): no H.264 decoding, max external res 1366x768 and no HDMI.
  • Compulsary IGP — it is always present and on. This wastes power when ION2 is active.
  • No DMI (Direct Media Interface), so ION2 has to run over 1x PCI-e lane. (There are no spare lanes.) This greatly limits graphics bandwidth and hence performance.

However, the Asus 1215N works well enough in the real world... as long as you don't need to run 64-bit OS.

Give me crisp text!

Microsoft introduced ClearType in Windows XP. It was off by default. I tried it and turned it off — even for LCD displays. In Vista, Microsoft improved it and it was on by default. I still prefer crisp text, so I turned it off.

In Windows 7, Microsoft went one step further. If you turn off ClearType, you'll immediately notice the text becomes much blurrer. It does not make sense.

(Just a note. In Windows 7, you need to turn ClearType off in two places for it to take effect.)

Did I really turn off ClearType correctly?

A quick google revealed the truth: Microsoft used the Segoe UI font, which requires ClearType to look nice.

It is simple enough to customize the desktop to use the Tahoma font (the default UI font in Windows XP). It works well enough, but it doesn't change everything. To do it, we need to edit the Registry and substitute Tahoma for Segoe UI. (Font substitution is a built-in functionality.)

The desktop is not where it ends. Microsoft Office 2007 onwards use the Calibri font by default, which also requires ClearType to look good.

Microsoft Visual Studio 2010 uses the new Consolas font for its text editor. You guess it, it requires ClearType to look good. I changed it to Courier New, although some people prefer Ludica Console.

Now, what's wrong with ClearType?

With the latest ClearType technology (since Vista) and ClearType fonts (Windows 7), I must say ClearType looks very good. What I dislike is that ClearType text looks bold and blurry, and sometimes with a tinge of color due to imperfect anti-aliasing.

IMO, our screens are not high resolution enough for anti-aliased text. (Resolution as in DPI.) My screen is about 130 DPI (1366 pixels across 10.55"), but most displays are much lower than that. 1920 pixels across 21" (a 24" display) is just 91.5 DPI.

I believe we need 150-200 DPI before anti-aliased text looks perfect.

Asus 1215N vs HP EliteBook 2510p

Asus 1215N HP 2510p
Screen 12.1" 16:9 glossy 12.1" 16:10 matte
Weight 1.46 kg 1.32 kg
Dimensions 11.7" x 8" x 0.9-1.4" 11.11" x 8.38" x 0.97"
CPU Atom 1.8 GHz D525 1.2 GHz ULV C2D U7600
HD 2.5" 250 GB 1.8" 75 GB
Res 1366 x 768 1280 x 800
Graphics ION2 512 MB IGP
Play 1080p Yes No
Battery Life >5 hours ~3 hours
Bluetooth No Yes
Optical drive No Yes
USB 2 3x 2x

(Note: newer 1215N models have 2x USB 3.0 ports and have offline USB charging. I bought it too early. :-()

The HP EliteBook 2510p and 2520p are true ultra-portable notebooks. The 2530p weighs 1.45 kg and the current 2540p weighs 1.53 kg. IMO, the newer models lost some of the magic by being so heavy.

There are a couple of things that can be done better on the Asus:

  • The netbook is too long. The LCD has a somewhat thick bezel. The 2510p is 0.6" narrower and can still fit a full-size keyboard.
  • The keys are much better on the 2510p! This includes the spacing as well. The 1215N has inter-key spacing that makes it hard to touch-type. (Which stupid company started this style-over-substance design? No guess needed.)
  • Vertical resolution of 768. 32 pixels may not seem much, but every pixel counts! The trick is to use vertical tabs instead of the default horizontal ones to maximize vertical space.

A few nice-to-haves, but I'm fine not having them:

  • I prefer a matte screen, but I can live with a glossy one too.
  • No "one-touch" button strip. I use it mostly to toggle Wifi and sound. Wifi can be toggled on the Asus 1215N, but not sound.
  • Easily visible LED indicators. The power, HD activity, Wifi and capslock LED are not easily visible on the Asus 1215N due to the way they are angled.
  • Lousy touchpad. The right click is especially hard to press. But I seldom use it as I usually use a wireless mouse.
  • No bluetooth. I don't expect to use any bluetooth devices except for the mouse.
  • No optical drive. An inconvenience, but optical is the new vinyl...

Midway to a RAM-only system

News: Toshiba rolls out slimmer form factor for SSDs

Date: 8 November 2010. Source: ComputerWorld.com.

Toshiba increased the performance to a maximum 220MB/sec.

Toshiba America Electronic Components on Monday announced a series of solid-state drives featuring a new form factor that's 42% smaller than today's mini-SATA or mSATA SSD modules.

The new drives are the same models used by Apple in its new MacBook Air netbook computer, which allowed the company to create a machine that tapers from just over half an inch to a tenth of an inch in thickness.

This is how the SSD looks like:

Blade X-gale SSD

Looks just like RAM, isn't it?

Hardware-wise, we are already moving towards a RAM-only system. But we need to change our software model, and that would require a total paradigm shift.

For example, do we still need a hierarchical file-system? Do we still need to load data from files? Do we even need to load programs?

Most importantly, can we just declare a variable and it is automatically persistent?

Asus 1215P vs 1215N

Trust me to get a new netbook before I realized Asus has announced a newer model: the Asus 1215P.

1215P1215N
CPUN550 1.5 GHzD525 1.8 GHz
Max RAM2 GB4 GB
VideoIntegratedION2
Max TDP8.5W13W
OSWin7 ProWin7 Home
PriceUS$550US$500

The 1215N is clearly better except for power consumption. The 1215P seems to be aimed at business users.

I'm sure Asus ruffle Intel's feathers by using the desktop Atom CPU in a netbook. :-D The 1215N is almost like an ultra-portable notebook — at half the price.

Update: it turns out that the 1215N can only access 2.74 GB of RAM because the Atom CPU can only access 32-bit physical memory (4 GB) and some address space is used for both graphics sub-systems. This limitation also applies to 64-bit OS.

(The predecessor 1201N can use up to 3.25 GB as it only has one graphics sub-system.)

Intel deliberately crippled the Atom CPU/chipset as it is meant for low-end use only. I always marvel how well it worked in practice in spite of that.

Asus 1215N first impressions

After waiting for a long time for the Asus 1200 series — the latest being 1215N — to come to Singapore, I finally gave up and ordered the 1215N from Amazon.

It costed me S$710.87. Breakdown:

NetbookUS$484.03
Shipping/miscUS$50.11

Physical impressions

  • The semi-glossy cover looks nice, but also looks prone to fingerprints.
  • The keyboard is flimsy, but it is still acceptable to me.
  • It is hard to press the touchpad's right button.
  • It is not that light at 1.46 kg (my friend weighed it at 1.53 kg).
  • The power cable uses US-style 2-pin plug.
  • The AC adapter uses a very thin connector to the netbook.
  • The HD access and capslock use blue LEDs.
  • There is no numlock and scroll-lock LED.

It does not come with a bag nor DVDs! The packaging is also pretty compact.

HD partition

C:107.37 GB
Recovery16.11 GB
D:126.56 GB
EFI20.97 MB

23.9 GB is used in C: out of the box.

I don't like the dual data partition structure with the Recovery partition separating them, but I can understand why Asus took this approach — a recovery will wipe out C: while leaving D: intact.

Due to the lack of built-in optical drive, I'll most likely stick with this structure. 100 GB is large enough for everyday use. I'll put "archived" files in the data partition.

Booting

It boots up pretty fast.

To Windows startup screen4s
To Windows login screen27s
To desktop5s

Windows Experience Index

Processor3.5
Memory5.0
Graphics3.2
3D graphics3.7
HD5.9

A 1.2 GHz Core2Duo U7600 ULV CPU — which I'm using now — gets a score of 3.7, so I can expect similar performance out of the 1.8 GHz dual-core Atom CPU.

(Just for comparison, a 2-CPU 2.8 GHz Pentium 4 Xeon HT gets a score of 4.6.)

Pre-installed Apps

There are way too many of them. I want a clean Windows 7! :angry:

  • Adobe AIR
  • Adobe Reader
  • Boingo Wi-Fi
  • ebi.BookReader3J
  • Eee Docking
  • LiveUpdate
  • Microsoft Silverlight
  • Skype
  • Times Reader
  • Trend Micro Internet Security

I uninstalled most of them. :lol:

Some of the apps are very large:

Adobe Reader650 MB
CyberLink YouCam55.9 MB
Dr Eee106 MB
Intel GMA Driver54.2 MB
LiveUpdate20.4 MB
Microsoft Silverlight20.2 MB
Nvidia Drivers63 MB
Syncables Desktop SE163 MB

Overall

I'm very happy with the netbook! :-D

The disconnected elites

News: A disempowered generation?

Date: 30 October 2010. Source: ?.

IN THE midst of all the talk about creativity and vibrancy and buzz, his question came like a cry in the wilderness.

Final-year aerospace engineering student Lim Zi Rui, 23, stood up during the Nanyang Technological University Ministerial Forum last night and asked: Did Senior Minister Goh Chok Tong know many young people no longer felt a sense of ownership in Singapore?

His question was one of several posed during the dialogue with Mr Goh, which ranged far and wide over ageing issues, art, even student accommodation.

I know what Mr Lim is talking about. Physically, Singapore has not changed that much since 2005. But it is far easier to bump into a "foreigner" these days.

When I was younger, I thought SM Goh looked out for the common people. He was still well-liked in 2005 when his wife remarked that T.T. Durai's $600k pay was "peanuts".

Recently, I found that SM Goh likes to deflect the question to something else and to re-phrase it "wrongly" so that bad becomes good. Mr Lim is worried about "Foreign Talents". SM Goh talks about "Foreign Workers". Mr Lim is disillusioned being a native Singaporean. SM Goh talks about integrating the foreigners.

There is another minister who always ask us to look at "the big picture". That's fine, but that's not very helpful.

I didn't think too highly about Mr Lim' arguments about the lost engagement. No flat means no engagement? That seems being more practical than being in love.

Flats are still overly expensive, that's true.

Microsoft, a has-been?

News: Microsoft's billions count for little in post-PC world

Date: 29 October 2010. Source: Economic Times.

Microsoft reported record first-quarter sales on Thursday of more than $16 billion and notched up a not-too-shabby $5.4 billion in net profit.

Not bad for a company that has been widely written off as a creaking dinosaur, destined to go the way of T-Rex in the face of competition from Google, Apple , Facebook and other companies that we probably haven't even heard of yet.

It's not just the tech contrarians who have been ganging up on the great software giant from the north. CNN ran a big story this week with the headline "Microsoft is a dying consumer brand" at a time when no less than five leading financial analysts all downgraded the company's stock.

It is still too early to write Microsoft off, but they do look vulnerable for now.

In the 90s, Microsoft was king and Apple was almost dead. Now it is the other way round. Fortunes rise and fall.

Singapore, the global city

News: Both boon and bane

Date: 30 October 2010. Source: The Star.

Singapore is striving to change itself into a metropolis, a meeting place for wealth and talent, but the flourishing life also comes with the high cost structure of global cities.

WHEN the government recently launched a dating campaign for young singles, it received an earful that maybe it was holding the wrong end of the stick.

A few men and women found it cool, but a wider response was: "Before you play Cupid, reduce the cost of living first!"

Your feelings will depend on whether you are being swept up or down the social ladder.

I find it very easy to be resentful, but ultimately, we decide our own fate.

Look Ma, no anti-virus!

Famous last words. :-D

I don't use anti-virus. This usually raise an eyebrow among the IT-savvy people.

I do keep my system up-to-date and use the built-in firewall. The firewall mainly prevents rogue servers and does not warn about programs that "dial home".

The trick to no-AV is to use common-sense. I try to avoid these as much as possible:

  • EXE files – very seldom; and then only well-known apps and from reputable websites
  • ActiveX – almost zero chance I will accept
  • Java – only for bank websites. I turn it off by default
  • Flash – I turn it off by default
  • PDF – I try to avoid it as much as possible. I also disabled its JavaScript
  • IE – I use another browser. I use IE only when it is absolutely required. These days, most sites work with other browsers just fine

(To be fair, IE is actually quite safe these days because it runs in a sandbox.)

Marry with the right mindset

News: Is Divorce is the Back of Your Mind as You Are Saying "I Do"

Date: 1 June 2006. Source: LifeStyle.

"Do you take this man or this woman to be your husband or your wife till death due you part? That is the question you are asked during your marriage vows. But in the back of your mind were you thinking, sure I take this person. But if it doesn't work I'll file for a divorce and get on with my life?

If that thought was in the back of your mind, you are not alone. It must be in the back of some couple's minds because 50 to 60% of today's newlyweds will divorce. Why?

The number one reason is money. They say money makes the world go around. But they also say it is the root of all evil.

Food for thought.

What's up with dates?

Today is 10/10/10, a rather special day if we write in this notation. As such, many couples would choose to marry on this day. IIRC, a friend married on 20/02/2002, at 20:02 to boot.

I saw a posting saying that 101010 in binary is 42 in decimal, or "the answer to the Universe".

Okay, so it is special. Grab your towel and don't panic!

Text-based screen manager

One thing I like VNC is its stateless nature. You can reconnect back to your session anytime. It is a great feature if you connect from multiple hosts.

Unfortunately, VNC is very slow over WAN, while CLI is super fast, so I prefer to use CLI. However, the free SSH client, putty, does not support tabs.

(I don't like to open too many instances because they take up screen space.)

This is where screen comes to the rescue! It is a text-based screen manager. It can open multiple "windows". Like VNC, it can be detached/attached freely. Perfect!

I have not used it in years because there is no need to: modern GUI terminals all have a tabbed interface.

How I use it:

To startscreen
New window^A ^c
To switch window^A [0-9]
Window list^A "
Enter scrollback mode^A <esc>
Rename window^A A
To detach^A d
To reattachscreen -r

(Note: ^A = Ctrl-A)

I remap the command key from ^A to ^G because I'm used to using ^A to jump to the start of the line:

screen -e ^Gg

Life is good again.

(Ctrl-G is the beep. It is rarely used. Surprisingly, it is quite hard to find an unused Control key.)

Hard disk size barrier: a tale of mismatched interfaces

A colleague mentioned he was not able to boot his external USB HD if the first partition was 128 GB, but was able to do it if it was 32 GB. I don't know the cause, but it got me thinking about the hard disk size barriers we have encountered in the past.

IDE Interface

The sanest of all (IDE-related) HD interfaces is the IDE interface. This is where the PC interfaces to the drive.

(Note: decimal SI units are used; 1G = 1,000,000,000.)

Year Standard Addressing Max size Year broken
1986 pre-ATA 22-bit 2.1 GB 1996
1994 ATA-1 28-bit 137 GB 2002
2002 ATA-6 48-bit 144 PB n/a

BIOS

Year BIOS Addressing Max size Year broken
1983 Int 13h 1024C/16H/63S 528 MB 1993
1994 Int 13h (ECHS) 1024C/64H/63S 2.11 GB 1996
Int 13h (ECHS) 512C/256H/63S 4.22 GB 1997
Int 13h (ECHS) 1024C/240H/63S 7.93 GB ?
1998 Ext Int 13h LBA 2^48 n/a

The BIOS has 2 real limits: 528 MB and 8.46 GB (24-bit addressing). The rest are due to bugs.

The first 528 MB limit lasted ten years. The first HD was 10 MB. I don't think the designers expected the limit to ever be reached. I could not find when the 8 GB barrier was broken. Probably in 1998 — a mere 5 years. It is even more unbelievable that the 137 GB barrier was broken in just 4 more years time.

1994 to 1998 was chaotic. We could not reliably move HD between computers due to different BIOS HD translations. Thank goodness those dark days are over.

The 2.11 GB limit is due to a BIOS bug. The 4.22 GB limit is due to DOS/Windows limitation (max 255 heads).

Just a note, the BIOS should not matter since we started using 32-bit OS in the mid-90s, as they don't use the BIOS. The BIOS is only used to read the bootloader, which can be stored within the first cylinder.

Other limits

Linux had a 64k cylinder bug that affected >33.8 GB HD. It surfaced in 1999. (It stores cylinders as a 16-bit integer.)

There is also a hidden limit of 2 TB if the software uses 32-bit sector numbers. (The first 2 TB HD was shipped in 2009.)

File system

Year Type Max size Year broken
1983 FAT-12; DOS 2.0 16.7 MB ?
1984 FAT-16; DOS 3.0 33.6 MB 1986
1988 FAT-16; DOS 4.0 134 MB ?
1991 FAT-16; DOS 5.0 537 MB 1993
1995 FAT-16; Windows 95 2.16 GB 1996
1996 FAT-32; Windows 95B 127.53 GB 2002
1993 NTFS 16 TB n/a

Don't worry about NTFS. It can support bigger HD if we use a bigger allocation unit (default is 4 kB).

(By now, it should be obvious we should use variable encoding to handle the ever increasing HD size.)

No wonder HDB parking is so expensive

News: HDB spending S$66m to add 5,000 more carpark lots

Date: 1 October 2010. Source: CNA.

To ease the shortage of parking lots, the Housing & Development Board (HDB) is spending S$66 million to add 5,000 more lots in over 100 carparks in the next three years.

Serangoon Central is one such area to benefit from the move. A new carpark there will soon provide residents with 62 more parking lots.

$66M / 5k = $13.2k per lot. At $90/month, it takes 12 years to break even.

It is not possible to solve shortage of carpark lots with more lots — you'll run out of land first. The high car population means cars can always saturate a popular location.

We need to move towards an adaptive supply-n-demand system. For example:

>90% full $5.00/hour High demand, we can ask for the sky.
>75% full $3.00/hour Popular, so charge more.
>50% full $2.00/hour Automatic peak rate.
>25% full $1.00/hour Automatic off-peak rate.
<25% full $0.50/hour Make it cheap so that people will come and park.

The details are more complicated, but you get the basic idea.

The hidden water cost

finance

Water costs $1.17 per cubic metre. It is expensive compared to other countries, but it is still a pretty reasonable price. (1 m^3 is a lot of water. Try to imagine a cube that size.)

What is not as obvious is the 23.96% waterborne fee and the 30% water conservation tax. Taken together, 1 m^3 of water actually costs $1.8013.

And not forgetting the fixed $2.80 sanitary appliance fee. (This is equal to 1.55 m^3 of water!)

A 24/7 server running cost

Singapore's electricity tariff for Q3 is $0.2413 per kWh.

An Atom PC draws around 25W. The modem/router uses around 10W.

It costs $0.2027 per day, or $6.18 per month.

(Formula: 35W / 1000W * $0.2413 * 24 (hours).)

This can be generalized to all electrical appliances.

25.6 kWh may not seem much, but it is almost 30% of my current electrical usage.

Segregating website files on a shared server

Apache runs as www-data. A user's website is in his user and group.

To allow Apache to access the user's website, the website must be readable to everyone. This allows other users to access all the files in a user's website! This is not desirable because server-side scripts and data files are exposed.

Note that the files are still semi-hidden because other users are not able to view the website's directories. However, they can guess the filenames by brute-force.

How can we make the website more secure? Solutions abound on the Internet, but they are all a tradeoff between security, performance and maintenance. Most shared servers are not totally secure due to that.

This is what we need to do to insulate users:

  • Each user's website must be served by a different Apache user/group, say www[0-99].
  • The user's website must in the same group as his Apache group. This prevents the files from being read by everyone else.
  • The user must be part of his Apache group too so that he can chown the files to the Apache group.

This can be tedious, though. Every new file needs to be chown to be accessible by Apache.

In a webserver-only server, we can put Apache in the same group as the user, so we can skip the chown step.

Notes:

  • This solution is only feasible for a small number of users. (Each user requires a separate Apache instance.)
  • A poorly written script can still leak any public file on the filesystem, including /etc/passwd.
  • A poorly written script can still leak any of the user's files. However, it won't be able to access other users' files.

We need to chroot Apache to truly secure the filesystem, but it is harder to set up and requires on-going maintenance.