5 Things You Probably Didn’t Know About Riding Motorbikes

I got my first motorbike, a Honda CBR250RR about two months ago. I thought I’d compile this list of 5 things that non-bike riders probably don’t know about motorbikes.

  1. When riding a motorbike, you get covered in bugs
    This obviously varies from place to place, in some areas you might face onslaughts of mosquitoes, flies or butterflies, whereas other parts of the world are relatively insect free. After riding 2,000 kilometers over 2 months, I have bugs spattered here and there on my riding gear, particurlarly on my helmet visor… imagine what is like for riders wearing open face helmets!
  2. Motorbikes are not just noisy for the sake of it
    You might think that motorbikes are built intentionally just to annoy you in the early hours of the morning while your trying to sleep, but you would be ill-informed. Unlike the often aesthetic “phat” exhausts that have recently entered widespread car culture, the reason why motorbikes are generally loud, is two fold -
    a) because they are built for performance - smaller exhausts reduce performance
    b) so people in cars with blaring stereos can hear them!
  3. Car Drivers are known as “Cagers” in motorbike circles
    The meaning is literally driving in a cage. That is, car drivers have a feeling of being in a secure haven while driving there “cage” around town, and as such sometimes neglect to consider other road users, particularly *cough* motorbikes *cough*. I suspect the second meaning is that being on a motorbike means being free with the elements, without the luxuries of windows, air conditioning and doors.
  4. There is virtually a science to riding in traffic
    Driving a car is easy in comparison - you sit in your lane, you obey the road rules, and with a bit of luck you’ll never run into serious trouble. In comparison, there is virtually a science to riding a motorbike safely in traffic. Concepts such as lane positioning, watching other vehicles and avoiding oil and other hazards are integral to operating a motorbike on the road.
  5. Riding a motorbike gives one a unique sense of freedom
    The best thing about motorbikes is when riding around, particularly through the bends, it gives one a great sense of freedom. The onus is on the rider to finely deliver throttle, braking and steering, with a much smaller margin for error than in a car. It’s just you, nature, and machine.

So there you have it. For motorbike enthusiasts, you might want to take a look at my pet project, Honda CBR250RR wiki, and stay upright. For car drivers, don’t forget about your fellow 2 wheeled road users!

Posted on 31 August '07 by Steve, under motorbikes. 1 Comment.

How to make a tag cloud in PHP, MySQL and CSS

Tag CloudToday I wanted to make a tag cloud, but all my searching proved fruitless - so I decided to stop being lazy and just work it out myself!

For my example, first you'll need a database that stores the keywords / search terms.

The way mine works is every time a search is run, I check to see if the term has been searched before. If it has, I update the counter field + 1. If the term has not been searched for before, I insert it with a counter of 1.

Alternatively you may store every search individually and use the GROUP BY clause to determine how many times the search has been run.

My query looks like this:

PHP:
// don't forget to connect to DB first!

$terms = array(); // create empty array
$maximum = 0; // $maximum is the highest counter for a search term

$query = mysql_query("SELECT term, counter FROM search ORDER BY counter DESC LIMIT 30");

while ($row = mysql_fetch_array($query))
{
    $term = $row['term'];
    $counter = $row['counter'];
   
    // update $maximum if this term is more popular than the previous terms
    if ($counter> $maximum) $maximum = $counter;
   
    $terms[] = array('term' => $term, 'counter' => $counter);

}

// shuffle terms unless you want to retain the order of highest to lowest
shuffle($terms);

Next we'll setup a bit of css. Feel free to adjust these as you see fit.

CSS:
#tagcloud {
    width: 300px;
    background:#FFFFCC;
    color:#0066FF;
    padding: 10px;
    border: 1px solid #FFE7B6;
    text-align:center;
}

#tagcloud a:link, #tagcloud a:visited {
    text-decoration:none;
}

#tagcloud a:hover, #tagcloud a:active {
    text-decoration: underline;
    color: #000;
}

#tagcloud span {
    padding: 4px;
}

.smallest {
    font-size: x-small;
}

.small {
    font-size: small;
}

.medium {
    font-size:medium;
}

.large {
    font-size:large;
}

.largest {
    font-size:larger;
}

Finally we just want to loop through the array and display it with the appropriate css class.

