WordPress Plugin: Random Posts Widget

My better half was complaining that she can’t find a suitable plugin for displaying random posts on her sidebar. I tried to look myself, and there were some references to the plugin but nowhere to be found. One good plugin I found is Random categories with random posts by Mike Stickel but it uses categories which is not what we are looking for. Also, it requires tinkering with PHP codes which is not suitable for less technical bloggers.

So I went to analyze his code for a little while. What the heck, I’ll just create a simple widget version with no categories involved. So I took about 30 minutes to write this simple code with not so many options. It is a widget and configurable in the Sidebar Widgets page:

Random Posts Widget configuration

  • Widget title: the title of the widget
  • List types: ul for bulleted list, p for paragraph, br for paragraph with line breaks
  • Before title and After title: you have to find out what your theme uses before and after the widget headers. A simple way to do this is to identify a currently existing widget in your site and viewing the source. Find the title and see what is printed before and after. For example it might show as <h2>Widget Title</h2> which is used by most themes.
  • Post count: Number of random posts you would like to be displayed

Basically that’s it. It’s really a simple widget.

I don’t like to reinvent the wheel but since I can’t find any I just have to create one myself. Most probably I will have not so much time to maintain this plugin, but it is suitable if you are looking for a (very) simple plugin to display random posts.

You can download it from WordPress Plugins Directory: Random Posts Widget, or view online here: randomposts.php

Current Version: 1.5.0

Installation

Copy the file to the wp-content/plugins/widgets directory and activate it in the Plugins page. Then drag and configure it in the Sidebar Widgets page.

Warning: Will only work on widgets enabled blogs.

Change Log

  • 07-May-2007: Fixed a bug of displaying widget before and after tag
  • 14-Jun-2007: Fixed a bug where pages are also selected. Now it only displays posts.
  • 26-Jun-2007: Removed before and after configuration options, now taken from theme settings. Was broken for some themes with embedded class in the header tags. Reported by Guohua. Thanks.
  • 03-Aug-2007: Overhauled entire engine to optimize queries. This has been tested on a test blog with 50,000 posts on an old machine (Pentium III 600MHz) in maximum 3 seconds. Also removed duplicated results and added category to choose.
  • 04-Aug-2007: Fixed a bug where wrong permalink was displayed.
  • 10-Aug-2007: Fixed a bug where if 1 post count is selected an error occurred.
  • 27-Sep-2007: Added ability to detect database version (WordPress 2.3 has database changed) while maintaining backward-compatibility with 2.2.x

Live Free or Die Hard

As a long time Bruce Willis fan (you’ll know if you see my gravatar and IM avatars), I was thrilled when Azidin told me that a new Die Hard movie is going to be released this year. It is going to be the 4th installment to the Die Hard series, being the 4th.

I have never expected that Die Hard 4 would be made, since I read somewhere that Willis said there will be no more sequel.

It’s planned to be aired in 28 June 2007 in Malaysia. This is one of the movie that I will make pre-booking to watch.

IMDB entry: Live Free or Die Hard (2007)

WP-Cache and GoDaddy Hosting

I have several blogs hosted on GoDaddy servers.

If your WordPress blog is hosted on GoDaddy hosting, do not use the WP-Cache plugin or your site will intermittently produce Error 500 (Internal Server Error). I can’t spot the error even when I enable the error logs – there seems to be none!

I’ve heard similar complaints from other GoDaddy hosting users. One thing I am sure about is that the problem is not because of the combination of WP-Cache and WordPress 2.1.3 as I have blogs hosted elsewhere that works fine with this combination.

I guess I will have to dig deeper… when I can find the time! Anyway the server speed and stability so far is good without WP-Cache – which is what we want to achieve by caching the pages. Hopefully the blogs do not overload the server anytime soon.

Imation Disk Manager II

A funny story. I just bought myself a 4GB flash drive to substitute my old 128MB Imation flash drive. So I was trying to format the Imation drive when I found a big loophole to the software.

The Imation flash drive comes with a firmware that automatically creates an executable to run the Imation Disk Manager II software. You can make the whole disk public, separate the disk to 2 partitions (public & secured), and the whole disk secured.

imation1.jpg

For the secure partition you’ll need to run the software and enter a password if you want to access the files in it. I am not in the hacking business so I have no idea how secure it actually is. But this is another story, not about the secure partition.

After I have copied the files to the new location, I simply execute the software and it let me reformat the entire disk without asking for a password. Easy, but dangerous. If the drive falls into the hands of somebody clueless (say your 4 year old brother) or someone with bad intentions, you can say goodbye to your data 😉

imation2.jpg

I was actually looking for looking for the Imation Swivel Pro flash drive but no shop in Low Yat have the 4GB version. They only have the 2GB version. I surely don’t think that the Imation Clip Flash Drive is available over there!

