Skip navigation

The following method can be used to easily generate an HTML table from any SQL Result set. The PHP methods used are for Postgres, but you could change them to whatever database backend you use, for example, MySQL, etc.

	

/**
 * Print out a generic results table from a postgresql result set.
 * Method should work on any result set.
 */

function mk_table_from_SQL($SQLTable) {

	pg_result_seek($SQLTable, 0);	// Rewind the result set to the beginning
	$html = "<table>";		// Write the table opening html
	$html .= "<tr>";		// Write out the column headers

	for ($i=0; $i < pg_num_fields($SQLTable); $i++) {
		$html .= "<th>" . pg_field_name($SQLTable, $i) . "</th>";
	}

	$html .= "</tr>";

	while($row=pg_fetch_array($SQLTable)) {
		// Write out subsequent rows

		$html .= "<tr>";

		for ($i=0; $i < pg_num_fields($SQLTable); $i++) {
			$html .= "<td>$row[$i]</td>";
		}

		$html .= "</tr>\n";
	}

	$html .= "</table>\n";	// End the table

	return $html;
}

I haven’t posted anything on here for over a year now, but I’m not dead! I’ve been studying Computing Science at Newcastle University.

On the topic of “studying”, I’ve recently been playing a lot of Minecraft, an indie game by Mojang Games. It’s still in Alpha but rapidly nearing Beta, with there currently being 50% off the RRP of £20 (€18).

I bought it a couple of months back because everyone was playing it… Two months later, I run a server for the Survival Multiplayer gamemode. I bought an old Dual Core Dell Opteron workstation and stuck a copy of Ubuntu Server 10.10 on it. Configuring ssh, ftp, Java (the game and server are written in Java) and the Apache webserver were trivial. It’s been a great learning experience, I’ve been bash-scripting backups and little integration features ever since.

Anyhoo, the server is at http://inks.dyndns.org/, although you’ll need to ask an admin to whitelist you before you can build. Oh, and Griefers can look elsewhere… I don’t need your shenanigans, I have a degree to earn.

 

We just want to be your friendsssssssssssssss

We just want to be your friendssssssssssssss...

D: …Cheerio.

Ok, so I began this little “how to” in this post way back in March, and I’ve finally gotten around to buying the parts (i.e. had time) and putting it together.


DISCLAIMER: You undertake this project entirely at your own risk. By attempting this you understand that I cannot be held liable for any damage you cause to your own equipment.

That being said: seriously, audio signals are of negligible voltage. You can cause a short circuit… and nothing will happen. There’s no way you’re going to cause a fire or anything.


You can click on the pictures on this post to get the full size image. Incidentally, while I’m at it I might as well license them to you under the GPL as Attribution Non-commercial.


02082009128

So, as a recap, the components I have bought: x2 3.5mm Male Mono jacks, and x1 2.5mm Female Stereo jack.

02082009130 02082009132

(Photos showing the inner connections of each jack.)

02082009134 (2.5mm Connected to the headset.)

So: I’m using a couple of pieces of cable I had lying about, single core in two wires, core is probably about 1mm diameter. You don’t want anything more than that or wiring the ends into the jack becomes particularly fiddly.

02082009142

Wiring the mono jacks: the outer cable was marked with a white strip, and this was how I kept track of which wire was neutral.

02082009147 02082009144

02082009148 02082009151

I put a dab of solder on each connection to hold it in place and make a good connection.

At this point, don’t forget to put the outer plastic of the female jack onto the wire! It’s going to be frustrating if you have to unwire the jack afterwards to put the plastic on and start again!

02082009155 (Yes, I know it seems obvious, but… well.)

Test the headphone socket first, see if you can get anything playing through the 360 headset so you can see that you’ve wired the audio jack correctly. I would expect (if you have the same design of connector as me) that the silvery inner connection is the speaker wire connection, rather than the brass-coloured one.

02082009152

Make sure the audio is actually turned up on the headset if you’re testing it this way. Same for the mic, when you do  that. Turn it on.

02082009156 02082009157

As above, I cropped the wires to the correct length. The first photo makes them look cropped shorter than they actually are, so careful here. You want enough left to go through the holes, but not too much, or it just gets in the way.

02082009161 02082009163

A couple of dabs of solder later, and there you have it! Note that you may want to mark which jack is the mic and which is the speaker, avoiding confusion later.

02082009164


Ta da! If you do attempt this, let me know! It’d be nice to see if I can actually help anyone out here.

Next up: an overview of the equipment I use to film a “Let’s Play”. Adios.

Another little project that I will  be continuing with next week is Cat Muffin Radio.

We have a jingle and everything.

