scripting

Where do I start when writing a new scripting “language”?

╄→尐↘猪︶ㄣ 提交于 2020-01-01 12:20:55
问题 I have a need to write a basic scripting/templating engine that will run under PHP. Ideally, I would be able to mix my own markup language with an (X)HTML template and run the document through a server-side parser to dynamically replace my own markup with (X)HTML served out of a database. Unfortunately, for all my knowledge of PHP and scripting, I'm not quite sure where to start. My first instinct was to run the entire document through some kind of regex parser and map my custom markup to

Generating plots in Gnuplot using loops

南楼画角 提交于 2020-01-01 10:06:09
问题 I would like to generate several plots using Gnuplot thats why I need to use loop. The data is loading from files "sort'i'.dat". The code is shown below but it doesn't work. I have got some problem with main loop. I don't know why it doesn't work, maybe it is connected with my version of Gnuplot. Thanks. do for [i=0:10] { set term png set output 'sort'.i.'.png' set title "Quick sort" set xlabel "Position number" set ylabel "Number on position" unset key plot 'sort'.i.'.dat' using 1:2 with

Exporting variables between shell script

别说谁变了你拦得住时间么 提交于 2020-01-01 09:43:11
问题 I have two independently running scripts. first one lets say script A calculates some values. And i want to echo these values from other script called B. These scripts will not call each other. I have used export keyword but didn't work. How can i do this? 回答1: If I understood the requirement then can't both scripts be simply executed in same sub shell, independently but without calling each other or without any need of an external file or pipe like this: Let's say this is your script1.sh #!

How to make Ruby file run as executable?

牧云@^-^@ 提交于 2020-01-01 09:42:43
问题 I want my Ruby Script File to run as executable from any directory of Windows XP. I have created a test.rb (Ruby Script file) and want to run it from any directory of my Windows as "test" for example, "C:\test" or "C:\Directory\test" runs my file test.rb. #!/usr/bin/envy ruby p "Hi this is my test file" I have added the shebang code in my ruby file but when I have to run the Ruby Script, I have to locate my Script file and run it expicitly as "ruby test.rb". I have also made the file

Display a drop-down/combo box in VB Script

寵の児 提交于 2020-01-01 09:19:45
问题 I'm trying to create a drop-down/combo box in VB Script. As per my understanding we need to create an instance for Internet Explorer and create a drop-down/combo box, something like this: set oIE = createObject("InternetExplorer.Application") with oIE .Navigate "about:blank" Do until .ReadyState = 4 : WScript.Sleep 100 : Loop set oDoc = .document .Visible = true end with with oDoc .open .writeln "<html><head><title>ComboBox Example</title></head>" .writeln "<body scroll=no><object " .writeln

Display a drop-down/combo box in VB Script

孤街浪徒 提交于 2020-01-01 09:19:12
问题 I'm trying to create a drop-down/combo box in VB Script. As per my understanding we need to create an instance for Internet Explorer and create a drop-down/combo box, something like this: set oIE = createObject("InternetExplorer.Application") with oIE .Navigate "about:blank" Do until .ReadyState = 4 : WScript.Sleep 100 : Loop set oDoc = .document .Visible = true end with with oDoc .open .writeln "<html><head><title>ComboBox Example</title></head>" .writeln "<body scroll=no><object " .writeln

Reading a value from a file in a windows batch script

微笑、不失礼 提交于 2020-01-01 08:59:32
问题 I'm trying to read a value from a file and use it in a subsequent command. I have a file called AppServer.pid which contains the process id of my app server (just the number, it's not a properties file or anything like that). The app server is hanging, so I want to take this value and pass it to the kill command. So my script will be something like SET VALUE_FROM_FILE=AppServer.pid # or something taskkill /pid %VALUE_FROM_FILE% /f Is there a convenient way to do this in Windows scripting? 回答1

get return code from plink?

妖精的绣舞 提交于 2020-01-01 08:57:08
问题 In a DOS batch script, I'm running a single command on a remote (also windows) computer using plink. Formerly, this command was only run on the local machine, and was relying on the return code to determine success. Is there a way to easily get this information back through plink? 回答1: That's not possible with plink . The current consensus is to have the remote script echo its exit code to a log file, then use pscp to transfer the log file to the local machine. See http://fixunix.com/ssh

How to share/reuse a Lua script for multiple entities?

假如想象 提交于 2020-01-01 07:08:13
问题 I'm in the design/skeleton coding phase of my C++ game with Lua scripting, but I have run into a design issue: The game will have many copies of the same kind of entities, with behavior controlled by the same script. Is there a straightforward way I can share the script between entities of the same type in a single lua_state? I have only been able to find this question asked a couple of times on the Internet; I have read mixed feedback on whether or not it's a good idea to load the same

Roslyn scripting: Line number information for run time exceptions

非 Y 不嫁゛ 提交于 2020-01-01 07:04:35
问题 I am messing around with the Roslyn scripting stuff (using the Microsoft.CodeAnalysis.CSharp.Scripting nuget package), and I wonder if there is a way to add line number information to the stack traces for exceptions that happen inside a script. When I run the following C# code: // using Microsoft.CodeAnalysis.CSharp.Scripting; var code = @" var a = 0; var b = 1 / a; "; try { await CSharpScript.RunAsync(code); } catch (DivideByZeroException dbze) { Console.WriteLine(dbze.StackTrace); } The