Friday, November 27, 2009

Joomla: Redirect to same page after login

Here's some code to redirect Joomla to the page you want, after forcing a user to login first.

$uri =& JFactory::getURI();
$redirect = '&return='.base64_encode($uri->toString());
"Please login.");

Wednesday, November 25, 2009

A TAB is 4 Spaces

A TAB is 4 Spaces.

In .vimrc or _vimrc add these lines:

set autoindent
set smartindent
set tabstop=4 shiftwidth=4
set expandtab

Tuesday, November 10, 2009

Mac Quirks: Multiple From Emails with Apple Mail

Thanks to Michael Voong for this tip. There is bare minimal documentation from Apple on how to add multiple email addresses to a single account in their email program.

The solution, edit your email account settings using a comma separated list for all the email addresses or email aliases you want to be able to use in Apple Mail.

Wednesday, October 14, 2009

Recursively Remove .svn directories on Linux

To recursively remove .svn directories on Linux:

rm -rf `find . -type d -name .svn`

Wednesday, August 26, 2009

Python 2.6, py2exe, and VC++ Runtime Issues

I got this annoying error the other day, while freezing a python 2.6 executable on Windows:

py2exe msvcp90.dll no such file or directory


Python 2.6 uses Visual Studio 2008, and so it requires the Visual Studio 2008 C++ Runtime (vcredist).

I saw a few posts on the web, here and here. They get the solution partially right.

The Correct way to fix py2exe msvcp90.dll no such file or directory.

In your file first exclude the dll so you can build the exe.

options = {
"py2exe": {
"compressed": 1,
"optimize": 2,
"bundle_files": 2,
"dll_excludes": [

Then add this to your manifest file in between the tags:

<assemblyidentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorarchitecture="x86" publickeytoken="1fc8b3b9a1e18e3b"></assemblyidentity>

This allows you to use the vcredist to install the required vc++ dlls on the target system.

Monday, August 24, 2009

Annoing Windows XP issue : _except_handler4_common could not be located

Thanks to Dev Adventures for this one.

I had one of the most annoining Windows XP issue. It happened while building a py2exe project on Windows Vista, and installing it on Windows XP.

The issue, a most cryptic error message:

"The procedure entry point _except_handler4_common could not be located in the dynamic link library msvcrt.dll"

The solution:

Remove the mswsock.dll from the distribution.

Wednesday, August 05, 2009

Visual Studio 2008 UAC Issue

Thanks Jim!

Visual Studio 2008 UAC Problem

I had a Visual Studio 2005 project with a manifest that set requireAdministrator. When ported to Visual Studoi 2008 I got this error: manifest authoring error c1010001: Values of attribute "level" not equal in different manifest snippets.


Remove the explicit manifest file and set the UAC.

1. Remove the explicit manifest file "Configuration Properties > Manifest Tool > Input and Output" remove the "Additional Manifest Files" value

2 Go to "Configuration Properties > Linker > Manifest File" and change the UAC Execution Level

Tuesday, May 26, 2009

SVN Ignore

CVS allows you to place a .cvsignore file in your path to ignore files you don't want in CVS. Subversion (SVN) has a similar feature, though a little bit different implementation. To ignore a file in SVN:

svn propedit svn:ignore ./some_path

Thursday, April 30, 2009

Free Wordpress Tutorials

Some Free Wordpress Tutorials covering the basics of:
  • Logging into Wordpress
  • Creating/Editing Posts in Wordpress
  • Creating/Editing Pages in Wordpress
  • Using the NGEN Gallery in Wordpress

Tuesday, March 03, 2009

Ubuntu Mouse Scroll and Vmware

Edit the xorg.conf file to :

Section "InputDevice"
Identifier "Configured Mouse"
Driver "vmmouse"
Option "CorePointer"
Option "Device" "/dev/input/mice"
Option "Protocol" "ImPS/2"
Option "Buttons" "5"
Option "ZAxisMapping" "4 5"

and the mouse scroll starts to work.

Friday, February 13, 2009

Flash Slideshow: ActionScript to Load an XML File

I've seen a few various ways to load an xml file with flash. Each of them suffer from the same problem. They are hard coded for a specific file, and riddled with magic numbers to access xml node data.

Here's some actionscript to load an XML in Flash. Great for loading say a Flash Slideshow from XML.

var slideshow_images:Array;

var data_xml:XML = new XML();
data_xml.ignoreWhite = true;
data_xml.onLoad = function(loaded) {
if (loaded) {
slideshow_images = load_images(data_xml);

//TODO: do something with the images

delete data_xml;


function load_images(images_xml) {
var images:Array = new Array();
var cur_image_xml = images_xml.firstChild.firstChild;
while (cur_image_xml != null) {
cur_image_xml = cur_image_xml.nextSibling;
return images;

function get_image_data(image_xml) {
var image = new Object();
var image_prop_iter = image_xml.firstChild;
while (image_prop_iter != null) {
image[image_prop_iter.nodeName] = image_prop_iter.firstChild.nodeValue;
image_prop_iter = image_prop_iter.nextSibling;
return image;

Saturday, January 10, 2009

Cross Browser CSS Opacity

Here's a simple CSS Tip from

If you want your transparency to translate to all browsers, then make sure to use all four of the elements shown below.

.class {
opacity: 0.7;

The first is CSS Standard and will work in all standards compliant browsers, the second is for Internet Explorer, the third for older Mozilla browsers and the last for older Safari browsers.