MozRepl gives ReferenceError sometimes (BrowserReload()) - mozrepl

I'm using MozRepl with Vim to reload the browser. This is the command I run:
echo "BrowserReload(); repl.quit()" | nc -w 1 localhost 4242
Sometimes it works, other times it gives ReferenceError: BrowserReload is not defined. Anybody in the know?
EDIT: OK, the problem is when the developer window is focused instead of the main window of Firefox.

Related

Opening emacsclient in terminal works but won't work with Automator

So I'm getting some pretty strange behaviour when I try to use an Automator service to open new emacs (GNU Version 25.2 with spacemacs) buffers.
In my terminal, the command emacsclient -a '' -c works as expected, opening a new buffer through emacsclient. However, when I make a service in Automator which simply runs a (/bin/bash) shell script:
emacsclient -a '' -c
I get an error message:
The action “Run Shell Script” encountered an error: “emacsclient: could not get terminal name”
On suspicions that this was due to Automator not using some default PATH variable, I tried the following instead:
PATH=/usr/local/bin:$PATH
emacsclient -c
which produced the same error as before.
Next I tried
PATH=/usr/bin:/usr/local/bin export PATH;
emacsclient -c
which produced a different error message:
The action “Run Shell Script” encountered an error: “emacsclient: invalid option -- c
Try `emacsclient --help' for more information”
however why I try that script in my terminal it also gives a similar error which doesn't make much sense to me.
If anyone has suggestions for how to fix this I'd really appreciate it.
The problem is the shell script is running an old version of emacsclient in /usr/bin you need to run the one in Emacs.app/Contents/MacOS/bin/emacsclient. Delete the PATH line and you can use a solution listed here for running emacsclient inside automator Running a macOS service for open with emacs failed with "emacsclient: could not get terminal name mac"

Prevent Raspberry from blanking (console)

Is there any way to prevent the rasberry console from getiing black after a while?
I use only the console without any GUI. I already tried the following, but it didnt work at all :(
/etc/kbd/config
BLANK_TIME=0
POWERDOWN_TIME=0
Would be very greatful for any hints
Type this...
sudo sh -c "TERM=linux setterm -blank 0 >/dev/tty0"
Add this line to the bottom of your ~/.bashrc file to have the blank screen disabled on boot.

Perl Debugger: Filehandle as Input

I have this problem:
I need to control the perl-debugger from an external script.
By research I found out about various solutions, but I don't understand them.
I failed to properly set up the RemotePort option (editing ".perldb"), which was the first I tried, and found no useful information on providing a filehandle from which the debugger would get its input (by somehow setting #cmdfhs)
I found both options over here: http://search.cpan.org/~nwclark/perl-5.8.6/lib/perl5db.pl
It would be nice if you could tell me how to provide the filehandle from which the debugger gets its input, or if you know a link where this is explained?
Here's a simple example setting it up using RemotePort, which seemed easier to me:
The trick to using RemotePort is that you have to have someone listening on the remote end BEFORE you launch the script to be debugged.
As soon as you launch your script with -d Perl will attempt to connect to RemotePort. So you have to make sure the initial connection succeeds by having someone listening there beforehand.
Here I assume some Linux/Unix variant, which has the netcat utility installed. We use netcat to wait for incoming connections in this example, but you can use anything else you wish too which is able to create a service port and shuffle data between that and the current TTY:
In terminal 1:
# Use netcat to listen for incoming connections on port 9999
> nc -l -p 9999
In terminal 2:
# Start perl with -d and request a RemotePort connection
> PERLDB_OPTS=RemotePort=127.0.0.1:9999 perl -d my_script.pl
As soon as you do that in terminal 1 you will see something like this:
Loading DB routines from perl5db.pl version 1.39_10
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(my_script.pl:4):
DB<1>
There you go..debug away.
Devel::Trepan is a gdb-like debugger. Although it has remote control, you can also run it at the outset with the option --command which will "source" (in the gdb-sense) or run a series of debugger commands.
To go into remote control, either start the debugger using the --server option or inside the debugger use the "server" command once inside the debugger.
See Options for a list of options you can give at the outset.

phantomjs command line never works

I'm trying to run a command line in the phantomjs prompt (to create a PDF screenshot of a website)
So I launched phantomjs.exe and after the phantomjs> I typed :
phantomjs rasterize.js http://www.google.com test1.pdf
Whatever I type, I get a
Expected an identifier but found 'rasterize' instead
phantomjs://repl-input:1 in global code
(rasterize or any other thing I typed)
Even the help, I cannot call (-h / --help) http://phantomjs.org/api/command-line.html
Both phantomjs.exe and rasterize.js are on the same folder on my PC.
What am I doing wrong in the syntax ?
thanks
You have to run this script directly on your command line and not inside the phantomjs interpreter:
phantomjs rasterize.js http://www.google.com test1.pdf

perl debugger freezes

First time perl user and I am trying to debug some script to follow project logic and of course syntax.
Using cygwin after entering at command line $
$ perl -d sample.pl
Loading DB routines from perl5db.pl version 1.3
Editor support available.
Enter h or `h h' for help, or `perldoc perldebug' for more help.
main::(sample.pl:5): print 'Hello world.'; # Print a message
DB<1>
It hangs at the DB<1> line. I cannot enter anything at the prompt.
Is there a reason why this post is inappropriate? or how is this not clear?
This is the actual program code:
#!/usr/local/bin/perl
#
# Program to do the obvious
#
print 'Hello world.'; # Print a message
I upgraded my cygwin installation at home and ran into a similar problem (though maybe not the exact same problem -- the perl debugger still responds to my input but does not display my input, and fubars my input even after I quit the debugger). In the meantime while I figure what is going on, my workaround is to fire up xemacs, launch a shell (M-x shell), and run the perl debugger from the emacs buffer.
If this works for you, then there is something funky going on with your cygwin terminal settings. If your debugger hangs even in an emacs buffer, then something else funky is going on but I have no idea what it could be.
Sorry for reviving this three-year-old question, but I believe to have been hit with the same problem, and to have found the solution.
In my case, perl -de0 invokes infocmp from ncurses, which hangs in a weird way (can't kill it). And infocmp seemed to be a victim of my Avast anti-virus which is listed under BLODA as affecting Cygwin. Disabling it resolved the issue -- see if you have any of the listed applications and try disabling it (perhaps also try safe mode).
Also, simply renaming infocmp.exe allowed perl -d to run normally. In the end I used this approach and left my Avast running.
It could also be a different executable that perl -d is starting -- try to run whatever hangs with strace, see what is the last executable mentioned and try to see if that is the culprit.