WordPress: A cute trick to combat WordPress spam – name verification

[Fighting Spam] – skypecaptain on Flickr, 2 Apr ’07.

To the people who leave comments, I’ve added a little something extra to the comment form. So please remember to fill in my first name (it’s the one that has 4 letters, starts with k and ends with n) on the box labelled My first name? (required). This is a little something I’m adding to combat the endless spam (average of 300 spam comments per day), so we’ll see if this works. Been thinking about doing something like this for months, but seeing WX’s comment drop into the spam list yet again spurred me to do something about it. (Or maybe I was simply in the mode to code, having stared at MRTG the entire day.)

Kudos to Jeff Barr for thinking this up!

If you’re planning to implement this on your own WordPress, remember to doublecheck all quotation marks ( ‘ ); the correct symbol is supposed to be on the same key as double quote ( ” ); WordPress replaces them with cute little apostrophes that kill your codes. My version of the code for WordPress 2.2.3 goes like this:

Inside comments.php:

<input type="text" name="namev" id="namev" value="<?php echo $comment_author_namev; ?>" class="textfield" tabindex="4" /><label class="text">My first name? (required)</label><br />

Edit the tabindex occurrences after that to continue properly i.e. 5 should follow 4 and so on.

Inside wp-comments-post.php:

$comment_namev = trim($_POST['namev']);

if ( 'kein' != strtolower($comment_namev) )
wp_die( __('Error: enter k*** as my first name you moron.') );

Fingers crossed, let’s hope this works.

Related post:
Writing Code in Your PostsWordPress Codex



File Destroyer; the name explains it all.

Aussie maths whiz supercharges net: onwards beyond ADSL2+? (via theage)

5 Most Badass (US) Presidents of All Time: totally kicks ass. (via cracked.com)

10 Articles That Changed My Life: inspiring. (via lifereboot)

MRTG graph generation for the network newbie in 8 easy steps

This post is for people like me who have had limited experience with creating an MRTG graph (aka Multi Router Traffic Grapher), and were struggling to configure it for traffic analysis. It’s also for myself, if I ever forget how to do it.

English: The graph drawn by MRTG. 日本語: MRTGが生成...

Note: configure, not setup from scratch. Setup instructions for MRTG can be found here on a guide written by sylvain.maurin@isc.cnrs.fr, or at the MRTG Implementation Manual by Florin Prunoiu.

(I’m using Debian distribution 2.4.18-bf2.4 FYI.)

#1 Use cfgmaker to create a .cfg file for your network device

