r3dux.org

A number-pimping side project from the valleys in *NEW* upside-down flavour.

  • Home
  • ABOUT
  • OLD SITE
  • SEARCH
  • FEEDBACK

Ladies and Gentlemen – The Psychic Image!

r3dux | March 23, 2010

Psychic Picture

It really does change to OFF when you shutdown your machine, there’s just no way to prove it! ;)

Comments
No Comments »
Categories
Humour, Imagery
Tags
Off, On, Psychic
Comments rss Comments rss
Trackback Trackback

HTML: Image Maps Are Easy!

r3dux | March 22, 2010

I hadn’t made an image map in a long time, and had to revisit them for a class I’m teaching – and they’re well easy! An image map, if you didn’t know, is a method of defining regions of an image which can be used to link to things i.e. you create a series of “hot-spots” on an image. Here’s a simple example of how it works using circle, rectangle and polygon definitions:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<title>Image Map Exercise</title>
	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
 
<body>
	<map name="MyImageMap">
		<area shape="circle" coords="84,100,63"	href="javascript:alert('You clicked on Earth!');" title="Earth!" alt="Earth" />
 
		<area shape="rect" coords="197,33, 366,167" href="javascript:alert('You clicked on Space Invaders!');" title="Space Invaders!" alt="Invaders" />
 
		<area shape="poly" coords="468,10, 421,70, 457,122, 450,171, 510,171, 513,125, 524,107, 527,80, 535,65" href="javascript:alert('You clicked on the mighty Gaming Fist!');" title="Gaming Fist!" alt="Fist" />
 
		<!-- You can omit this one if you want the default behaviour for the mouse on the rest of the image to do nothing.. --> 
		<area shape="default"	nohref="nohref" title="Nothing to see here..." alt="Default" />
	</map>
 
	<div align="center">
		<img src="ImageMap.jpg" alt="An example image map" usemap="#MyImageMap" />
	</div>
 
</body>
</html>

Which gives you this:

Earth Invaders Fist

Default
An example image map

The different area type parameters break down like this:

  • circle area type: centre x coordinate, centre y coordinate, radius
  • rectangle area type: top-left x coordinate, top-left y coordinate, bottom-right x coordinate, bottom-right y coordinate
  • polygon area type: just a series of x and y coordinates

To find out the co-ordinates you want to use, it’s easiest to just open the image up in a paint package like the GIMP, and put the mouse cursor over where you want to get the mouse coordinates of – in the GIMP they’re displayed in the status bar at the bottom on the left, in Photoshop you need to open the Info window (shortcut: F8). Note that in Photoshop you might need to change the units from cm or inches or whatnot to pixels via Edit | Preferences | Units & Rulers.

Photoshop Units And Rulers

If you want more information, there’s a great tutorial on the topic here.

Comments
1 Comment »
Categories
Coding
Tags
HTML, Image Maps, Web
Comments rss Comments rss
Trackback Trackback

How To: Compile and Use the Dolphin Gamecube/Wii Emulator in Linux

r3dux | March 21, 2010

It’s really easy to get this emulator up and working – but you do have to compile it yourself in linux – still, it’s only a couple of commands and you’re set. I did it on Ubuntu 9.10 64-bit and it worked like a charm…

Update (04/07/2011): Easiest way yet – simply add the PPA and get it (for Ubuntu 10.10 & 11.04 32/64 bit only) like this:

sudo add-apt-repository ppa:glennric/dolphin-emu
sudo apt-get update
sudo apt-get install dolphin-emu

Update (Older than above): I found that you can download pre-compiled .deb files for Ubuntu 9.10 here (PPA addition required) – be careful with that sudo apt-get upgrade command in the instructions though – I don’t really think you need it and you probably don’t want to upgrade your entire linux distribution just to play an emulator… I’m confusing sudo apt-get upgrade (which upgrades currently installed packages) with sudo apt-get dist-upgrade (which updates your linux distribution if there is a newer version available) – my bad.

