technology

Installing Python 2.7.0 (32-bit) for OpenCV 2.4.0 under Windows 7 (64-bit)

After getting errors like this:
http://stackoverflow.com/questions/5030362/how-to-use-opencv-in-python

I discovered that OpenCV works best (most easily) under Windows as 32-bit
http://luugiathuy.com/2011/02/setup-opencv-for-python/

The alternative is to compile OpenCV for 64-bit
http://stackoverflow.com/questions/3919681/compiling-opencv-on-windows-7-64bit

I discovered that my Windows install of Python (2.7.3) was conflicting with my (implicit) Cygwin install

(2.6.5), so I removed the Python language package from Cygwin.

Scrapy (python) install under Windows 7 x64

I recently managed to install scrapy on a Window 7 64-bit dev machine. It wasn't straight forward so I've

documented the process. Here are the binary install files you need for the install:

python-2.7.3.amd64.msi
lxml-2.3.4-py2.7-win-amd64.egg
pyOpenSSL-0.11.winxp32-py2.7.msi

Backbone.js requires underscore.js to be in the global page context

I was loading underscore.js then applying the .noConflict(). When Backbone (0.5.1) was loading, it couldn't find Underscore (window._). This manifested as a Firefox console error "f is undefined".

Once Backbone has loaded, you can safely clean up both libraries without disrupting either:


var b, u;
b = window['Backbone'].noConflict();
u = window['_'].noConflict();

ZendServer upgrade includes MySQL 5.1 but breaks logfile size

I recently upgraded my ZendServer (development) from 5.0 to 5.6.0. This includes PHP 5.2.17 and 5.1.50. Everything worked very smoothly, but when I restarted my machine MySQL failed to start (Error 1067). I googled my way to this post, then found the .err file in MySQL's /data directory:


InnoDB: Error: log file .\ib_logfile0 is of different size 0 45088768 bytes
InnoDB: than specified in the .cnf file 0 56623104 bytes!

synchronising time between two linux servers using SSH

NTP is a fantastic protocol, but there are cases where you don't want to have another daemon running on a server. This script connects from machine A to machine B using SSH, reads the time from B and applies it to A.


# fetch time from machine B
time=`ssh user@b.domain.com -p522 "date +'%m%d%H%M%Y'"`
# apply date to local machine (A)
echo "Setting time to "$time
date $time

Make Skype start minimised

Every time I restart my computer, Skype (5.5) loads, logs in and opens a window. I discovered how to make it load minimised:

  • Find the Skype program files folder(C:\Program Files (x86)\Skype\Phone)
  • Create a new shortcut
  • Modify the target to read /secondary /minimized
  • Find the Windows startup folder
  • Delete or move the old Skype shortcut out
  • Move the new shortcut in
  • Run Skype, select View -> Compact mode

The value of a good backup

I've got a 2TB Western Digital drive that's showing the early signs of failure. It corrupted a 1GB file the other day. The thing is that corruption could be caused by the NTFS driver (Tuxera NTFS for Mac), or even the media encoding software that produced the file (Handbrake). Only time will tell when either a second file is corrupted, or the drive entirely fails.

Firefox showing spinner indefinitely for HTML 5 (video.js) .ogg embed

One of my sites uses HTML 5 to show video on the homepage. The VfE embed worked fine in Safari/Chrome/IE but had stopped working in Firefox. It just left the loading spinner spinning indefinitely and refused to play. I tracked it down to the source=".../video.ogg" line.

Google Maps tile display bug for KML layers

I've encountered a problem with the Google Maps API, specifically with the KML layers on my Surfy Survey map. The KML-enhanced tiles occasionally fail to load and default back to the normal tiles. This produces a map that shows part of a heatmap, as the two images below illustrate. This behavior is non-deterministic.

array_walk snippet on php.net

I wrote a small explanation of a call-by-reference problem. Taken from php.net's array_walk description, it reads:

I wanted to walk an array and reverse map it into a second array. I decided to use array_walk because it should be faster than a reset,next loop or foreach(x as &$y) loop.


<?php
$output = array();
array_walk($input, 'gmapmark_reverse', $output);
//
function gmapmark_reverse(&$item, $index, &$target) {
$target[$item['form_key']] = $index;
}
?>


Alex Stanhope is a Technology consultant to the UK Creative Industries and Venture Catalyst. This is my personal website.
Bristol | Lightenna | ManKind Project | goodkarma
All material copyright (c) 2006-2010 | Website by Lightenna, featuring N.Design's GlossyBlue theme.
Syndicate content