Friday, March 30, 2007

Latest Project: Facebook Widget

To help me with my face book addiction, i've decided to make a dashboard widget, strangely enough it's for the said website, facebook. A bit more useful than the search widget that currently resides on the internet, and a lot more simple than the famed Isolation project.

After 20 minutes in photoshop here it is


ETA, is about a week i hope, besides how hard can it be ...

As i see it have to translate part of the current offical Java API to Javascript, and parse some xml. Thats the hardest part, the actual widget design should be simple. Development starts in about week, after the java work is done. ^_^

But i think i've announced too much vapourware so i need to start delivering

I'm off to bed, some of us have to work you know.

I love to function

While working on my piece of piss Java assignment, i came up with a neat little random number generating function. It's a mirror of a function that is commonly used by Objective-C developers, and allows you to have random numbers but within a range. I've casted the result before i return to the calling routine, so you simply change or remove the cast to get the primitive of your choice, as it's all Floating point arithmetic.

Java



private int randomIntWithinRange(int pLow, int pHighest, boolean pDebug){
boolean acceptableValue = false;
double possibleValue;
double finalValue = - 0.1;
int attemptsTillSuccess = 0;

//If the value is not acceptable continue
while(!acceptableValue){
possibleValue = Math.random() * (pHighest * 10);

if(possibleValue >= pLow && possibleValue <= pHighest){
finalValue = possibleValue;
acceptableValue = true;
}
else{
attemptsTillSuccess++; //How many times
}

}

if(pDebug){
System.out.println("" + attemptsTillSuccess + " attempt(s) till success"); //debuging
}

return (int)finalValue;
}

It's even does a little debugging line, so you can see the number of attempts till it succeeds. Released under the GPL 2.0, For use in non-commercial products yada yada. When i can be asked i'll write a Javascript, and C version, and if i feel really nice a VB version.

Update: With me having banned myself from facebook for a while, i thought i would make myself more useful and covert the java to ECMA script, of Javascript for lesser clued up, wasn't hard just replaced primitive declarations with var ^_^.

Javascript



function randomIntWithinRange( pLowest, pHighest, pDebug ){
var acceptableValue = false;
var possibleValue;
var finalValue;
var attemptsTillSuccess;

while(!acceptableValue){
possibleValue = Math.random() * (pHighest * 10 );

if(possibleValue >= pLow && possibleValue <= pHighest){
finalValue = possibleValue;
acceptableValue = true;
}
else{
attemptsTillSuccess++; //How many times
}
}

if(pDebug){
Document.write(attemptsTillSuccess + " attempts till success"); //debuging
}

//Damn loosely typed language!!
return Math.round(finalValue);



PS. I didn't test the javascript version, so don't count on it to work straight off the bat.

Wednesday, March 28, 2007

Facebook is the nuts!

Get one, i love it.

I've got in contact with people from my primary school
One of my cousins
Couple people from secondary school

Basically for someone enjoys "trying" to be social, it's amazing.

Quote of the Day
"I'm sorry charile murphy, it was an accident i'm having too much fun."

Dave Chappelle

Sunday, March 25, 2007

A Guy, A Mac, and a Linux Distro

So, it's that time of year again. Everyone's disappeared to their various corners of the uk, and i'm left here to contemplate life on earth.
So many people have asked, why have i decided to stay here on my own, simple i got a lot of work to do, plus i wanna take advantage of the gym.

Heres what i got to do in the next three weeks

  • Database fundamentals Coursework

  • Internet Computing Assignment

  • Computer Architecture Coursework

  • OOTM Assignment Assignment

  • Learn x86 assembly

  • Finish the Fat Cheetah website

  • Write & Design a reusable PHP CMS

  • Write & Design a reusable PHP forum

  • Apply for loads of Jobs

  • Do someone else's assignment

  • Cook various people dinner

  • Revise for networking

  • Buy and play with a Treo 680



Quite a lot of stuff if you ask me. I'm only working at maplin on the weekends, so i'm gonna try and give this thing my full attention. In my eyes these three weeks will make or break my course, prehaps in yours too ...


Now if you excuse i have to contemplate whether or not to get a facebook or not.

Quote of the Day
PS3 buyer"I need an optical cable for my PS3"
Me "Cool, how is it?"
Customer"Don't know didn't get any games."

Nice going sony, you get a grown man to fork over £425 quid, and then shaft him and give him no games.

Saturday, March 10, 2007

Ones to Watch

Now that i'm back at home, if only for a couple of days, i have the opportunity to try out the finest TV shows from our brothers across the pond.

Firstly 30 Rock,

Number 1, it's got a Baldwin in it, so that caught me. Second it's got the head writer of Saturday night live, writing and staring, Tina Fey.

This two things mean that it can only be good. Thus far I've only seen four episodes, but it is very funny, clean and stupid.

I would highly recommend this if you like family guy or american dad, and no it's not a animated series.



Next up, The Apprentice Season 6 : LA

No it's not the uk version, it's Donald Trump doing what can only be described as good tv. Watching the first episode now.

Nothing like watching wasters try to shoot each other down

Wednesday, March 07, 2007

20 in 8

Nothing much to say, except that in 8 days i'll reach that milestone age of 20 years old. How about that. Jonathan at 20, i should really do the whole dave chappelle thing, and make comparisons between me at 20, 14 & 8. Would be quite funny i think, i think i'll make that bus post.

Plus i'm going back to hemel this weekend to link up with the old crew, till another time ...