You should have your device’s IP address ( and the SNMP community name (SNMPnewdevice) at this point. Mine outputs to a file called newdevice.cfg.

cfgmaker SNMPnewdevice@ --global "WorkDir: /var/www/mrtg/newdevice" --output /etc/mrtg/newdevice.cfg

*The above command is one single line.

**/var/www/mrtg is where my MRTG page is, you should edit it accordingly.

***/etc/mrtg is where my MRTG .cfg files are.

#2 Tidy up the .cfg file

Edit your .cfg file and remove any interfaces you might not want to monitor; use # to comment them out.

vi /etc/mrtg/newdevice.cfg

Checkout the wiki on vi if you’re new to it.

#3 Be organised: created the new work directory

You can see that we specified a WorkDir in step #1, and now we need to create it. This will hold all the graphs for the new device.

mkdir /var/www/mrtg/

#4 Use indexmaker to create the index page for your MRTG graph (or graphs)

/usr/bin/indexmaker --output /var/www/mrtg/newdevice/index.html /etc/mrtg/newdevice.cfg

*The above command is one single line.

This generates the page index.html.

#5 Populate the MRTG graph (or graphs) for the first time

cd /var/www/mrtg/newdevice

mrtg /etc/mrtg/newdevice.cfg

This generates the graphs and the nice little MRTG banner at the bottom.

#6 Tidy up your index page

Add needed information e.g. the name/IP of the interface, where it’s pointing to.

vi /var/www/mrtg/newdevice/index.html

#7 Add a job to your crontab to regenerate the MRTG graph every 5 minutes

vi /etc/cron.d/mrtg

0-55/5 * * * * root if [ -x /usr/bin/mrtg ] && [ -r /etc/mrtg/newdevice.cfg ]; then env LANG=C /usr/bin/mrtg /etc/mrtg/newdevice.cfg >> /var/log/mrtg/mrtg.log 2>&1; fi

*My MRTG cron is in /etc/cron.d, so edit yours accordingly.

**This is very important: MAKE SURE the second command remains as one single line when you enter it; copy-paste sometimes breaks the line into two, and this effectively renders the cron from working. And worst, it’s the next thing to being invisible. It took me a good half hour to find the error (Thanks to ShaolinTiger’s post on WindowSecurity.com).

#8 Restart your cron

/etc/init.d/cron restart

And that’s all, we’re done! Feel free to leave any comments or suggestions that you might have on improving this article for MRTG graph generation.


Additional tip:
If you want to make your MRTG graph’s timeline go from right to left, do this:

vi /etc/mrg/newdevice.cfg

Add this section of code at the top, below ### Global Defaults

Options[_]: growright

Optional: Add this to allow the values to be converted into megabits automatically:

Options[_]: bits

To make it go from left to right, add this instead:

Options[_]: growright, bits

Remember to use # to comment out the other options!

Enhanced by Zemanta


[playing with Cookie] – V’s Flickr, 17 Feb ’08.

As per Estee’s request (quoted via MSN: *kaachiingg* i insert a 50cent coin and request for Kein to blog about cookie), here’s the awaited post on my puppy!

We bought Cookie (that’s the name of our pup, incase anyone hasn’t realised that by now) from Pets Paradise at Melbourne Central for $850. Here’s a few pics taken on the first day, 8 weeks of age:

We named her Cookie, which came from a dog belonging to a friend of Stan’s. She was simply “the puppy” for the first two days until I decided to call her Cookie. First choice was Milkshake, but V thought that sounded weird so.. oh well.

She’s actually three-quarters chihuahua, but I didn’t really bother finding out what the remaining quarter was (the cute factor must have come from the quarter lineage somewhere). She’s not much of a barker though, whines alot and wants attention.

Favourite activities?

  • #1 Face licking. For some reason, she finds my face interesting enough to lick for a few minutes non-stop. (I wouldn’t want to lick my own face even if I could do it.)
  • #2 Playing with random stuff e.g. pen, tissue paper, plastic bags, tennis balls, biting her own tail (her tail’s too long for her to chase it).
  • #3 Mountain climbing: scaling the heights of Mount V and the seemingly insurmountable Mount Kein. Successful conquests result in activity 1.
  • #4 Trying to bite our toes/ankles, and charging about like a miniature train in her nonstop attempts. Playing this with her is exercise enough for me, who needs a Wii?

A lot of things were skipped when we first bought her, like for example:

A proper dog bed, which cost like $40. The petshop wanted to sell us like everything, but V decided that we should shop around to see if we could get a better deal (that’s her job). So we put her in a cardboard box with a tea towel for the first week.

She got sick somewhere in the middle of the first week, due to the dry food we were feeding her. The vet didn’t seem to be too surprised when he heard that though, seems like a lot of puppies get upset tummies in their first week. After listening and feeling her over with his large capable hands, he said was, “leave her with us for the night, and give us a call tomorrow morning to check how she is”, and proceeded to jab her with a syringe for her diarrhoea. Of course, Cookie didn’t take that too well, and started barking loudly.

We picked her up the next day, and she was much better, having visibly gained alot of weight. Fortunately there was this guarantee from the petshop which covered the medical expenses from the Village Vet, and all I paid was $9.75 for the food which the clinic recommended.

And now she’s into the second week of her life with us, and looking pretty happy after we upgraded her bed:

It’s actually the same old cardboard box, but we bought a metre of fleece from Lincraft and wrapped it up. Add a cushion and hey presto, new comfy bed! It cost us a total of like $7, in comparison to the $45 which we saw at Queen Victoria market.

Cookie seems to like the bed enough.

There’s the bit about toilet training which we are still struggling with right now though. In the first week, she pretty much peed and pooed all over the place, especially when she had diarrhoea. We’re pretty vigilant nowadays, so any signs of her sniffing around gets her hauled off to the pooping zone.

This was stage 1, when we newspapered an area and blocked it off with Yellow Pages (convenient building blocks, reminds me of Lego).

I read an article about papering the entire area, and decided to try it out. This was stage 2. Bad idea, especially when we came out of the shower dripping. Wet newspapers, blah. Stage 2 lasted a few hours, and it was back to stage 1 mode, but with a bigger pooping zone.

Our neighbor Clyde asked a friend of hers, and suggested putting newspapers on her favourite pooping spots, and gradually shifting the newspapers towards the bathroom when she got used to the newspapers. Too long for me though; any other quicker suggestions? What we do now is bring her out to play for 20 minutes, and dump her in the poop zone if time’s up or she starts sniffing.


I hate to imagine how Cookie will be looking like after she takes her bath (we haven’t had a chance to bath her yet).

Cisco IOS: 7200 series router – dumping the IOS

[Cisco 7200 Series Routers] – ^tt^ on Flickr, 27 Oct ’07.

I was fiddling around with a Cisco 7204 VXR yesterday, wondering how the hell it was supposed to work without an IOS. (The vendor blandly admitted that his new warehouse manager stuffed it up.) After a bit of reading, I concluded that I had to get the IOS into the PCMCIA flash card somehow.

Option 1: rip the IOS off the existing router. Troublesome; not within walking distance and no car.
Option 2: download the IOS and ram it into the card somehow. I had no idea on how this could be done.

I was about to resign myself to option 1 when the answer finally appeared: I could just download the IOS off the Cisco site, plug the card into my laptop and transfer it over.

(Incase you were wondering why I didn’t think of that: I thought the file systems weren’t compatible, which was why I hadn’t tried.)

So I copied it into the card, stuffed it into the slot0 on my router and rebooted it. And all was good after that. Just remember to format the card before that:

Router# format slot0:

Summary of the week: V-day, and the weekend

[Flower Child] – Angelique (Liek) on Flickr, 20 Sep ’07.

(I’m trying to keep to a post-per-week schedule right now, so keep checking back!)

Valentine’s Day for us, was just another day. I didn’t get anything, and we had a normal dinner at home. Well, it’s normal if you discounted the fact that I burnt the chicken wings (a little) while trying to fry them on the pan. My first attempt, so heh. But like I was telling V, it would be appreciated if she could do stuff for me once in awhile without me having to ask. Feedback given, and that’s that : )

