22.10.08

do news writers know what they are writing about?

saw this article about SKorea finding melamine in egg powder... near the end of this article, the reporter attempts to explain what melamine is: "Melamine, an industrial chemical that artificially increases protein content in dairy products, caused an uproar [etc]"...

i think that a chemical that increases protein content would probably be... protein... instead, the clause should be "... increases perceived protein content" or "... increases nitrogen content"...

makes one wonder what other technical terms are being explained wrongly...

21.10.08

android, openmoko

read about android being open-sourced just now... (apparently, it just happened not too long ago).. this prompted me to go look at what's up with openmoko (i didn't mind using my flex points to buy the freerunner)... anyway, the gsm900 versions are sold out at the webstore, so... no go...

also saw that the next hardware design (gta03) looks attractive too... except for the presence of a camera... i then went to see if the enduser can disable it (desolder or something... this is an open phone after all)... and it turns out that as of 26 aug 2008, the camera interface is planned to be modular, which is great!

filing under "computers"... well... maybe i should rename this label to "gadgets"...

20.10.08

fujitsu lifebook p8020

hmm.. this notebook is also an ultraportable... differences (comparing the non-customizable version of the p8020):
  1. faster processor (1.4Ghz)
  2. ieee1394 port
  3. smaller hdd (120gb)
  4. lighter (1.31kg)
  5. more ex (US$1799)
  6. batt life is TBD
  7. looks nicer (thinner screen bezel)
  8. port replicator has DVI-D [need to check A600]
overall, a600 still looks more attractive

17.10.08

a primary school kid's confidence

as [tuition] teachers, do we want to build up or tear down our students' confidence?

of course, "tear down" sounds quite brutal... but... let's say one tries to build up a kid's confidence... that's all fine and good until they start getting yaya-papaya and insisting that there's nothing wrong with their working when there're obvious mistakes.. case in point: i've had a kid doing 199 + 11 = 200 and insisting that it was correct...

but if the kid doesn't have confidence, then it becomes a problem of the kid not even attempting questions that he would be able to do... case in point: same kid as above... once he sees even 1 fraction on the question, he'll say "i dunno how to do"... forced him to do it and... guess what? he did it... whoopie...

both these incidents happened on the same session... wondering what i should do to him...

to (have piano lessons) or not to (have piano lessons)... that is the qn

practising bach these few weeks has highlighted my dreadful lack of [proper?] piano technique...
  1. can't even get notes to sound evenly (i.e. rhythm problem)
  2. can't get piano [dynamic mark] and pianissimo (i.e. dynamics problem) on my piano [instrument]
  3. lack of finger independence
  4. etc.
so... maybe i should have piano lessons again... the problem? how to find a teacher... and how to find time... sigh...

public transport fines and public transport in general

yesterday, ptc fined smrt and sbs for failing to meet service standards (see here also for the ptc announcement and more details on non-compliance)...

it's quite amazing to see that there were so many instances of non-compliance for having the bus leave the bus terminal within 5 min of the schedule at least 85% of the time daily... this doesn't even seem like a tough requirement to pass (unlike, say, loading shall not exceed 95% during weekday peak hours)...

i also note that only 1 smrt service had a failure for the loading criterion for 1 day... whereas sbs had 27 failures...

anyway, i wonder how effective this fine system is... if the fine doesn't even hurt, it doesn't really make economic sense for either bus company to improve its services i guess???

and what's this nonsense about encouraging the public to take public transport when such easy-to-pass standards (well, i'm guessing that they are easy) are being infringed?? no wonder one doesn't really see ministers/saf officers (the more vip-ish ones)/rich people taking public transport... i was just thinking the other day.. a guy who doesn't X tells others to X is just _slightly_ unconvincing, don't u think? _if_ the day comes when... uh... let's say.. the PM can welcome delegates (including heads of state) and transport them using public transport (of course, on the pretext of showing what an efficient public transport system our dear country has)... then... that's when public transport would really have arrived... the chance of that happening is... approximately 0 (to the nearest 4 decimal places) i guess...