PHP:
// start the output to the page
echo "<h3>Popular Searches</h3>
<div id=\"tagcloud\">
<div>\n"
;

foreach ($terms as $k) // start looping through the tags
{
    // determine the popularity of this term as a percentage
    $percent = floor(($k['counter'] / $maximum) * 100);
   
    // determine the class for this term based on the percentage
    if ($percent <20)
    {
        $class = 'smallest';
    } elseif ($percent>= 20 and $percent <40) {
        $class = 'small';
    } elseif ($percent>= 40 and $percent <60) {
        $class = 'medium';
    } elseif ($percent>= 60 and $percent <80) {
        $class = 'large';
    } else {
        $class = 'largest';
    }
   
    // output this term
    echo "<span class=\"$class\"><a href=\"search.php?search=" . urlencode($k['term']) . "\">" . $k['term'] . "</a></span>\n ";
}

// close the output
echo "</div>
</div>\n"
;

And thats it! Hope this saves someone some time. Add your comments below!

Posted on 22 August '07 by Steve, under PHP. 38 Comments.

What is a Cron Job?

Q: What is a cron job?

A: A cron job is an automated task that runs on a linux server, similar to Scheduled Tasks on windows.

The main idea is that you can run a process without you or someone else manually setting it off - my first experience with cron jobs was when working with an online auction website. As you can imagine, an auction runs for a fixed time period. So lets say an auction runs for 7 days. What happens at the end of 7 days? The database says this auction is closed. If the auction did not sell, whether the reserve was not met, or their were no bids at all, then we want to automatically relist that auction.

There are two options:

a) run a process when a page load occurs... sucks because the page load is gunna take longer due to the extra processes occurring

b) run a cron job every x minutes, looking for auctions that have passed their end time, and either relist them or close them down permanently

I tend to code in PHP and MySQL, which means that I create a PHP file that does all the maintenance tasks required and I run it at set intervals. The cool thing is, if you want to be running different tasks at multiple times of the day/week/year, just setup multiple cron jobs.

Thats great, but how the hell do I setup a cron job?

I'm glad you asked!

If you are comfortable working with command line, then you might want to visit a site like this. If, like me, you have access to cPanel, life is much, much easier.

How to setup a cronjob in cPanel

1. login to cPanel

2. click on the cron jobs tab (near the bottom)

3. Select your time you want the script to run. The options are pretty straightforward. If you select Minutes > 30 that means the script will run at xx:30am/pm. You can also hold the Ctrl key to select multiple minutes/hours etc.

4. Enter the "command to run". For my purposes, I generally want to load a php file. It doesn't hurt to put these files outside of the public web folder "just in case". Something like this should do the trick on a standard cPanel/WHM server:
/usr/local/bin/php -f /home/myusername/scripts/ascript.php

The first part is the "path to php". You might want to ask your hosting providers what this is, if the above doesn't work. The second part is the absolute path to your file. By default on a cPanel server the structure is /home/your_account_username/ where you can modify everything inside your account folder. Generally contained in the account username folder is a www/public_html folder with your live web files.

Hope this is of some help - cron jobs are a breeze - once they are running as desired its fun dreaming up new ways to make them more and more sophisticated... after all, now the server is actively taking away the daily grind!

If you have any questions do not hesitate to ask below.

Posted on 15 August '07 by Steve, under PHP. No Comments.

Get Firefox or Opera

Technorati Profile

Internet Explorer is an inferior browser, including the latest incarnation Internet Explorer 7. Fear not, alternatives are available.

A couple of free browsers are faster, more secure, and more stable than IE. They offer greater reaching functionality which will enhance your browsing experience. For example, for web developers both Opera and Firefox have many plugins that let you do common tasks; view the window at a specified resolution, disable javascript, disable css and much more.

I highly recommend anyone still using Internet Explorer to tryout these far superior products:


Opera

Posted on 18 July '07 by Steve, under Rants. No Comments.

Rainbow Six Las Vegas Single Player

After my original review of Rainbow Six Las Vegas, I have dedicated most of my gaming time to playing the single player campaign. Let me tell you, it is hard, so hard! After conquering the Mexico levels, we are thrown into Las Vegas. There is a good diversity of levels, each requiring a unique approach, and inevitably many restarts!

