Jump to main navigation

Archive for February, 2008

Redirecting non-www to www with .htaccess

If you want to redirect all non-www requests to your site to the www version, all you need to do is add the following code to your .htaccess file:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]

This will redirect any requests to http://my-domain.com to http://www.my-domain.com. There are several benefits from doing that: Read the full text...

How to display code fragments in web pages

Since in this blog I'll be writing about JavaScript, XHTML, CSS and other languages, I was wondering which would be the best way to display code fragments in a web page. Obviously each fragment will go inside a CODE element, but there's other things I'd like to implement:

  1. When the page is displayed without CSS, I'd like the code fragment to have a decent formatting.
  2. I'd like to add a sort of caption to each code block, to add things like "add this to your .css file" (see the code fragments below as an example).

And of course, I'd like to do it with the cleanest possible XHTML. Let's go! Read the full text...

FixIE v0.5 released

This is a bug fix release that solves the problems when there were empty instances of the elements used as containers for the addFirstChild method. Head over to the FixIE page to donwload the new version.

Whole-Play update

I've been a bit slack lately with Whole-Play, but that's going to be an exception, W-P can't wait!

Today I've closed drumGenerator2, and left it as a test program. Now I'm moving on to something much more exciting and challenging: teaching Chuck some harmony! The new test program I'm working on is called harmonyDetector, and I'm not sure how good it will be, but I'm hoping VERY good. This is forcing me to do two things: find ways to process note/chord data to infer harmony properties, but also think about what harmony is. It's easy to collect the data, but what's a key? What's a root? What's a scale? Believe me, when you put that into a programming language, it's quite tricky!

I'm also going to be working on the first milestone, wich is scheduled for Feb 27th, and will be a more interesting version of drumGenerator2. Did I talk about milestones? Well, because the development of Whole-Play is a long term project, I've set up a few milestones along the way, so I can both keep track of the progress made and enjoy the project. This means that whatever the state of the project, at certain points I'll write a commited program trying to make the most of the current possibilities. I ask myself something in the lines of "If I stopped the Whole-Play development now, what would be the best I coud do with it?". I'll post the results of these milestones here, so it's not all words.


FixIE is a little script that I've created to overcome a few of the CSS selector limitations in IE6. What it does is adding a few helper classes to certain elements/states, which then can be used in your .css files to reference those elements/states. In particular:

  • It adds the"first-child" class to the first child of certain containers (by default UL and OL).
  • It adds/removes the class "hover" to LI elements inside certain containers (by default an element with id="nav"), to provide support for CSS drop-down menus.
  • It adds a class to all INPUT elements, matching their type. That is, all inputs of type "text" will also have the class "text", and so on.

It is possible to configure the first two features, choosing any number of containers. For example, you could add first-child functionality to all divs, or apply the hover functionality to several navigation menus (see the JS source). Read the full text...

Personalizar WordPress

Una de las ideas de integrar WordPress en dense13.com era practicar un poco con WordPress y ver hasta donde puedo adaptarlo a mis necesidades. Soy novato en ello, pero en los pocos días que llevo investigándolo he visto ya que las posibilidades son muchas. Escribiré sobre alguna de las cosas con las que me voy peleando, por si alguien se encuentra alguna vez en situaciones parecidas. Read the full text...

Whole-Play update

Not a very good week this time. I got stuck on some stupid configuration issues (I won't detail them because they are stupid). So not much progress in the end. The drumGenerator2 has improved a bit anyway, that's what counts.

Additional content and navigation


Main navigation menu