From this thread I found this pretty odd Canon Australia page which works, however do not think that the deb in the download is the universally understood file extension for a debian package, no it is just some guy's way of indicating that this is targeted at debian based systems. What you actually have to do is inflate and ./install.sh, then all works well.
Tuesday, 4 June 2013
Sunday, 2 June 2013
Dual boot OSX and Ubuntu
This has been one of the least pleasant Linux experiences, but then aren't they all!
As Mike Orr put it:
Linux Air
Disgruntled employees of all the other OS airlines decide to start their own airline. They build the planes, ticket counters, and pave the runways themselves. They charge a small fee to cover the cost of printing the ticket, but you can also download and print the ticket yourself. When you board the plane, you are given a seat, four bolts, a wrench and a copy of the Seat-HOWTO.html. Once settled, the fully adjustable seat is very comfortable, the plane leaves and arrives on time without a single problem, the in-flight meal is wonderful. You try to tell customers of the other airlines about the great trip, but all they can say is, "You had to do what with the seat?"
Many sites cheerfully claim that there is no problem dual booting a mac to run Ubuntu. eg life hacker. I beg to differ!
My mac is a MacBookPro8.2, 2011 build. As shown by:
dmidecode |grep -i macbookpro
A twist is that it has an SSD where its optical drive should be, so I have to install from an external USB CD drive (I tried from a USB memory stick but ran into other problems).
It seems as though there were problems with the previous (12.04) version of the Ubuntu installer such that a problem with the usb cd provoked an issue with the video driver, or some such. I installed rEFIt and fiddled around for an age. I produced black backgrounds, purple backgrounds and even turquoise backgrounds, but no X.
I managed to install a server version of Ubuntu, but could not get ubuntu-desktop to load. By removing quiet and splash from the grub config I could see the X server crash.
Fatal server error:
no screens found
From wikipedia:MacBookPro I found I have dual graphics cards, an Intel card and an AMD Radeon HD 6490M.
From recovery mode boot I was able to see the real culprit:
fb: conflicting fb hw usage inteldrmfb vs EFI VGA - removing generic driver
I reinstalled from the ubuntu mini iso the latest (13.01) Ubuntu. Got the same conflict error. I installed the latest rEFId using a .deb. Still the same error, but now understand it is a conflict between the driver installed by rEFId and the Radeon driver.
From this thread I was able to find an incantation which worked!
outb 0x728 1
outb 0x710 2
outb 0x740 2
#Power down ATI
outb 0x750 0
linux /boot/vmlinuz-3.5.4-030504-generic root=/dev/sda4 video=efifb i915.modeset=1 i915.lvds_channel_mode=2 i915.lvds_use_ssc=0
This can be put into /etc/grub.d/00_header and then
grub-mkconfig -o /boot/grub/grub.cfg
Thursday, 30 May 2013
Conditional inclusion in Python LaTeX template
I have been using a very simple templating technique in python
page = template % dotted
dotted is a dictionary whose keys are a dotted path to every property in an object eg child.carer.email
To conditionally include text in LaTeX you can use the etoolbox package:
\usepackage{etoolbox}
\newcommand\toggleTrue{\toggletrue}
\newcommand\toggleFalse{\togglefalse}
\newtoggle{elephants}
\toggleFalse{elephants}
\iftoggle{elephants}{
elephants
}{
not elephants
}
A boolean object property, say member.isAdult can now be used to control inclusion:
\usepackage{etoolbox}
\newcommand\toggleTrue{\toggletrue}
\newcommand\toggleFalse{\togglefalse}
\newtoggle{isAdult}
\toggle%(member.isAdult)s{isAdult}
\iftoggle{isAdult}{
payment date
}{
date of birth
}
Wednesday, 15 May 2013
Flower planter tip
Thursday, 2 May 2013
Reverting to squeeze from wheezy
On my xen vm I tried to upgrade to wheezy, this is not possible if the host dom0 is still on etch. The kernel you are actually running is supplied by dom0 (why?) so you will now have a broken system. In particular ldconfig will segfault with kernel too old. apt-get install -f fails with:
The following packages have unmet dependencies:
cpp : Depends: cpp-4.7 (>= 4.7.2-1~) but it is not installable
g++-4.4 : Depends: gcc-4.4 (= 4.4.5-8) but 4.4.7-2 is to be installed
gcc : Depends: gcc-4.7 (>= 4.7.2-1~) but it is not installable
gcc-4.4 : Depends: gcc-4.4-base (= 4.4.7-2) but 4.4.5-8 is to be installed
Depends: cpp-4.4 (= 4.4.7-2) but 4.4.5-8 is to be installed
Depends: libgomp1 (>= 4.4.7-2) but it is not going to be installed
Recommends: libc6-dev (>= 2.13-5) but 2.11.3-4 is to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).
Part way home it failed with:
libgcc1 : Breaks: gcc-4.4 (< 4.4.6-4) but 4.4.5-8 is to be installed
libstdc++6 : Breaks: gcc-4.4 (< 4.4.6-4) but 4.4.5-8 is to be installed
and similar.
To return to a clean squeeze install is not easy. First edit /etc/apt/sources back to squeeze.
Now edit all of the following to comment out ldconfig:/var/lib/dpkg/info/libstdc++6.postinst /var/lib/dpkg/info/libstdc++6.postrm /var/lib/dpkg/info/libgcc1.postrm /var/lib/dpkg/info/libgcc1.postinst
# Automatically added by dh_makeshlibs
#if [ "$1" = "configure" ]; then
# ldconfig
#fi
Edit /etc/apt/apt-conf
APT::Default-Release "squeeze";
Now pin the packages which have been incompatibly upgraded (note Package: * does not work:
Package: libc-bin libc6-dev locales gcc gcc-4.4 cpp libgomp1 libgcc1 libstdc++6\
build-essential
Pin: release n=wheezy
Pin-Priority: -10
Package: libc-bin libc6-dev locales gcc gcc-4.4 cpp libgomp1 libgcc1 libstdc++6\
build-essential
Pin: release n=squeeze
Pin-Priority: 900
Clear apt's cache
apt-get clean
Finally you can
apt-get install -f
And uncomment the ldconfig lines and use * in /etc/apt/preferences
Package: *
Pin: release n=wheezy
Pin-Priority: -10
Package: *
Pin: release n=squeeze
Pin-Priority: 900
Now we are back to a system where apt-get works, but sadly still running an etch kernel!
Saturday, 27 April 2013
Serialise a Django model to a dictionary following links
To enable a simple templating system I wanted a dictionary with keys as dotted paths in the object tree eg child.carer.user.first_name, however Django does not offer the ability to follow foreign keys out of the box.
def dottedDict(model, name, dict):
for f in model._meta.fields:
if type(f) in [models.fields.related.ForeignKey,
models.fields.related.OneToOneField]:
referred = getattr(model, f.name)
if referred is not None:
dottedDict(referred,
'%s.%s' % (name, f.name), dict)
else:
dict['%s.%s' % (name, f.name)] =
model.__dict__[f.name]
return dict
This enables an object to be rendered (substituting empty strings for nulls):
def registrationFormLatex(self):
template = file('Form.tex.template', 'r').read()
dotted = dottedDict(self, 'child', {})
done = False
while not done:
try:
page = template % dotted
done = True
except KeyError, e:
dotted[e.message] = ''
return page