Wednesday, October 28, 2009

[DSA] posting of link in comment box

pls use HTML code

The following link is done with
www.google.com


<a href="http://URL" > the link < /a >


still figuring out how to post js in the comment box. as for entry, no problem encountered. If you have a solution to it, I did like to hear from you

Tuesday, October 20, 2009

[DSA] stun question Wk1


I came across this "game" when our department have a staff retreat at the Singapore flyer.
The objective of the game is to arrange staffs into 3 "E" characters.

Since this week our learning topics revolves around functions(), arithmetic evaluations, use of variables and proper programming methodology. I think it would be interesting to write a program to solve it. Anyway, during that period of time, access to a computer is a luxury. All equations have to be done on the paper. I manage to save this data in my memory and it is fresh still.

Attached is the screenshot of the piece of paper that illustrate the requirements.

Assume that the top and bottom horizontal bar is X, mid horizontal bar is (X-1) and the vertical bar is (X+1). Instinctively, this is a classic case where we can solve for X to the total number of staff and use it to form the "E". There is a possibility that there will be some staff remained, because we would want to maintain the uniformity of the 3 "E" characters.

3[(x-1)+2x+(x+1)] = total staff available.
which can further deduce to
12x = total staff available. => that is for forming 3 "E" characters.

Hence forming of 1 "E" character would be
4x = (1/3) staff available

The diagram below are not drawn to scale.

(x+1)
======== (x)
+
+
====== (x-1)
+
+
======== (x)

But how to translate the problem specs to code????????

we can use a divide and conquer approach to subdivide the problem into smaller portion.
Solving the algebra problem in the program might be redundant, since we have solve it on paper.

Some questions to ponder before start writing the code
a. what are the variables will be used.
b. do we need to use some form of data structure to store the temporary data?
c. what are the algorithms to calculate the X's, to display on the screen.

below are the sub-problem that need to be solve. drill down to further detail is not required.
1. Read in inputs from user for the number of staff available
2. Calculate how many will be left out from the E formation
3. calculate how many staff will form the top, mid and bottom horizontal bar
4. calculate how many staff will form the vertical bar
5. output to a screen

let the code and comments flow in!

Thursday, October 8, 2009

[DIY] Blinking LED bling belt buckle

Last Last week, attended one of my secondary school classmate's wedding. Btw, late Sept and early Oct I have already received 4x invites to wedding. More are in the pipeline..oh my goodnessssssss...........