In the end I got myself a Sandisk Cruzer Micro 4GB drive which is a U3 compatible drive. Now I have Portable Apps and U3 in one drive 🙂

New Header and Footer

I’ve just updated the header and footer for this site. At first I only changed the image but then the night scene was not quite suitable for the default header colors. So I decided to play around with Photoshop and make some color adjustments.

The header image was taken last weekend, when we went to the lake that separates Cyberjaya and Putrajaya to try some night shots after returning from the Community Club. We have been wanting to go there for a while and with a tripod in hand we got some pretty good shots. It’s about time we utilize the DSLR!

Here’s a bigger photo (click for a bigger image):

Wawasan Bridge Putrajaya at night

Unsolicited Mails

I hate it when I receive unsolicited mails such as this one. I have never registered for any services by this company, and most importantly I only use my disposable emails from Yahoo! to register for any untrusted services in the Internet.

So this is a human imbecile who harvested my email. I already have 2Mbps broadband. I was thinking of bombing their email with like a million messages a second but considering today’s computing and storage power I think it will just be useless and wasting my precious time.

spambroadband.jpg

Hmm… This low life company (so called Broadband Multimedia) is located in KL and have branches in Johore and Penang. I will never be a customer of a company who spams me without me asking for it. Never ever. I am guessing ez-marketing is an affiliate or a subsidiary who is specially created to spam Internet users. 😡

Kelab Komuniti Taman Tasik Cyberjaya

On Sunday afternoon we got bored at home and decided to go out, just anywhere. We finally decided in the car to go to Taman Tasik Cyberjaya, also to check out the latest addition, the Community Club. For non Malay speakers, Taman Tasik Cyberjaya translates to Cyberjaya Lake Park. Some people prefer to say it as garden but it’s more like a park to me.

The whole area was quite big, and I actually broke some sweat walking all the way from the park entrance to the community club. Yes, there are actually 2 different entrances (maybe 3) – one to the park and the other one to the community club. Since I was looking for the community club but parked at the park entrance I had to walk quite a long way.

Coming from Persiaran Multimedia (MMU road) we’ll first encounter the park entrance, as the community club entrance was actually further. But after we left the park and went to look for the community club entrance, we discover something new (at least for us) – that MMU has a second grand entrance at the back complete with the big sign and a guard post. Cool.

Click on continue reading for more…

Continue reading Kelab Komuniti Taman Tasik Cyberjaya

One Day Blog Silence

On April 30th 2007, the Blogosphere will hold a One-Day Blog Silence in honor of the victims at Virginia Tech. 32 innocent people died at the US college massacre.

One Day Blog Silence

I support this as a human, and since it has got nothing to do with religion, politics (hope not!) or anything else. Massacres are bad. I pray that it would never occur again anywhere in the world.

Can someone suggest to Ted to suggest the same for PPP and the posties? 🙂

Hosting: Responsibility of Customer or Provider?

This post is specially dedicated to Exabyte’s latest customer newsletter, which provide very useful information on how customers could prevent servers from overloading and causing service downtime.

I do agree with what Exabytes have to say, and it is true that I noticed that when the services were down, it was indeed caused by processes using too many CPU and memory resources. However it must also be noted that not all users are efficient programmers, and sometimes the codes simply made to achieve a certain goal without considering the impact to the server resources. This is the user’s fault.

I guess you know that there is a big BUT coming: when I experience service downtime I can see that many many cron (task scheduler) jobs are running out of control on the server. Some of them were even a few weeks old. The processes are obviously user cron jobs. In this case there is a lack of policing activity from Exabytes. When a service is down, the engineers simply restart the service and not do any investigation on what caused the overload.

After receiving an email confirming that the service is already up, I usually go in and check the zombie processes and they are still there, hogging MySQL and CPU resources.

We need to keep in mind that not all users are technical and have shell access like me, and they might not even know that their application / cron job is causing any resource problems. So IMHO it’s the provider’s responsibility to alert users if such case happens.

Now I only serve images on the server, and the server in US actually checks if the user is from Asia and if the Exabytes server is up. If it’s up then the images will be served from there. If not then users will have to wait for images to load a little longer.

Click on continue reading to read the rest of this post.

Continue reading Hosting: Responsibility of Customer or Provider?

Secure Your Wireless Network

Since a couple of months I’ve heard quite a lot of concern in the Internet about Wi-Fi security. The WEP encryption standard has been widely known and easier to crack. This means that a guy next door can easily sniff your packets and break into your wireless network after he manage to get your key.

WPA was an interim solution to cope with this problem, which was later finalized by WPA2.

I have less time nowadays to look into such matters but I do realize I have to do something about it. Not that I suspect my neighbors hacking into my wireless connection, but then again who knows?

