Friday, April 20, 2007

I know i can count, but i'm not sure about my mac

So in a moment of boredom, i opened up my trusty text viewer, and had a look at some files. Namely a RTF, and a Text File.

First off, i now understand why programmers love plain text files so much. First off, there are no bytes wasted on headers. It's straight into the data, no messing and no playing.

So here is the test stub
#!/bin/bash

## Coursework mass compilation

cd ~/Desktop/OOTM

javac TerminalInput.java

javac Deck.java

javac Player.java

javac Game.java

javac CardGame.java

## Run the application

##java CardGame

This was a little bash script i wrote to help compile my coursework.
Not to remember the basics, each character is equal to a single byte, or 8 bits. FF is therefore equal to 255.

The plain text file is 8KB, with 204 characters. My maths tells me that should be equal to 204 bytes. But for some reason, my mac accounts another 1300 + bytes!!

Mean while the Rtf file is 4KB, with 561 bytes, which is the exact number of characters in the file. But wait you say, there are only 204 characters in the file. Correct, so whats the other junk ....
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420
{\fonttbl\f0\fswiss\fcharset77 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\paperw11900\paperh16840\margl1440\margr1440\vieww9000\viewh8400\viewkind0
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\ql\qnatural\pardirnatural

\f0\fs24 \cf0


I only went through it briefly, but it appears to show the font types, and colors for the file.

But my question to the world is, why on earth is the text file twice the size, but yet still halve the number of bytes in the hex editor?

Saturday, April 07, 2007

Social Discovery

Call me socially inept, but i just realized something. You can tell when someone likes you or enjoys your company, when they start doing random things, without just cause. Now depending on what they do, you can then determine whether or not they are trying to get close to you, or in fact kill you.

Ie. I do random things for people all the time, however i personally rarely have random things done for me. Which clearly shows i'm dis ... Right let me rethink that.

But you get the point, however the caveat to this, is that you can begin to think that every random act of kindness, has a meaning. If your a pretty young lady, then it generally does. If your me, then most likely not, however every other one might have some significance.



Quote of the Day
"Look, it's my favourite Drunkard, top of the evening too ya"

Can't beat viki, you really can't

Friday, April 06, 2007

Useful Email validation

Got some javascript, for the coders out there. Not my finest work but quite neat.

This validates a email field, combined with a simple input field as shown.

HTML



"<"input id="emailInput" class="halfSize" type="text" value="Place Replay to Email here" name="replyTo" onkeyup="validateEmail( this.value);" />


However it does it in a funky AJAX way, allowing the user to see where exactly they have put a foot wrong.

it checks the following

  • Address is longer than 6 characters

  • There is a @ symbol present

  • and there is a "." within the domain section of the email



The 6 character mimumim was calculated using the following logic,

1 = one character for username
2 = one character for the @ symbol
3 = one character for the domain
4 = one dot/decimal to seperate the domain from the TLD
6 = two characters for TLD and ccTLD.

First improvement, that one should make, is enable both the input field, and result field to be supplied as function arguements, however in my case (internet computing assignments), this is only getting used once.

Javascript



function validateEmail( pEmailObj ){

var pEmailString;
var retVal;
var returnObj = "emailValidStatus";
var whereIsSymbol;

//Setup
pEmailString = pEmailObj;
document.getElementById(returnObj).style.background = "#bf3a3a";
document.getElementById(returnObj).style.color = "#fff";
document.getElementById(returnObj).style.padding = "2px";

//Go Down a level after each check
if(pEmailString.length > 6){ //Check length

if( (whereIsSymbol =pEmailString.search(/@/)) > -1){ //Check for @ symbol

//Find the dot after the @ Symbol
var lastDot = pEmailString.indexOf( ".", whereIsSymbol)

if(lastDot != -1){ //Check for . after @ symbol
document.getElementById( returnObj ).style.background = "#71ba43";
retVal = "Valid!";
}
else{
retVal = "Invalid: Bad Domain";
}
}
else{
retVal = "Invalid: Missing @ symbol";
}
}
else{
retVal = "Invalid: Too short";
}

document.getElementById( returnObj ).innerHTML = retVal;
}


Last but not least it's Released under the GPL, so use it and abuse it.

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 24, 2007

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 ...

Tuesday, February 27, 2007

Too Badu for you

In the last couple of days i've been listening to a lot of Erykah Badu, and man is she good. In my book shes, like the musical sister Jill Scott never knew about.

Sadly not all is well. I discovered that Ashley, from such famed posts as "meet my friends", lost his mother to Cancer, plus the ex-partner of one of my work colleagues has been in hospital for a while. To them i wish them all the best, and hope for a speedly recovery, as for Ashley my heart goes out to him, and i pray that his mum made it to heaven.

In business news, Isolation is on hold while i do some contract web design work, Ajax and the usual lark. But in even bigger news, i;ve join the "Fat Cheetah" Revolution. Fat Cheetah is a three man company destined to take over the world. It comprises a quality graphic designer; Paul, a classy Web Developer/Application Programmer; me and a Shark Tunde. The perfect blend.

If you live or work in the southampton city area, you'll be hearing from us!

Oh, while i'm here

March 13th, @ Bambuu Bar Come down and see Heartless Crew in action
A One Promotions & Fat Cheetah event

Thats about it for a round up, i'm try to save money to pop another Gig of Ram in that black plastic thing over there (writing on my nix box), Was ill for the last week, and had apple juice and popcorn for dinner, plus Jai quit smoking.
Quote of the Day
Lights dim
Anwar "Where did nikya go?"
Somone else "Don't worry i can see his teeth"

We love him really

Monday, February 12, 2007

Looking for work

Super amazingprogrammer looking for work!
i code in the loads of langauges, and i do contract work for cheap. If your interested conact me, and don't try the line that you couldn't find my email address, half the population of nigeria knows it, so for you it should be a peice of cake.

Websites
Bespoke Developement
Debugging
Scripting

what ever, call me

ps. I haven't lost my job, just looking to move up.
Quote of the Day
Yeah, because we come across 18 + digit binary numbers in our day to day lives

Computer architecture can be fun, honest.

Friday, February 09, 2007

Whats new....

Well since the data disaster, i've managed to rewrite a sizible chunk of code for isolation. However, it's hard work, considering i had done it all before. I've also gone backup nuts, and wrote a back script that i keep in the dock.

In other news, i've started on a light Cocoa project. A Cocoa version of one of my favourite games, Dope Wars. As you've come to expect here's the teaser...




Loads of work as you can see Started yesterday, while watching lost. Now although i love Xcode, i hate this whole idea of connecting the program to the UI. I can see the benefits, but i dislike the way it's done. Sure it's kind of similar to the way things are done in visual studio, but still.

Plus i've started learning about assembly on a serious level, so i'm now learning 3 languages at the same time, as well as brushing up on my C skills, to help improve my ideas on all these new fangled languages. Coupled with this i want to do some proper ruby on rails development, and see what all this crap is about in a production like environment.

Lastly, i've discovered that for all my love of computers macs, that i really don't know what i want to do after i leave university. Web development, is exciting, fairly easy and pays ok, but it's not a challenge. I write CSS in my sleep.... Writing kernel/device drivers looks cool, but how often does one need a new camera driver? Software development looks cool, but things take too damn long. And i'm not keen on all this paper designing either, wheres Visio for OS X? Although i plan to work for no one, and do my own thing, i'm not quite sure what yet.

To sumerize in Objective-C ...
Future = [Me whereIsCareerGoing:currentStatus];


Quote of the Day
Am i too nice, or do i just like thinking that?

Lets put the vote to the people

Tuesday, January 30, 2007

I'm a Retard

Why, i wiped my Mac's harddrive, every last kb. Yes i could of recovered it, but i can't be bothered to build up any hope of getting my data back.

So what happened,

I was trying to install the New Microsoft Vista(Which i'm using as we speak). I used the disk utility on the mac osx install dvd to remove my old boot camp partition. i had split it as follows 103 GB for osx, and 8 gb for linux. It had been that way since the week after i got my mac. I was using rEFIt to manage the boot partitions.

I selected the 8 GB parition plus the nix swap space, and erased them. Before i did so, i clicked the little lock, to prevent editing to the osx partition. after wiping the two, i then reformated them as fat32, and thought nothing more of it, one restart latter osx wouldn't boot. thought it must be a partition table issue. So i reboot the install dvd, and went to repair the drive/partition.

Thats when i saw it. Macintosh HD had 55Mb used, instead of 90 Gb!

So what have i lost

Isolation, and Syndication, The new company website. plus all the recent changes to the HTTP library and Diggr for the last couple months. All of my uni work for the last 3 months, plus about 2000+ tracks. And my cracked cs3.

So .... backups are a good thing.

What i can say, is that Vista isn't too bad. They fixed the performance issues that they had with the last version i tried, 5270. It's nice and shiny, and although i haven't got all the drivers, it's still not too bad. After i've reinstalled osx, i'll set up a proper boot camp partition.

Isolation will be rewritten this month (February), Syndication who knows, Diggr is on hold until i can master palm's C api.

HB HTTP lib, i'll release what i have, but it won't work until the nice folks at HB update the runtime environment or the compiler, to fix the stream writing methods.

So if you'll excuse me, i've got a hard days worth of installing and downloading ahead of me.

Monday, January 29, 2007

Finally!!

So Januarys kinda like done, and i still haven't finished my first app. But the good news, is the weirdest part is done, which was handling data/ captured requests between two servers is practically done.

hence rejoice, for i have screen shots, but no code (i kinda like trying to make money thanks)




Now if you excuse i got loads more work todo, plus i need to stare at this powerbook(not mine) in front of me...


Quote of the Day
"So he came up behind you and began kissing you on the neck, ok"

As i said on numerous occasions, teen drinking is very bad

Friday, January 19, 2007

The Bookshelf gets better




The bookshelf is getting better. Finally after a week of waiting the precious Objective C book is finally here. Time to write some real code, i'm java's slave no more.

The book i got in the end was from my favourite publishers, O'Reilly, but Addison Wesley???? It's called "Cocoa Programming for Mac OSX" by Aridian Hillegass an ex apple and NeXtstep engineer. Only up to page 13, but it's looking good.

Now if only i can get enough to a have a proper reference library...

Plus i sorted out my house for next year, 6 beds, 3 boys 3 girls. Moving in July 1st.

Quote of the Day
Steph "I need you out of the house for a week after we move in"
MeWhy should i, i pay rent too?
Steph "Fine, stay you just won't like what your'll be hearing"

This is what i'm living with... Just kidding it's not all bad

Wednesday, January 17, 2007

Deadlines; What are they & how i misuse them

For what must be the first time in while, (think 6/7) i'm performing academically the way i should be. I'm doubting myself and still getting 95% in tests, never mind completely acing others. It's a nice feeling, the torment that was A-level results left my head in a bad place, so it's great to be heading over the ridge.

I like love what i do. Writing code for me is better than ... making money. So it's great that i can use one do achieve the other. However, and employees of DSGi will know what i mean, i like setting ridculous deadlines. Heres one famed example.

A completely automated website to manage a entire retail chains intranet. A normal developer would quote a couple of months. I said 2 weeks!

So how do i make these estimates up?
Easy my calculations don't account for sleep, eating transport times etc. Why, cause i don't plan to do any of it. I'll work my arse off till, i collapse or do other injury to myself.

So where is this going?
Isolation, Diggr and the HTTP lib are gonna be late. Reasons are as follows

Isolation: - No real bottle necks just so much damn code to write; hashing controls, cache algor., multithreaded servers etc.

Diggr:- VB is like AIDS to me right now, and hint that i'm in proximity and i'm running, plus i gotta boot up windows. I'm on the verge of dumping the whole win32 thing for good, i just know its stupid to do so.

HTTP lib:- Palm OS is doing some weird stuff, and things aren't working exactly as they should be, debugging on device is like so yesterday, plus i wanna dump this whole two device thing and get me a Treo 680.

Plus i just kinda sold my beloved TX to a classmate, which technically means i can't finish the HTTP lib has it has to be tested on a device, no ifs no buts. That great treo 680 only has bluetooth (+GPRS but how the hell to i capture packets with that?) which i have no idea how to even begin to use fully. I think i would have to monitor a faux serial port!

So yeah, lifes great

If you excuse i must go food shopping instead of working to assignment deadlines.

Quote of the Day

Jai "You were doing the Carlton Dance!"

Me "Sadly, i just about remember that!"

Teen Drinking is very bad, even if you got a fake id

Thursday, January 11, 2007

TIOTI: Tape it off the internet Beta

For once i can talk about someone else's work. TIOTI, has been around for about a year. I first heard of it on Digg. As usual they was a big fuss, but as the months went by that died. Fortunately for me i have a good memory and was able to sign up for the beta program.

So for the people that haven't seen it here it is.



Thus far, it seems like a cooler version of TV.com. There are user discussion groups on various shows. You can add them to your favourites. You can get RSS feeds for various things, like group discussions etc. It's got a nice balance between web 2.0 goodness, and plain old skool web design



In fact its cross between digg and TV.com. Users swarm over tv shows, rather than stories. After that you can then paticpate in various activities related to your show and get badges and such.
Apparently was i was using was build 14


However there is one sweet addition, this thing schedules torrents, based on your favourites! But it's not only for us Fearless DMCA folks, it also checks for itunes downloads, which it lists a premium content. Please excuse my poor screen grabs, am still getting used to this sexy mac. Oh yeah, this shots are from a mac. They recommend using firefox on osx, so thats what i used. But most of it seems to javascript, css and html so safari performance shouldn't be too far away.]


This is the user account page, i just joined like 5 mins ago, so excuse the lack of friends.

Speaking of code, it's quite clean, all the javascript is placed in external files, so the actual html is very clean, (perfect for greasemonkeying ...)

The future looks bright for this service. I'm glad to say that TIOTI is not vapourware and should become a useful tool in filling the downtime of life, not that i would know anything about that kinda of thing.

Wednesday, January 10, 2007

Killing my own Ideas

Great idea, a External display via the firewire 400 port on my computer!

Lets do the math
(bare in mind that this done assuming we want 24 bit displays at 60hz)

Firewire = 400 Mbits
SXGA = 1 310 720 pixels
Each pixel is 24 bits / 3 bytes
therefore 3 932 160bytes (3.75 Mb) required to refresh the display each cycle.
average display is refreshed 60 times (60Hz) therefore 60 * 3.75
Total required thoughput of 225 Mb/s
Firewire total thoughout = 50 Mb/s

Thats why it's a express card job

Another reason why Having no express card port on this macbook is starting to suck. a 13" macbook pro would have been really nice right about now.

Another bright idea, external display via gigabit ethernet, nope only 125 MBit/s. Looks like my dream of a dual headed macbook is kinda dead. It's a mathmatical impossiblity :(

Since i was in this frame of mind i wondered, what the thoughput of a DVI connector might be

Single link
1920*1200
6.5 Mb per cycle
395 Mb/s


Dual link
2560 * 1600
11.7 Mb per cycle
703 Mb/s

A nice indication there of how much pixel pushing a graphics card really does in order to devliever a rich high resolution experience. Still no reason for crappy open source support, but it at least makes it clear why graphics cards have to be so damn powerful.

Sunday, January 07, 2007

OSS HTTP Lib is in semi-effect

After months of promises to the users of 1src, the HTTP OSS lib is operating. Most of the code has been written without ever testing it all, which is stupid, but i was too busy reading HTTP docs, to take the time to set up a testing server and go through logs looking to see it i had a hit or not.

In the end i didn't actually do that, i used ethereal, and MAMP on my mac ^_^. The point is, the OSS lib for HB++ developers is practically done. I've started the documentation ....


You might have also noticed, that that is windows. Although i've grown to dislike it, i need it. I had hoped that once i got my mac i could kiss this windows workstation good bye, but sadly not about of wine and vmware can make up for nativity. So until then, Linux on my desktop is dead, less glitz more work.

Now if you excuse me i'm off to tell the nice folks at 1src about this.


Quote of the Day
Me "Dont hit me with that"
Aimee "Why, are you gonna hit me?"
Me "No, but i'm gonna leave busies, and they won't be on your face!"

I think i'm in some sort of widthdrawl, can never get your hands on people when you want to...