Multifunctionals on Linux

[Important: You can skip the first part of this tutorial by generating a PPD for your printer. Thanks Wilbert!]

This document describes how to install the new multifunctions on (Ubuntu) Linux. While this procedure is pretty straight forward, things become a little bit more complicated in case account tracking is enabled. While bits and pieces can be found all over the web, I thought it would be helpful to consolidate everything in one document.

Account tracking

Before you can use account tracking, you need to install a CUPS filter and create a configuration file containing your credentials.

  1. Save the minolta filter to your Downloads directory.
  2. Open a terminal (press ALT-F2, then type “terminal”).
  3. Move the filter to the cups filters directory:
    sudo mv ~/Downloads/minolta /usr/lib/cups/filter/
  4. Make the filter executable:
    sudo chmod 755 /usr/lib/cups/filter/minolta
  5. Make a configuration file containing your credentials. The filter uses the printer name to find the file. You can freely choose your printer name, as long as it matches. I suggest using the name assigned by the University ICT department.
    sudo echo ACCOUNT_NAME=\"\" > /etc/cups/ppd/KM-PR0000.km
    sudo echo ACCOUNT_PASSWORD=\"12345\" >> /etc/cups/ppd/KM-PR0000.km
    sudo echo ACCOUNT_COETYPE=\"0\" >> /etc/cups/ppd/KM-PR0000.km
    Note that you have to replace the bold bits! WordPress keeps changing my quotes, you might need to replace them.

Installing the printer

First, download the PPD for your printer. Note that these have been modified such that it uses the filter we’ve installed above. The original PPD files will NOT work with account tracking.

Then follow the steps below to install your printer:

  1. Open the CUPS administration panel http://localhost:631/
  2. Click the Administration tab
  3. Click Add printer
  4. Select “Windows Printer via SAMBA” at the bottom of the list.
  5. Enter the location (replace the bold parts):
    smb://username:password@ru.nl/payprint03.ru.nl/KM-PR0000
    Special symbols should be percent-encoded (thanks to Micha Hulsbosch).
  6. Enter KM-PR0000 as the printer name.
  7. Click “Browse” and choose the PPD file you downloaded before.
  8. Click Add printer.
  9. Click the “General” tab.
  10. Choose A4 paper and “set default options”.

The printer should now work.

Bonus reading

You can set the name that appears when printing using:
@PJL SET KMUSERNAME=”Zaphod”

You can directly contact the printer using:
socket://km-pr0000.print.ru.nl:9100

You can store your prints in a box on the device using the following commands:
@PJL SET BOXHOLD=STORE
@PJL SET BOXHOLDTYPE=PRIVATE
@PJL SET BOXFILENAME=”Important”
@PJL SET BOXNUM=314159265

Secure printing can be enabled using:
@PJL SET HOLD=ON
@PJL SET HOLDTYPE=PRIVATE
@PJL KMJOBID=”SecurePrintId”
@PJL HOLDKEY2 = “SecPassword”

 

EDF File Format

In my current research, I track eye position using the EyeLink system. This system produces EDF files which I currently convert into ASCII files using a manufacturer supplied tool. Then, I parse this ASCII file using a custom built Mex file in order to get the data into Matlab. As I’ve always been particularly interested in figuring out how stuff works, this post documents my attempts to read the EDF files directly.

Every file seems to start with:
* SR_RESEARCH_COMB_FILE\n
* A couple of information strings (each terminated by \n)
* And finally “ENDP:\n” which I guess is for end prelude.

The actual data follows. There seem to be a couple of types of variable length frames:
* 0F 00 21: Seems to contain sample frequency, possibly events or samples settings
* 11 00 21: Seems to contain sample frequency, possibly events or samples settings
* 18 xx 21: Seems to indicate the start of a string message
* 41 C0 21: Unknown
* 81 C0 21: Unknown
* D1 81: A sample with delta-time only
* F1 81: A sample containing full time stamp

