20 August 2012

222. Fighting and, eventually, installing HP laserjet P1102w on debian.

This printer is great when it works. It's just always a pain to set up, and it seems to be down to the way the install scripts are written. Setting up the printer was easy in the end -- but getting there? Not so much. Obviously, part of the reason is my own stupidity. Summary: it works on linux, but you'll need a bit of time and patience.

Update: here's an interesting post on the same topic: http://downfromthetrees.com/linux-installing-a-proprietrary-hp-printer-driver.html The only thing I would add is that instead of using sudo as described in that post you may have to use gksu in order to avoid the Magic Cookie error.

The short guide:
You NEED a binary plugin. It blows, but you do. Blowing harder: there's a lot of references to letting hp-setup download it for you -- but I'm willing to bet that it will fail for you.

Anyway, do this:
wget http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.12.6-plugin.run
chmod +x hplip-3.12.6-plugin.run
gksudo ./hplip-3.12.6-plugin.run

Hopefully that's good enough to take you through to system-config-printer and/or hp-setup. I did a lot of things, but it was the gksudo ./hplip-3.12.6-plugin.run that did it in the end.

And don't forget to add yourself to the lpadmin and perhaps lp groups:

cat /etc/group|grep lp
lp:x:7:verahill
lpadmin:x:111:verahill
I don't know how necessary it is, but heck, why not?


Here's the full, painful (and probably embarrassing) route I took:
It should not be this difficult to get a bloody printer to work. With older printer models it's been quick and easy, without having to download any 'binary plugins'. This is just effing ridiculous. Guess who's not buying another HP printer...

I reorganised my office, and as part of that decided to move my printer from my desktop to one of my networked boxes to free up some space on my desk. My desktop is running GNOME, while the target box is running KDE.

If you install the hplip packages in debian you end up with a very helpful script called hp-setup. You can run that as a user, but try running it as root via sudo, and you get

Invalid MIT-MAGIC-COOKIE-1 keyhp-setup: cannot connect to X server :0

OK, so you can run it as user. Everything looks great, BUT...you'll find that in this case the install will fail at the step of downloading the magical, mythological 'binary plugin'.

Also, as a user you're unlikely to be able to be able to put files in the places where they belong anyway, so there's that (see e.g. the first comment below).

You then do a bit of googling for hplip-3.12.6-plugin.run, and end up here: https://aur.archlinux.org/packages.php?ID=44646

You do
wget http://www.openprinting.org/download/printdriver/auxfiles/HP/plugins/hplip-3.12.6-plugin.run
chmod +x hplip-3.12.6-plugin.run
./hplip-3.12.6-plugin.run

This opens a gui where you get to accept the T&C. Not much seems to happen beyond that though. Oh, and you can't do the sudo-thingy because, well, you get the magic cookie error.

OK, take a step back.

sudo lpstat -a

global-mfp accepting requests since Mon 20 Aug 2012 10:46:48 EST
HP-LaserJet-Professional-P1102w-2 accepting requests since Mon 20 Aug 2012 13:49:19 EST
lpoptions -d HP-LaserJet-Professional-P1102w-2

lpq
HP-LaserJet-Professional-P1102w-2 is ready

Test it:
lp /etc/fstab
request id is HP-LaserJet-Professional-P1102w-2-1 (1 file(s))

 lpq
HP-LaserJet-Professional-P1102w-2 is ready and printing
Rank    Owner   Job     File(s)                         Total Size
active  (null)  1       untitled                        2048 bytes
Printing my foot it is.

Hmm...
cat /etc/group|grep lpadmin
lpadmin:x:114:
OK, edit /etc/group and add myself to lpadmin.

I can open system-config-printer, but I can't 1) delete any printers (which would've been nice) or 2) start it with sudo.

I can use http://localhost:631, but as a user I'm somehow not allowed to remove printers, and I use sudo -- there's no 'root' password.

At this point I was getting frustrated and nuked all printers clear of my system.

sudo lpadmin -x HP-LaserJet-Professional-P1102w-2

sudo apt-get install system-config-printer-kde

Now I had both 'printing' (= vanilla CUPS system-config-printer) and 'Printer Configuration' in the KDE menu.

Still no dice.

OK, another step back.
mkdir hp
./hplip-3.12.6-plugin.run --target hp
cd hp/
sudo cp 86-hpmud-sysfs_hp_laserjet_professional_p1102w.rules /etc/udev/rules.d

Still no effing luck.

Tried one last desperate thing:
gksudo ./hplip-3.12.6-plugin.run
Clicked the agreement. Said done.
Hit 'print test page' and...it printed!

