global-set-key (kbd "C-c C-g")
(lambda ()
(interactive)
(shell-command "/home/user/trial.pl")))
Thursday, March 13, 2014
Sunday, March 9, 2014
ideas to capture to emacs and avoid nuance
SetTitleMatchMode 1
WinWait Nuance
WinGetText, text ;
MsgBox, the text is: `n%text%
WinActivate Nuance
Send ^a
Send {Del}
Sleep 100
Clipboard = %text%
WinActivate Nuance
Send ^v
Return
Wednesday, February 26, 2014
stumpwm problem with mouse on gtk3 apps such as evince and other apps
I have been using stumpwm for several years and am very happy and can't contempl
ate otherwise.
I just noticed a change in debian sid.
The new version of evince 3.10 (which is a pdf viewer)
mousewheel no longer scrolls up and down the page while running under stumpwm.
I reported to evince upstream and they denied it as a problem on their end.
I found they are right when i opened up lxde icewm gnome etc evince worked norma
lly.
Note evince 3.4 under stumpwm (debian wheezy) was fine.
It was only when i upgraded 3.10 or even using jhbuild latest 3.11 same behavior
.
Do you have any idea what the change in mouse handling that would affect this ap
plication.
I have not noticed other applications.
is it a change in the xorg?
thus qpdfview works with normal scroll behavior and okular.
I mentioned on #stumpwm irc
where it was confirmed by alezost
other applications
evince
nautilus
eog
-----------
It can be solved by
> GDK_CORE_DEVICE_EVENTS=1 evince file.pdf
will work normally with the mouse
can this be set in the .profile or .bashrc ???? don't know how
Sunday, November 10, 2013
Reformat the output of hebcal to be more useful
want to format the output from hebcal on combined lines like so
#!/usr/bin/perl -w
use strict;
use v5.10;
my @output=`hebcal -dsC 'new york'`;
my %hdata;
chomp @output;
foreach (@output) {
my ($date, $data)= split (/\s/,$_,2);
my ($month,$day,$year)=split(/\//,$date);
my $date=sprintf('%02s/%02s/%d',$month,$day,$year);
if (defined $hdata{$date}){
push( @{$hdata{$date}}, $data);
}
else {
$hdata{$date}=[$data];
}
}
foreach (sort (keys %hdata)) {
say "$_ @{$hdata{$_}}";
}
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
.
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
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
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")
)
gtklp
both work nicely
emacs settings to try
(custom-set-variables
'(lpr-command "gtklp")
'(ps-lpr-command "gtklp")
)
Subscribe to:
Posts (Atom)