Either way, I’d recommend you just compile it yourself – it only takes a couple of minutes.

Update – Nov 2011: Like anything published, it ages and what might have been correct at the time of writing may no longer be the case – so with that in mind, if you’re going to build your own copy of Dolphin, you’re probably best off going to http://code.google.com/p/dolphin-emu/wiki/Linux_Build and using the instructions there.

#Get the project dependencies
sudo apt-get install subversion scons g++ wx2.8-headers libwxbase2.8-0 libwxbase2.8-dbg libwxbase2.8-dev libwxgtk2.8-0 libwxgtk2.8-dbg libwxgtk2.8-dev libgtk2.0-dev libsdl1.2-dev nvidia-cg-toolkit libxrandr2-dbg libxrandr-dev libxext6-dbg libxext-dev libglew1.5-dev libcairo2-dbg libcairo2-dev libao2 libao-dev libbluetooth-dev libreadline5-dev
 
# Make a directory to get the source and go into it
mkdir dolphin
cd dolphin
 
# Grab the latest source code through subversion
svn checkout http://dolphin-emu.googlecode.com/svn/trunk/ dolphin-emu-read-only
 
# Get to the right location to build the emulator (it needs to be the one with the SConstruct file in it)
cd dolphin-emu-read-only/stable
 
# Build it!
scons flavor=release

Issues: If you’re getting errors along the line of Looking for lib Cg… no. Plugin_VideoOGL must have cg and cggl to be build, then the fix is to install the nvidia-cg-toolkit package with:

sudo apt-get install nvidia-cg-toolkit

With all that done, it takes around five minutes to compile and build, then you can go to the Binary folder inside your source-code download location to find the executable and launch it. Once it’s up and running just go File | Open and point it at an Wii or Gamecube ISO and you’re in business!

Dolphin Gamecube/Wii Emulator

By default you get a gamecube controller bound to the keyboard (Enter = Start button, x = A button, cursor keys up/down/left/right) and an emulated Wiimote is bound to the mouse (where the left mouse button is the A button), but you can use joysticks, real Wiimotes etc as well without too much fuss. Fantastic stuff :)

If you’re having any issues, just read more about linux confix/setup/dependencies here, while the main Dolphin wiki lives here.

Comments
5 Comments »
Categories
Gaming, How-To
Tags
build, Compile, Dolphin, emulation, Emulator, Gamecube, scons, Wii
Comments rss Comments rss
Trackback Trackback

JavaScript: A Countdown Timer for Dates

r3dux | March 20, 2010

The mighty Shetboy’s heading down under to visit soon, so I thought I’d shove a JavaScript timer in the sidebar… There’s a lot of them out there, but the one I found didn’t work – so I fixed it.

Just shove this somewhere in the body section of a HTML document to see it work…

<script type="text/javascript">
<!-- Hide script from browsers with JavaScript disabled
 
