Archive for July, 2006

CSS: Style Elements Based On Attributes

Thursday, July 20th, 2006

Most of the time you refer to elements within your stylesheet you do it using IDs or classes. What many people do not know is that you can refer to elements based on any attribute within them.

Now to a clear but not so usable example to illustrate how this works. On your page you have links pointing at #top (the top of your page). The XHTML code for these links are:

<a href="#top">Back to top</a>

If you would like to make them different from the regular links using CSS, you would probably first put them all in a class so that you could easily refer to them inside the CSS.

But instead of wasting a class for this we could just choose to style by refering to all elements with the href-attribute set to “#top”. In CSS that would look like:

a[href="#top"] { style information }

No additional changes to the XHTML code would be needed.

A test page with a better example is available

Note! Although this is part of the CSS standard older versions of IE does not support it (suprised?), version 7 does though. It works fine in browsers like Opera and Mozilla Firefox however.

The Phenomenon of Web Integration and APIs

Tuesday, July 18th, 2006

A maybe not so new but definitely hot area when it comes to Wordpress plug-ins is integration. Everything should integrate with each other these days.

Users want to share the top albums of their music collection, previous additions to their bookmark collection, or why not show you and other visitors random photographies from their sister’s wedding which they store using Flickr?

Whether the majority of integration plug-ins existing today are necessary (and useful) or not is a matter of taste. Something taste won’t change however, is the fact that many things benefit from users growing interest and search for better and innovative levels of integration.

(more…)

Nightly Snapshots From Subversion

Thursday, July 13th, 2006

I took the time to locate a script I wrote a few months ago. The Perl script keeps track of a project’s Subversion repository. When executed it attempts to do a check-out of the current code and it then parses through the commit log to see if it has already made a snapshot of the current revision.

If it hasn’t, it makes one and also generates a RSS feed with information about what the current revision is, who commited it and also an enclosure tag containing the URL for the snapshot itself.

(more…)

Wordpress Community Podcast Launched

Sunday, July 9th, 2006

Three days ago the first episode of the new Wordpress community podcast was released. The podcast aims at keeping the ordinary user updated on the latest progress in the development, but also to present new useful plugins and tips for taking their blogging to another level.

So check out their webpage or start syndicating today using your favourite podcast client. Also, consider commenting and send your suggestions.

Backup All Wordpress Databases On a Server

Sunday, July 9th, 2006

This simple script looks in a specified directory (and its subdirectories), the webserver document root preferably, for wp-config.php files. When it finds a file it parses it to extract the variables DB_NAME, DB_USER, DB_PASSWORD and DB_HOST inside the file and then connects to the database and dump it using mysqldump into a text file compressed using gzip. All the backups are placed in another user specified diretory where they are suffixed with the current date in %Y-%m-%d format.

Some of the advantages are that you don’t need to specify anything on beforehand since it will automatically find all the Wordpress installations in the document root and back up their databases. Also, if a user or administrator changes the settings then the script will use the new values since it does not save them anywhere, it reads them straight from the configuration file on every run.

It should probably be extended with some error handling but right now it’s simple and works fine.

A Wonderful Coincidence?

Wednesday, July 5th, 2006

A few months ago my school arranged a democracy day. All students wrote their own proposals (as the real parliament does) and we were divided into groups depending on the topic our proposal touched on. I happened to be placed in the group discussing IT and traffic questions. :)

My proposal was a long one, I carefully explained who makes up the WWW standards and the importance of following those standars so that people, no matter what webbrowser, operating system or device they use to access the information, can still view it.

The proposal got a final touch of importance by adding a table showing how many errors and warnings some common government or government related sites had in their markup. Some pages had as much as 400 errors and no valid DOCTYPE declarations.

Of course actual politicians were there to celebrate the event and take part in the discussions. Their staff people (from the parliament) and the teachers at my school had previously read through all the proposals and most of the politicians had done that as well.

Today, a few months later, the Swedish government’s entire website (www.regeringen.se and www.sweden.gov.se) is facing a re-design to increase the usability and availability by making sure their web sites comply with the XHTML 1.0 Strict and CSS 2.0 standards as well as the WAI guidelines.

A funny coincidence? Not that it matters, but it would feel good to know I’ve made a difference.