Arghz, wedding reception is soOOooOoo boring. The food is usually not on par (mass produced), the alcohol is crazy (I'm in the brotherhood team, I'm used to blockade drinks targeting the groom.No drink driving please), lots of photo taking (I don't like to be the subject and I insisted to be photoshopped!!!! RAWRRR)

What totally grab my attention was my the first dish served, the cold platter. The lights are dimmed, Techno song was played (yeay!!!) and at the center of the dish there is this very "beng" blinking LED. It is in the shape of a dome, served in a cup of lightly coloured agar-agar (to give the light a medium to be illuminated). Quickly my I laid my paws on it before my bro daniel get to lay his! haha

Can' wait, I fished out my phone switch on the flash and tried to open the dome. But it is secured by screws! Well, I usually carry a handy tool set with me. No effort at trying to pry it open.

What drove me thinking was, how possible to pack 1 LED, some sort of controller/pic/MCU and battery cell small enough to fit into a dome shaped container at the size of a 20cents????

The content of the dome is just 1 LED and 2 button shaped battery (gives 3v). But, where is the controller???? Upon close inspection of the LED, i saw a tiny weeny black chip in the LED itself. That briefly explains the whole LED blinking sequences. My girl said I am "sua gu" (frog living in a well)...

well....I am pretty much exited with the "new" toy, open it up and find out that I can easily make 1 myself too without the hassle of wiring up a controller/MCU/pic and the considerations to make it small enough to be portable. The sample dome is in my office.

"Inspired" by this blinking LED, I was telling my trainees about this bling i going to make.
It is basically a belt buckle, complete with flashing LED.

Went Sim Lim Square (SLS) and Sim Lim Tower (SLT) last week for window shopping.

What?? Window shopping at SLS and SLT??? Not orchard ION, illuma? you gotta be kidding me!

Was hopping in and out of the shops in SLT looking for cool kit set and wares i can play with.
Chance upon this Flashing LED that cost 50cents each. They came complete default with flashing sequence, such that, there is no need to have a pic/MCU attached to the LEDs. Small is beautiful.

Initially, I only want to use 3v (button sized) to light up the LEDs, so all LEDs are wired in parallel circuit. Because there are too many branches and the current are divided at each branch of the circuit, it is not enough to drive the blinking LEDs. Normal LED are still OK. It Is in the circuit as a referencing point for the "beng-ness", lumens [brightness]. Actually, i only bought 10 of these. "LED not enough lar".

here I gave you my prototype belt buckle, 3v and 9v powered. Can spot the characters I am flashing?



Thursday, September 17, 2009

[wares] upgrading fujitsu e8410 with 500gb hdd on windows 7 x64 64bit OS






Last Monday, the 2.5" 500GB WD essential passport i owned was dissected, disassembled to retrieve the goodies in there.
http://shin-ajaran.blogspot.com/2009/09/wares-opening-wd-passport-essential-25.html

Now, the hdd itself is going to be transplanted on my fujitsu E8410 (otherwise known as FCS lifebook E8410 on non asia pacific market). The E8410 is 2 years old, 160GB hdd, 4GB DDR2 ram and sports a CPU that support virtualization technique. It is the perfect candidate to upgrade it to an OS that uses 64bit architecture!



This is the back view of the laptop, bottom up. There are 10 screws to be removed, to get access to the HDD. The location of the HDD is the medium size box at the lower portion of the image above.
Disclaimer: It is your risk financially, liability (void warranty) to open up / disassemble your warrez!!

1. Remove the battery
2. Remove the optical drive
3. Unscrew the nuts that fasten on the cover
4. Lift up the hood!

The whole casing have to be lifted up. Check out the video below~!




[youtube]x_RF8FKKn2Q[/youtube]



A peek under the hood of my E8410

the HDD is located at the position of the grey box. It is protected by a metal cover, which need to be removed to get access to the HDD.



Close up shot on the CPU, a T7300



Close up shot on the HDD, A fujitsu 160GB beneath the metal cover.

1. Unscrew the HDD metal cover that is secured to the laptop.
2. Unscew the metal cover that is secured to the HDD.


The 160GB HDD that is going to be swapped into the WD passport essential casing.

Now, get my paws on the 500GB hdd!


Replaced the newly removed 160GB HDD into the connector




Now, put back the cover and secure *ALL* screws that was from the laptop :0)



Here come the win7 x86 installation part.
1. Get your hands on a copy of the OS. You can download from MSDN AA if you are a student of an academy affilicated with m$

2. Get your CD key from the local admin.

3. Setup bios to enable vituarlization. Need to turn this on to use the m$ virtualPC and the famed XP mode. Its RoXoR!!!!!



4. SOP install


5. Enjoy the goodies~~!


Monday, September 14, 2009

[wares] opening the wd passport essential 2.5" 500GB HDD

[youtube]C9wnJz-ZPrA[/youtube]


1. gently pry at the sides of the WD passport essential 2.5".
1.1 Use your fingernail/screw driver/card

2. gently lever at the rounded edge, one side at a time

3. pull out the white colour plastic piece gently.

4. Remove the shock absorbers (4pcs total)
5. gently slide the 2.5" hdd out of the aluminium housing

6. There you have a 2.5" WD 500GB hdd. HDD alone retails at s$138 at SLS, comex is selling at $119 for wd passport essential 2.5" 500GB