Category development

Hierarchical WordPress pages menu

For a Web project I am working on I wanted to use WordPress as a CMS for flat pages only. No blog posts, no categories, simply a hierarchical page tree (too complicated for the user). Thus I installed the CMS Tree Page View plugin, set some permissions and tried to render a hierarchical menu in the navigation bar of the Web site.

Well, I tried. It is not as simple as it seems to render a hierarchical menu in WordPress that does the following:

  • always display all top level (root) pages
  • always display the current path down to the current page
  • always display all child pages of the current page
  • always display siblings of the current page

This is pretty much the behavior I’d expect from a hierarchical menu in a CMS.

Unfortunately it seems this is not very easy to implement in WordPress. The wp_list_pages function with all its options does not allow to render a page tree that goes up to the top level. And none of the samples on the page is the right solution (on a side note: the advanced samples on the page are not targeting the latest WordPress releases and won’t work out of the box as they target the wrong database tables) – they render the current parent page or siblings or… something.

Anyhow, here is a short snippet that provides a hierarchical page menu in WordPress, simply add this to the template where ever you would otherwise just have the call to wp_list_pages:

I hope this helps someone who runs into the same issue… and – if there is a better, simpler solution that I did not see or find, please leave a comment!

Reset a ThinkPad USB Portable Secure Hard Drive

I am using one of those hardware-encrypted disks that have a keypad on it and need you to enter a 8-digit keycode before they show up as disk on the computer… Should be fairly simple, but somehow I managed to destroy the disk multiple times.

The behavior is that neither Windows nor Linux or Mac OSX even recognize that the disk is attached to the computer (no entry in the syslog, no lsusb entry, nothing). Tried USB and eSATA. Same result. On multiple machines. How to replicate? No idea, it somehow just happens.

So if this happens, here is how you reset the disk (but be aware, all your data will be gone!):

  • Press the red “x” key while attaching the drive any power source. The LED will flash blue and red.
  • Press and hold the red “x” + the green “lock” + “2″ for 10 seconds – until the LED will turn green for 3 seconds.
  • After the drive has been reset the combination to unlock will be 12345678.

That worked. But what’s scary – the drive is now sometimes detected *once* so it can be repartitioned and reformatted, but as soon as it is plugged in somewhere else it is not being detected. Same on the computer that just formatted it. But as I said, only happens sometimes…

So be aware, those disks might have some bug that might eat all your data…. but you have a backup, right?

Image (c) Lenovo

Legacy code

Recently, on top of a file:

Somehow it reminded me of this Dilbert… fixing 12 year old code is not really fun, especially if basically everything changed since then (Operating system version, Perl version, Oracle version etc. etc.). But anyhow, it worked…. 1 line of code fixed the issue, took 2 days to figure it out….

Comic (c) dilbert.com.

rpm quick hints

As I am recently dealing a lot with rpm I want to share some useful commands:

To view a list of files within an rpm file use:

To extract the files from the rpm use this command

(use cpio -t to list the files)

To extract the pre/post install scripts from the rpm use:

Happy hacking & have fun with rpm!

Human tasks switches

…have you ever noticed that you can assign one job to one person, and they’ll do a great job, but if you assign two jobs to that person, they won’t really get anything done? They’ll either do one job well and neglect the other, or they’ll do both jobs so slowly you feel like slugs have more zip. That’s because programming tasks take so long to task switch.

Yeah, that’s how it is. An old posting but still true – programmers are less productive if they have to constantly switch between tasks that are all super-mega-important for management. In fact each developer should only worry about the task at hand right now and leave it up to the project manager to decide upon the next task.

The full article from Joel is worth reading.

… an interesting … “documentation”

dojox.layout.ScrollPane is an interesting UI, scrolling an overflowed div based on mouse position, either vertical or horizontal.

Not only the behavior is interesting, but also the “lengthy and detailed” documentation:

Available since version 1.0, but still no documentation… :(

Dojo documentation :(

I need to rant about this… the Dojo documentation is simply in very very bad shape… For example the superb description of the dojo.subscribe feature:

This is one of the major features, available since Dojo 0.9. And there is NO documentation available. And I’m even not going to talk about the fact that there are tons of broken links in the documentation or examples do not work on their own site… (if samples are available at all).

“Unbeatable JavaScript Tools” – I agree to this slogan 100%. Unbeaten in performance, bugs and documentation.

</rant>

Farming vs. Mining

In the mining model of software companies, the charismatic, flighty founders and their investors stand to make a lot of money. Their workers, their customers, and their secondary investors all get boned, because these companies and their products tend to suck.

So true…

The people who really change the world are farmers.

Unfortunately mining seems to be very popular these days….

Read the full blog post.

Software is not free

A while ago I ranted about “making money in the Appstore” and that EUR 3,- are too much for an application. Most probably the people reviewing those apps never wrote code on their own… that said, there is a great list of 13 reasons why software is not free… and I could not agree more with Brittany… some of my highlights:

  • Software is not easy to create — especially not software that people consider easy to use and attractive. It’s a whole heck of a lot of work, in fact.
  • Good software takes somewhere between months and years to create. It’s not something you just whip up in a night like they show you in the movies.
  • Software is created by hard working people… like you. Do you get paid for your work?
  • People who make software have more to do once your purchase has been made. We are here for you when you run into issues by providing a support team to answer questions, walk you through troubleshooting steps, fix bugs, etc.
  • You pay for your clothes, gadgets, your movie tickets, your lunch, your plane ticket, etc. So why not your software?

    Read the full 13 reasons here and please think about this before you rant about spending money for software…

    DevOps?

    After writing about Taco Bell Programming I discovered that there is a new movement called “DevOps” which goes into the same direction:

    Let’s face it – where we are right now sucks. In the IT industry, or perhaps to be more specific, in the software industry, particularly in the web-enabled sphere, there’s a tacit assumption that projects will run late, and when they’re delivered (if they’re ever delivered), they will underperform, and not deliver well against investment. It’s a wonder any of us have a job at all!

    The Devops movement is bold enough to believe that there’s a better way – a way of building teams, and building software that can solve these problems.

    Read the full DevOps article.

    Older posts