脚本

Python 3.4.1 script syntax error, arcpy &

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am used to working in python 2.7 so there was some new things like the print function being different. So excuse my ignorance. I am also pretty new to programming. So here is my script, I keep getting errors that highlight some commas or spaces and saying there is a SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 16-17: malformed \N character escape Code: import arcpy print("mosaic to new raster starting!") env.workspace = "F:\GDAL" arcpy.env.pyramid = "NONE" arcpy.env.rasterStatistics = "NONE" arcpy.env

Where do I put my Hello world PHP file on Ubuntu?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: So I want to learn PHP, and I've installed it with "sudo apt-get install php5" on my Ubuntu 14.04 machine. I see it also installed Apache. Now I've created my program, and I've saved it to a php file. <?php echo '<p>Hello World</p>'; ?> I know that I need to use something like http://localhost/myfile.php , but where do I put the file, so Apache will see it? 回答1: Pick a name for it lets use hello.php for this example. On Ubuntu the folder is /var/www/html , NOT /var/www . You will need root access for that. So you save the file as /var/www

Virtualenv “. venv/bin/activate” vs “source venv/bin/activate”

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: lets say i created a virtualenv called venv (virtualenv venv) From reading tutorials, i read there are 2 ways to activate virtual env: . venv/bin/activate source venv/bin/activate I think they both accomplish the same thing, but i dont understand whats going on. Also for number 1, doesnt the "." just mean the current folder? but it doesnt work if i just type in "venv/bin/activate" without the "." any help would be great! 回答1: . and source do exactly the same thing, with the only difference being that while source is more readable, it may not

Inside a bash script, how to get PID from a program executed when using the eval command?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have commands in a bash script that are similar to this: eval "( java -classpath ./ $classname ${arguments[@]} $redirection_options $file )" & pid=$! However if I do a ps $pid it shows the main script process instead of the process of the java program. It obtains the correct process when I omit the eval, but in order to get some of the complicated arguments to work correctly I need to use it. Any idea of how I can get the PID of the java program when it's executed within an eval command? 回答1: Your ampersand is backgrounding the eval line,

Can I pass an argument to a VBScript (vbs file launched with cscript)?

匿名 (未验证) 提交于 2019-12-03 02:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have this script saved in "test.vbs": Set FSO = CreateObject("Scripting.FileSystemObject") Set File = FSO.OpenTextFile(workFolder &"\test.txt", 2, True) File.Write "testing" File.Close Set File = Nothing Set FSO = Nothing Set workFolder = Nothing When I run the script I want to pass the value of the "workFolder" variable. How can I do this? Can I do it? Something like "cscript test.vbs workFolder:'C:\temp\'" perhaps? Bonus question: Is it neccessary to clean up the passed variable with "Set workFolder = Nothing" or does VBSCript do that

What is the default username and password for h2 when there&#039;s nothing explicit in JDBC?

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: From a program, I created a H2 database without specifying any user or password in the JDBC URL. Now I'm trying to access that database with the Script tool. The doc says to use -user sa in the default case. That doesn't work, and it still doesn't work if I either add -password sa or remove -user . What am I missing? /opt/h2/bin java -cp h2-1.3.161.jar org.h2.tools.Script -url jdbc:h2:/data/jug/jas-coref.h2 -user sa -password sa -script /data/jug/ris-start.sql Exception in thread "main" org.h2.jdbc.JdbcSQLException: Wrong user name or

Post-install script on Yocto-built linux

匿名 (未验证) 提交于 2019-12-03 02:54:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I need to run a script on a target OS built by Yocto. This script needs to be ran as part of the install and thus must be ran only once (either after the entire OS install or on the first boot). It cannot be ran on the host system, as it depends on the hardware IO which exists only on the target. An additional, minor, constraint is that the rootfs is mounted as read only, but I guess that can be avoided by having the script re-mount as rw and again remount as r after the execution or something along those lines. Any help is appreciated. 回答1:

VB6 Parser/Lexer/Scripter

匿名 (未验证) 提交于 2019-12-03 02:53:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've got a game in VB6 and it works great and all, but I have been toying with the idea of creating a scripting engine. Ii'm thinking I'd like VB6 to read in flat text script files for me and then lex/parse/execute them. I have good programming experience, and I've built a simple C compiler, as well as a LOGO emulator before. My question is: Are there any tools that I can use, like Lexx/Yakk/Bison to help me? How should I approach this problem in regards to lexing, parsing, and feeding the commands back to VB6 so I can handle them? Is this

Injecting jQuery into a page fails when using Google AJAX Libraries API

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'd like to inject jQuery into a page using the Google AJAX Libraries API, I've come up with the following solution: http://my-domain.com/inject-jquery.js : ;((function(){ // Call this function once jQuery is available var func = function() { jQuery("body").prepend('<div>jQuery Rocks!</div>'); }; // Detect if page is already using jQuery if (!window.jQuery) { var done = false; var head = document.getElementsByTagName('head')[0]; var script = document.createElement("script"); script.src = "http://www.google.com/jsapi"; script.onload = script

Require.js ignoring baseUrl

匿名 (未验证) 提交于 2019-12-03 02:52:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: OK this is driving me crazy so maybe someone can point me in the right direction... I'm using the latest require.js combined with jquery as my module loader. I am using the data-main attribute to point to a config file with a baseUrl . When I try to load a module the baseUrl is ignored and require is attempting to load from the same location as main.js . /js/main.js require.config({ baseUrl: '/js/vendor/' }); /path/to/page.html <script data-main="/js/main" src="/js/vendor/require-jquery.js"></script> <script> require(['jquery', 'bootstrap'],