structured whatnots part 2, deposit guarantees

glad that the straits times is finally putting up articles on this nonsense, after the speaker's corner event took place...

on another note, also glad that mas and mof have finally decided to guarantee bank deposits until dec 2010 although how they intend to use s$150bn to cover approx s$700bn is beyond me.. sdic's website is also not updated yet...

i also note, rather disgustedly, that the motivation for this move was to "avoid an erosion of banks’ deposit base and ensure a level international playing field for banks in Singapore" - pro-business reason, rather than for pple's ease of mind... of course, other govts have also been doing it to shore up confidence for their banks...

the stated reasons for NOT guaranteeing bank deposits fully work in all circumstances:
  1. if banks are already safe, there's no need to guarantee..
  2. if banks are not safe, then it will cost too much to guarantee and this will eventually trickle down to taxpayers (well, in fact this cost thing was used by mas to justify the measly 20k limit, so if banks are not safe one can only imagine that this reason will be strutted out even more)
BUT, now that banks' competitiveness is threatened, they guarantee the bank deposits... so my romantic notion that the govt works for the good of the pple has just been dented...

design choices, more tool gripes

Ooh the past week has just whizzed by hah... and i shall try not to use capital letters anymore...

this wk, 1 of the things i was doing was to implement a phase-shifter (digital). 2 issues:
  1. no real math library yet, so needed to get the trig tables in.
  2. needed to get some values into the chip to act as rom.
for (1), i just wrote a matlab/octave program to output a vhdl file containing a package containing the trig table (one quadrant of cosine). easy.

for (2), i wrote a smallish extension to emulate a 2d unconstrained array (to move stuff into the INIT_xx, INITP_xx generics of RAMB16_Sxx_Syy). 2 problems:

first, the INIT_xx and INITP_xx stuff... no documentation available from ise 8.1 (which i'm using) as well as ise 10 (the default doc on xilinx's site). the lib doc referred to the constraint doc, and the constraint doc referred to the lib doc. whoopie. instead, had to search for ise 7's documentation, and the description was in the constraint doc. OR, read the VITAL sim source file...

second, my extension included a pair of functions to access the "elements" of the array:
function get_bv_elt(spec: varray_spec_T; b: bit_vector; n: natural) return bit_vector;
function set_bv_elt(spec: varray_spec_T; b: bit_vector; n: natural; v: bit_vector) return bit_vector;

so the second function was meant to be used as: o := set_bv_elt(spec, o, index, new_val), for e.g... this worked ok with modelsim, but synplify bombed out with an "out of memory"... seems like the compiler is memoizing each function call (i have large loops)... how to solve? convert the setter into a procedure, which reduces its reusability... not that it took alot of work, but... why can't the compiler just garbage collect the unneeded stuff?? wasted 15 min of my time (10 min waiting for it to compile 2x).. grrr..

11.10.08

Schubert Sonata in A minor Op. 42

Gosh I listened a recording of this piece (linked from Wikipedia; some performance in Boston)... and... the other (non-first) movements of this piece are like... tough...

hooray for sequels

Yeah! After a season of... not very interesting anime, a new season is starting with 2 sequels to anime that I rather like:

First is Nodame Cantabile Paris... Follows up after the couple go over to Paris to have more musical adventures. The (classical) music is still from the TV series and TV special though...

The other one is Clannad: After Story... More silly/cutesy adventures of the Engekibu... erm... drama club i think...

pull ups

Hmm... since RT (remedial training) is starting soon, I have decided to put in some more effort this time in an attempt to pass my IPPT (individual physical proficiency test). So, to increase my motivation, I shall attempt to record what I've done over here. (I guess this is some form of imaginary accountability??)