So...you need to be root...but the MIT magic cookie issue combined with the requirement to have a friggin' gui (why???) made that painful. Well, I guess that's why we're told to use gksu whend oing graphical stuff...

OK, only things remaining: network sharing. Should be simple. Opened up all ports on print-host box to accept traffic from my desktop (and desktop only). No luck.

gksu system-config-printer
Click on server, settings -> check Publish shared printers connected to this system.

On my desktop it was then just add a matter of adding the printer in GNOME (ipp://192.168.1.101:631/printers/HP-LaserJet-Professional-P1102w)

Sweet.

SOLVED.


16 August 2012

221. First steps with Moodle (the .deb version) in Debian

This is a very brief, very basic outline.

Looking online the general recommendation seems to be to install moodle yourself and avoid the debian package version. While not a stranger to rolling my own, I just want to play with moodle for learning purposes because that's what my uni uses.

Anyway, do
sudo apt-get install moodle

Once it's installed, look at
ls /etc/apache2/sites-enabled

If there's nothing moodly, then do
sudo cp /etc/moodle/apache2.conf /etc/apache2/sites-enabled/moodle.conf
sudo service apache2 restart

Navigate to http://localhost/moodle

The actual installation takes ages, so go get yourself a cup of tea/coffee to prevent your mouse finger from getting itchy. In other words, just wait until you get a list showing that all steps have completed and that you may continue.

You need to allow cookies.


Fill out the admin stuff - country, password, city etc etc.



At this point you can log in, create a class and start exploring. Have fun.


15 August 2012

220. My first few lectures in Australia...and the importance of thermodynamics

I'm not an expert on anything. It's not a matter of false modesty, but an observation based on the fact that I come across new things on a regular basis, even within my field of research. When I do, I try to learn.

But to learn new things I need a toolbox - a set of skills that I rely on to put anything new into context. The toolbox for a chemist is basically thermodynamics. Simple, applied thermodynamics. As a chemist you can get away with memorising the expression for Gibbs free energy and the general expression for rate laws, and you can do a whole lot of fun/damage.

I'm only at the beginning of my current class, and I'm an inexperienced lecturer, but I had a bit of a shock today discovering that my class -- second semester of the second year at a 'good' university -- don't feel comfortable dealing with free energies and standard potentials.

The origin lies in the idea of students as clients here -- universities want pass rates in excess of 70-80%, while most of the faculty likely experienced a first year as undergraduates where the Gen Chem class (which did thermodynamics until you eyes were bleeding) had a failure rate of 60% or above.

We might have thought it was harsh to fail that many students at the very beginning, but the result was that the more inspired/motivated students made it through, and the ones who weren't willing to dedicate the effort necessary to become professionals got a kick in the pants to look for majors that actually interested and inspired them.

If something interests you it  becomes 'easy' -- either because you instinctually  understand it, or more likely, because you simply put in that extra effort to teach yourself.

Instead, the impetus to pass as many students as possible -- and to get 'good' student feedback which will help your promotion -- means that the students are never challenged. 'Difficult' topics are avoided and taught late in the course or ,increasingly, not at all.

Rumour has it that one of the reasons why some Australian universities are adopting a Bologna-inspired model is because they can use the masters section of the education to cover the things the students should have learned as undergraduates --- and thus still produce graduates with the skills that their chosen major indicates that they should have.

It's pretty damning.

The consequence is dire -- some scary example of PROFESSORS -- that is: professionals entrusted with teaching the next generation of scientists and engineers -- in the STEM fields who don't appear to understand basic thermodynamics or more specifically: entropy and the distinction between open and closed systems based on their use of thermodynamics to 'disprove' Evolution. They may be appearing to be capable professionals in every other sense and may well do 'good' research. The individuals may be appearing to do capable research in every other aspect and may be wonderful people, but their use of the 2nd law of thermodynamics as an argument against evolution is just misguided.

Andrew McIntosh -- Professor of Thermodynamics(!) and Combustion Theory at Leeds. Website.
Stuart Burgess -- Professor, Department of Engineering at Bristol. Website

In fact, the list here would presumably include mostly people of a similar persuasion. While I've seen Andrew's and Stuart's writings, I feel comfortable commenting on their opinions, but since I am not as confident about the rest of the people on the list, let's just highlight the fact that it include people from (the universities of) Sheffield, Cambridge, Liverpool and Cardiff.

Or what about this letter: http://www.bcseweb.org.uk/index.php/Main/EstelleMorris
The fact that the signatories mention their affiliations is an obvious way of trying ot use those affiliations to attach significance to their views.

Anyway, here's MC Hawking's take on it: http://www.mchawking.com/includes/lyrics/entropy_lyrics.php