Rubénerd :)

Tuesday 06th April 2010

Host multiple blogs with default WordPress?

Vinícius Lira over in this comments thread has proposed a ridiculously elegant solution to using a default WordPress installation to host multiple blogs on different databases. If it works, it’s genius.

Read this post >

Tuesday 01st September 2009

WordPress summaries on some posts

Every time I try to pry myself away from WordPress which I’ve been moved over to in 2005 after thinking for far too long, another feature comes along that makes the decision harder. I’ll give you the attention you deserve one day Django!

In this case, it’s the ability to show a summary of a post with a link to read more, but only posts you elect it to happen to. Given I merged all my blogs into this one recently I’ve decided to use this on anime reviews which tend to have a ton more graphics and are much longer. It also means I can append a mild NSFW warning on some posts above the read more link when Her Senjougaharaness insists on spending half an episode in the shower.

To pull it off, make sure you have this code within the the_content() method, NOT the_summary() as you may assume. Finally, wherever you want the more link to be inserted, add <!--more-->.

Spiffyness.

Monday 25th May 2009

The real problem with PHP

PHP motivational poster

Coursesy of Nick Hodge of Microsoft I read this article from The Register discussing Microsoft Azure’s support for PHP. In particular these paragraphs stood out:

Yes, let me introduce you to the professional PHP programmer. You see, PHP is like a handgun. On its own, it is simply an inanimate tool that has no moral leaning. In the hands of a responsible citizen, it can be used to the benefit of society. But in the hands of someone who is untrained or mentally unstable, it can be used to commit horrible atrocities.

Whenever there’s such a tragedy, other developers are quick to blame PHP. If PHP were illegal, then Yahoo would never have happened. If we regulated PHP tightly, then there would be no Digg. Now, it’s not fair to say that the world would be better off without PHP, but its community could certainly use less encouragement, which is why Azure’s support for PHP worries me.

This has been one of my primary criticisms of PHP from day one, aside from some elements of the language that don’t make sense. PHP can be used to create elegant and fast web applications, but only in the hands of competent programmers. It is way too easy to easy to create horrible spaghetti code in PHP. Even in the hands of said competent programmers, maintaining PHP code others have written I think is also more difficult than it needs to be. Then again I’ve heard people use the exact same observations to claim the language is more flexible; each to their own.

In a way I make up for a lack of time by using high level languages like Ruby and Python because more than PHP (or Perl) they force you to do things "more correctly", Python moreso.

Wednesday 06th May 2009

SimpleTags for WordPress

Michael Franks
My post about Michael Franks was the last to use the SimpleTags plugin. Couldn’t think of any other picture to put here!

When I started using it for this blog back in 2005, WordPress didn’t have native tagging abilities. The Ultimate Tag Warrior was the most popular third party plugin to provide them at the time as evidenced by the importer available for it in more recent WordPress versions. I chose not to use it because I’ve never been comfortable with plugins altering my blog’s database.

The solution I found at the time was Broobles’ SimpleTags which allowed tags to be defined within the text of a blog post either inline or in a block. When the post was rendered the plugin would generate a nice list of Technorati tag links with the rel="tag" attribute so they’d be recognised as such. No muss, no fuss.

ASIDE: All posts here that used SimpleTags have since been mass tagged with the simpletagged tag using WordPress’s tagging system. That’s right, I have an internal tag for posts that have been tagged in another system. I also had a grilled chicken sandwich for lunch, and I don’t hear anyone complaining.

When WordPress implemented tagging support I stopped using SimpleTags, meaning most of my posts from 2006 (and very early 2007) still have them. Fortunately SimpleTags still works even with the latest versions of WordPress so I can keep it installed to generate those links. For example, I can define a few right here:

That was fun, I haven’t done inline tags in a long time!

Even though I’ve moved over, I can see situations where SimpleTags would still be preferable to using WordPress’s tagging abilities. Unfortunately (in my opinion) WordPress handles tags very much like categories in your blog database, meaning if you don’t want your tables to get ridiculously huge and therefore take longer to backup, you have to be more restrictive in your tagging. With SimpleTags you can tag a post with as many as you want; I remember on many posts I would include several different spellings of the same word, and with posts about software I’d include a generic name tag along with a more specific name and product version tag.

So I did end up reviewing SimpleTags, it just took 4 years to do it ^_^.

Friday 17th April 2009

Turning off Post Revisions in WordPress

This is probably old news in the WordPress world since 2.6 and subsequent versions have been released, but given I’ve decided to stick around using it for a bit longer I thought it was worth getting right when I installed it fresh here since the [forced] move.

One feature I really don’t use is Post Revisions. While I can see the benefit of using it on a Wiki, on a blog written by just one guy it doesn’t really make much sense; plus it adds junk records to the database which makes backing up said blog a more time consuming process than it needs to be.

Courtesy of Lester Chan, if you want to turn Post Revisions off, just add the following line to your wp-config.php file.

define('WP_POST_REVISIONS', false);