Anyway, the plan is to alternate days of pull and push ups, do some leg stuff (haven't decided what... besides doing 1-legged half-squats) and get started with some form of jogging hah [the jogging's going to be a BIGGGGG challenge].

For yesterday (10/10/08), it was 6+5+6 pullups.

A break from Bach

I just got myself a copy (from IMSLP again, where else??) of the 1st movement of F. Schubert's Sonata in A minor Op. 42. This _might_ be the first Schubert I'm playing... I was too enthralled with Chopin when I was a teenager... Anyway, the song selection comes from the manga/anime Nodame Cantabile, which is basically... a love story with classical music mixed in (or a classical music story with love mixed in... well). Watched 2 samples on Youtube (one by a guy and the other by a lady) and decided that it's quite nice after all.

This means that Invention 4 will be put off indefinitely.

10.10.08

on carpark lot reservation

Today when I went to work, I saw the same sight that has been greeting me since sometime last week - a whole bunch (about 14?) of empty reserved lots. And everytime I see these I will be irritated, because, as a selfish driver, I do want lots that are nearer to the building in which I work. So, being Singaporean, I griped about it to my colleague, and being a new blogger, promised him that I would write about it :P

Of course, as my colleague rightly pointed out, my employer has the perfect right to reserve lots for VIPs that are visiting. But because I am irritated by this practice, I have to find another angle from which to criticise this kind of action.

But before doing that, I want to emphasise that I have nothing (on topic) against these VIPs [I do have some gripes that are unrelated to this incident]. In fact, I doubt that they would mind parking in normal visitor lots. My gripe is completely against my employer's actions.

First, the lots that are being reserved are staff lots. There is plenty of parking space in the visitor's carpark (of course, when the staff lots are being reserved, the visitor lots get used up alot quicker, by staff cars). So why don't the VIPs, being visitors, park in the visitor's lots? Well, I would think that it is because the visitor carpark is significantly further from the main building than the staff carpark.

Now, if the VIPs have problems walking, I wouldn't mind if they parked near the main building, but the point is these are people from the SAF. And they are supposed to be fit - in fact, they probably are alot fitter than me. Being fitter, I would expect that walking from the visitor's carpark to the main building probably induces much less discomfort than most people. Maybe this argument doesn't apply to ministers, but.. I don't think the ministers that visit have much problems walking either. And even if there were people who had difficulty walking, the number of cars carrying them would be much less than 14.

Perhaps it is a form of common courtesy that my employer affords to guests that are here on business. This argument doesn't quite make it because on the same day, I saw a WO, and a LTA or CPT parking in the visitor lots. Clearly, the reserved lots were not for them, even though they were here on business. The main "party" who was going to be there today was the CAF. So the lots were probably for his entourage.

Being extremely uncreative, the only other reason I can think of is... well, maybe the reserved lots are for the rich and/or powerful (R&P). Certainly, CAF and ministers fall into that category. This kind of reason is deeply unsatisfying (in part because as humans, we also have a partial desire to be R&P, I guess, and this kind of behaviour just points us to our un-R&P-ness, yah?). Well, this aside, assume that this _is_ the reason...

Suppose a middle manager rudely tells his subordinates to clear out of the way for his boss's visit, and then treats his boss nicely. A phrase we use to describe this is "suck up" (SU). What are the probable reasons for SU-ing? Well, to gain some advantage, I guess? Transfer that pattern of thought to the case of my employer. What advantage does it stand to gain?

What is the impact of these actions on the psyche of us employees? Well, for one, a vibe I get is "hey, if you're R&P, you'll get to enjoy all these as well!". Another is "well, because you're just a normal staff, you'll just have to live with these inconveniences. Aiyah.. anyway, only walk abit mah don't complain too much. Be glad that you even have a parking lot up here", and "staff should treat customer better (physically)! If you have meetings with them, make sure they are comfortable - oh, you can order refreshments for them too... but for internal meetings... oh we should be more thrifty and not spend on refreshments" [NOTE: I state here that the official policy is that refreshments are allowed based on the length of the meeting and not the particular persons attending].

Well, having said all that stuff about being disgusted with my employer for SU-ing, do I practice this? Well, yes. I definitely tend to treat (and have better thoughts of) my colleagues, friends, etc better than, say, a construction worker. Is this right? Well, no, at least, I don't think so... James 2:1-9 essentially speaks against that.

Hmm... wonder how I should end of... this rambling has taken up more time than I expected... well.. till next time...

Portege A600

Just visited here and the more impt specs are:
  1. 1.2GHz C2D ULV
  2. 2GB RAM
  3. 160GB HDD (yeah! not the pricey potentially problematic SSDs)
  4. built-in DVD with R/RW
  5. 12.1" 1280x800
  6. GbE
  7. 802.11 b/g/n
  8. camera [this is a MINUS :(]
  9. built-in microphone [a minus for privacy?]
  10. 1.38kg [another minus]
  11. batt life "up to 9 hrs".. so... if that's marketing, should be able to do at least 4...
  12. all this for only a measly [USD?]$1499 ~= SGD$2200
  13. oh yeah, comes with vista business [another minus], but i'll install linux anyway...
maybe I don't have to enroll for M.Sc. after all haha... if i'm willing to take that weight...

i'm quite surprised at the battery life actually... it's 5800mAh... that means the current draw is... 0.6A.. if we assume the battery voltage is ~11V, that gives about 7W power draw...

The max TDP for the SU9300 (processor) is 10W.. so... hmmm.... maybe taking the realistic life to be half the figure may not be too wrong after all... well, i might just be too out of touch with this aspect of technology...

9.10.08

laptop

I also saw a report on upcoming toshiba laptops.. and the specs of the R600/A600 are certainly enticing... I'm currently looking for a replacement for my current Portege 2000 (bought in 2002) since the pccard slot is cranky which makes wifi cranky as well... also, it's a teenyweeny bit short of RAM, so I'm forced to use xfce instead of gnome, which i use on the desktop (well, i haven't tried the relatively new LXDE yet)...

When I was in HK, D brought along E's (well, I shall try not to reveal names in this blog for now I guess) eeepc, and I thought... ok... a netbook is actually not too shabby (it had way more ram than my machine, which helps)... but the main problem was the size of the keyboard... So on that trip I decided that my requirements are:
  1. weight: no more than 1.12kg
  2. preferably full-sized keyboard
  3. battery life must be no less than 4 hrs (to read Jap notes on the plane harhar)
  4. must be able to play at least a 640x480 h264 encoded movie, and hopefully a 720p one :P well, I don't need that size, but i hope to at least be able to decode the 720p real-time and scale it down if it's the video driver that slows things down.
  5. should have speakers that i can at least hear in a reasonably quiet hotel room
  6. should cost <>
  7. should not be a MacBook Air... or perhaps I should say... should have more than 1 usb port... hopefully it also has a built-in optical drive, but that might be asking for a wee too much for the weight that i want...
the A600 looks to be ideal... yeah... maybe I should go do an M.Sc. in Math after this laptop is launched to be eligible for the student price hahaha...

structured whatnots

Just read a CNA online report on 983 S'poreans petition for MAS to probe sale of credit-linked securities. Actually I'm subscribed to the RSS feed of TKL's blog. In any case, I hope that the govt really looks into this....

I've always been moving money around in fixed deposits based on interest rate (well, my father makes me), so... starting from last year, whenever I deposit to/withdraw from the FD, the counter staff would always ask me whether I'm interested in a higher interest rate yadda yadda... Had it not been for the fact that this is actually not "really" my money (i.e. it is not my salary), and that my father really doesn't approve of "this kind of thing", I might really have deposited this money into this kinda product... thinking that it would be safe. Gosh. From the fallout, it seems like these things are very far in terms of risk from fixed deposits, so why in the world are they like recommending it to pple who are opening FD accounts... duh...