Saturday was spent going over to Fitzroy for a peek at some display suite at an apartment we’re interested in (pricey, ouch ouch). If everything goes well, we might be living there in a couple of years’ time but well.. that’s too early to say for certain. Someone else got there before us, and the apartments we’re interested in got booked already so woops?

And IKEA shopping yet again, we bought a coffee table (that’s to be used as a dining table). Despite past experiences of IKEA’s easily assembled furniture, this particular table was a nightmare. It’s seriously a miracle that I managed to get the table into one piece at the end of the day, bloody hell.

BÄNKÃ…S – NEVER buy this bloody piece of crap unless you like the screwdriver (the tool, not the drink).

This is probably the last piece of furniture in quite awhile, since we’re keeping everything to a minimum. Less encumbrances = higher mobility when it comes to moving house next time.

These days, I’m kinda braindead so it’s pretty hard to think much. Infact, the CCNP studies have temporarily taken a backseat until I’m convinced that yes, I do have energy to study at night and no, it’s not because I’m too bored that I’m doing so. The brain’s overloaded with too much stuff at the moment, even the thought of picking up my BSCI notes is unthinkable.

Me: “Revise BSCI?”
Brain: *suggests more attractive options immediately*
Brain: “Reading blogs/manga/MSN-ing?”
Me: “.. right let’s do that instead.”

Rinse and repeat, and there you have it: my daily routine at night for the past three weeks.

More about the new doggie in a later post.

*Link for Honda: woot Hot Asian Chicks from Funtasticus!

The longest week

[Happy Weekend!快樂週末!] – Pisces Romance on Flickr, 17 Aug ’07.

This is a little late, but Happy Chinese New Year nonetheless, and hopefully it’s been a great weekend for everyone so far.

I’ve had a very long week, but it’s finally all over now. V’s been over at Sydney for the entire week for an external job, so I’ve had a quiet week alone. Had a few dinners out with friends, and one agonising evening where I cooked chicken curry at 730pm, and it was 9pm before I started eating; absolute torture.