I estimate I live for about 8 minutes on average... in most cases, I find myself in a bad situation where the only entry to a building is from the ground floor, where the enemy has the advantageous higher ground. In other cases your AI teammates get themselves shot (usually due to a bad order from me)... you do have the opportunity to give them an injection and they make a miraculous recovery, but giving this dosage often requires that you get in the firing line yourself and suffer the same fate.

Some tips if your struggling:

  • Choose your weapons wisely - in particular get the sniper rifles for open levels and powerful machine guns or shotguns for the space restrictive levels
  • Use your AI teammates to defuse tricky situations, but be warned that if and when they die you'll often be left in a pickle. If one teammate survives, get him to revive your fallen comrade
  • Often it's better to scout around yourself because naturally you should make more intelligent situations... should I shoot this guy now, or wait until his mate comes over and lob a grenade their way? The AI is obviously not programmed in this capacity.
  • Always enter rooms with extreme caution. If you see a fast rope, see if you can't pick off some enemies before you descend. Glamorously smashing through glass windows with guns blazing is not a great situation when you suddenly discover there are 5 more enemies in the room than you thought, and there is nowhere to take cover
  • Speaking of cover, use it, always.
  • Use stealth whenever possible. The AI enemies generally stay put until you get very close to them
  • Use the snake cam before entering any room, and tag enemies where appropriate. Get your teammates to use an alternative entry when suitable

Posted on 14 July '07 by Steve, under PS3. No Comments.

Rainbow Six Las Vegas PS3 Review

After months of promising screenshots, tantalizing movies and much hype, Rainbow Six: Las Vegas has finally arrived on PS3. I remember the good old days of Rainbow Six on PC, the original. What makes this game unique is its realism. The original had to be one of my first experiences of one-shot kills in a first person shooter. Tactics and teamwork are champion.

Lets take a look at the PS3 incarnation on a few levels.

Graphics

Hmmm... you know that feeling when you are watching a clip-scene, and then you have a sudden realisation this is IN-GAME graphics and they totally kickass, and within moments i'm going to be running around in this high-res city. That was my first impression of Rainbow Six.

Level design is thorough, challenging, and ideally suited for heavily armed special forces operatives roaming in unison for some scum to pump full of lead. It is hard to characterise the graphics - they are indeed quite nice to look at, but at the same time, I can't help but think, why do they have to have this crazy filter over everything, that to me seems to make everything look a bit fuzzy, a bit dreamy.

Things blow up, glass breaks, grenade effects are nice, character design is solid.

Gameplay

This is where it gets fun. I can hardly hope to express my glee at for the first time, hopping over a wall and descending down a rope, with the option of going conventional or ultra-cool upside down style, all the while being able to shoot any mofo with my pistol. Single player, it has to be said is good. I'm only a few hours into the single player campaign, and boy it is challenging. But commanding your AI teammates around is a true joy.

Option 1: Order them to follow you around and go gung-ho around corners, with a very real possibility of death, and that inevitable frustration at losing 10 minutes of your life as your get ported back to your last checkpoint.

Option 2: Find yourself the nicest vantage point, select a sniper rifle with optional 6x or 12x zoom scope, and feel like a general as you command your team to move to any location within sight.

A particular highlight is ordering your players to a door, and then having the option of how they enter the room. Sometimes, a bit of the old flash-bang grenade is called for, while other times you might want to send them round the back while you prepare for a frontal assault.

Walls and virtually any other object on the map that might substitute as cover come to great use in Rainbow Six. Just hitting the L1 button will have you hunched against the object. A bit of analogue maneuvering allows one to sneak up to a corner, with a generous proportion of the out-of-site scenery suddenly revealed. With a bit of practice, you'll look like a real pro, lining up ze enemy before even becoming visible, waiting for the perfect moment (like when the ze enemy reloads) and bang!

Multiplayer

Multiplayer in Rainbow Six is comprehensive. There is no hiding the fact that the game makers know how to give this title longevity on the PS3, by stuffing multiplayer mode with many delights. The character customisation is good with a decent amount of skins and body armour to select from. Within minutes I stylised myself with a handlebar moustache, a nasty gash above my right eye, some badass full-suite body armour, and a big, mean, machine gun. And with eye protection in mind, who could forget a pair of aviator sunglasses?

Whats more, there are weapons and kit items to unlock, making it all the more enticing to progress through the ranks.

