UPS is a Joke, use anyone else

August 17th, 2012 by admin

Wanted to buy this USB external screen. Although its from Taiwan, the only distributor is in the USA. Its also listed on Amazon Japan, but they would not ship to Canada. Furthermore the US distributor would not ship outside the US. Fine, I’ll try, nope, the seller requires the shipping address to match my card. But I’m overseas travelling. Okay, I’ll call a friend in the US and get them to buy it on their card. Great. He bought it a gift for me. It arrived at his place, and we decide to ship it with UPS to Ottawa, from Michigan. So my $165 item will be $265 due to the UPS, Customs and Taxes, according to some online calculators. Lets go ahead anyway.

Lachine, QC, Canada 08/15/2012 11:31 Shipment pending release from clearance agency
08/15/2012 9:53 Package data processed by brokerage Waiting for clearance / Expired-unable to resolve exception
Lachine, QC, Canada 08/14/2012 17:12 Import Scan
08/14/2012 15:48 Arrival Scan
08/14/2012 11:52 Shipment pending release from clearance agency
Plattsburgh, NY, United States 08/14/2012 8:44 Arrival Scan
East Syracuse, NY, United States 08/14/2012 3:47 Departure Scan
08/14/2012 1:48 Arrival Scan
Buffalo, NY, United States 08/13/2012 22:59 Departure Scan
Lachine, QC, Canada 08/11/2012 0:09 Package data processed by brokerage Waiting for clearance
Madison Heights, MI, United States 08/10/2012 18:15 Pickup Scan
United States 08/10/2012 18:32 Order Processed: Ready for UPS

So the sender starts getting cryptic emails saying the package is in exception mode. Three calls to US UPS, saying everything is fine. 8 x Automated emails saying my package is in EXCEPTION mode. With cryptic wording saying  “if this isn’t resolved then call with your (REALLY LONG) tracking number which you must say over and over as you get transfered from department. Which I did 6 times in total, perhaps read my tracking number 12 times.

Okay after 2 hours on the phone and a 5 day delay, I find out they need proof of purchase for a gift, gifts don’t get charged customs or duty anyway – so why does it matter how much it cost? Why doesn’t this show in the logs? Why didn’t anyone call me after I logged my phone number in the system and was told I’d receive a call back within 1 hour. The sender did list it as $25, and it did cost $165 so fair call. But why didn’t anyone ask for the documentation.

So, I call UPS a few more times, eventually I escalate the situation to a ‘supervisor’ who can’t confirm she is in fact a supervisor. Anyway, she was the most helpful person I’ve talked to so far. She at least she listened to my sob story, and gave me an email address (o – did I mention that the fax number I was given, was never answered, making it pretty much impossible to send the documents they require). So I’m going to send the email now, and a fax too with the proof of purchase.

If anyone is interested the fax number that didn’t work was, 18009727676 (no record on google), then I was given 15064473612 (which I will try now), and the helpful “supervisor”, Cindy, gave me the email

Watch this space. I’ll be amazed if this is the end of it.


USB External Laptop monitors

April 26th, 2012 by admin


Lenovo ThinkVision LT1421 – USB LCD Monitor


GeChic OnLap 1301 USB monitor review: dual monitor for your laptop


AOC e1649Fwu Portable USB Monitor: A good match for your MacBook


22″ – E2251FWU – 1920 x 1080 resolution @60 Hz.


Lesscss, Bootstrap, Django workflow and setup from Development to Production

March 15th, 2012 by admin


So we’re now using twitters Bootstrap with Django and making awesome customisations, overriding less css in the core of bootstrap. This is our workflow from design, to production

In design

We just include node.js, and all the bootstrap files. This means the designer doesn’t need a django environment setup. All the less files are compiled client side. At the moment we have one less file that overrides, default bootstrap ones, however in future we will be breaking this into multiple files for maintainability.

In development (ubuntu 10.10)


Neat django template from the talented Julia Elman setup making use of django-compressor

Installing node.js

Based on experienced from information found here

So you can install node.js from an offical ubuntu repository, however ‘nodejs -v’ shows its only version 0.1.97 (which since is an odd number, may also be unstable – not sure). Anyway, this is too out of date for my liking as:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
nodejs -v
You could also do it from source as described here

This is all great, but this doesn’t worth with less. According to this I need version v0.6.6. This means compiling from source.