It’s a weekly radio show brought to you from three Very English Fellows, under the pseudonyms InksGuy, Jibar and Voidseraph.

Because we have something to hide.

Basically, we do the news, a review of whatever video game we happen to be playing at the moment, and other general hilarity. In the format of a 1/2 hour podcast or “Radio show”.

Target audience is anyone who finds the need for some entertainment.

Anyway, if you’re into that sort of thing, check it out at http://catmuffin.wordpress.com/

Graah! Angry blog!

One of the things I really hate is chain E-Mail. Don’t like it. Not one bit.

So, when I was sent this by a good friend who had also been hoaxed, I was a little bit annoyed… well… more than a little.

The E-Mail included a statement accusing someone (who is more than likely entirely innocent) of being a “hacker”. In the bad sense of the word. Black hat. I have removed the poor fellow’s name and E-Mail address, I imagine the original perpetrators have simply used this E-Mail as a vehicle for bullying him. And I am not going to continue that.

>> THIS IS NO JOKE
>>
>> IF A PERSON CALLED <Name and E-Mail address>
>> CONTACTS YOU THROUGH EMAIL DON’T OPEN THE MESSAGE.
>> DELETE IT BECAUSE HE IS A HACKER!!
>> TELL EVERYONE ON YOUR LIST BECAUSE IF SOMEBODY ON YOUR LIST
>> ADDS HIM THEN YOU WILL GET HIM ON YOUR LIST. HE WILL FIGURE
>> OUT YOUR ID COMPUTER ADDRESS, SO COPY AND PASTE THIS MESSAGE
>> TO EVERYONE EVEN IF YOU DONT CARE FOR THEM AND FAST BECAUSE
>> IF HE HACKS THEIR EMAIL HE HACKS YOUR MAIL TOO!!!!!…

(It went on in this vein for quite a while.)

This particular E-Mail made use of scare-tactics and the claim that:

>> Subsequently you will LOSE EVERYTHING IN YOUR PC,
>> And the person who sent it to you will gain access to your
>> name, e-mail and password.
>>
>> This is a new virus which started to circulate on Saturday
>> afternoon. AOL has already confirmed the severity, and the
>> anti virus software’s are not capable of destroying it .

It just makes me angry.

In all fairness, the sender wasn’t particularly computer-savvy, so the threat may have seemed real in that respect. However, the use of LOTS OF BLOCK CAPITALS and numerous grammatical errors were a dead give away.

(I was going to put an apostrophe before the “s” in “errors”, but I couldn’t bring myself to. Not even for the sake of humour…)

In response, I wrote a rather ranty reply (whoo, triple alliteration high score!), which I now feel slightly bad about.  They probably didn’t deserve the brunt of my spam-induced wrath. Decide for yourself:

Hi,

Sorry to break it to you, but this is absolute rot. Rubbish, balderdash, baloney. Tripe. Piffle. Numerous other synonyms.

All you have accomplished by sending it on is to perpetuate the original sender’s little chain spam e-mail.

The original E-Mail addresses are quite obviously faked, they are web-based E-Mail accounts easily made to look like official company addresses. I guarantee you, there is absolutely no function in existence that could allow the (wholly fictional) “hacker” mentioned in this E-Mail to perform the tasks “he” is reputed to be doing.

In addition, no legitimate company ever sends this sort of E-Mail. This particular type of chain E-mail hoax makes effective use of the lack of knowledge in non-computer-savvy users who perpetuate the message. The excessive use of block capitals is the first clue. In addition, the instruction to:

“PLEASE SEND A COPY OF THIS E-MAIL TO ALL YOUR FRIENDS, And
ask them to PASS IT ON IMMEDIATELY!”

is also absolute rubbish.

You are, in fact, more susceptible to the (currently) non-existant “virus” by sending this E-Mail on, because, in the sending of this E-Mail, you have passed on to me (and everyone else) the E-Mail addresses of everyone in the chain. And your own E-Mail address. And, presumably, mine.

Please, please, please don’t re-send chain E-Mail, especially rubbish ones like this.

-Sam, 12/05/2009 17:19
(Because I care!)

PS: Sorry I’ve subjected you to my little rant, it rather touched a vein. I really do not like spam!

So there you have it. Was it fair? Comment below to break or multiply my guilt!

I’m going to point you in the direction of http://www.breakthechain.org/. They’re making an effort to educate people on the scummy mass of spam and chain, floating on the surface of molten pool of E-Mail. Read it.

Oh, and as an afterthought, this post is very good too.

Aha! I was wondering what this thing did…

Windows Live Writer is part of the Live Essentials pack. I’m using it on Windows 7 at the moment. It’s kinda pretty…

This is just a post for me to get a first impression of the software, and I’m posting it in the form of a little review.