After work yesterday I poked around my WRT54G v2.2 and see whether I can implement WPA2 in my own wireless network. I was using Sveasoft’s Alchemy as my firmware and the highest security level I can set is WPA. I was not satisfied and do some more research until I find DD-WRT which is based on Alchemy, meaning it should have all functionalities of Alchemy, and much more. WPA2 security is indeed included.

Continue reading Secure Your Wireless Network

Portable Application – A Reality

Not everything that you dream of can become reality. But one of my oldest dream has come true. I really wanted that my frequently used applications can be brought along anywhere I need them, and be used in any computer I want to.

I found PortableApps. It can be used as a suite, and can be used individually. And the software list is great, comprising of most important software you’ll ever need. Well, almost. Obviously huge software such as graphic design software is not in the list (yet).

Coupled with my Maxtor OneTouch III Mini, it’s going to be a portable powerhouse. Here’s a screenshot of PortableApps running from my 128MB USB thumb drive.

PortableApps

Bad Domain

I just tried to register to Chitika and Nuffnang and they both rejected my email address with this domain – @romantika.name

I thought all systems have updated the checking code to include .name as well, as it has been around for quite a while now.

Invalid email

Well I sent them an email to notify about this glitch. I think they’ll want to update, as this decreases frustration when bloggers with .name domain try to register.

Update: My email to Nuffnang bounced went through but I think the error I received was due to forwarding to multi recipients (like what I usually do for important email addresses). In this case, Timothy’s mail address was unreachable.

This message was created automatically by mail delivery software.

A message that you sent could not be delivered to one or more of its
recipients. This is a permanent error. The following address(es) failed:

timothy at netccentric.com
(ultimately generated from admin at nuffnang.com.my)
retry time not reached for any host after a long failure period

—— This is a copy of the message, including all the headers. ——

Return-path: <ady at romantika.name>
Received: from [206.190.53.33] (helo=smtp108.plus.mail.re2.yahoo.com)
by server.nuffnang.com.my with smtp (Exim 4.63)
(envelope-from <ady at romantika.name>)
id 1Hawvh-0007WZ-9g
for admin at nuffnang.com.my; Tue, 10 Apr 2007 00:41:22 +0800

Oh well no big deal. I’ve registered using another email anyway 😉

Update: I received a reply from Nuffnang. Well done, people. Good speed.

Automated WordPress Backup

Since I am maintaining several WordPress installation now, I feel that it is quite a tiring chore to backup the databases every now and then. I used to do it once a week, and it is even a recurring event in my pocket PC. It was WordPress Database backup 0.8 and every time I clicked on the link on the plugin page, the site is no longer there. I thought Skippy was doing maintenance and because of other commitments I let the thought go.

A few days ago, I was thinking of writing an automated plugin, and I searched for it first not to reinvent the wheel. I found it at a different site: http://www.ilfilosofo.com/blog/wp-db-backup, and learned that the plugin has changed hands from Skippy (Scott Merrill) to Austin Matzko.

I was excited to learn that the new plugin support the cron hook provided by WordPress 2.1. Yay! And the plugin worked flawlessly:

WP DB Backup

One thing you might want to take note is that the cron event is not a real, system cron event but it is triggered when your site is accessed. I noticed that when I installed and configured the email function on a newly set up installation (hence no traffic) it didn’t work until I access the site.

The plugin can also be configured to save the backup files to the server, but of course this is not recommended because of security reasons.

Have a try, I believe you’ll love it. However do remember to also backup your image files separately!

Another Reason Not To Host In Malaysia

Would you register your blog if the Government ask you to? Although I rarely write about any sensitive issues related to the Government, I have to express myself on this one.

So now Malaysian Government is planning to make it compulsory for bloggers to register themselves. Here is an article from The Star: Bloggers may have to register

According to another this news in The Star Online, “… plan to register all bloggers using locally hosted websites …”. If this is true, I am not related anymore since I moved out from Malaysia hosting. So was my decision to move from Exabytes the correct decision to make?

We have to wait for the official announcement from the Government.

My opinion is that this is entirely not necessary. From what I see now the Government is creating another enemy, instead of embracing bloggers for a better country. Why can’t the Government take it as a challenge to make things better, or even take it as the voice of the people living in this country? There must always be a reason why people talk about bad about the Government, not only in Malaysia. A Malay proverb: Kalau tak ada angin takkan pokok bergoyang which means exactly that.

And really, this is the classic case of kerana nila setitik rosak susu sebelanga (because of one bad thing/person the entire group receives bad reputation).

So after this there should not be any question anymore why Malaysians do not host their website within the country. Not that the service is good anyway.

As usual I include the original news below in case the original article is no longer available.

Continue reading Another Reason Not To Host In Malaysia