Skip navigation

Category Archives: Web Development

App Engine StringListProperty and merge join queries offer the ability to perform searches for a variety of purposes.

Read More »

Finally, a simple explanation of @staticmethod vs @classmethod.

Read More »

Want to Grep through the files of a directory and sub directories recursively?

Read More »

How to redirect a form in drupal 6.

Read More »

This is the best Drupal blog tips I’ve ever seen. It’s got simple to understand Drupal Developer tips which are presented in an easy to read manner.

Read More »

Want to add all new SVN files recursively?

Read More »

If you’re having issues with search engine friendly URL’s in K2 you can use the Artio JoomSef component with the Artio JoomSef k2 extension. Read More »

Drupal 6 node.save uses different methods for saving taxonomy for different taxonomy types.

For multiple select based taxonomy:

(php)

$nodeObj->taxonomy = array(2=>array(15,19));

(python)

nodeOb['taxonomy']['2'] = [15,19]

For tags based taxonomy:

(php)

$nodeObj->taxonomy = array(
  'tags' => array(
         2=>'military,navy'
   )
);

There is an issue with Drupal 6 menu router rebuild which causes Drupal to time out with 404 pages or internal 500.

The following fix worked for me:

Install Drupal Tweaks, increase php memory, and mysql recommendations etc

http://drupal.org/project/drupal_tweaks

Download the following patches:

http://drupal.org/node/251792#comment-1831346


http://drupal.org/node/317775#comment-1491208

From command line copy patches to your root drupal directory.

cd to your root drupal directory and then apply the patches. Each time you will be asked where the file is for the patch and the actual path to the files to be patched will be provided in the command line. Just copy and paste each file path as presented into the prompt.


cp *.patch /home/drupal_directory/
cd /home/drupal_directory/
patch < no-router-blob-317775-56-D6.patch
patch < lock-251792-163-D6.patch

|--- includes/bootstrap.inc (revision 7577)
|+++ includes/bootstrap.inc (working copy)
--------------------------
File to patch: includes/bootstrap.inc

So in the above text you can see it gives you the path ‘includes/bootstrap.inc’. Just copy and paste that to where it says ‘File to patch:’. For each file it will provide you the correct path to the file assuming you are in the drupal root directory.

The final thing to do is to cp the lock.inc file which is created to includes/

Thematic is a pretty cool theme development framework for WordPress although I believe it can be improved.

Read More »

First install imagemagick.

sudo apt-get install imagemagick

Then cd to your folder with your jpg images and type the following:

mogrify -quality 75 *jpg

Image optimization quality is defined by the number after -quality. In this example 75%.

The fundamental blog layout can be pretty crap for converting visitors unless you have exceptional content that can’t be found anywhere else.

The ‘above the fold’ (top of the page before scrolling) area on most blogs is usually taken up by one story and a bunch of basic links in a sidebar. Layouts like Smh homepage are optimized to get a user to click on an article with a selection of images associated with articles.

Hot images can really help increase ctr. The band of images near the bottom of the fold on the shm is a proven converter.

Read More »

If you’re moving or copying MySQL Binary files be sure to do the following:

Read More »

Here’s an explanation of a desktop setup for Ubuntu Intrepid Ibex.

Read More »

Multi form “http post” with python.

Read More »

The geniuses over at Dreamhost decided to upgrade their Rails without telling anyone and without providing instructions on how to upgrade older apps meaning hundreds of websites crashing and not working for days.
Read More »

Joomla 1.5 has an interesting quirk with Placehere Content Item Module.

Read More »

Drupal does not show the correct $node->path when a user is not authenticated in some drupal pages.

Read More »

Recurring subscription payments in Ubercart are covered by this module.

Read More »

Some nice candidates for Serif siFR Flash Fonts are:

  • Serif Bold (Standard Gimp Linux)
  • Utopia
  • DejaVu Serif Bold
  • Courier 10 Pitch Bold

A nice san-serif font Nimbus Sans L Bold Font.  Be good to use with siFR Flash Fonts.

Want to bulk delete .svn folders recursively?

Warning: Before you use this command make sure you have changed to the correct directory where you want to apply this. example:

cd /mysvn/path/iwant/to/delete/svn/folders

find -name "\.svn" -exec rm -rf {} \;

If you want to set a limit when you iterate a list in python slice it up by doing this:


for i in list[0:6]:
print i

This will list the first 5 items.

You can’t use ‘tidy’ python binding with App Engine as far as I know so use this for cleaning up your xml and html characters:


import cgi
string = str('I hate monkey & hyena characters')
cgi.escape(string)

Should print out:

I hate monkey &amp; hyena characters

If you want to change the content type or mime type for your Google App Engine template:


self.response.headers['Content-Type'] = "application/xml"

Full example:


class MainPage(webapp.RequestHandler):
def get(self):
greetings_query = databasemodel.all()

template_values = {
'greetings': greetings_query
}
self.response.headers['Content-Type'] = "application/xml"
path = os.path.join(os.path.dirname(__file__), 'templates/index.xml')
self.response.out.write(template.render(path, template_values))