Today was a domestic day (as all our Saturdays usually tend to be), going grocery shopping. Got chicken thighs, chicken wings, tomatoes and cabbage; I guess that should be enough to last the week since there’s still eggs and fish fingers in the fridge, and canned food in the cupboard. Stocking up the larder is a very important part of my life here heh heh.

And we bought a 32″ Hitachi LCD TV over at Harvey Norman last weekend, which was a pretty good buy IMO. $900, and an additional $120 for a total of 5 years’ warranty.

The next few days was spent shopping for the right cables, since the TV didn’t come with any. One coaxial cable from the TV point to the TV ($3), one RGB cable from TV to laptop ($15), and a 35mm audio cable from TV to laptop ($2.50). Harvey Norman was selling the coaxial cable at $40, alot of computer shops sold the RGB cable at $20 so we had to look around for a good buy. (It’s times like this that make you wish for Sim Lim Square/Tower.) There’s a supposed difference in quality but the connection’s good enough for me as it is; watching YouTube and DVDs on the TV sure beats the laptop screen hands down.

Sometimes things tend to happen seemingly by accident, and today was one of those days. I’d thought to get off the tram at my usual stop, but was too busy woolgathering to notice. And by the time I got up, the tram door closed so I was thinking whaddahell, the next stop’s not that far anyway so I alighted at the next stop over at Federation Square.

Today’s performer was an entertaining fellow who kept everyone laughing with his quips, and proceeded to wow everyone by balancing on a 10 foot unicycle while juggling machetes. (FYI, a machete is a knife. A big one.) Some things he said made alot of sense.

“I make a living by making people laugh, and to me I reckon I have the bloody best job in the entire world.”

“I’m asking you to donate not to keep me alive, but to keep the streets of Melbourne alive.”

Hmm, food for thought. It made me wonder about job satisfaction, and later in the afternoon I was reading some links Stan sent me the night before.

10 Reasons You Should Never Get a Job by Steve Pavlina

And yes, I donated too, incase you were wondering ;p


Here’s something interesting; the man with a hundred voices.

The Pacific filmshoot

[filmshoot] – V’s Flickr, 02 Feb ’08.

There’s an upcoming TV series (titled: The Pacific) which is a sequel to Band of Brothers, and part of the filming was done at Flinders Street in Melbourne, right beside my apartment building yesterday.

Flinders Street was closed off for the day, and we took the chance to snap away: here’s some of the stuff we took. It’s not exactly everyday that you see Flinders Street being closed off, and cars, trams and even people from the 1950s materialise from the wonders of filmmaking.

Positively vintage.

One of the takes in progress.

I was taking the photos from upstairs initially, but decided to try a ground level view later.

The view wasn’t too good: big crowd, too manyheads. I’m not exactly ten feet tall or something.

Solution: mounted my camera on the fully extended tripod, set a 2s timer. Held it by the bottom joints of the tripod heh.

Here’s a big one.

The tram driver looking dapper in his uniform.

We thought that there would be only a day shoot, but it turned out that there were night scenes as well. So.. we went for a second round, albeit from different positions this time round.

This was still from a top view; you can see that the scene has changed.

A bigger one.

All waiting for the take to start.

The cameraman. This was taken at ISO800 due to the poor lighting, so the graininess is pretty obvious.

Banner #1: Come on Australians, Fill The Liberty Loans

Banner #2: “A Foolish Spender is a Traitor”: Buy $10 National Savings Bonds or War Savings Certificates


Sandbags being piled up at the windows of the train station.

This one was taken with a flash, so it’s slightly clearer.

This says Melbourne City Council.

We saw endless retakes of the same scenes, and watching everything is really interesting; it feels like an enormous jigsaw puzzle coming together. Everyone has a part to play, and the enormous amount of logistics and co-ordination required is staggering. Unlike the finished product, the filming is actually very, very boring on the actors and everyone else. Even the extras were tired of standing around after awhile.

Well, this is yet another of those things I probably won’t see back home. Here’s a video clip I uploaded of the take:

Related links:
– Photographs from doigal on Flickr from another angle; Icy Cream cart and the general scene.
– Photographs from brewz on Flickr; checkout his set On location – The Pacific. There’s also links to his videos for the day shoot on the page.