Posts Tagged ‘linux’

Windows Vista using a CUPS PDF printer hosted on Debian

So, every time I upgrade my system, it seems like my printers break.  I don’t know if it’s bad management of the cups debian packages, the peculiarity of windows, or my own incompetence.  The breaks have wildly varying symptoms.  So, I haven’t seen a pattern in them that allows me to fix things gracefully.  Sometimes Samba is to blame.  Sometimes CUPS (-PDF) is to blame.  And sometimes Windows is to blame.  Well, when I upgraded from Lenny to Squeeze awhile back, of course it broke my virtual PDF printer that I use to generate electronic invoices.  When I’d try to connect to the printer (as configured in Lenny), I got the following error:

Windows cannot connect to the printer. Operation
could not be completed (error 0×0000000d).

(No, it wasn’t in those colors or with that background… but I figured I’d try to find a way to make you, dear reader, feel as annoyed as I felt when I saw the error.) Anyway, with such a wonderfully informative error, I didn’t know quite where to turn. The logs (cups, samba, auth.log, syslog, etc.) on the server gave no indication that anyone had tried to connect. And I could browse the other shares from the vista machine nicely and those connections did show up in the logs. So, I had a strong indicator that the problem was NOT my upgrade from Lenny to Squeeze. But, being the stubborn idiot that I am, I started fiddling around with the printer and samba configs anyway…. which lead nowhere, of course. The upside is that I am just a smidgeon more familiar with cups and samba. [sigh]

When I finally typed the error into a search engine, I found the answer provided by some participants of Microsoft TechNet, which I repeat here for posterity:

From: AHarsent

I've seen this problem with a few printers now, not
consistantly[sic] between any particular makes or
models. However, I have found a consistant[sic]
fix to connect to any network printer from vista:

Run a command prompt and type the following:

   net use LPT2: \\servername\printer

This sets up a behind-the-scenes connection to
the printer.

Then go through the add printer wizard, choose to
add a local printer, and choose port LPT2… It will
probably ask for a printer driver, and you can just
choose whatever XP driver you might have been using
before. The printer is then installed without any errors,
and works just fine.

Of course, since I’m using CUPS-PDF, I don’t have a printer driver. I just use the Generic MS Publisher Imagesetter, which seems to work nicely. And now that I’ve made the right sacrifices to the right gods, I’m back to being able to generate PDFs from any program on the windows machine.

Matlab C API, engdemo.c, and JMatLink “Can’t start MATLAB engine.”

OK.  Since I stupidly spent too much time on this problem, I feel like I have to write about it here in the hopes that I can decrease the stupidity in the world.

I’ve written a GUI for a Matlab simulation.  On Linux, we use the JMatLink bridge between Java and Matlab.  At some point, when doing a dist-upgrade on my Ubuntu laptop, the JMatLink bridge stopped working, yielding the uninformative error:

Can't start MATLAB engine.

Well, I proceeded to hack JMatLink, turn on debugging for it, futzing with my LD_LIBRARY_PATH, and my PATH, changing JDKs (since there is a problem with the Sun JDKs and the X11 library libxcb (see here and here for more info on that — I finally downgraded to the gutsy libx11-6 and libx11-dev), etc.

In any case, my fog finally lifted and I decided to try the engdemo.c file provided by Mathworks as the canonical demonstration of calling Matlab from C. And, sure enough, I get the same uninformative error: Can’t start MATLAB engine.” So, I Ask.com’ed (no I don’t usually use the Eye of Sauron for searching) for URLs with this text in them and found: this post by “Mohammed Hasan”. Sure enough, I did an:

$ sudo apt-get install csh

and all is now well. [sigh]

Return top