The first really nice feature I noticed was that it mirrors the WordPress Blog’s theme in the editor. That is to say, the basic two column layout I’ve got going on. This WYSIWYG type editor is a good improvement on the built-in WordPress blogging tool, which (at time of posting) only gives a fairly generic editing platform.

I also like the capability to embed videos, maps and so on.

Anyway, future posts will be coming from this program.

 

Screenshot of publishing

I use Audacity to record from Skype, and I can show you how to set it up. This guide is aimed at Windows people, as I don’t have a Mac, and can’t be bothered to boot into Ubuntu to test it in Linux…

  1. Download Audacity and Skype, if you don’t already have ’em.
  2. Check you can record from Stereo Mix. Actually, that should have been #1…

To do this, open up the Sound Volume control, in the tray. Click Options, Properties, then the radio button which allows you to adjust properties for recording.

Sound Volume - Mix highlighted

  • If you have a Stereo Mix check-box in there- Check it if it isn’t checked already, and press OK.
  • If you don’t see a Stereo Mix check-box in the box next to the Line in and Microphone check boxes, this could mean a couple of things. Either your Soundcard doesn’t support it, full stop (unlikely)… Or, you need to update the drivers. I found this site particularly helpful, you might too. (If you have a Dell laptop with a Sigmatel card, use Option 2 on there!) Otherwise, check the card manufacturer’s site.

Then, ensure that the stereo mix slider is dragged up full and selected.

3.  Open Audacity and Skype.

In Audacity, set the recording source to Stereo Mix:

Select Source

Then go to Skype, find someone to call, hit record in Audacity and WHAM!

You have yourself a recording. Export it as an MP3 or WAV to save. For MP3 you’ll need the encoding DLL, but Audacity provides a guide on how to get this.

Happy Skype recording!

|

[EDIT:UPDATE]

This fellow here had a problem with an echo of his own voice… I had a think about it and decided it might be this:

Software Playthrough

Software Playthrough will play the current track back out while still recording it. It’s not simultaneous because of the latency you get on the non-realtime Windows kernel…

In other words, there’s a slight delay. While handy in a studio environment, or if you’re wearing headphones, you should disable it when recording from Stereo Mix or you’ll just get an echo.

Preferences is accessible through the edit menu, or press Ctrl+P from in Audacity.

Oh- and if the Mic is picking up the speakers you’ll get much the same effect…

Of course, I could be completely wrong, barking up the wrong tree and just plain mad, but it’s working echolessly for me!

A couple of weeks ago, I received a lovely new Resident Evil 5 XBox 360, which I pre-ordered from Game.

But for some reason, I now find myself wondering about the potential uses of the wired headset that came with it, instead of actually playing on it.

So, I ask myself: “How do I hook it up to my laptop? I want to use it for Skype!”

The headset, for those who don’t already know, features a 2.5mm stereo jack which plugs into the wireless controller for use with online gaming. This makes it reasonably friendly for people who want to put it to other uses…

But- my laptop doesn’t have a 2.5mm stereo jack… It’s got a veritable wealth of standard 3.5mm ones, but no 2.5mm.

For reference, a picture. Taken with the less-than-trusty webcam:

Jack size comparison

6.35mm (1/4"), 3.5mm, and 2.5mm Stereo Jacks.

If you have a mobile phone with a stereo jack for handsfree, chances are that’ll be a 2.5mm one. You could probably make calls with it. Hell, you could probably plug it in and use the Bluetooth Audio Service to connect it to the PC! But I don’t have one of those phones, so that wasn’t an option. [EDIT: Actually, I think phones have a 4 pole jack… but it might still work.]

I’ll go for the hard-wired approach:

Maplins Electronics was my first port of call. I quickly found what I was looking for. A female 2.5mm stereo socket.

That sorts the connection of the headset onto something I can wire. Next, I need to split the Speaker and Microphone up.

Effectively, I need two 3.5mm Mono Jacks– one for the speaker, one for the mic. Maplins again.


It should be fairly simple to sort out which connection is the mic and which is the speaker. I’ll test it by holding the wires to an audio signal source… my laptop, playing music out through the speaker output, for instance.

Anyway, I’ll solder it all together when I get the chance. Watch this space.


So, want Part 2?

 

Hello, good evening, and welcome to…
You.

You are looking at InksGuy’s Quasi-Pseudoblog, a blog which is sort of not a blog. Sort of.
Where will it take you?

>North
You can’t go that way!

>South
Look, come on. Traverse the Blogosphere!

> _

Anyway, yes. I’m going to use this blog to post some fairly random stuff- the only rule being it has to interest me.

Come back when I’ve posted something! Go on! Begone!