cd ~
mkdir nodejs
cd nodejs
git clone git://
cd node
git checkout v0.6.6
sudo make install
Installing npm (this section is no longer required see update #2)

Great we have nodejs installed… lets install the node package manager.

curl | sudo sh

Secuirty note: I think this is a bad way to install a package, Especially if you put sudo’ in front of that command like some suggest. Not sure about using curl to run a script from the internet. But this is a commonly the recommended appoach, so I’m going with it for now.

Update: you’re actually better of troble shooting on the NPM site. This is what worked for me.

sudo chown -R $USER /usr/local

Update 2: Note that npm is installed with nodejs since version 0.6. That makes this step irrelevent.

Installing less

you can just install the via the commands (from SO answer here)

sudo apt-get install rubygems1.8 ruby1.8-dev
sudo gem install rubygems-update
sudo gem update rubygems
sudo gem install less

but i decided to follow the offical method which is much more unclear … and actually doesn’t work for me…

This is what does work:

cd ~
npm install less

Also you’ll need to symlink it

sudo ln -s /var/lib/gems/1.8/bin/lessc /usr/bin/
or add ruby gems dir to PATH variable:
export PATH=/var/lib/gems/1.8/bin:$PATH

Otherwise you may need to put the full path to the lessc in COMPRESS_PRECOMPILERS statement

Update: Actually you can just install less like this to make it available system wide

sudo npm install less -g

In produciton (ubuntu 11.04)

We use chef, and require node.js, npm, and lessc on the server so that css can be compiled just in time (and cached).

This scripts provides a neat way to add a unblessed nodejs community repo on github:


The secret juice (that no one tells you and is undocumented)

For a long time, many hours, too many hours, django-compressor would not process my less files (DEBUG=False). I thought it had something to do with the compiler and environment, but over time it became clear it did not. The problem is that none of the less files were getting output entries in the the html file. At 3am, after exausting all other options I started playing around wtih the ordering of the attributes in the

<link type="text/less" href="{% static "bootstrap/less/bootstrap.less" %}"  charset="utf-8" media="all" rel="stylesheet" >

Turns out that that it would only work with the type attribute first, and the rel=”stylesheet” statement. Not rel=”styleshee/[something]” and not if the href attribute was first. In my opinion this is an undocumented requirement or bug. Lesson, follow documentation to the letter… copy examples and change them… don’t assume ANYTHING.


[work in progres]

Still working on the chef deployment repo.


A hint at production lessc statement


Chef Cheatsheet

January 8th, 2012 by admin

Chef Opscode

Note: this is a work in progress. I usually keep these personal cheetsheets alongside version controlled source, but I’ll trial putting them online. Please let me know if you find this post helpful via a comment with a command of yours that makes life easier. Thanks.


# Install rubygems (useful for knife plugins)

gem install knife-ec2 knife-github-cookbooks


# Update roles from files.

knife role from file roles/base.json

knife role from file roles/*


# Update a codebook and its dependencies – see also

knife cookbook site install mysql


# Update a databag

knife data bag from file [bag-folder-name] my_app.json


# Install a cookbook from github. Note does not auto install dependencies.

knife cookbook github install Yipit/djangoquickstart-cookbook


# Update cookbooks to Ops code server

knife cookbook upload -a


# Create a cookbook

knife cookbook create


# Bootstrap a server with a role(s)

knife ec2 server create -G linux,gunicorn,web,haproxy -I ami-7000f019 -f m1.small \

-S keynamehere -i ~/.ec2/keynamehere.pem -x ubuntu \

-r ‘role[base],role[django_cms_database_master],role[django_cms],recipe[django_cms::db_bootstrap],role[django_cms_load_balancer]’


Deploying Django via Chef Opscode Resources

December 14th, 2011 by admin

Here are some resource I found useful in determining best practices for deploying Django with chef.


A python chef approach, with good background info:


I also found O’Reilly’s book Test-Driven Infrastructure with Chef good. Particulary the first half on configering chef.


UPDATE: I’ve decided to play around with Chef and am running through a couple of tutorials. Resources aren’t great and the docs instructions seem a bit out of sync with current code which is frustrating. I’ll try and document my findings here in the hope it helps someone, somewhere, somehow. Love to know if it does via a comment. Thanks.



Build a Django Stack

Error #1: “NoMethodError: undefined method `mysql_database’ for #<Chef::Recipe:0xb6c7bf94>”

I found this discussion:


The solution specifically was:

If your local Chef Repository is a Git version controlled repository, you should use `knife cookbook site

install` to retrieve new versions.


knife cookbook site install mysql

knife cookbook site install database


This will automatically integrate the cookbooks into your repository, creating branches and revision

tags as described here:

See the section “Tracking upstream changes.”


Error #2: Chef::Exceptions::ResourceNotFound: Cannot find a resource matching service[apache2] (did you define it first?)

Solution: This one just disapeared with a ssh to server just spawned, and a sudo chef-client. This is a good way to get further informatio about why recipies/rolls/run_lists fail to run as stack trace is dumped locally on the machine with a more meaningful output. Would be great if there was a way to get this from the Management workstation, or in the opscode management tool.

Error #3: Can’t connect to mySQL sever.

Solution: This was mostly my mistake for misconfigering security groups. Make sure both servers are in at least one of the same security groups. From what I quickly gleened this means they will both be able to access any ports on each other, without explicet settings.

Error #4: Key setup for app from private repo


Django Superproject – 3rd party git repo subdirectories mapped mapped to apps

November 12th, 2011 by admin

Django Superproject – 3rd party git repo subdirectories mapped mapped to apps


I want to import pinax-theme-bootstrap directly into the project so its easy for our web developer to update, and easy for me to fetch-merge upstream changes and request a pull for anything neat we might come up with.

pinax-theme-bootstrap repo has a subdirectory with pinax_theme_bootstrap and git submodule doesn’t allow you to specify subdirectories. Annoying!

Sidenotes: This is a major barrier to recieveing contributions back to you’re project in my opinion. Django needs a clear way to import modules into a project, allow you to tweak them, then submit changes upstream. IMHO if this were part of the default workflow, and more clearly documented the community would be able to contibute more easily. As it stands rather advanced git command knowledge is required in order to set up apps in the right place in django. Note: you don’t need this setup for apps you’re not going to customise. For those just use pip intall -r and the requirements.txt

Possible Solution – might work for you:

This was a nice idea, but seemed a little messy.


Ultimatly I settled on the solutions found here:


i forked the pinax-theme-bootstrap repo. Then within my project:

$ git remote add -f pinax-theme-bootstrap
$ git merge -s ours --no-commit pinax-theme-bootstrap/master
$ git read-tree --prefix=apps/pinax_theme_bootstrap -u pinax-theme-bootstrap
$ git commit -m "Merge pinax_theme_bootstrap into apps/pinax_theme_bootstrap"
$ git pull -s subtree pinax-theme-bootstrap master


So its several months down the track and now I need to merge all the changes that have been made to pinax-theme-bootsrap. I’ve since locally overriden some files. But I believe most should merge across without to many dramas. Lets see what happens.

So what commands do I need to run to get the code into my djano project,

1. merge all changes from upstream into the local pinax theme bootstrap git fork I made and cloned to be beside my django project. I did this is a new branch, then when all was okay merged the new branch to master, before …

2. Pushing it to my fork on github.

3. Change to the Django project and

git fetch pinax-theme-bootstrap

4. then run the merge,

> Automatic merge went well; stopped before committing as requested

5. test it, and if your happy. Commit it.

Update 2

I could never get the pull to merge upstream changes working using the above method. So I tried this one

the script linked too doesn’t work for private repos. With a bit of treaking this could be accomplished.

git subtree add –squash –prefix=apps/pinax_theme_bootstrap master

This however didn’t let you select just a subdirectory within the remote repo. It grabs the whole repo.

Update 3.


It looks like the original approach was close. Persuing.

git pull -X subtree=sites/all/modules/my_module REMOTE_REPO master


git pull -X subtree=apps/pinax_theme_bootstrap pinax-theme-bootstrap master

Feeling lucky!… not lucky… going to crowdsource the problem on stackoverflow.


Amazon Deployment Gotyas – django, pinax and wsgi

July 29th, 2011 by admin

Official Ubuntu Images Listed

Cheers to drifter_m on #django for that one


Removing Known Hosts when Strick SSH host checking is enabled

$ ssh-keygen -R {}
$ ssh-keygen -R {ssh.server.ip.address}
$ ssh-keygen -R
$ ssh-keygen -R

Fabric deploy files need run(command) simply () fails silently


Ubuntu 11.04 handles init.d stuff differently

Changed :

sudo(“invoke-rc.d postgresql-8.4 stop”)


sudo(“invoke-rc.d postgresql stop”)


Locate on ubuntu 11.04 fails


ubuntu@x:/etc/postgresql/8.4/main$ sudo locate postgresql

locate: can not stat () `/var/lib/mlocate/mlocate.db’: No such file or directory

ubuntu@x:/etc/postgresql/8.4/main$ sudo updatedb


Apache user can’t load modwsgi

ImportError: No module named django.core.handlers.wsgi

to check its working you can do. But this isn’t ideal as the apache process is now a member of the root wheel. eek!

sudo usermod -G ubuntu www-data


Ensure that python bin directory is readable

Check that the wsgi file includes the correct python version


Can’t login to pinax after reinstall with correct password

Clear the browser cookies


Hack your productivity with an LED monitor?!?

May 31st, 2011 by admin


Stumbled across this when doing some research for a client. [1]

The study showed that the extra amount of blue light in LED back lit monitors had an effect on the circadian clock, alertness, and cognitive performance. Saying the non-LED backlit group “elicited a significant suppression of the evening rise in endogenous melatonin and subjective as well as objective sleepiness as indexed by a reduced incidence of slow-eye movements and electroencephalographic low frequency activity (1-7 Hz) in frontal brain regions.” [1]

This might explain why I’m coding later and longer each day, effectively living a 25 hours day if left unchecked.


C. Cajochen, S. Frey, D. Anders, J. Späti, M. Bues, A. Pross, R. Mager, A. Wirz-Justice, and O. Stefani, “Evening exposure to a light emitting diodes (LED)-backlit computer screen affects circadian physiology and cognitive performance,” Journal of Applied Physiology, Mar. 2011.

[2]  rickyromero over at flicker.

SQLite to Postgres for Django

May 29th, 2011 by admin

UPDATE: The dumpscript required to much memory to be useful on the Micro AWS machine I was using, however I was able to use the standard dumpdata and loaddata commands that come with django. I also found out that SQLite dosn’t do any enforcement of max_length statements in Django models. And thus had to keep changing my scheme using ‘south’ for migrations. I’ll write that up another time.

So I started developing our app using django’s standard SQLite backend, but to scale up it was necessary to move to Postgres. This required migrating the data across. This is the workflow I found actually worked. Our tables had M2M objects, and data in the SQLite backend was not strictly valid. That is some times we had “” in an int field, which was not serilisable by django’s dumpdata command (or anything else to my knowledge).

0. Back up!!! Or data will, most likely, be lost.

1. Clean up your sqlite database to be valid (in reality you do it as errors are thrown)

2. Install django-extensions. Don’t forget to add to, even though you are just calling the commands, django needs to know what to call it. Also FYI apparently python variables can’t contain ‘-‘ and thus the module name to put in installed apps section of the file is actually django_extensions. Notice the underscore.

3. Dump the data. python dumpscript > app/dumpdata/ or something similar. You can actually just do an app, or Model. Look at the docs.

Note: This is likely where you will  have serilization errors if your sqlite database is not strictly valid. To identify where exactly the problem lay you can:

3.1 run shell, then

3.2 “from import call_command; call_command(‘dumpscript’)” OR

”from import call_command; call_command(‘dumpscript’, ‘appname.Modelname’)”

3.3 wait for the error, then “import pdb;” , which will drop you into a debugger and allow you to have a look at ‘self’ and ‘value’

4. Copy the to your sever where postgres is being kept.

5. Ensure that the schema is identical between the data you want to migrate, otherwise all bets are off.

6. Reset the app, and load the data (from the Docs)

$ ./ reset appname
./ runscript testdata

7. Check it all looks good in the admin section, or Postgres GUI tool of choice.

Note: They put me onto pgAdmin3 over at #pinax. Accessed the remote postgres db over a ssh tunnel. Just make sure you enable connections from in pg_hba.conf. Something like ‘host all all trust’ should do it.

Many thanks to FunkyBob, GrahamDumpleton, amagee, dstufft and lukeman in #django and #pinax for their support.


Add any folder to dropbox on osx

May 23rd, 2011 by admin

Note to self:

Go to Dropbox folder

cd ~/Dropbox

ln -s ../Documents/Business/ImportantProject/ ImportantProject