scripting

Batch script: navigation menu with highlighted selection

夙愿已清 提交于 2020-01-03 02:58:09
问题 I am obsessed with idea of mimicking functionality of 8-bit era programs by virtue of pure command line. So I want to make an array of menu options which can be selected with nominal (since there are no keymap for arrowkeys) left and right keys and confirmed with Enter. To keep things clear there is a working example I wrote. Please pay attention for ANSI escape codes I use A LOT, not sure if ESC control character would display in browser. @ECHO OFF ECHO Chose and option with [36mZ[0m for

Running a command for each line of a text file (Bash)

Deadly 提交于 2020-01-03 02:46:33
问题 I am working on a program that does the following: Reads 270 file in the folder X and calls another program to run a command with the contents of the file. For example: $ cat X/1.txt AAAA BBBB CCCC The program is supposed to read that text (there are 270 of them) and in the loop it's supposed to do: $python file.py AAAA; then python file.py BBBB; then python file.py CCCC. and the move on the next file like 22.txt (the files aren't numeric so a counter wouldn't be much help). I tried the

Stock Trading script/language for .NET?

*爱你&永不变心* 提交于 2020-01-03 02:30:15
问题 Is there a component I can use to create a stock trading/backtesting application in .NET? I am looking for something similar to TradeScript from ModulusFE: http://www.modulusfe.com/tradescript/ 回答1: It's not as easy as the guy above tries to make it sound. You're best to use TradeScript, MQL4, EasyLanguage or even MatLab - there are some back testing add-ons for MatLab. You do NOT want to roll your own. There's a lot more to it than meets the eye. 回答2: I don't know if I understand you

Using Boost::Python::Object causes linker errors

隐身守侯 提交于 2020-01-03 01:21:47
问题 So, I'm attempting to embed Python into C++. I have gotten fairly far in, and have been able to do basic things like run strings of Python. As soon as I tried to use Boost::Python::Object I began getting these 4 linker errors. I built boost using BJAM with Boost 1.54.0 and Python 2.7.5. Python Lib Build Commands: bootstrap .\b2 toolset=msvc-10.0 --with-python Minimal Code Example : #include <boost/python.hpp> #include <iostream> int main(int, char **) { Py_Initialize(); PyRun_SimpleString(

Eclipse Command Line Plugin

不羁岁月 提交于 2020-01-02 14:58:50
问题 I need an Eclipse Plugin run shell scripts under Linux. I have a beautiful Rsync script and I want a button in Eclipse to activate it. The best Solution would be if the Rsync shell script was also activated when I was saving Stuff, so maybe I can add a script builder or something like that. Anyone has a clue for both of the solutions? 回答1: You could use the eclipse external tools feature. For running shell scripts put in the location field /bin/sh and the argument should be the shell script

Eclipse Command Line Plugin

蓝咒 提交于 2020-01-02 14:58:11
问题 I need an Eclipse Plugin run shell scripts under Linux. I have a beautiful Rsync script and I want a button in Eclipse to activate it. The best Solution would be if the Rsync shell script was also activated when I was saving Stuff, so maybe I can add a script builder or something like that. Anyone has a clue for both of the solutions? 回答1: You could use the eclipse external tools feature. For running shell scripts put in the location field /bin/sh and the argument should be the shell script

Create Local User with Custom User Folder in Powershell

我的未来我决定 提交于 2020-01-02 13:26:09
问题 I am trying to create a new Win 2008 server local user and assign the user a different profile path. I don't want Windows to generate all the files under C:\Users\newUser, instead, I'd like to have it do that in D:\customDir\newUser. Does anyone know of a way to do this? So far this is what I have: $users= @("U1","U2","U3") $computer = [ADSI]"WinNT://$env:COMPUTERNAME,computer" $group = [ADSI]"WinNT://$env:COMPUTERNAME/MyCustomGroup,group" $users | foreach { $userName = $_ $userPath = "D:

Using Ant scriptfilter to count lines

落花浮王杯 提交于 2020-01-02 12:17:27
问题 I am trying to write an Ant <scriptfilter...> to change occurrences of the string "__LINE__" to the correct line number in Java source files. Does anyone have an example of using JavaScript (or some other embedded scripting language) to do this? In particular, how do I create a "global" variable that is initialized to 1 when the script starts and is incremented with each new line? Thanks. UPDATE: Just tried the solution offered by Martin Clayton (thanks!), replacing the JavaScript with

Can a script be automated after a commit on Perforce?

与世无争的帅哥 提交于 2020-01-02 09:56:27
问题 We use Perforce at work, and routinely keep software projects in the repository. In general creators follow the normal Perforce flow, BUT we also have a class of users, who doesn't have any need to edit the files but only read them. Currently we use P4Web but that requires the user so download each file individually to reassemble the project directory. Ideally I would like to have a process where when a user does a commit/submit in Perforce, the script would automatically run to generate a

Is there a way to download partial part of a webpage, rather than the whole HTML body, programmatically?

半腔热情 提交于 2020-01-02 08:24:24
问题 We only want a particular element from the HTML document at nytimes.com/technology. This page contains many articles, but we only want the article's title, which is in a . If we use wget, cURL, or any other tools or some package like requests in Python , whole HTML document is returned. Can we limite the returned data to specific element, such as the 's? 回答1: The HTTP protocol knows nothing about HTML or DOM. Using HTTP you can fetch partial documents from supporting web servers using the