The Bad

I can't help myself. I have to make some comparisons. And going off what I know, I have to compare Rainbow Six to Resistance. Given the fact that Resistance was a launch title here in Australia, and Rainbow Six has had many months to polish their act, I find some annoying annoyances with Vegas.

  • Load times are excessive - nothing more frustrating than booting up for a quick game, only to spend a few minutes loading up the multiplayer console, being forced into a random multiplayer game (no facility to select a game that i've seen) wait patiently for the in-progress game to finish... and then the game host quits and your back to square one!
  • The graphics are just a shade fuzzy, like i'm getting a bit of eye strain and I know its not from a lack of hardware (just look at resistance and the smooth chaos that occurs)
  • Overall I think the game lacks just a touch of class, as though there was some rush in its preparation... or something. Undoubtedly we will see a game patch sometime in the future that hopefully addresses all of the above.

Conclusion

Ok so i've unloaded the good and the bad about Rainbow Six: Las Vegas on PS3. My review is about 75% positive so I think thats a good indicator of my satisfaction level. To be fair I haven't even seen much of this game, such is the nature (hopefully) of owning a game for less than 48 hours. I have no doubt that there are many surprises, many joys and few disappointments awaiting as I dig deeper into Rainbow Six.

Posted on 30 June '07 by Steve, under PS3. 2 Comments.

MySQL Reserved Words

The database language MySQL has a number of reserved words that should not be used in queries or for field names. Some of the big ones are:

  • Add
  • All
  • Between
  • Both
  • Check
  • Current_Date
  • Drop
  • For
  • From
  • Group
  • INT
  • Key
  • Load
  • Lock
  • Null
  • On
  • Out
  • Real
  • Repeat
  • Table
  • Use
  • Write

And so it goes. I came across the official list when I couldn't work out why this query wouldn't work:

SQL:
SELECT COUNT(id) FROM messages WHERE READ = ‘0AND TO = $logged_in_id

The reason? Both "to" and "read" are reserved words and the query failed. See the full list here:

http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html

Posted on 25 June '07 by Steve, under PHP. 1 Comment.

Playstation 3: First Impressions

The long wait was finally over 3 months ago, and I was the proud new own of a Sony Playstation 3. Blissfully gaming away, its hard to believe the long struggle in attaining a PS3 in Australia. Unlike countries on the NTSC video standard, the release of the Playstation was delayed until March 23rd, 2007 for all countries on the PAL standard. Agonising as the delays were, it was worth it!Like any kid with a new toy, I marvelled at the ease in which I was able to connect to my wireless broadband connection using the in-built wireless network card, and get straight into the online store. Awaiting me was several demos, a bunch of hi-def trailers, and the full version of Tekken 5 Dark Resistance for $15 or so dollars.

Not to mention, I was comfortably lounged on the couch, with the freedom of movement that only a wireless dual analogue controller can provide.

So wireless freedom aside, here is a short highlight list, which may encourage you to join the next generation of consoles, if you haven't already!

Games 

If some of the downloadable trailers are anything to go by, the array of games being released in the next 6-12 months looks very, very promising. Their is the impending release of Rainbow 6: Las Vegas, Collin McCrae DIRT, and of course the big one, Grand Theft Auto 4. Add to this to the current lineup which include highlights such as Resistance, FEAR (although the controls in this game suck) and Motorstorm and you'll be wishing someone would subsidize the time you spend on your PS3!

Don't forget, a blockbuster game on a console is now equivalent to a PC game, in that game patching and new content are common occurrence. That means new levels, new challenges, bug fixes, all that good stuff - anyone who's ever played Battlefield 2 on PC will know exactly what a good game patch can add to a game (Jalalabad anyone?)

Resistance: Fall Of Man

My initial game purchase was Resistance, and its certainly a great insight into next-gen gaming. The graphics are smooth and highly detailed, with great level design and plenty of nifty things to shoot at. Most will notice the physics right away, as objects interact with each other in a very realistic manner. Have a read of my Resistance: Fall of Man Review here

Online Content

Owning only one game for the first 3 months is not bad as soon as one sees the delights of the playstation store. Accessed from the Playstation OS, the store contains a mix of free demos, free and paid full games, free and paid game items, and free videos (mostly game and movie trailers).

Within 8 hours I had downloaded absolutely everything I could, and between the demos, trailers and the local video shop, its still hard to get bored with the PS3. It's all very easy to just plug in the credit card details and download the paid stuff.

Controllers

The dual analogue controller has grown up, and has some nice revisions from the previous Playstation 1 and Playstation 2 versions. For starts, the shock vibration system is gone. Bummer, yeah, but it doesn't take too long to appreciate the newfound lightness of the controller. There is a PS button in the middle between SELECT and START that lets you do important things like:

  • Turn the Playstation off
  • Turn the controller off (good when the batteries and you have to switch controllers)
  • Reassign the controller
  • Quit a game

The motion sensor is pretty cool, although I haven't had much opportunity to use it except as a virtual steering wheel in the frantic Motorstorm.  I'm guessing that there will be some really good usage coming into the next crop of games - in fact I hear that in Rainbow 6 it can be used to steer a mini camera through air vents!

The L2 and R2 triggers are more Xbox like, allowing for more accuracy when pressure is important, such as when used as accelerate/brake. There are also lights on top to indicate what number the controller is (eg. 1, 2, 3 or 4) as well do a bit of flashing here and there when something important is happening.

Obviously the cost of wireless controllers is that the they need charging up. But you'll be relieved to know that the battery life is both very long, and if you have a spare controller its easy to switch. On top of that, you can always plug in the USB cable and charge it up anytime even while gaming.

Summary

When news broke of the PS3's delayed release in Australia, I seriously considered buying an Xbox 360. I don't want to start an Xbox 360 vs PS3 war (not in this post at least ;) ) but I think we all know which console is superior on virtually any level. The Playstation 3 is THE console to own for at least the next 5 years. So what are you waiting for?

