Thursday, January 24, 2013

CUPS Printer not printing after a cups power cycle: Unable to write print data: Broken pipe


http://www.novell.com/support/kb/doc.php?id=7006889


Situation
Printer errors out upon printing a job. The error results from either an incompatible printing format or some other software related issue. To clear the error and resume printer operation it is necessary to power cycle the printing device.
Once the printer is back online and display a green status light it does not print any job. If the workstation sending the print jobs is rebooted the situation does not change and the printer remains in ready mode. Yet printing from other workstations to the same printer is possible.

Resolution
On the workstation where print jobs never complete edit the file /etc/cups/printers.conf with a text editor like vi. Run the following command:

sudo vi /etc/cups/printers.conf

When prompted enter the administrative password for the system.
Vi will open the file for viewing and editing. At the top of the file you will note the text highlighted in red below.
You will need to edit the first line and change the string to State Idle.
You will need to delete the second line entirely

Below is what the printers.conf file looks like when the printer is not accepting jobs

# Printer configuration file for CUPS v1.3.9
# Written by cupsd on 2010-06-15 00:28

Info Brother HL-1470N BR-Script2
Location My office
DeviceURI socket://192.168.1.55:9100
State Stopped
StateMessage Unable to write print data: Broken pipe
StateTime 1276586906
Accepting Yes
Shared Yes



Below is what the printers.conf file should look like once the editing is complete.

# Printer configuration file for CUPS v1.3.9
# Written by cupsd on 2010-09-03 12:26

Info Brother HL-1470N BR-Script2
Location My office
DeviceURI socket://192.168.1.55:9100
State Idle
StateTime 1283541947
Accepting Yes
Shared Yes


Save your changes and exit vi.
You will need to restart CUPS on the workstation to reload the configuration information from printers.conf. Perform the following command to accomplish this:

sudo /etc/init.d/cups restart

Normal printing operations will resume once the CUPS daemon is restarted.

Thursday, June 7, 2012

How to make a wperl.exe executable in windows from scratch

GUI scripts
version 2.1

The standard perl.exe is a console based application, this is the right
thing usually, but sometimes it might be tedious.

Imagine you have a Tk or Win32::GUI based script, you start it by a
doubleclick on an icon and an ugly empty useless console appears and
stays on screen until you close the script. Not a nice thing huh?

There are several solutions.

Hiding the console
You may hide the console as soon as the script starts.

use Win32::GUI; BEGIN
{Win32::GUI::Hide(scalar(Win32::GUI::GetPerlWindow()))};

There are three problems with this solution.

The first is that the console flashes on screen when you start the
program. Even if you use BEGIN{} to hide it as soon as possible.

Second, if you run such a script from a console, it will hide the
console instead of detaching itself and leaving the console visible and
ready to take other commands.

Now let's think about what to do when the script ends. If it keeps the
console hidden and it was started by a doubleclick on an icon everything
is cool, but if it was started from a command prompt, the prompt is
still running, but it's invisible. This way, you'd run out of memory.

If you on the other hand show the console, it may flash on screen.

Solutions
For some time I advertised a way to prepare a perl.exe that doesn't
create a console. This is no longer needed if you use ActivePerl. The
distribution contains wperl.exe which is just that. If you compiled Perl
yourself you may need to create such an executable yourself. It's easier
than it may seem:

All you have to do is to copy your perl.exe to wperl.exe and run this :

c:\> EDITBIN.EXE /subsystem:windows wperl.exe

I'm using extension .gpl for the scripts that are to be run by wperl,
but this is up to you.

Since the editbin.exe is part of Microsoft's development tools and AFAWK
is not free, Jan wrote the following script that is able to do the same.

Usage:
exetype c:\perl\bin\guiperl.exe WINDOWS

I've tested this both under WinNT4.0 (sp4) and Win95sp1.

An updated version of the script is now installed with ActivePerl as
c:\perl\bin\exetype.bat.

You may use it to "de-consolize" any EXEcutable of course ;-)

Script
This script was written by Jan Dubois . Thanks,
Jan :-)