He also has instructions on how to delete existing entries made my Post Revisions if you’ve had it turned on for a while.

Friday 03rd April 2009

WordPress WXR/RSS problems solved!

Screenshot of my faulty exported WordPress export file from 2009

For those of you following my adventures with the WordPress WXR/RSS export feature (here, here, here and here), I finally figured out why the resulting file was truncated and only contained posts up to October last year. It’s so simple I’m kicking myself for not figuring it out sooner: PHP on my webhost was configured to only allow a maximum file size of 4MiB.

As I’ve said before I’m not a PHP guy so I had to do a bit of digging, but it turns out the most reliable way to increase allowed file sizes if you don’t have access to your php.ini file (usually this is the case) is to add the following line to your root .htaccess file:

php_value memory_limit 32M

Icon from the Tango Desktop projectYou might have to do some trial and error to find a size value that works. If in doubt, contact your webhost.

I think the people at WordPress ought to include a simple warning on the Export page of people’s blogs informing them of the file size limitation on their web servers, or barring that issue an error if it runs out of space with a link to a page explaining how to increase available file sizes instead of cheerfully and misleadingly informing users the export is finished. I imagine there are plenty of people who’ve been caught out by this, some of whom I’m sure aren’t web developers and wouldn’t know where to even start looking to solve this.

Tuesday 31st March 2009

Trying again with WordPress WXR exporting

Photo by wileypics
This is the logo for phpMyAdmin right? :). Photo by wileypics on Flickr

UPDATE: This was another blog post I thought I’d published, but for some reason it was only saved as a draft, whoops! The original timestamp was for 2009.03.24

Reading back some comments I’ve been receiving from people regarding my long string of WordPress WXR/RSS Export posts, it seems I didn’t explain what I’m trying to do very well.

The problem is, I have three separate blogs and a podcast which I’m trying to merge together into one blog (but with separate categories etc) to make it easier to maintain it all. To do this, I obviously need to export the posts from all these WordPress installations and import them into the new site.

Along with more traditional MySQL table exporting, WordPress has an Export Posts feature which creates a single "WordPress eXtended RSS" WXR file which you can import into another blog (I think even Movable Type supports these now). The advantage of using WXR files instead of exporting SQL files is that it’s easier for WordPress to merge multiple sources of posts because fields like the post ID are created as they’re being imported. As I understand it with WordPress tables, if you tried to import two sets of tables from two separate databases into one, there might be overlaps and clashes and it could get messy. Or if it is possible, it certainly wouldn’t be as easy or straightforward.

Icon from the Tango Desktop projectAnyway, it turns out that while the WordPress Export feature works fine on three of my WordPress installations, on this blog it seems to fail at a seemingly random point in October last year, and I haven’t been able to figure out what’s going on.

I’ve been thinking perhaps the key is to export a SQL file from PhpMyAdmin from this blog, import it into my new meta blog, then use WordPress to import the WXR files generated from the other sites. That way it doesn’t matter that WXR doesn’t seem to work here.

I haven’t bothered learning too much about the inner workings of WordPress or it’s database because I’ve been intending to move off it for quite some time, but studies and work keep getting in the way! WordPress is really easy to use, but it’s really kludgy in some areas and it’s security record is less than stellar. I use MediaWiki for many projects, but it would be overkill for a site like this.

Clear as mud!

Sunday 22nd March 2009

Night thoughts about WXR, PHP, MySQL…

Photo from my Flinders Ranges photoset on Flickr. Think it says it all really.
Photo from my Flinders Ranges set on Flickr. Think it captures the mood pretty well.

Thought I’d just post another quick update on my adventure to get the WordPress WXR/RSS export feature working. In an earlier post I claimed I had given up on this, but since then it’s been gnawing at my mind enough to make me want to figure out what’s going on!

ASIDE: Sometimes I find thinking out loud helps me work through a problem. Please forgive me if I make no sense! Well, less sense than I usually do.

I read in several WordPress forum posts that sometimes faulty authors (ha) in the database are enough to confuse the exporter, so I merged my authors into one. Not only didn’t this fix the problem it actually made it worse; before it would export 4.4MiB of data, now it exports 4.2MiB worth. This translates to exporting all the posts I’ve created here up to early October last year.

I’m not a PHP guy, but I figure if this problem was being caused by an insufficient maximum file size value in my host’s PHP settings, doing something on the database end wouldn’t make any difference. I’ve also seen people throw around numbers like 25MiB and discussing the need to use Gzip on PhpMyAdmin for example; my blog would not reach that.

Icon from the Tango Desktop projectMy next thought was that it might be a poorly formed post that trips the exporter and stops it. If this were true though, I would expect the exported file to abruptly end; instead it’s well formed (well, as best as a WXR/RSS file could be expected to be) and has all the correct end tags in place. It’s a valid file, it’s just missing a large swath of posts! Also, every single post validates as XHTML 1.0 Strict except one which has an embedded video, and that was written much later than when the exporter stops.

