replace

×

Error message

Warning: apc_store(): Potential cache slam averted for key 'www.hashbangcode.com::cache_bootstrap::variables' in DrupalAPCCache->set() (line 206 of /var/www/www.hashbangcode.com/2014-03-22-2105/docroot/sites/all/modules/contrib/apc/drupal_apc_cache.inc).
replace

Count Number Of Characters In A String With MySQL

Thursday, September 30, 2010 - 18:00

Today I needed to grab some data from a table where there was more than one occurrence of a string within another string. Basically, I needed to find all URL's from a table that were more than 3 levels deep (i.e. with 3 slashes), but realised there wasn't a function to do this in MySQL. I found an alternative method, but it got me thinking on how that might be possible.

Category: 

JavaScript Redirects

Wednesday, March 11, 2009 - 11:07

There are two main ways in which to redirect the browser using JavaScript, both of which look at the location of the window object. These are the location.href property and location.replace function.

location.href

The following example will cause the page to redirect to another page, keeping the browser history. This might seem like a minor point, but if you redirect a user to another page they will be able to click back, which will mean that they are redirected again.

Category: 

Wordpress Post Friendly Code With JavaScript Replace

Thursday, February 12, 2009 - 12:03

I recently talked about adding code to blogs and comments to Wordpress and making sure that certain characters are encoded properly. So to simplify things I thought I would create a little set of regular expressions that takes a sample of code and convert it into a Wordress friendly format. It consists of the following function, which takes the value of a text area called tochange and runs some regular expression replace functions on it.

Category: 

Find And Replace On All Files In And Below A Directory

Thursday, October 9, 2008 - 12:03

The following shell command uses the find function to find all files in or below the current directory that have the extension php. It then passes each file found onto a sed command which then replaces all <? with the longer &lt?php version.

Category: