脚本

How to have Emacs save file at multiple locations?

匿名 (未验证) 提交于 2019-12-03 03:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there an easy way to have emacs save current buffer in two locations? I could in the 'after-save-hook' programmatically copy the current file to a second location, but writing lisp code for that might take some time. For those that are curious why I want this: I want the changes I make to my JSP immediately be deployed in tomcat's webapps/myapp directory. So everytime I save a JSP file I want it saved in both my current version controlled source location as well as in the directory where my Tomcat application is deployed. I can't use

Python CGIHTTPServer crashes with “OSError: [Errno 13] Permission denied”

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am running the following command from my home directory: python -m CGIHTTPServer This runs the server, but when I try to access a script in the cgi-bin directory I get: Traceback (most recent call last): File "/usr/lib/python2.7/CGIHTTPServer.py", line 251, in run_cgi os.execve(scriptfile, args, env) OSError: [Errno 13] Permission denied Running as root does not make a difference. The files seem to have all the right permissions: student@bandersnatch:~$ ls -lhR .: total 12K drwxr-xr-x 2 student student 4.0K Jun 13 18:38 cgi-bin drwxr--r--

Granting permission to users on different schema

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have tables in Schema A. I created views in Schema B using the tables in schema A. I want to grant permissions to a user to select the data from view in Schema B. For this to work i know we have to enable the grant option on tables in Schema A to user B. But I want to do it in a single script (This script has to be in schema B). Is there a way to do this using the user name/password of schema A. 回答1: It's not unusual to want to have a single script to deploy a change. The thing is, such a script needs to be run by a power user, because it

Forwarding emails with a PHP script

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: We have a cron'ed PHP script that checks an inbox every ten minutes. The purpose of this script is to handle "STOP to quit" functionality for our SMS notification service we provide. If the script finds any emails with the word "STOP" at the beginning of the email, we remove the user from our notification database. To cover our bases, we'd like any emails that don't meet the above criteria to be forwarded on to another email address (which is an alias) that several people receive and check hourly. However, we're running into problems

Javascript Gallery that automatically uses all large images on page

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a site with lots of images on one large page. The easiest would be a Script that i could include, that automatically searches through that same page and uses all images larger than 100px to create a slideshow gallery from them. Anyone knows such an easy script, that doesent need any programming skills? I found this for a start: jQuery get all images within an element larger than a specific size To get all images larger that some size you can use something like this: var allImages = $ ( 'img' , yourDivElement ) var

Edit shell script while it's running

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Can you edit a shell script while it's running and have the changes affect the running script? I'm curious about the specific case of a csh script I have that batch runs a bunch of different build flavors and runs all night. If something occurs to me mid operation, I'd like to go in and add additional commands, or comment out un-executed ones. If not possible, is there any shell or batch-mechanism that would allow me to do this? Of course I've tried it, but it will be hours before I see if it worked or not, and I'm curious about what's

InvalidStateError: “An attempt was made to use an object that is not, or is no longer, usable” in basic Google Map tutorial example

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have an XML, which is transformed to HTML via an XSLT. The XML is able to contain JavaScript, and it translates this correctly to HTML, as I do in many other pages as well. It just does not work with GoogleMaps, and I suspect, my JavaScript is faulty somewhere. The relevant sections of the resulting HTML look like posted below. What's happening in the HTML/in the Scripts: The API is loaded from googleapis.com A div with the ID map_canvas is created. A function start() is defined, which is started via <body onload="start();"> . In this

Python &#039;source HOME/.bashrc&#039; with os.system()

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am writing a python script (Linux) that is adding some shell aliases (writes them to HOME/.bash_aliases ). In order to make an alias available immediately after it was written I should issue the following bash built-in: source HOME/.bashrc source is a bash built-in so I cannot just: os.system(source HOME/.bashrc) If i try something like: os.system('/bin/bash -c source HOME/.bashrc') ...will freeze the script (just like is waiting for something). Any suggestions ? 回答1: What you want is not possible. A program (your script) cannot modify the

How can I get one Perl script to see variables in another Perl script?

匿名 (未验证) 提交于 2019-12-03 03:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a Perl script that is getting big, so I want to break it out into multiple scripts. namely, I want to take out some large hash declarations and put them into another file. How do I get the original script to be able to see and use the variables that are now being declared in the other script? This is driving me nuts because I haven't used Perl in a while and for the life of me can't figure this out 回答1: Use a module: package Literature ; our % Sidekick = ( Batman => "Robin" , Bert => "Ernie" , Don => "Sancho" , ); 1 ; For

Apache (2) throws “No such file or directory: exec of &#039;/usr/lib/cgi-bin/fst.cgi&#039; failed”

匿名 (未验证) 提交于 2019-12-03 03:05:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am working in Ubuntu 10.10 (Maverick Meerkat) and running my CGI script under Apache , but it is showing me the following error... [Sat errorNo such file or directory: exec of '/usr/lib/cgi-bin/fst.cgi' failed [Sat Oct 22 02:56:45 2011] [error] [client 127.0.0.1] Premature end of script headers: fst.cgi My script is #!/usr/bin/perl print "Content-type:text/html\n\n"; print "hello world"; I have set the permissions of the file... I have also added the following line in file apache.conf : ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ <Directory