skip to content
February 10, 2010

A handy feature of javascript is being able to tell the browser to go to a new URL. There are a few ways to do this, you might be inclined to write:

window.location='http://www.example.com';

But that doesn't seem to work for IE, rather IE gives me a blank page and inserts the value that I tried to assign to window.location. Here is the compliant way:

window.location.replace('http://www.example.com');

Also convenient is the ability to use relative URLs and hashes. If you are on www.example.com/contact and you try this:

window.location.replace('/about');

You will be taken to www.example.com/about

If you are on www.example.com/ajaxapp#1 and you try

window.location.replace('/ajaxapp#2');

You won't get a complete page reload, instead the browser will update the URL hash from 1 to 2. Nice!

I tested all of the above IE6, IE7, IE8, Firefox 3, Chrome, and Safari 4. Please comment if you have problems.

January 8, 2010

Today's situation: how to upgrade an SVN-managed Drupal installation. My current Drupal core is 6.14 and I need to get to 6.15

My svn path looks like this:

https://mysvnserver/svn/thesite/trunk

All my active development is occurring in trunk. How do I easily merge in the 6.15 changes? It turns out that I could have been better prepared for this situation by implementing the "vendor branches" approach. This method is described in the SVN book:

http://svnbook.red-bean.com/nightly/en/svn.advanced.vendorbr.html

Here is a Drupal-specific discussion about implementing the vendor branches approach for a Drupal site:

http://www.davidgrant.ca/maintaining_vendor_sources_with_subversion

This is nice because it allows you to merge the new Drupal files using the branch merging features of SVN. Since I was not prepared for this situation by having the Drupal core in its own branch, I have some manual work ahead of me. I used this as a guide:

http://thedrupalblog.com/upgrading-subversion-integrated-drupal-site-part-2

The idea outlined by Eric is to diff your current and destination Drupal core. If there are only file modifications you can just copy those files on top of your SVN trunk and then commit the changes. If there are added/removed directories or deleted files in the destination version, it gets tricker and you will have to make those changes by hand. For point-releases (security upgrades) this usually isn't the case.

One thing Eric does not cover is the process of copying the destination files on top of your SVN trunk. An easy way to do that is to use the find command and pipe its output to xargs for the sake of running cp:

robert@host /tmp/drupal/drupal-6.15 $ find * -type f | \
 xargs -I {} cp {} /var/www/localhost/htdocs/thesite/{}

For some reason that did not copy the .htaccess file, I'm not sure why.

November 11, 2009

Having been in Canada for over a year now, I have run into several instances where I am not allowed to view certain content on the internet because it is not licensed for my "region". The content provider is able to do this by looking at where your IP address is geo located. You can see a demo of this by visiting www.ip2location.com, it will show you where your public IP address is geo-located.

This post on the SF-LUG mailing list describes how to create a local socket which will tunnel through another machine, allowing you to proxy your web traffic:

http://linuxmafia.com/pipermail/sf-lug/2009q3/006990.html

I'd bookmarked this a while ago but thanks to aruthur i actually remembered this today.

And it works like a charm! I can now use Pandora again. See my wiki for a configuration reference:

http://www.robertjd.com/wiki/index.php?title=SSH_Tunneling

June 10, 2009

Everyone seems to be selling "digital voice" products these days. Which is just an elaborate way of saying VOIP.

I have owned a phone number through Gizmo5 for some time. The number is a 415 area code, San Francisco, and anyone can call it just like any other number for SF. The cool thing about it is that the incoming call can be directed many places.

For a year I accepted the calls on their software client on my computer. The call quality was always pretty poor, and I was becoming skeptical of the service. But then I decided to try a hardware solution.

I purchased a D-Link DVG-2001s from eBay for $30. This is a VOIP terminal adapter which can register with your VOIP service, brining the call to the box and the land-line phone that you plug into it. D-Link considers this a discontinued product, so here is an AU page with technical info:

http://www.dlink.com.au/Products.aspx?Sec=1&Sub1=16&Sub2=34&PID=190

Using this box I now have my 415 number coming into a typical cordless phone. The sound quality is amazing, it would seem that the poor quality is limited to their software client. It was a refreshing experience to hit "talk" on the cordless phone, hear a dialtone and call someone.

May 21, 2009

While doing a MySQL setup the other day, it came time to set the root password, which you usually do with this command:

$ /usr/bin/mysqladmin -u root password 'new-password'

This is not the best command, because it saves a root password in plain text in your shell command history. It is advisable to use mysql_secure_installation instead, which will allow you to enter your password without having it appear in your command history.

Also note that the mysql CLI creates its own command history in ~/.mysql_history, which will also have a record of any passwords you have entered as plain-text while using the mysql CLI. There are many other interactive programs which save similar command histories, it is advisable to be aware of where anything typed in plain-text is being stored.

Be safe, don't leave passwords lying about in plain sight (or plain text).

May 20, 2009

I noticed today that the option:

"Visitors can create accounts and no administrator approval is required."

Was enabled on my site. I am having a hard time determining if this really is the default setting or if some other module has intervened.

Regardless, this is no good because it is a great way to get comment spam.

April 29, 2009

After much time with an HTML-only website, I've gone the Drupal route.

I resisted Drupal for a long time, on the basis that it is written in PHP. Sure PHP is great if you want to be able to say that $cat is an array, and then a string, and then an array again. But for most purposes I really don't like PHP.

That said, what you can do with Drupal is pretty amazing. Thus, I am diving in and learning how to develop for it.

What strikes me about it is how many people use it. This is your typical public code repository type of open-source project. Which is nothing new, but that fact that so many non-developers are becoming part of such a development structure is interesting.

Powered by Drupal. CrystalX theme created by Nuvio | Webdesign. Modified to my liking.