website tracking
Logo
Japan
 
My Photo
Name: James Pearce
Location: Perth, WA, Australia

Powered by Blogger

Firefox Plugins
Friday, April 27, 2007
I was going through the archive of the old site, and came across a search page I wrote. It basically takes advantage of the way the GET process works in HTTP by forming special URL strings. I used it to group a bunch of search pages (not just search engines) into one page so I didn't have to go to the page to search. For example, IMDB has flash and lots of pictures, which can be annoying when just trying to find a movie name.

I'm deleting that page though, because it's still annoying to have to load a page to search. Of course, when I wrote it in 2001, there wasn't really any other options! But now, (well for a while), Firefox has supported the search bar. And you can write your own search plugins. They're easy to write, and use some simple JS to formulate the URL. It's cool :)
Gumbie Blading
Thursday, April 26, 2007
*Finally* my blades arrived today. Now, I haven't bladed since I was about 12 and I wasn't exactly good at it then. I mean, I can balance, still...just. But I have trouble stopping at speed, or even maintaining speed in a straight line hehe

But practice makes perfect, so I was skating around the driveway a bit to improve my basic techniques, and of course, I stacked it. Now my elbow is all sore. I don't remember it hurting this much when I was younger...it's great though hehe. I WILL persist, and move on from being a gumbie blader!!! :)
Serendipity Unkown
Monday, April 23, 2007
I bumped into my ex gf today, it seems she finishes class when I start teaching it on Mondays. Didn't say anything, just a smile, interesting effect on me though. Seeing her still makes my heart rate double and my knees go weak, you know, like an anxiety attack ;)

I'm never really sure how to deal with situations like that. I figure with the obvious effect it has on me, I'm better off keeping my distance for my own safety! I will, too, unless my help is specifically requested.

Still, with random encounters like that, who knows when my next serendipity will come along. There's definately enough lovely ladies at uni! Just need to improve my stewardship I think :)
Grumpy Parental Unit #1
Sunday, April 22, 2007
I've chosen to emain in a co-habitat with a parental unit for a while. Unfortunately, one of the ways I learn is to argue. If I think your're wrong, I tell you. If you think I'm wrong, I presume you'll tell me. With guys, that seems to work fine. I mean, it's not the best of a way to communicate, but most guys can handle it. With females...well it seems to break them pretty fast.

So the question becomes, how to successfully co-habitat with a parental unit where almost everything I say results in a delayed explosion. Heres my hypothisis:

1. Everyone wants respect. They respect you if you respect them. One of the signs of respect is paying attention to them, and what they are saying. So, don't argue.

2. "sensitive" people don't like my advice. I tend not to sugar coat things by nature. So, don't give advice. Just give encouragement that they can do it on their own.

3. Avoid unnecessary counseling of my affairs with them. This breeds weakness. Of course, sometimes it is weaker NOT to counsel, especially if they have the experience you know you need. Still, minimise this. Especially given the assumption that the longer I talk, the more likely I am to put that person offside.

4. In fact, try not to talk to the person all together. It may be harder to get a message accross in written form, but that usually means I write less, which means I keep to the point. Plus there's no one to argue with :)

5. Avoid contact, but always be courteus. That means saying hello and goodbye, please, thankyou, and excuse me.

6. If I have to have a conversation, stick to asking questions that reveal information, and making positive comments. Avoid making suggestions, getting off topic, or talking about anything else.


This is going to require me to jam up my real world relationships for a while, so hopefully that means more frequent blogging! We'll see how it turns out :)
Menu Links - Fixed!
Thursday, April 12, 2007
Ok I fixed the links in the menu (Home etc.). Now the content on the site needs to catch up with the links :)

