To the person who keeps getting to my blog by searching for “shamess the elf.wordpress”, bookmark my blog! Gosh. It’d be quicker than searching for me every time.

And "anal porno", wtf? How did you even managed to find my blog searching for that.
To the person who keeps getting to my blog by searching for “shamess the elf.wordpress”, bookmark my blog! Gosh. It’d be quicker than searching for me every time.

And "anal porno", wtf? How did you even managed to find my blog searching for that.
I need to convert this:
--foo -a --foobar="Hey there" --lol=laugh -dw randomtext texttext
Into this:
$switch = array ('-a' => true, '-d' => true, '-w' => true);
$parameter = array ('foo' => true, 'foobar' => "Hey there", 'lol' => "laugh");
$misc_args = array ('randomtext' => true, 'texttext' => true);
At the moment, I’m just exploding at spaces which makes $parameter['foobar'] impossible.
// Whatever's after the function name are arguements, we'll need those too
$argument = explode (' ', trim (preg_replace("/^".quotemeta ($function_name)."/", '', $_GET['r'])));
// These need to exist
$parameter = array ();
$misc_args = array ();
$switch = array ();
// If the first array element is empty, they're all empty so remove the array # This is caused by a weird bug, wherein the explode always finds space to explode...
if (empty ($argument[0])) unset ($argument); else {
// Look at each argument
foreach ($argument as $arg) {
// Now we need to work out which switches and arguements were included, there are two possible ones: --, and -
if ($arg[0] == $arg[1] && $arg[1] == "-") {
// This could be in the format simply "--hello" or "--hello=weclome", we need to find out which
if (strpos ($arg, '=') === FALSE) {
// Just the simple version
$parameter[trim ($arg, '-')] = TRUE;
} else {
// Split up the parameter and the value
$arr_arg = explode ('=', trim ($arg, '-'));
$parameter[$arr_arg[0]] = $arr_arg[1];
}
} elseif ($arg[0] == "-") {
// Go through each letter, and add it to the switch array
for ($x = 1; $x < strlen ($arg); $x++) $switch["-".$arg[$x]] = TRUE;
} else {
// This is just any other random junk
$misc_args[] = $arg;
}
}
}
I haven’t got time to check this out at the moment, but here’s a possible solution I got:
14:15 preg_replace(‘/((?(?=^).*?#OQ#|G)(?:(?!#CQ#).)*?)s+/g’, ‘$1#SP#’, $text)
14:16 though, it would probably be better to split it into two statements. One to
find all #OQ#..#CQ#, another to replace s+ with #SP#.
14:19 preg_replace(‘/(?< =#OQ#)(.*?)(?=#CQ#)/ge’,
‘preg_replace(‘/s+/’,'#SP#’,'$1′)’, $text) or something…
14:23 maybe move the second preg_replace into a function
I’ve probably mentioned this before, but I love WordPress. It’s perfect for what it does. And even when you want it to do something it wasn’t made for, you can probably find an add on to make it (or at least hire a developer to make one for you).
When you need to make one you kinda run into problems though. The documentation is so damn iffy, and the support is fairly slow moving. The irc channel sucks. So, for the good of everyone, whenever I have spare time I’m going to do a bit on the documentation (which is in a wiki format). I can’t believe there are still some fairly common functions that’re used in WordPress that aren’t even covered yet.
A while ago the only support I could get was from a wiki page in French. Fortunately I could read it, but still. That’s just not good.
None of the code for WordPress is commented either, which I think is a really important thing within an open source project! You can’t get more developers if they can’t understand what your code is doing without rummaging through every include. It’s just not cool.
I was stumbling around the Internet (productively, not just randomly) when I found a blog post directing me to Academic Earth, and my mind has been blown.
Two submarines, both likely carrying nuclear missiles, apparently nudge each other in the ocean and some people aren’t happy about it. I’m not sure what the fuss is.
The first thing I’m annoyed about is why are we even hearing about this? No one was harmed, there’s no nuclear fall out. The subs took a bit of damage, and so I suppose that they’ll need to find some reason as to why they crashed in order to get insurance, or at least explain why they need another few million to fix it up.
I expect that’s what France was doing when they said they “hit a container of some sort”. They didn’t want to tell us they hit another nuclear ship, we don’t need to know that. Then England come up and was like “oh, btw, it wasn’t a container, it was actually us that hit you!”
The reason I think it’s dumb to admit that two ships collided is that now even a stupid person can find out where our nuclear ships hang out. We know how long it took the ship to get back to Faslane, we know the speed the ship can travel. That doesn’t help us much, but add that to us knowing where the French base is, and how long it took them to get back to base, and it’s just simple trigonometry to find out where they were (and where they’re likely to end up again).
We shouldn’t even know what ocean their in, let alone their rough location to within a few miles.
Lib Dem defence spokesman Nick Harvey has called for an immediate internal inquiry with some of the conclusions made public.
“While the British nuclear fleet has a good safety record, if there were ever to be a bang it would be a mighty big one,” he said.
This man is an idiot.
What does he expect an inquiry to deliver? There was nothing either party could have done to avoid this, short of handing over their route plans. There’s no way to update procedures to take accidents like this into account. The submarines can’t, and shouldn’t, see each other. They’re both “cloaked” from each other. This is just a huge accident that’s not likely to happen again, ever.
But the designers of the ships probably realised that likelihood and put precautions to stop the nucs from detonating every time someone pokes them. They’re designed to be safe at a time of war, a friendly nudge is hardly going to be enough to cause colossal problems.
My homepage, and web application I use most (even more than Facebook), is Google Reader. I have about 35 feeds I’m subscribed too – some aren’t updated regularly, some every few hours – all in all, if I don’t check Reader every day or so I end up with an unmanagable amount of items to read. Saying that, I usually read them all. People like Lifehacker and Techcrunch update all the time.
Anyway, I sometimes “share” items, which stick them in an RSS feed of their own for people to see what I really like. Anyway, I figured I’d talk about the items that I share once a week or whatever, because I like updating here.
I’m not a big vodka fan, but I know people who are so this post about Skittles flavoured vodka, and it’ll be an awesome present for them. Though, incredibly sweet. Much like the time I added Southern Comfort to my tea – it was delicious but added sugar isn’t needed.
I love Boxxy. She’s amazingly… cute.
Cutest. Thing. Ever.
[Update 20090216] Somehow, this post is getting page views from people searching for “boxxy” on Google. The SEO of WordPress blogs astounds me. But, I went and looked for what page I appeared on, and can’t find it anywhere. Someone most have spent a long time going back pages looking for Boxxy stuff…
There’s a Guardian article on how she got so famous – or rather why she has no reason to be.
I actually have things to be doing, but I thought I’d check my RSS feeds/digg/reddit before I started with actual work. Usually that takes about half an hour, but it took considerably longer today because someone linked to TED videos again, and I’m always getting lost in there.
But that’s not what’s amazed me! I just found out about Bespin! Lifehacker called it a text editor (which made me think WYSIWYG editor) but it’s actually a plain text editor. Awesome for coding and stuff.
Mozilla guys, talking about Bespin
It looks phenomenal. I never really understood what the canvas tag could be used for, and apparently it can be used for great things.
My MySQL server seems to actually be fixed. At least, I’ve not seen it go down for a while, and I think it’s much snappier. That might be because of something that changed in 2.8 of WordPress.
Unfortunately, now my SSH turns itself off, randomly. It doesn’t crash. It’s just like it’s not been turned on, so it must cleanly shut itself down at some point. I’ll check error logs later…
I just decided to pop in here to have a tiny rant about something that’s bugging me about my Database Design class.
I just got my assignment. We’re basically to design and set up a database, create forms, use VBA, general piss easy stuff. I’m a little annoyed to read the specification for this work to find that we’ve actually been told most of the table names, and attributes that need to be there. Thanks for taking away my creativity.
What I’m most annoyed though is this:
Finally ‘status’ is set to ‘current’ and ‘end date’ is left null. When a customer wishes to end a contract the end date is set for the last day of the current month and the status is changed to ‘ended’.
It’s not just me that finds this stupid, right? I can’t even really explain why this annoys me.
Company’s don’t do this. They have minimum term contracts. They’d just have a StartDate (when the customer wants the contract to start) and and EndDate (when it’s to end). In fact, a better design would be ContractLength.
Leaving the empty EndDate seems dumb to me. And having to have some sort of batch process which checks for an EndDate and then updates Status seems like a lot of extra work. Why does Status even sodding exist? In that stupid system, if there’s no EndDate then it’s obviously “current”, else “ended”.