function countdownTimer(targetYear, targetMonth, targetDay, targetHour, targetMinute)
{	
	// Get the current date
	var currentDate = new Date();
	currentYear = currentDate.getFullYear();
	currentMonth = currentDate.getMonth();                  
 
	// Convert the current date and target date into miliseconds. Because months start on 0 subtract 1 from target month.                       
	var currentMilliseconds = (new Date(currentYear, currentMonth, currentDate.getDate(), currentDate.getHours(), currentDate.getMinutes(), currentDate.getSeconds())).getTime();                                 
	var targetMilliseconds  = (new Date(targetYear, targetMonth - 1, targetDay, targetHour, targetMinute, 00)).getTime();                  
 
	// Calculate the difference between the current date and target date in seconds                  
	var timeLeft = Math.round((targetMilliseconds - currentMilliseconds) / 1000);
 
	// If the time left is less than zero (i.e. the target date has arrived) cap it to zero
	if (timeLeft < 0)
	{
		timeLeft = 0;
	}
 
	// Work out days/hours/minutes/seconds
	var daysLeft = Math.floor(timeLeft / (60 * 60 * 24));
	timeLeft %= (60 * 60 * 24);
	var hoursLeft = Math.floor(timeLeft / (60 * 60));
	timeLeft %= (60 * 60);
	var minutesLeft = Math.floor(timeLeft / 60);
	timeLeft %= 60;
	var secondsLeft = timeLeft;            
 
	// Add on plural suffixes (PS) where required
	var daysPS = 's'; 
	var hoursPS = 's';
	var minutesPS = 's';
	var secondsPS = 's';
 
	// Nix the plural suffix after any occurence of "1"          
	if (daysLeft == 1) {
		daysPS = '';
	}
	if (hoursLeft == 1) {
		hoursPS = '';
	}
	if (minutesLeft == 1) { 
		minutesPS = '';
	}
	if (secondsLeft == 1) {
		secondsPS = '';
	}
 
	// Create the HTML output
	var timerHTML = daysLeft  + ' day' + daysPS + '<br />';
	timerHTML += hoursLeft + ' hour' + hoursPS   + '<br />';
	timerHTML += minutesLeft + ' minute' + minutesPS + ' and<br />';
	timerHTML += secondsLeft + ' second' + secondsPS + '!';
 
	// Display the timer on the screen
	document.write(timerHTML);
 
}
 
// Run the function once every 1000 milliseconds (i.e. once per second) to update the clock.
// *** THIS DOESN'T WORK - FUNCTION DOESN'T APPEAR TO BE CALLED AT PROVIDED INTERVAL =( ***
//setInterval("countdownTimer(2010, 3, 27, 23, 0, 1)", 1000);
 
// Just call the function once... At least that works. 
countdownTimer(2010, 3, 27, 23, 0, 1);
 
// End of JavaScript--> 
</script>

I’m a bit disappointed that the setInterval call doesn’t work to update the clock ticking down each second… I think it’s something to do with the function scope and references (as discussed here), but I’ve tried wrapping a function around the “proper” function, and calling the proper function from the wrapper, where the wrapper is the one passed to setInterval, but still no dice…

Would be super appreciative if any JavaScript coders out there know how to fix this issue :)

Comments
2 Comments »
Categories
Coding
Tags
Countdown, Dates, JavaScript, setInterval, Timer
Comments rss Comments rss
Trackback Trackback

PS3 Motion Input

r3dux | March 19, 2010
YouTube Preview Image

I’m really in two minds about this and Natal… but then when the Wii was first announced and you could see the Wiimotes for the first time it just screamed fad!, but once you do a little bowling or tennis is all sort of made sense… It was so new it just seemed wrong, but with time became commonplace.

On one hand, it might be cool to have true motion tracking, and I’m sure there could be some good uses for it – throwing grenades/punches, light sabres, manipulating object on screen – that sort of thing. But on the other hand, it really does look like some freakish plastic ice-cream or over-sized roll-on deodorant, and I’m not sure I want to play Fight Night Round 5 flailing my arms and dripping with sweat…

So the Sony device has buttons while the Natal is button free – and I can definitely see positives and negatives for both systems – but as to which will be the best, and which if any, I’ll really want to use, I genuinely have no idea until I can give them both a shot. And that assumes that the price is right… What do you reckon?

Comments
No Comments »
Categories
Consumer Whore, Gaming, Tech
Tags
Camera, Input, Motion Control, PS3
Comments rss Comments rss
Trackback Trackback

« Previous Entries Next Entries »

Translate

Categories

Archives

Tags

3D ActionScript ActionScript 3.0 Adobe AI Ballarat Bash C++ Class Convert CS4 Effect Error Film Flash GLSL Gnome Hack How-To install Jaunty Java Kinect Linkage Linux Mash-Up Microsoft Motion OpenGL Particle Problem PS3 Remix Retro script Slides Sound Systems Texture Ubuntu Video VirtualBox Wii Windows XBox

Gamercard

OpenR3dux

Misc.

Flattr this

RSS Feed

r3dux twitter feed



“Atheism is a non-prophet organisation.”

rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox