Wednesday, 30 December 2009

Python: Determine location of Site-Packages / Dist-Packages

Nice tip from the Django tutorial page.

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

Wednesday, 23 December 2009

Show only directories in bash using ls

In Windows you can just go "dir /ad" on Linux its not so obvious:

ls -d */

Monday, 21 December 2009

Elements of a web-store

I want to build on existing solutions as much as possible, but remain flexible.

  • Static info.
  • Navigation / Categories.
  • Product Presentation.
  • Visitor tracking, analytics, landing pages.
  • Shopping Cart.
  • Customer login / registration.
  • Checkout / payment processing.
  • Dispatch workflow.
  • Customer / marketing database.

Friday, 18 December 2009

Google Chrome Keyboard Shortcuts

With the Linux and Mac versions, Google Chrome is becoming pretty ubiquitous as a browser.

[CTRL-T]  = new tab
[CTRL-PGUP/DOWN] = move between tabs
[CTRL-W]  = close tab
[CTRL-E] = perform search


mkdir BitchX
cd BitchX
tar xvf BitchX*.tar.gz

Thursday, 17 December 2009

Useful Cisco Commands

show ip traffic
show tcp
show ip dhcp bindings
show interface atm 0
show interface dot11

New 'Rapid-Carbon' Web Application

An e-commerce web application providing the following functional requirements:
  • Database of customers.
  • Database of products.
  • Amazon / other e-payment integration.
  • Wiki pages for manuals etc.
  • Internationalisation.
  • Views edited by someone else.
  • Easy / Quick to deploy.
  • Move between hosts.
  • Backup.
  • Quick to develop.

Wednesday, 9 December 2009

Repeated Sharepoint Credentials Box when opening Office Doc in IE on Windows 7.

We have a Sharepoint server at work used to share documents via WebDav. It is authenticated via the Active Directory, using the current logged on user credentials. It has always been the case, on IE on XP that you needed to carry out the following steps to access files without seeing an annoying credentials box:

1. Add the Sharepoint host to Trusted Sites in IE.
2.a.  From the security tab, select "custom level" for Trusted Sites.
2.b.  Scroll to bottom of options and select "Automatic Logon with current username and password".

However since moving to W7, this continues to work but I keep getting prompted for my credentials after opening an Office Document. This is annoying as repeatedly typing the correct password has no effect, and only by clicking "cancel" does the document download.

Seem this is a bug, due to the fact that:

1. We don't have a proxy, i.e. MS ISA Server.
2. We are using a fully qualified domain name.

Don't think I understand how MS missed this state of affairs as valid use case / test case, but anyhow.

There is hotfix for Vista to fix this, however the patch does not work on Window 7. However following the manual steps in the article below fixed the problem and worked for me (editing the registry):

Saturday, 5 December 2009

Linux on the Desktop : Ubuntu Karmic

Linux is the server operating system, but honestly I wouldn't consider it on the desktop - except for development. I've installed Ubuntu Karmic on my Thinkpad X60s as a dual boot with XP for one reason - as a platform for developing an Django application. The deployment issues I had with my last application, a Rails project, developing on XP then migrating to Linux (especially with Imaging libraries) was unreal - so I'd prefer to develop on the same platform the application will run in production.

My first instinct was to run CENTOS, the same platform as my host, however I stumbled across the ChromiumOS build page and it was clear Google developers were using Ubuntu Karmic, so I thought, if its good enough for them, I'll try it. Honestly I'm very impressed, it was actually a slick experience. I run Windows 7 on my desktop at work and on my Media PC, and the experience isn't better (and of course the compatibility isn't there on Ubuntu, however for developing a Django web app, in Vi and using all the nice Python deployment tools Ubuntu is ideal.

Basic stuff, but this article helped me get the default GUI how I wanted it:

Thursday, 12 November 2009

Google Wave First Impression

I have blagged a Google Wave account. Yet to understand it fully.

The first impression, running it in Chrome, is that it looks more like an actual application than a web application. More like a real app than any Web App I've seen so far...

UPDATE: A week later, its like a waste land. Obviously not enough friends on the Platform to make use of it yet.

UPDATE2: People have started asking me for invites. Now some people from work have it, there may be some scope to use it properly.

UPDATE3: Trying to use it at work for some development of ideas exchanges. Will have to see how far we get.

Tuesday, 3 November 2009

How to Tar and Gzip a folder via Bash

tar -cvzpf archivefile.tar.gz folder

Keyboard shortcuts in BASH on RHEL / Centos

  • Ctrl + R - Let’s you search through previously used commands
  • Ctrl + K - Clear the line after the cursor
  • Tab - Auto-complete files and folder names

Restarting Apache in CENTOS / RHEL

/sbin/service httpd restart

May work without the /sbin/ depending on the path.

Monday, 2 November 2009

Automated Rails Website Clone / Mirror with WGet and FTP script.

As a bit of paid work outside of my day job I wrote a css layout for someone's business website. It was just a product presentation site. Eventually I was being asked to update it all the time so I wrote a rails app to allow stuff to be added by the customer in a 'wiki' style manner: [].

At first I had this served from my host, but it was a bit slow and occasionally my host had issues. So I've moved the rails app onto another domain, and each week I'm looking to configure a copy process to mirror the rails site, then FTP it up to my customer's own public host.
Clone locally
First step is to clone the site generated from the rails app into a static folder on my host, which is running CENTOS. I did this using wget:
  • [root@host ~]# wget --mirror -w 2 -p --convert-links -P foldertocopy2 http://rooturltomirror/
Annoyingly, the site came out unviewable: the HTML was OK, but the link to the CSS and the images were all broken. This was due to a random number appended to each CSS and Image URL such as ?323124124. These were generated using the Rails Asset Tag helper:
Given the scale of this site, there is no benefit to leaving the asset timestamps feature switched on, so I turned it off as follows ... in /config/environment.rb add:
Finally, I was missing files which were linked to via the CSS file, i.e. via @import url("importthis.css"); or images which are only referenced by the css file. Given these files are not subject to change, I'm going to overwrite them from a static folder when I upload to the public host- I can use the same mechanism to blank out the forms (which won't work on a static host).
FTP to the public domain.
I just tried to use the ftp client built into CENTOS for this, and echo the commands into it via the EOF mechanism in a shell script, per:

However, using the standard ftp command you can't recurse through directories. I.e. you can copy all files in a directory, but not descend into sub directories. First I looked at a scripted option such as: . This approach made me nervous so I upgraded to lftp on my host ... [yum install lftp], and found I could upload the site as follows (with the command 'mirror -R'):
  • [root@host ~]# lftp public-host-ftp-server -u ftpusername, ftppassword -e "mirror -R /local/source /remote/destination"

Sunday, 1 November 2009

Django Shopping Kart - Satchmo or Django-Kart?

Python Coding Standards & Resources

Templates Etc.:

Online Payment Systems

Online stores are public Internet web applications. They allow people to find information about a set of products, and order them for delivery. Checkout and payments is a pretty standard use case regardless of the product, and there are all kinds of nasty security issues which could be got wrong. These two points alone justify using a third party, 'hosted' checkout service rather than growing your own, especially for a smallish site.

This blog article makes another point, in relation to Amazon's experience in the early days of web shopping in the nineties:
observation at the time was that many customers repeatedly pay with same payment method and the same ship-to address. By keeping them on file, and establishing clear defaults, Amazon could shorten the purchase process

Kind of obvious, but it relies on a network effect, or economy of scale- in that you are using the same platform across many different product purchases. Again, for a small site this is another reason to use a third party payment platform.

I will take a look at the options as per today, with the following requirements, which are appropriate for the kinds of thing I am trying to do:
  • Limited in scope - i.e. I want a framework which can assist with checkout and payments, not a full stack e-commerce solution.
  • Adoption - i.e. how much can we benefit from the network effect - i.e. how many people already are subscribed to the platform.
  • Simplicity - of API and to signup.
  • Cost.
Google Checkout

Amazon Payments


:post in progress:

Wednesday, 28 October 2009

VMware vSphere Client on Windows 7

Frustratingly there is an issue here. After installing the client, and trying to connect, this message is shown:
“Error parsing the server “server name” “clients.xml” file.”

The above blog post worked for me. Irritated I had to though.

Monday, 26 October 2009

Active Directory for Windows 7

The remote management tools, what in XP was the Administrative Tools Pack, i.e. the AD Users and Group manager, DHCP, DNS, etc ... are available for Windows 7 but its a bit more tricky.

1. Download from here:

2. Install as normal.

3. Go Start > Control Panel > Programs and Features > Turn Windows Features on or Off

4. Go to "Remote Administration Tools" and turn on any features you need.

5. Start the appropriate snap-ins from Start > Administrative Tools

Rotating Flikr Wallpaper and Screensaver with Windows 7

This isn't very enterprise IT, but its a neat way of varying my desktop wallpaper and screensaver dynamically with Windows 7.

  1. Setup or use current Flikr account to upload pictures to.
  2. Via account section, create a free API key:
  3. Download Slikr Screensaver:
  4. On the 64 bit version of Windows 7 I had to uncheck "Open GL Check" within Slikr properties (via screensaver properties).
  5. Then put the API key into Slikr and sync it up with your user account.
  6. Then as a wallpapers, select %userprofile%\pictures\slikr\user\youruser
The upshot is any pictures you add to your Flikr will automatically join the group of pictures on your screensaver, and by extension your wallpapers.

If you access privileged data or systems from the user account you set this up on, check "On resume, prompt for login".

Migrating / Move Lotus Notes from one PC to another.

First a digression: Notes is the singularly worst piece of widely adopted enterprise software I know of.

The key is the data folder. Each user has a Notes Data folder which contains their settings. On the old PC, which was XP and had migrated from 6.5 -> 7 -> 8 -> 8.5 this was at:

c:\program files\notes\lotus\data.

I installed Notes 8.5 on the new machine and copied the data to:


Selecting to overwrite or replace all conflicts. I then started Notes, cancelled a few meaningless wizards and messages (one about "Internet Mail", one about "IM" and a "Cannot create folder").

However after 15 mins of Notes "churning", I can see my inbox, and I'm migrated.

Saturday, 24 October 2009

Run CENTOS VM in background on Windows for Free with VMware

A developer at work wanted to do this and here are the pointers I gave him.
  1. Download VMware Server for free from VMware. []
  2. Download the ISO for CENTOS and put it in your "C:\Virtual Machines" folder, then mount it from within VMware from the "Datastore". [I get them from]
  3. Make sure the Intel VM Extensions are enabled in your BIOS if you have them.
  4. Install CENTOS on VM as you would for a Physical PC.
  5. Setup SSH and SCP and then interact with your box via PuTTY, WinSCP and HTTP.
He seemed pretty pleased with the outcome.

Disable Driver Signature Enforcement - Cisco PI21AG

I've got a Cisco PI21AG WiFi PCI NIC card for my media box PC. Cisco don't supply a driver for the 64bit Windows 7 in the final release version. However there was a Microsoft driver in the W7 beta which worked perfectly (but taken out in RC and RTM versions of W7). After installing the release version of W7-64 I just installed the driver that had come with the Beta.

Problem is the "driver signature enforcement" is invalid so the driver won't load. Although this can be disabled by pressing F8 each time the PC boots and selecting the "disable enforcement" option, this is tedious so I Googled and tried this:
  1. Run command prompt as administrator.
  2. bcdedit -set loadoptions DDISABLE_INTEGRITY_CHECKS
This did NOT WORK. Apparently it does work on some versions of Vista, but who cares Vista is a waste of time.

Seemed dodgy, but I then tried this:

Basically its a case of switching the OS to a driver developer "test mode" and then applying a sort of "self signing" to the driver in question. So by going into Device Manager and selecting the device, properties, driver tab, driver details - I can see it is athrx.sys which is not signed.

So using the app I applied both these steps and rebooted. Worked great - No more F8 and I can keep using my expensive bulletproof Cisco Wifi NIC on the Media Box PC.

Wednesday, 21 October 2009

Search and Replace in Vim


Splunk 4.0 out the box cleanup.

  • Download
  • Install
  • Disable all apps [except search :P ]
  • set in default_namespace = search

    in $SPLUNK_HOME/etc/apps/user-prefs/local/user-prefs.conf

Square one.

Monday, 19 October 2009

Cisco 877W Factory Reset Password Recovery

Bought a Cisco 877W off eBay, as a reliable router / access point for home. It came configured as a "The Cloud" free WiFi Hotspot.

If you need to do a "factory reset" on one of these you can.
  1. Connect to the console using serial cable.
  2. Switch on while hitting [FN-CTRL-BREAK]- (I have a Thinkpad, [FN] not needed on a desktop keyboard). Tricky, may take a few attempts - need to be hitting it really early on in the boot process.
  3. Get rommon> prompt. []
  4. >confreg, >yes, >no to everything except "ignore system config info".
  5. >reset
It will then reboot from an alternate configuration file, and you're in! Now however, to clear the existing setup and revert the router to a good state.
  1. Router>enable
  2. Router#conf t
  3. Router(config)config-register 0x2102
  4. Router(config)exit
  5. Router>write memory
  6. Router>reload
Useful guide:

Saturday, 17 October 2009

Useful Windows freeware utilities

In my optimistic migration to Windows 7, I am reloading my laptop from scratch. Here is a list of useful free utilities I installed.

* Notepad++
* gVim
* Paint.NET
* 7-Zip
* Stickies
* ProcExp (minimized on startup)
* KillNotes / KillDomino
* MagicISO
* Putty
* imgBurn

Friday, 16 October 2009

Windows 7 Application Settings Access Denied

Microsoft have moved some standard system folders round in Windows 7. "To keep us on our toes" :P

'Documents and Settings' has become 'Users' and 'Application Data' has become 'Appdata', among others.

For backward compatibility they have symbolic links setup. Being Microsoft they need to pretend they invented them (1983) and called them "Junctions". I'm sure there is some subtlety.

In any case if you try and hit them in Explorer you get "Access Denied". Microsoft excel at meaningful messages. I would expect hitting this folder in Explorer is pretty common as Application Data is a hidden folder in XP.

So, if you are like me looking for:

%USERDATA%\Application Data\Folder\

You need:


No idea why the Roaming is necessary. However this does the trick. On 32 bit.