Posted on 25 June '07 by Steve, under PS3. 1 Comment.

Resistance: Fall of Man Review

Resistance: Fall Of Man

My initial game purchase was Resistance, and its certainly a great insight into next-gen gaming. The graphics are smooth and highly detailed, with great level design and plenty of nifty things to shoot at. Most will notice the physics right away, as objects interact with each other in a very realistic manner. Possibly the best example is shooting at the round cylinders littering the alien levels, where you can shoot at one explosive, and then watch as it explodes and sets off a chain reaction of explosions, sometimes to great effect against the enemy.

Speaking of enemies, the AI holds it own, not revolutionary but certainly good quality. Enemies will sometimes decide they are facing imminent death, and will retreat to find some support. Likewise when they are in numbers, they ain't backing down!

After completing the single player mode with a mate in co-op mode I was satisfied on the most part with the single player campaign. But a good single player mode doesn't cut it in this new age of internet capable consoles.

The multiplayer in Resistance has slowly grown on me, and it is now my sole purpose for booting up the game.  The community is steadily growing in size, and you don't have to look hard to find some very worthy foes. Of course, you have to start somewhere, and in most games there will probably be a "first timer" who invariably turns into cannon fodder.  The multiplayer modes are quite diverse, ranging from shotgun carnage in a tightly enclosed bus yard, to massive levels where strategy is king. The popular multiplayer modes include all the favourites, Deathmatch, Team Deathmatch and Capture the Flag, as well as a few other less popular, but all the same fun, modes.

Posted on 25 June '07 by Steve, under PS3. 2 Comments.

Disable Overtype Mode In Microsoft Word Permanently!

By default in Microsoft Word, when you hit insert key, Word jumps into overtype mode, which writes over the text at the cursor instead of inserting new characters. This drives many people insane. The fact that it is a default behaviour remains to be seen.

How to fix overtype mode:

There are two options to remedy this:

1. Go to Tools > Options > Edit > Overtype Mode

And uncheck the Overtype mode box.

OR

2. Kill the Insert Key:
1. Start Word
2. Click on the Tools menu
3. Click Customize
4. Click the Options tab
5. Click Keyboard
6. Under the Categories dropdown box, select All Commands
7. Under the Commands dropdown box, select Overtype
8. Under the Current keys downdown box, select Insert
9. Click Remove
10. Click Close until the dialog windows close.

Thanks to the guys at tech-recipes.com, where I discovered this information after years of using method 1! this guy deserves a medal!

Posted on 13 May '07 by Steve, under Rants. 3 Comments.