I also doubt it has something to do with the server configuration because my Rubenerd Show WordPress installation on the same server was able to export all the posts without any problems at all. I can only logically surmise that there must be something up with my WordPress install on here, or a fatal error in one or more of the MySQL database tables. I’ve only been running this install since early 2006 but who knows, perhaps something corrupted it.

I will figure this out if I have to stay up all night… if only the Boatdeck Cafe was open 24 hours!

Tuesday 18th November 2008

Podcast feed has been fixed

I was alerted by Todd and Kaede that the Rubenerd Show RSS podcast feed thingy wasn’t working properly for them. I had a look on my server and it turns out the RSS feed php file was corrupted when I upgraded to the latest version of WordPress last night. As far as I can tell that was the only file affected, but to play it safe I re-uploaded every server-side file again.

Hope that clears it up for people, sorry for the trouble.

Saturday 01st November 2008

Rubenerd Blog October 2008 rambling summary

A Swindon based 63 service
"A Swindon based 63 service" by The Oxford Bus Page

It’s official, October 2008 has been the best month for the Rubenerd Blog since August 2006. In total 63 posts have been submitted compared to 23 posts last month and 37 the month before last. Realistically many of these have been long and involved but many more have been silly posts with less than three lines. Still, that’s 63 random thoughts and ideas which isn’t as high as the ridiculous 110 I made back in August 2006 but it’s close.

In a kind of ironic twist, it seems that the more work and studying I need to do, the more material appears here. I think connecting my mind to a keyboard and letting all the ideas flow is a fantastic coping mechanism. It also allows me to keep my mind alert when I take breaks instead of being a passive consumer like I would be if I just watched TV.

ASIDE: For some reason I think this post will be getting the "pointless milestone" tag. The question is, how can I pull off putting a picture from an anime series on here too so I can use the "pointlessly fun anime reference" tag as well. These are the thoughts that keep me up at night. That and coffee. That made no sense.

Given I’m posting so many entries from my iPhone now as well, I think the next logical step in the evolution of this long winded and overly verbose trail of consciousness is to include some form of location metadata into each post. In this way I could see just how many words I have typed while I was sitting at the Boatdeck Cafe in Mawson Lakes or the huge Starbucks with lots of comfortable lounge chairs in Millennia Walk in Singapore. I have a sneaking suspicion they might be where most of this stuff gets done!

ASIDE: Millennia Walk was just across from where the Singapore Formula 1 night race was held. It’s a really bizzare building with gigantic pyramid like skylights that stretch above the main shopping area by several whole floors. I did work for people around Suntec City and Millennia Walk after I finished high school in 2004.

Millennia Walk, Singapore
Millennia Walk, Singapore by williamcho

The place of the Rubenerd Show I think is also starting to evolve again. Previously I would speak everything I was thinking into that show, now it’s much more of a spur of the moment type of project which I hope will improve the quality. I wish I had the self confidence that Frank Nora has by being able to speak into a voice recorder as I walk down the street with people staring at me the whole time… perhaps at some point I’ll get to that stage.

At some point I would also like… ney LOVE, to be able to finally move all this material onto the content management system I wrote myself in Ruby (without Rails… it bothers me how people assume it must use it if it’s a Ruby web app) earlier this year too. Perhaps after the exams and this latest project I’m doing for a client I’ll take a solid week off to do that.

Yukikiro Matsumoto I’m fed up with all these constant WordPress updates; it is a great blogging system if you want millions of bells and whistles but don’t want to do any programming yourself, but it’s incredibly top heavy for what I want to do here. Not only that, but it’s written in PHP. As a guy who also loves Perl, I have nothing against PHP, it’s just Ruby is so much more Smalltalk like and is so elegant. Ruby code can be syntax-highlighted and printed onto posters it looks so nice. Yukihiro Matsumoto knew what he was doing!

ASIDE: My beautiful late mum thought that Yukihiro Matsumoto was cute.

I’d love to learn though how to better integrate MediaWiki with Ruby applications though, I love MediaWiki and I’d love to start using it again for my own projects. For a while I was a maintainer of an intranet wiki system and I wrote a lot of Ruby scripts that PHP would call using system calls, but it wasn’t very elegant. If I could figure out how to better integrate them, I could write so many scripts for Whole Wheat Radio to do trippy things Jim would have to start blocking my IP address because I’d be using all WWR’s idle CPU power. Wouldn’t that be fantastic?

BRAINWAVE: Wouldn’t it be great to be able to use the same user database for my Ruby CMS and MediaWiki? Then I could leave my CMS for the blogging portion, and use MediaWiki for the Wiki side, but the users would be consistant. I’m so smart it’s scary sometimes. Okay, I’m more scary than smart.

Well that post started constructively and quickly deteriorated into rambling quickly… sorry about that. 63 posts though. Like the way I got back on topic again by referencing what I was supposed to be discussing? That’s called "skill" and it’s not something you can learn at any fancy tertiary educational institution.

< Older posts
Dedicated to my groovy late mum Debra Schade.