Wednesday, May 21, 2008

firefox you swine....

so it appears under certain circumstances firefox will play swapsies with you @ and " key. This is fine for some people, but others just can't seem to find the newly located @ key. When you have an email sign up form this can be a problem.
Lucky then that I have the solution...

first we need a method to run everytime a key is pressed. This will read the current text cursor (caret) position and return it as a number. We will then set the caret to be in the next position. This is exactly what flash does anyway, but we need to physically do this, to complement the hidden button off screen.

This hidden button will respond to certain key presses, namely the @ or " signs...
When these keys are pressed it will add a @ sign to the end of the input text box, and then because we have pressed a key, our earlier method will push the caret to after the @ sign... genius!

heres the code for the frame with the text box (n.b. sally is the var name of my input text box):

var Pos:Number;

function setCaret(n){
Selection.setSelection(n,n);
}



myListener = new Object();
myListener.onKeyDown = function(){
cursorPos = Selection.getCaretIndex(sally);
trace(cursorPos);
cursorPos=cursorPos+1;
setInterval(setCaret,0,cursorPos);
}

Key.addListener(myListener);

Then add this to a button off screen:

on(keyPress "@"){
sally=sally+"@";
}
on(keyPress '"'){
sally=sally+"@";
}


I'll post the fla up later...

Tuesday, April 29, 2008


thats right, GTA IV

Tuesday, June 19, 2007

-= Safari for Windows =-


well i'm writing this post from Apple's Safari browser Beta 3 for Windows. I've been using it now all day and I have to say I'll be switiching back to FireFox tomorrow.

The Good Points:
 - It's great for development use. ie I can now check a website displays properly on a mac without having to use one.
 - It's clean and pretty and the font smoothing is really nice.
 - It's fast.

The Bad Points:
 - Ad blocking is a little sporadic
 - The scrolling is too slow
 - Its completely un-customisable
 - The RSS is not as good as LiveLinks in FireFox
 - Theres no home button on the Beta
 - There's no drop down menu on the back button
 - There's no drop down menu on the address bar

All in all I will keep it to test websites I make, but it won't be my default browser. 
If you look at the videos on the apple site, they haven't even got safari as their default browser... and I wonder why?

Thursday, May 17, 2007

-=Selection Sort=-

This is a nice easy quadratic sorting algorithm similar to BubbleSort. Think of this one like arranging cards in your hand. You take the first card and note down its number (4) then you look along the cards and find one smaller (3), you note down where the smaller card is located and then you carry on trying to find smaller than that. Once you've found the smallest, you swap the first card with the smallest. Then you repeat starting from the second card. Easy!

view the php demostration here

and the source code here

-=bouj=-

-=Bubble Sort=-

i've been extra busy with exams and my project report (18,000 words) over the past few weeks.
as part of my algorithms revision i have been implementing the basic algorithms in php to help me remember them.

Bubble sort is whereby you pass through the array n times, where n = (array_length -1).
Each time you pass through you compare the 1st cell of the array with the 2nd, if the first is higher then you can swap them. repeat with the 2nd and 3rd cells etc...
This method pushes the largest number in the array to the end, and in the 2nd pass pushes the 2nd largest to the penultimate cell etc.

you can see the php running here (note that on each iteration the array has been printed to show workings)

and the php code can be found here

-=b0uj=-

Tuesday, April 03, 2007

-=Live Maps=-


i hate microsoft. Vista is the worst modern OS i have ever seen. I would sooner run marathons than be forced to use it day to day.
And what's more I love Google. i want to work there, i love their ethos, and i use their products.

But. Microsoft, aware of their main rivals fantastic Google Earth application, have developed Live Maps, which has been sourced from images taken by a plane with 5 camera's, each 11mega pixel. One is top down and the others point north south etc.

Looking over my house in top down mode is highly disappointing, worse than Google i would say. But when I swapped to 3D mode, i was amazed. From 4 angles you can clearly see my old car sitting on the drive. My mum's fiesta parked outside, and the Log Cabin she has had built in the garden.

Somewhat voyeuristic, but I love it.
Sadly though my london home has much worse resolution shots, and only has east and top down views. So my beloved Rover is lost in action, but i can see that it's not parked outside my home.

So this bears the question, where is my Rover? its British Racing green and has white viper stripes, and if any one finds it there is a reward.

It could be anywhere in London though, or most of England come to think of it.

nice one microsoft! (something i thought i would never say.....)

Monday, March 19, 2007

unlucky for windows, number 13

well i've found new love for wine this week,
I've learned that all windows programs should be tried using wine, and if it works you're a winner. I'm already using utorrent under wine, and i have used internet explorer under wine in the past, but today i tried to install coverXP the easy way to produce perfectly proportioned cd/dvd covers. After receiving Casino Royale in the post this week, the cover was ripped by the postman, so time to give her a new dvd case and cover.
Simply download coverXP and run. It installed fine and runs and prints a dream, the only thing not working is the drag and drop from the internet, but that could be firefox and not coverXP.

So far, nothing I can't do, and i can do it all at once without having a slow computer.

get drunk on wine.


Saturday, March 17, 2007

reasons 12, 13, and 14

reason 12 why ubuntu is great: my cd's came today, they posted 10 mixed; 3 mac, 3 64bit and 4 pc versions. Nice! they paid to send me 10 brand new pressed cd's with their OS on.

reason 13: when you create a new folder and don't name it, its deleted. So no more New Folder(78) syndrome.

reason 14: Beryl Desktop Cube. - Imagine you have 4 desktops and they are all faces on a cube, and switching between them looks extra sexy, and it runs on a medium spec laptop. see for yourself:


you know you need ubuntu.