scripting

Unwinding promises and their handlers

狂风中的少年 提交于 2019-12-25 05:38:05
问题 I want to launch a sequence of tasks and I need they execute in order. When a button (#submitButton) is clicked on the entire process is launched (startAll function), so I implement an architecture like this: function startAll() { var startDeferred, highPriorityTasksDeferred, lowPriorityTasksDeferred, finalizeDeferred; startDeferred = $.Deferred; **highPriorityTasksDeferred= startDeferred.then(initialize).done(initiate); <-- ERROR HERE** lowPriorityTasksDeferred= highPriorityTasksDeferred

Applescript Syntax (Multiple Args) Inside Objective-C File

谁说我不能喝 提交于 2019-12-25 05:31:39
问题 I have been working on trying to run an Applescript from within Objective-C that queries out to the terminal to run some shell commands. I am running into an issue with how to format the command within Objective-C, so that the script object gets referenced properly. This is what the script looks like as an applescript set thisFile to "Dev1.4" set testTarget to "/Users/lab/Desktop/untitled" do shell script "/Users/lab/Desktop/TempRoot/myCommand.command " & thisFile & space & testTarget with

Scripting Java or C inside a VUser script to manipulate a web app in Ajax

只谈情不闲聊 提交于 2019-12-25 04:58:07
问题 I wonder if it is possible to script (in either C or Java) inside a vuser recorded script to control/manipulate elements, clicking radio-buttons and so forth on a web app/page using Ajax and being under test? Problem is that when running a vuser script against a web app implemented using Ajax, I need to manipulate page elements in order to get the script running further (using http-protocol) and because http-protocol is focused on recording http-traffic as in web requests and responses the

Does Browser load a whole block of JavaScript Before its execution?

有些话、适合烂在心里 提交于 2019-12-25 03:44:37
问题 Below is valid javascript code: <script> foo(); function foo() { alert("foo"); } </script> The function foo is invoked before its declaration. So, I think browser must load the whole block script before its execution. By "whole block", I mean a open tag to a clos tag or a external javascript file. Is this true? 回答1: Function statements are subject to hoisting . This means that regardless of where a function is declared, it is moved to the top of the scope in which it is defined. (function ()

identify error in if statement

让人想犯罪 __ 提交于 2019-12-25 03:44:36
问题 Here is the complete code.. What I'm trying to do is this - > I'm trying to find the average of the values in the second column of the files . If the file has 2.54 in its name, I want to find averages from files called file_2.54_even.xls and file_2.54_odd.xls . If the fiename does not have 2.54 in its name, then simply find the average of file. For example: file_1.60.xls #!/bin/bash for file in pmb_mpi tau xhpl mpi_tile_io fftw ; do for f in 2.54 1.60 800 ;do if [ ${f} = "2.54" ] then echo $

Bash - Remote Library

白昼怎懂夜的黑 提交于 2019-12-25 03:24:20
问题 We're two student working on a Bash Tools Box, and we come across a problem : Our local script use functions, stocked in two local libraries. Our script uses functions inside the first library, and this last uses functions inside the second one library. Script <-- Library1 <-- Library2 We can't fusion the two libraries in one. We actually use this command to run our script on a remote computer : ssh login@remoteIP bash < ~/script.sh The question is : How to set in the script the library

Groovy/Jenkins - How to use a for loop inside the http request body

Deadly 提交于 2019-12-25 03:24:08
问题 I am trying to dynamically read in an array (each element is a string) and use those string values to replace the current hardcoded user names. This is for creating pull request in Bitbucket. Both #1 and #2 below belongs to the same class BitbucketUtil.groovy 1: def createPullRequest(projectSlug, repoSlug, title, description, sourceBranch, targetBranch) { //this is reading in the array with the user names def names = BitbutkcetUtil.getGroupUsers(teamName, activeOnly) def prResponse = this

Add users in shell script with txt file

僤鯓⒐⒋嵵緔 提交于 2019-12-25 03:04:42
问题 I want to add some users who are in this file like: a b c d e f firstname lastname always #!/bin/bash Lines=$(cat newusers.txt | wc -l) first=$(cat newusers.txt | awk '{print $1}') last=$(cat newusers.txt | awk '{print $2}') #test echo $Lines; echo $first; echo $last; until [ -z $1]; then useradd - m -d /home/$1 -c "$1 + $2" $1 fi before loop it works fine but I can't add newline. The echo shows a c e and second for lastname b d f . I tried to add newline in but it doesn't works. What can i

google apps script - batch setValues() on Sheet

烂漫一生 提交于 2019-12-25 03:04:05
问题 In order to optimize my code, I'm trying to do the batch updates. Instead of calling setValues() on the loop, I want to store the data in an array, then do an setValues() once after the loop. However, I can't make it work: var tempValuesArr= []; var ctr = 0; for ....{ //there is only one row needed for every second sheet, get the data at the 2nd //row with 6 columns var secondSheetRange = secondSheet.getRange(2, 1, 1, 6); tempValuesArr.push(secondSheetRange.getValues()); ctr++; } //finally,

Bash script. Accept integer only if is from range

只谈情不闲聊 提交于 2019-12-25 02:33:03
问题 I have bash script with basic arithmetic operations - Addition, Subtraction, Division and Multiplication. #! bin/bash input="yes" while [[ $input = "yes" ]] do PS3="Press 1 for Addition, 2 for subtraction, 3 for multiplication and 4 for division: " select math in Addition Subtraction Multiplication Division do case "$math" in Addition) echo "Enter first no:" read num1 echo "Enter second no:" read num2 result=`expr $num1 + $num2` echo Answer: $result break ;; Subtraction) echo "Enter first no: