Blog

Today I was trying to figure out why in the name of all that good in the world why I couldn't use $_SESSION in my form's _submit handler.

As it turns out, I actually CAN put stuff into $_SESSION, it's just that when you want to pull something OUT of $_SESSION later, that's not where it is.

Instead, it's on the $user object in Drupal, in $user->session. After some studying, it seems this is a pipe-delimited and semi-colon delimited list of variable names and their serialized values.

Here's a function to pull stuff off of $user->session:

Chris

I recently needed to redirect a client's traffic from their old URL to a new one. In this case, they wanted any traffic going to plain example1.com to go to example2.com/blog and all other traffic to go to example2.com/[equivalent URI] (e.g., example1.com/about --> example2.com/about).

To do this, I messed around with rewrite rules and conditions for a while, until I decided on what seems to be a fairly straight forward solution:

Patrick

MySQL and PostgreSQL's MD5() functions are nice, simple, ways to hash your data. Unfortunately, SQL Server 2005 and up (sorry, in order to get it working in SQL Server 2000, you'll need to try a stored proceedure), you can use the HASHBYTES() function.

In a recent SQL Server port of the Actions module for Drupal 5, I ran into the following MySQL query:

SELECT aid FROM {actions} WHERE MD5(aid) = '%s'

Patrick

If you get the following error

svn: This client is too old to work with working copy '.';
please get a newer Subversion client

... or you just want to update your subversion client (command line), try the following:

Patrick

A typical install of OS X won't create a .bash_profile for you. When you want to run functions from your command line, this is a must-have.

  1. Start up Terminal
  2. Type "cd ~/" to go to your home folder
  3. Type "touch .bash_profile" to create your new file.
  4. Edit .bash_profile with your favorite editor (or you can just type "open -e .bash_profile" to open it in TextEdit.
  5. Type ". .bash_profile" to reload .bash_profile and update any functions you add.
Patrick