============================exetype.pl=============================
#!perl
use strict;
unless (@ARGV == 2) {
print "Usage: $0 exefile [CONSOLE|WINDOWS]\n";
exit;
}
unless ($ARGV[1] =~ /^(console|windows)$/i) {
print "Invalid subsystem $ARGV[1], please use CONSOLE or WINDOWS\n";
exit;
}
my ($record,$magic,$offset,$size);
open EXE, "+< $ARGV[0]" or die "Cannot open $ARGV[0]: $!"; binmode EXE; read EXE, $record, 32*4; ($magic,$offset) = unpack "Sx58L", $record; die "Not an MSDOS executable file" unless $magic == 0x5a4d; seek EXE, $offset, 0; read EXE, $record, 24; ($magic,$size) = unpack "Lx16S", $record; die "PE header not found" unless $magic == 0x4550; die "Optional header not in NT32 format" unless $size == 224; seek EXE, $offset+24+68, 0; print EXE pack "S", uc($ARGV[1]) eq 'CONSOLE' ? 3 : 2; close EXE; Automatic setup I've written a script that creates the wperl.exe (if you do not have it already) and sets the file extension mapping for extensions you specify. You may find it at http://Jenda.Krynicky.cz/perl/makeGUIperl.pl.txt You need Win32::Registry2 patch from my pages! http://Jenda.Krynicky.cz Subprocesses If your application doesn't have a console, your subprocesses should not have one either. It would look dirty if a console flicked on the screen every time you use system() or backticks. Since build 632 of ActivePerl you may use this BEGIN { Win32::SetChildShowWindow(0) if defined &Win32::SetChildShowWindow }; to instruct Perl to hide the consoles of such processes. Author The text was written by Jan Krynicky and is based on
discussion on Perl-Win32-Users mailing list, the code is by Jan Dubois
.

Tuesday, April 3, 2012

kprinter equivalents

xpp
gtklp
both work nicely

emacs settings to try

(custom-set-variables
'(lpr-command "gtklp")
'(ps-lpr-command "gtklp")
)

Saturday, January 28, 2012

annoying beep in console

create a file
.inputrc
set bell-style visible

and can use xset b 0
as well
------------------
.emacs file

and how to shut off in emacs?
this will make it visible

(setq visible-bell 1)
;; Now some people find the flashing annoying. To turn the alarm totally off, you can use this:
(setq ring-bell-function 'ignore)

Thursday, November 24, 2011

trouble with texlive-base in sid upgrade

apt-get upgrade or dist-upgrade

I had persistent problems

errors were encountered while processing:
texlive-base
texlive-latex-base
feynmf
texlive-latex-recommended
texlive-fonts-recommended
pdfjam
texlive
texlive-generic-recommended
texlive-luatex
texlive-metapost
texlive-pictures
texmacs

ie the following


Reading database ... 642501 files and directories currently installed.)
Preparing to replace texlive-latex-base 2009-14 (using .../texlive-latex-base_2009-15_all.deb) ...
Unpacking replacement texlive-latex-base ...
Processing triggers for man-db ...
Setting up texlive-base (2009-15) ...
mktexlsr: Updating /var/lib/texmf/ls-R-TEXLIVE...
mktexlsr: Updating /var/lib/texmf/ls-R-TEXMFMAIN...
mktexlsr: Updating /var/lib/texmf/ls-R...
mktexlsr: Done.
Running mktexlsr. This may take some time... done.
Building format(s) --all --cnffile /etc/texmf/fmt.d/10texlive-base.cnf.
This may take some time...
fmtutil-sys failed. Output has been stored in
/tmp/fmtutil.QRFBRZLF
Please include this file if you report a bug.

dpkg: error processing texlive-base (--configure):
subprocess installed post-installation script returned error exit status 1
configured to not write apport reports
dpkg: dependency problems prevent configuration of texlive-latex-base:
texlive-latex-base depends on texlive-base (>= 2009-1); however:
Package texlive-base is not configured yet.
dpkg: error processing texlive-latex-base (--configure):
dependency problems - leaving unconfigured
configured to not write apport reports
dpkg: dependency problems prevent confi

---------------
so what i did was read the bug report


http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=648278
i tried this so let us see what happens with the next attempt to upgrade
Rashi:/home/mlaks# mktexlsr /usr/share/texmf
mktexlsr: Updating /var/lib/texmf/ls-R-TEXMFMAIN...
mktexlsr: Done.
Rashi:/home/mlaks#

This did not help:

then see the remark there about installing all the texlive-base dependencies
at the same time

-----------------
Holger Levsen wrote:

> during a test with piuparts I noticed your package failed to install. As per
> definition of the release team this makes the package too buggy for a
> release, thus the severity.

Thank you, I found the reason - both bug reports seem to point to the
same problem. It does not show up when all dependencies of texlive-base
are installed in the same aptitude or dpkg run, only when they are
configured first and texlive-base is unpacked afterwards.

And of course it is in my new libpaper'ing code...

A fix is in svn, I'll upload soon.

Regards, Frank

-----------
that fixes it


so I did this

apt-get remove --purge texlive-base texlive-common texlive-binaries texlive-doc-base tex-common luatex

(copied down all the stuff being purged and then did)


apt-get install texlive-base texlive-common texlive-binaries texlive-doc-base tex-common luatex

and then we were ok

next step is to reinstall whole batch of files that were removed
:)

Sunday, September 25, 2011

How to get rid of all the rc entries in dpkg -l?

i just did the following and it seems to work

dpkg -l|grep -e ^rc|perl -pe 's/rc\s+(\S+)\s+\d.*/$1/'|xargs apt-get -y remove --purge

use at your own risk!

Thursday, September 8, 2011

oraysa and toratemet interesting project to review at google code