Not to mention, I keep getting flyers advertising these structured whatnots along with my statements.

Anyways, learning from the mistakes of others, I guess one really must be aware that the bank's primary purpose is profit-making. The goodwill from giving good advice is apparently simply not worth the peanuts obtained from recommending such stuff to pple.

And of course I hope MAS will look into this, even though the statements made so far seem to me (a lay person) that it just doesn't want to get its hands dirty with this. If nothing is done should I conclude that the govt is more interested in maintaining a business-friendly environment over here? In that case, perhaps staying around in SGP isn't such a good idea after all; I will someday grow old and senile and trusting of banks too...

tool chain gripes... again...

Since I've been spending this past few weeks on FPGA programming, my thoughts have inevitably drifted to all the things that are wrong with the whole workflow...

The last component I've been working on is some FIR filter... Now, this _SHOULD_ be as easy as just writing the equivalent of

y := 0;
D <= din & D(0 to NTAPS-2);
for i in 0 to NTAPS-1 loop y := y + COEFF(i)*D(i); end loop;

or something similar...


BUT, because of the *inadequacies* of the toolchain, I can't do this because I will inevitably end up with timing closure problems (I'm running a Xilinx v2p at 200MHz after all).. So instead of the much simpler behavioural description, I have to do this sorta thing structurally, so it becomes a mass (or mess) of code... grrrr...

It doesn't even work if I put a few delays at the end to let the synthesis tool rebalance the delays (in the first place, why can't I just say, add as many delays as the tool requires?), because the placer will inevitably place the coefficient memory in a different location from the multiplier, and not realise that the only place to place the FFs feeding the multiplier can only be the CLBs near the multiplier! So the P&R (place-and-route) will take about an hour before giving up and saying it's not possible...



Because of this, I wrote a set of primitive components (like an adder which can also do loading, or a loadable counter) one year ago. However, this kind of hand-coded thing is never flexible enough... for e.g. take the adder-with-load example. it's declaration is something like..

entity addld is port (a, b, ld_val: in std_logic_vector(...); cin, ld_n: in std_logic; cout: out std_logic; s: out std_logic_vector(...)); end addld;

and it's behaviour is something like... (loose syntax again)

cout & s <= "0" & ld_val when ld_n = '0' else "0"&a + "0"&b;