I am sorting the old blog posts, and putting up the old content as ncessary so that should help. I also added the site to Google today...unfortunately, it had already indexed me when I didn't have the main page up though :(
Oh well, it'll right up given time! :)
Perl LWP::UserAgent & Google
Wednesday, April 11, 2007
Just been writing a Perl script to leverage the Google engine. When I do a request to Google using the URI http://www.google.com/search?q=searchTerm with searchTerm equal to whatever, it fails with a 403 Fobidden error.

For me, this was actually due to the user agent. LWP identifies as libwww-perl/#.##", where "#.##" is substituted with the version number of the library. Google doesn't seem to like this. I guess it's a simple way of detecting scripted attacks.

Anyway, the simple work-around is to change, or even just remove, the user agent string:

$ua->agent('Mozilla/5.0'); # Identify as Mozilla
$ua->agent(""); # don't identify

Either of these work for me. I personally did not identify it, so that Google does not try anything browser-specific in the response :)

On a side note, I change the logo for the site in the top right last night...looks much nicer hehe :)
Back To The Future
Tuesday, April 10, 2007
Ok so I've started importing my old blog entries as said. You'll notice in the archives, they are getting older :)

I gotta' say though, because I have to look at each one manually to fix it (links and titles mainly), it really is a blast from the past ;)

Lots of memories. Maybe I'll put up a memoirs blog entry when I'm done publishing them all heh ;)
Importing posts to Blogger
Sunday, April 8, 2007
I said when I started this blog that I was going to use it to merge all my other blogs into one.

Well I Googled a bit and search the Blogger help, but theres very little information on actually doing this...other than retyping it all manually. I finally found someone referencing an 'idea' to use the Blogger email facility. I.e. in your settings, under Email, you can set an email address that you send to and it gets automatically blogged. You can even tell it not to publish until you go in and publish it (i.e. it saves it as a draft). Couple this with the fact that it is possible to alter the date / timestamp on posts in blogger (go to Edit your post, at the bottome of the post click on Post Options, and set whatever you want), it makes it possible to import.

Basically, we just need a way to auto-magically convert a bunch of posts to a standard email format so blogger can read it and blog it properly. This is text manipulation. This is perl work!

My realllyy old "news" page (before blogs existed) was basically a slightly HTML-ised text file. I did this for portability and it finally paid off. If your blog posts are hosted somewhere or in another format, you basically want to aggregate them into one file so you can process that one file. I have multiple blog pages, so I'll do them seperately, which each blog file containing a hundred posts or so.

There are a couple of things to bare in mind. Blogger will date and timestamp using the time that it receives the email. So you'll still need to change that manually. What I did to make this easy for me, is I used a regex to strip the date of the post from the file, and used the date of the post as the subject for the blog. That way I know what I'm looking at when there are 100 draft posts in my blogger!

Also, Blogger escapes any HTML in the email. I used a regex to strip a lot of the HTML out, but for some of the URL's blogger still broke them. Oh well, they are 4 year old posts!

I called the perl script I used news2blogger.pl, and it's in the resources section (not that the resources section is operational at the moment!). It was customized for me, so it is basically a proof of concept for anyone else. If you want to use it, make sure to examine the way I'm parsing the file with regex's and to alter the email settings.
MySQL Limits
Friday, April 6, 2007
Today I was shifting one of my sites to another server, and had to rewrite a bunch of code to comply with the software installed on the new server. In the process, I found the database code was flawed to begin with.

I had a table that used an auto-incrementing ID field:














IDData
1Stuff 1
2Stuff 2



Well, you get the idea. The table has about 100 rows at the moment, and I split the data up into pages of 10 entries displayed on a webpage using PHP. A while ago, when I was first looking at optimizing SQL queries, it became apparent that one should seek to limit the result set to what we want. This is as opposed to returning everything from the SQL server, and filtering the result set in PHP. If we can limit the result set to begin with, we save load on the SQL server, and save time in processing in PHP.

So the idea was just use the ID as the row number. So if we want 10 entries per page, and we are on page 3, then we want entries 31-40 inclusive. So the statement can look something like:

SELECT Data FROM mydb.mytable WHERE ID>30 AND ID<41;






















IDData
1Stuff 1
2Stuff 2
4Stuff 4
5Stuff 5

We've lost the row with ID=3! Now if we execute the above style query to get the first 10 rows, we will actually only get 9!

Lets go back to what I was originally trying to do though. I want to select a number of rows with an arbitrary starting row number. MySQL already provides a function for this! For the first 10 rows:

SELECT Data FROM mydb.mytable LIMIT 0,10

And the abstract version of this is:

SELECT (col1,col2,col3...) FROM (database).(table) LIMIT (row number to start from),(number of rows to select)
Steganography in Debian
Wednesday, April 4, 2007
What is it?
Basically, it's the embedding of data in other data. I was just watching an episode of Numb3rs in Season 2, and they mention embedding of data in images. So I've been thinking of posting a photo of myself again, so I thought I'd hide it :)

I searched freshmeat.net and found a program that actually looked like it was maintained, Steghide. Actually, it's already in the Debian repository, and also in the Ubuntu universe repositories :D

So heres the photo:



And the command to extract it is:

steghide extract -sf picture.jpg

Whats the passphrase? Well it's a photo of me, so naturally the password is my full name :) No capitals, all one word. Have fun!
rsync 'n' Cool Diagrams :D
Monday, April 2, 2007
Ok so I'm trying to sync with one of the local boxes on my network, but I don't want to install another server demon on it. To the rescue - rsync!
But wait...doesn't rsync require the rsync demon? Not always! Besides, transmitting cleartext doesn't impress me much. And setting up SSH secrets and auth files for rsyncd goes against my new Ockham's Razor principle :)

rsync has come a long way. The version at the moment means that there is only one binary that acts as both the server and client. It also supports the ability to operate over SSH. So, given that it's 5am and I'm still operating on about 4 hours average sleep, I'm explaining things fine, I'm just not explaining much...and using lots of words to do it! Hows that for anti-Ockhams Razor...

I am currently obsessed with MS Visio though, so I made a sexy little diagram :)



This REQUIRES both computers have rsync installed...but only as client programs!
Then, to sync the data, the general command form is:

rsync -avzr (source) (destination)

And to use a remote computer via SSH, the path is specified by "-e ssh user@host:/full/path

So if we are using Computer 1 and wish to sync FROM Computer 2:

rsync -avzr -e ssh user1@computer2:/source/path /destination/path

If we were just copying, we could use scp -r, but then we'd have to copy the whole dir every tim!

And the short explanation for the digaram is: Sync with rsync and ssh with an encrypted channel with existing Linux user permissions on the client / server. Finito! Sleep time.
PDA Troubles :(
Sunday, April 1, 2007
I own a Palm TX. Yes, it's PalmOS based. It annoys me looking and using Windows on a mobile device, it just feels...wrong ;)
Windows was built for a mouse in my opinion.

Unfortunately, PalmOS is not perfect either. Neither are the devices they make. I was at a business conference last night, trying to take notes. 'Trying' because half the time I would write something, and it would mess it up. Not because it interprets everything incorrectly, it just interprets some really common things incorrectly. Which is annoying to say the least. Oh and if I alter the pressure I use on the pad with the scribe while writing, it will often just result in a dot. It must think that I'm just tapping the pad. Sigh.


Common problems I've found in Notepad with the recognition:
- My 'u' often turns into a 'v'
- When writing an 'l' and doing a space quickly afterwards, it thinks I'm trying to do a 't'
- When trying to do a 't' it thinks I'm doing an 'l' and a space!
- If the letter is slightly off angle, it picks it up as the control character (diagonal slash), and if I fail to notice, it winds up doing some random operation when I draw the next letter
- Also as above, sometimes it will pick up the letter as the special character marker, and refuse most characters as input.
- It skips spaces a lot (i.e. I'll do a space and it won't pick it up!)