Our Daily Bread

what I need to do ...

  • Continious learning -unlearn as necessary
  • Reach out to family & loves ones
  • Maintain fitness - strong core and clear IPPT
  • Pick up parenting skills
  • Save up and plan for renovation
  • Build passive business & investment income
  • Back up Data
  • Manage $ Cash flow
  • Learn sinan mori

Wednesday, July 30, 2008

Sending Image via socket in j2me

Despite looking at several examples and forum i did not manage to resolve this for quite some time.I was blindly following the examples.File operation is suppose to be one of the basic fundamental concept in programming.After scrutinizing the code with understanding ... i set out to observe the bytes that are exchange and manage to nail down the problem.=) I am not satisfied yet got to ensure that it work for other formats and large files.

Nevertheless the following is the code snippets.

client side
=================
try {
FileConnection fileConn =
(FileConnection) Connector.open(imgPath, Connector.READ);
InputStream fis = fileConn.openInputStream();
long overallSize = fileConn.fileSize();
int FRAME_SIZE = 10 * 1024;
int length = 0;
while (length < overallSize) {
byte[] data = new byte[FRAME_SIZE];
int readAmount = fis.read(data, 0, FRAME_SIZE);
_out.writeInt(readAmount);
System.out.println("Amount of data send over>>" + readAmount);
_out.write(data, 0, readAmount);
_out.flush();
length += readAmount;
}
System.out.println("All data send over>> -1");
_out.writeInt(-1);
_out.flush();
fis.close();
fileConn.close();

} catch (IOException e) {
e.printStackTrace();

} catch (Exception e) {
e.printStackTrace();

}

output:
--------
Amount of data send over>>10240
Amount of data send over>>10240
Amount of data send over>>2567
All data send over>> -1


Server Side:
================
DataOutputStream out = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(path)));
int FRAME_SIZE = 10 * 1024;
int moreBytes = in.readInt();
System.out.println("Amount of data received >>" + moreBytes);
int readAmount = 0;
byte[] data = new byte[FRAME_SIZE];
while (moreBytes != -1) {
in.readFully(data, 0, moreBytes);
out.write(data, 0, moreBytes);
out.flush();
moreBytes = in.readInt();
System.out.println("Amount of data received >>" + moreBytes);
}
System.out.println("Done");

output:
--------------
Amount of data received >>10240
Amount of data received >>10240
Amount of data received >>2567
Amount of data received >>-1
Done

Sunday, July 27, 2008

One Step @ at a time

Found this song meaningful ...... one step @ a time .....

Lyrics to One Step At A Time by Jordin Sparks

Hurry up and wait
So close, but so far away
Everything that you've always dreamed of
Close enough for you to taste
But you just can't touch

You wanna show the world, but no one knows your name yet
Wonder when and where and how you're gonna make it
You know you can if you get the chance
In your face as the door keeps slamming
Now you're feeling more and more frustrated
And you're getting all kind of impatient waiting

[Chorus:]
We live and we learn to take
One step at a time
There's no need to rush
It's like learning to fly
Or falling in love
It's gonna happen and it's
Supposed to happen that we
Find the reasons why
One step at a time

You believe and you doubt
You're confused, you got it all figured out
Everything that you always wished for
Could be yours, should be yours, would be yours
If they only knew

You wanna show the world, but no one knows your name yet
Wonder when and where and how you're gonna make it
You know you can if you get the chance
In your face as the door keeps slamming
Now you're feeling more and more frustrated
And you're getting all kind of impatient waiting

[Chorus]

When you can't wait any longer
But there's no end in sight
when you need to find the strength
It's the faith that makes you stronger
The only way you get there
Is one step at a time

[Chorus x2]

Wednesday, July 23, 2008

Time wait for no one

I have got 2 more weeks before the terms starts again. This holiday has revolved around FYP which i made snail-pace progress. What’s going on? I am task to source for chipset and to date i have not gotten any yet and this have limited progress. If this requirement is given to a vendor i believe they can do it for a sum probably in range of at least $ 10,000. I really wonder what to do having exhausted all avenues, swimming in a pool i am not familiar in. Got to press on ....

I wonder what i value in life at present. I am not getting any younger and in a year time i got to start flying upon leaving school. Many things i want to do but cannot do due lack of funds and next time if i got the funds i hope to have the time. I say i want do this and that and end up not doing them. Got to work it out! Time is not going to wait for me. So abstract, in concrete sense, i look forward to be competent in areas i am keen in for now i enjoy image processing. In physical sense i am eyeing the IPPT gold, in social sense i got to plan some events and many more ...

Tuesday, July 1, 2008

In Green for 2 weeks

Had two weeks of ICT, had a fair share of high and lows. I when in very motivated and came out sulking. What happen ?? When you stepped in there are lots and lots of things to take over. When there numerous items to be accounted for your head cries “Where is the manpower?” There is no concrete system in place. Many times a note book and pen come to an aid with a long queue waiting to collect the items. Admin issue! Scene like this repeat most of the time.

1 x character had trapped in the office. All were wondering how he endured his pee almost half a day. It takes team effort and bit of detail to prevent this.

The state of the art RFID based system failed to detect some laps and delayed the book-out timing. Good thing there was some video to fall back on, and still that would be labor intensive. After the first run of 2400m, the system was reset and checked and it took hours before the circuit was open again. It was wait, wait and more waiting. On a positive note the scorching sun was slowing weakening. May be going back to manual mode for that period would have save man-hours as suggested by my boss.

Had abrasion and i had to endure with the rest of the training. Attribute it to the soap and undergarment. Once sore it takes days to heal. With the desert-like weather things just get worse. Lumps start to grow. The heat power came to the rescue during those moments.

Out in the field i bumped into a snake, get myself to Holland and manage to figure a way-out to mange the situation and progress further. Got to invest in a GPS device! Not a long -term solution though. My frequency ended up being jammed and shut-down at times. As the clock ticks, towards the closing somehow the energy level of some starts to grow. Handing over equipment, seeing the damage and loss list growing make my head spin. Fortunate some willing soul came forward to save the day.

At last it was all over.

In the process did meet some amazing people. Remarkably one of them is my boss, who never fails to smile and handle tense situation well. Another one, i will credit for is the hardworking M-----, who shoulder many responsibilities because he was willing, he need not have to and would just followed the rest. He had keep things moving. There is a bunch of group not worth mentioning let’s forget them and move forward getting better.

Quotes

  • You are your thoughts.The thoughts in your head are what institute the laws of attraction. You think therefore you are. - Joe Vitalli, The Laws of Attraction
  • Don't react blatantly in Anger and become a Zero - Papati
  • Don't miss out in the learning values of problems by over-looking the root causes but starting at the occurences - Raj
  • You can do almost anything if you have a steady income. Little or much, what matters is that you can count it, month after month.Without the regular flow of funds, you will be constantly distracted from you goals - Norm & Bo
  • Time is greater than money, you can never really buy time. Don't let time slip away. - Raj
  • Ignore technology advancement and you will either be left behind or you have to fork out more - Raj
  • Without passion nothing happens in life but without compassion the wrong things happen - Jan Eliasson
  • The poorer you are the more you need to plan and act wisely. Any undesired outcome you have little resource to manoeuvre.
  • “Life changes when you least expect it to. The future is uncertain. So, seize this day, seize this moment, and make the most of it.”
  • To get to where you want to go in life you must start from where you are - Tan
  • Maturity does not come with age,it comes with the acceptance of responsibilities - Tan

ACM TechNews