I’m guessing that 0×20 indicates the presence of a full time-stamp. For some reason this does not hold for messages?

Messages
* 4 byte: time-stamp
* 1 byte: Unknown
* 2 byte: String length
* n byte: Null terminated string
* 1 byte: Null (there seem to be two)

Samples
* 1 byte: delta or 4 byte: time-stamp
* 2 byte: left x
* 2 byte: left y
* 2 byte: right x
* 2 byte: right y
* 2 byte: pupil ?
* 2 byte: pupil ?
* 2 byte: status (always 04?)

Color printing in Matlab on Linux

The Linux version of Matlab (2013a at least) defaults to printing in black and white. To print in color, you either have to specify another printer driver as an argument to print (“-dps2c” instead of “-dps2″) or manually select “color” from the “color scale” tab in the print preview dialog. The default for this setting is stored in: $MATLAB/toolbox/local/printopt.m. Look for the line that says dev = '-dps2'; and change it to dev = '-dps2c';.

While you’re at it, you can change default paper size, units and more by editing startup.m. My configuration looks like this:

set(0, 'DefaultFigurePaperType','A4');

set(0, 'DefaultFigurePaperPositionMode', 'Manual');
set(0, 'DefaultFigurePaperUnits', 'Centimeters');

set(0, 'DefaultFigurePaperOrientation', 'Landscape');
set(0, 'DefaultFigurePaperPosition', ...
[1 1 -2 -2] * 1 + ... % Set margin here
[0 0 29.7 21.0]); % Size of A4 in landscape format

Psignifit on Win64

Today I wanted to try Psignifit on my work computer which unfortunately runs Windows 7. As the required 64-bit MEX file is not provided, I’ve compiled it myself. The¬†Psignifit MEX file for AMD64 can be downloaded from my website.

Update:
The 64-bit MEX files seem to be a bit unstable. I’ve noticed that this is because the variable index on line 2092 of psignifit.c can be nan. To fix this problem, the line should be changed from:

if(index < 0.0 || index > (double)(nVals - 1.0)) return NAN;

to:

if(isnan(index) || index < 0.0 || index > (double)(nVals - 1.0)) return NAN;

Note that I did not yet recompile the Windows MEX file.

Quake

While I generally don’t like playing computer games (except maybe OpenTTD), I recently tried QuakeLive. This game uses a custom browser plugin, which in essence does away with the in-game menus no-one likes anyway. The actual game-play is perfect, but some more (different?) levels wouldn’t hurt.

If you decicide to try it too… feel free to add me to your friends list, my account name is ivarc.

Batavierenrace 2009

Yesterday I participated in the world’s largest relay race, the Batavierenrace. While I’ve been walking large parts during training, I was able to run all 6 kilometers at a nearly constant speed of 11 km/h. To the left is the official Batavierenrace picture taken somewhere near the start, our team-mate Jurrian also made some clips of the finish which I’ll post as soon as possible.

During the last couple of weeks I’ve also been creating an online tracking system using GPS and J2ME (see previous post). The logging worked like a charm, it sent nearly 500 kb of coordinate points to my home server during the race. Our custom battery pack only failed after our runner entered the city of Enschede. Due to an error in the web application, the runner appeared to be stuck, however. I’ll have to improve on that part for next year’s race.

J2ME FileConnection still problematic

Today I’ve implemented a tile cache which only uses one single file. In theory, this file would be opened once (i.e. once permission dialog) and it would then reuse the file handle¬† err… stream. Of course J2ME/Nokia does not allow access to the internal file system using the FileConnection api (without having the maff^Wverisign et al. sign your application). As I gave my micro SD card to my Dad (it was probably his to begin with), I can’t test whether I am allowed to access that…

Even though I really like Java as a language, the J2ME security system sucks. If you’re considering writing a mobile application, my advise would be to stay away from J2ME and just use C.