tutorial

Controlling who sees a block in Drupal

You can configure Drupal block visibility under Admin -> Blocks -> Configure. One option is "expert mode" whereby you can write a snippet of PHP code. If it returns true, the block is shown, otherwise it is hidden.

Drupal "save as draft" feature

Recently the Poorhouse wanted some sort of "Save as draft" facility, such that a (fabulous) article could be started at one point in time, saved - without being published - and continued some other time. Also the option to decide whether to publish to the front page or not on a case-by-case basis was desired - after all you don't want every last bit of the inner workings of your mind highlighted for all to see. At least make them work for it.

Drupal contains this feature, under "Publishing options". However, this is only available to the initial admin user, plus anyone who has node edit privileges. The Poorhouse wanted its guest authors it have this facility too. However giving them node edit privileges was not quite right, because it meant they could edit, delete and otherwise have finger-slips over everyone's articles and not just their own.

Drupal stuff

The Poorhouse uses a content management framework called Drupal. Drupal is great. It may be a bit complex to get your head around at first, but it is ultra flexible, modular, decent user community and so on.

This page will contain links to a few notes the Poorhouse has made during the adventure into Drupal, mostly so the Poorhouse can remember what he did if it needs doing it again, but maybe, just maybe, it'll be of interest to other avid readers.

Converting Drupal Acidfree module to mySQL 3.x

See here for an explanation. Basically, this is how thepoorhouse.org.uk converted the Drupal module "Acidfree" which is designed for mySQL 4 and above to run on mySQL 3.

Converting Drupal Workspace module to mySQL 3.x

See here for an explanation. Basically, this is how thepoorhouse.org.uk converted the Drupal module "Workspace" which is designed for mySQL 4 and above to run on mySQL 3.

Drupal modules on mySQL 3

The Poorhouse tends to use cheap hosting...which whilst bargainous, means you don't get the latest and greatest software. Most importantly here, it only has mySQL 3.x. mySQL 3 is missing a few features, including the UNION sql operator. Whilst this is fine for Drupal core, some of the modules rely on its existence. Which is fair enough all considered - but annoying for us.

Two such modules are Workspace and AcidFree. Both very useful, but required some faffing around to transform into something mySQL 3 compatible. In case anyone is in a similar situation, here's what was done to make them work to an acceptable standard.

Deciding what function to use at runtime in VB

Good coding practice in VBA (or Visual Basic itself) suggests that you should use functions and subroutines rather than one big long list of code. However, sometimes you may not know in advance the name of the procedure you want to call. This is a problem because you can't use a variable to call a function.

Actually, you can. Just use the "run" method. As an illustration of how it works, the following 2 bits of code do the same thing, both calling the function func1. The difference is that in the second one we didn't have to decide on the function to run before the code started running.

Faking page headers on a Microsoft Access subreport

In a tedious Microsoft Access report featuring pages and pages of meaningless numbers in a table you quite often want the table headings (the bit labelling the column) to repeat itself at the top of each page. That way the recipient has no excuse for not knowing what a hundred pages of mind-bogglingly dull numbers mean.

Normally Access provides a Page Header section of the report for exactly this purpose. If you can't see it then in the report design view, go to the View menu and select "Page Header/Footer". Whatever you write in this section will appear at the top of each page.

Breaking WEP for novices - more wifi insecurity

Having dealt with faking MAC addresses in a previous article, the Poorhouse heard on the grapevine that it wasn't so difficult to beat the other side of bog-standard wireless network security either; the encryption key.

When a wireless network client talks to an access point (for instance a router) it transmits packets of data. These packets could potentially be intercepted by a nefarious individual sitting nearby by virtue of the fact they are flying through the air for all to see. They could then feasibly see what the network user is up to, or sneakily communicate with their network, use their Internet connection and so on. Therefore wifi networks with a semblance of security use encryption so a passer-by cannot see what is going on with the network or understand any of the packets being transmitted around it. Typically this may be done with "Wired Equivalency Privacy" (WEP), which is often the only option open to users of older or cheaper equipment. The Poorhouse knows for sure that both home users and perhaps more worryingly business users use it regularly.

Faking your MAC address

Most network hardware, be it in a computer, a PDA or a component, has a Media Access Control (MAC) address associated with it. This is a unique number, often written in the format 00-00-00-00-00-00, that is permanently assigned to one exact piece of network equipment. From it you can work out such things as what company made it and so on.

More critically it is often used as at least one part of network security with regard to wireless networks. This, combined with the (usually WEP) encryption key that the other part of "bog-standard" wifi security, does indeed sound like a very good idea insomuch as someone wanting to access that particular network would need a specific piece of hardware (identified by its MAC address) and a specific piece of knowledge (the encryption key). Indeed this is the upper limit of security that many older or cheaper network set ups have available to them.

Syndicate content