Monday 11 January 2010

All kinds of creepy

Okay, I'm gonna establish a few things before I get onto the meat of this post
  1. I do not consider myself a prude, despite using terms like "Man Reaction" (purely because it's funny), or think of myself as one to get freaked out by peoples lifestyle choices.
  2. Although some people wouldn't think so, studying Artificial Intelligence means that you get to look at certain very strange concepts, and the idea of a sexbot is nothing new to me, in fact I've listened to several talks on whether this would be a good idea in the past.
  3. Without sounding like I'm a sociopath in a sweater-vest the sheer complexity of correctly programming a machine to perform this task is tantalising, and certainly something I've pondered doing as a future career (usually after watching too many episodes of Dollhouse).
 That established, I read an article on the Telegraph today, which, while certain parts are interesting, other parts just contain high-octane nightmare fuel.  The story is about a robotic sex toy that can "communicate" with it's owner.  Now, this in and of itself is not the scary part, that gets reserved for the following lines:
"a young unnamed doll with a naïve personality"
 I mean wow, just wow can any one say paedophilia starter set. That's the kind of thing that Chris Hansen would want to have a talk with you about. The second is this immortal line:

"Inspiration for the sex robot sprang from the September 11, 2001 attacks, he said, where a friend died and he vowed to store his personality forever."
Yeah, that's just wrong. I mean, why would you do that? I mean I understand, he lost a friend under tragic circumstances, but what would have to go through your mind to generate that chain of logic, I mean it just seems to end up like this in my brain:
 Given:
    The Death of my friend,
    and that I didn't want my friend to die
Then:
    I will design a system to store my friends personality forever.
Therefore:
    A high-tech sex toy is probably the best thing to get to work on.
IT JUST DOESN'T MAKE SENSE!


I don't believe in an afterlife but, if I'm wrong, I'm fairly certain the inventors friend is desperately trying to find some way back from the dead to kick the ever loving crap out of the guy. I mean is that what you would want as your legacy? "I died so that someone can get some virtual nooky!".

I mean, okay I haven't lost a close friend in a terrorist attack, but even I know that if you're going to improve a scientific field so that others don't have to go through your loss, you work on something like cryogenics, or the ability to download a human brain into a computer, or advanced cloning, not a sex doll!


Sunday 10 January 2010

A new hobby

Why is that going on holiday has made me more productive? Maybe I am actually solar-powered.  Anyway, I've managed to get interested in the fields of cryptography and cryptanalysis.  Obviously, I can't make much progress in learning about this field, but I've already got several books on order from Amazon, for when I return.

I have, however, managed to make some progress, having written a program to break any shift cipher like ROT13, or the Caesar cipher.  Such ciphers work by moving the encoding alphabet along and wrapping round the missing characters; so the ROT13 cipher looks like this:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
N O P Q R S T U V W X Y Z A B C D E F G H I J K L M

 So the message "Hello, World!" becomes: "Uryyb, Jbeyq!".  Decryption is done by performing the reverse. The small number of possible shift cipher's means that the decrypting can be done by brute force alone, and this is exactly what the program I'm writing does.  The difference is that after that the program uses a dictionary of words to find the decryption attempt with the most words which are actually valid.  This means that the system will be able to operate automatically.  I'll put the code up when the program is completed.

Saturday 9 January 2010

Not so "diff"-icult after all

I've gone back and updated the way that the filename formatter would work on the command line, and it turns out that on the command line, it's a lot simpler than I'd previously thought.  So here's the ammended version:

perl -e 'print join("\\ ", @ARGV)' [FILE NAME]
I also feel no shame in using yet another "diff" based pun in the title.


Friday 8 January 2010

A "diff"-icult problem

Sorry, I couldn't help myself.

Writing the file copying routines for the "diff for folders", I've come across the small problem of converting from the non-escaped versions of file names that readdir produces, to the escaped versions that the shell commands need.  I have, however, managed to produce a imho pretty nice oneliner to do this.
join("\\ ", split(/ /, $fileName));
 Which takes a file name like "some random file.txt" and converts it to "some\ random\ file.txt". Obviously, this won't work directly from the command line yet, but when I've got more time I'm going to adapt it to do so.

Tuesday 5 January 2010

Creating a "diff" for folders

For me, diff is one of those utilities that, although I don't use it frequently, I would be lost without.  In essence, diff checks the content of two files and compares them line by line; showing you where there are differences between the two.

Now unfortunately, diff is also one of those utilities that suffers from Unix-itis, the tendency for a command line utility to have an interface that could charitably be described as esoteric (I could cite awk and sed here but I won't). Getting diff to show he difference between the content of two directories is an "interesting" problem, as this page shows.  Comparing the content of two folders though is actually one of those problems that personally occurs quite often.  Therefore I've decided to write my own program, to perform this task automatically.

Now, as usual, I've decided to write the program in perl, and have managed to put together a working prototype, but there is still work that needs to be done.  I've gone with a GUI for the interface design, but want to put in command line options as well.  Over the course of the next few days, I'm planning to solve the few bugs and glitches the prototype has, as well as add increased functionality, and stability.