incidentally, this component takes up the same amount of delay (and space) as a normal adder (without the bypass load functionality). AND, it cannot be inferred by the synthesis tool because it uses the MUL_AND part of a CLB (this idea was taken from one of Xilinx's appnotes) which can only be instantiated... even the LUT part cannot be inferred because Xilinx's synthesis tool is too stupid to realise that the A and B inputs must be equal to the MUL_AND inputs and will happily optimise them away, leaving the mapper to complain and bomb out. great eh?

BUT today, i wanted to load a particular pattern... (I want to load the extremal value of a 2's complement number)

ldval <= neg & repeat(not neg, WIDTH-1);

(repeat will form a vector out of [arg1] repeated [arg2] times)...

so because the addld is hard-coded with LUTs, the synthesis tool obviously doesn't figure out that to implement this particular ldval it is not necessary to incur an additional LUT delay computing , and so I might get silly timing closures related to this again! grrr... of course, I can build in this capability to have ld_val(i) optionally inverted etc etc but the point is... THE TOOLCHAIN SHOULD BE THE ONE DOING THIS NONSENSE!!

yeah, so basically... sian...

Invention 8

After about an hour of practice, I can finally (sometimes) play the whole piece through BH (both hands)... Realised my left hand is really weak... :(

Invention 13 also sounds uneven... almost feels triplet-y... and as for #14, I still can't do the 3-4-5-4-3 fingering on the left hand (LH) with the ring finger on a black key fast... sheesh...

Think my LH 4th and 5th finger are just... weak... sian...

Also need to practise the legato part more...

:)

My mother's minor hand op was ok, no complications... Thank God...

8.10.08

vhdl gripes

Was implementing a FIR today. If you have a FIR obviously you'll have an adder tree. But how does one declare a generic adder tree component? It would be nice to be able to do (pardon the syntax errors):

entity signed_adder_tree is
  generic (N, IN_WIDTH: positive);
  type din_T is array(0 to N-1) of std_logic_vector(IN_WIDTH-1 downto 0);
  port (c: std_logic; din: din_T; dout: std_logic_vector(IN_WIDTH+log2(N)-1 downto 0));
end signed_adder_tree;


but this is unfortunately not possible. So instead, I need to concat the inputs into one humongous vector (since std_logic_vector(N*IN_WIDTH-1 downto 0) is obviously possible) and then manually unwrap inside. Such a waste of time! Fortunately, VHDL-200x has this :)


Another minor gripe I have is the inability to do recursive instantiation of components, i.e. instantiate an entity from its own architecture. Instead, I need to do iteration... which means a need to declare lots of signals... imagine the same adder_tree... if I could write it as (again, with very relaxed syntax, and ignoring the pipelining):

architecture arc of signed_adder_tree is
begin
  base_case: if N = 1 generate
    dout <= din(0);
  end generate;

  recurse: if N > 1 generate
    signal dd: array(0 to (N-1)/2) of std_logic_vector(IN_WIDTH downto 0);
  begin
    l1: for i in 0 to N/2-1 generate
      rr: entity work.addld_pipe
      port map (c=>c, a=>din(2*i), b=>din(2*i+1), s=>dd(i));
    end generate;

    ll: if N mod 2 = 1 generate
      process (c)
      begin
        if rising_edge(c) then
        dd(dd'high) <= signed_resize(din(din'high), IN_WIDTH+1);
        end if;
      end process;
    end generate;

    lr: entity work.adder_tree generic map (dd'length, IN_WIDTH+1)
      port map (c=>c, din=>dd, dout=>dout);
  end generate;
end arc;

How nice would this be!? But instead, now I have to declare all those intermediate signals... yuck...

a parallel/distributed vhdl simulator

While at work just now, I was dreaming of having a parallel VHDL simulator again... A quick check on google showed that it appears that a normal digital circuit simulation does scale up quite well, contrary to what I would have guessed... Maybe this can be an extremely long term personal project...

mum's hand

My mother's going for an op at SGH tomorrow morning. Minor hand op with LA. Well nobody knows about this blog yet, so this is just for recording purposes... Praying that it will be successful i.e. no complications and it will accomplish its purpose...

bach's inventions

A while ago I decided to "re-learn" the piano.

Originally the idea was to practise Hanon (I actually found a copy in some cupboard at home), but after googling discovered that it actually might not be such a good idea since I probably don't know what's right and what's wrong about technique.

Some sites/forum posts suggested Bach's inventions and sinfonias (is that the plural form??) and since I happened to have a photocopy of the Bach-Gesellschaft edition (which is public domain and at imslp.org anyways) of his keyboard music, decided to have a go at it. I originally photocopied it in Sec 3[?] when we were exposed to his French suite #5 (G major) in MEP but more on that some other time. Perhaps.

Anyways, after some time, inventions 1 and 13 are okay and memorised; 14 is on the way (still trying to do the turn-like motif on the last 3 fingers of the left hand argh) and approximately memorised; and going to start on 4 and 8 (rather short pieces) tomorrow [hopefully].

The sinfonias seem totally undo-able at the moment... now I remember why I always avoided Bach and chose Scarlatti sonatas for the piano exams hah...

7.10.08

virgin post

Hmmm... decided to try this out... wondering how long it'll last...

Anyway, the first thing that struck me about starting this was the difficulty of thinking of some blog address that is available... anyways, this address is "inspired" from 2 well-known non-orientable surfaces. I was surprised that even mobiusstrip, mobiustrip, and kleinbottle were taken.