variables

jq not replacing json value with parameter

梦想的初衷 提交于 2020-01-30 05:21:45
问题 test.sh is not replacing test.json parameter values ($input1 and $input2). result.json has same ParameterValue "$input1/solution/$input2.result" [ { "ParameterKey": "Project", "ParameterValue": [ "$input1/solution/$input2.result" ] } ] test.sh #!/bin/bash input1="test1" input2="test2" echo $input1 echo $input2 cat test.json | jq 'map(if .ParameterKey == "Project" then . + {"ParameterValue" : "$input1/solution/$input2.result" } else . end )' > result.json 回答1: shell variables in jq scripts

Using a String representing the name of a variable to set the variable

陌路散爱 提交于 2020-01-29 05:44:09
问题 This is a basic example that I know can be simplified, but for testing sake, I would like to do this in such a way. I want to set a variable based on an appending string (the variables "cam0" and "pos1" are already declared in the class). The appending string would essentially be an index, and i would iterate through a loop to assign cameras (cam0, cam1..) to different positions (pos0, pos1..). cam0 is defined as an UIImageView pos1 is defined as a CGRect This works for a NSString Variable

In Python, how to create a large number of variables in a loop? [duplicate]

寵の児 提交于 2020-01-26 04:09:20
问题 This question already has answers here : How can you dynamically create variables via a while loop? [duplicate] (8 answers) Closed 5 years ago . I'm looking for a way, in python 3.2, to create a large number of variables and assign them values. Something like X = 10 Y = 10 A = 0 B = 0 while X >= 0: while Y >= 0: cell[C]X[A] = A cell[C]Y[B] = B B = B + 1 Y = Y - 1 C = C + 1 A = A + 1 X = X - 1 Which would optimally create 200 variables of cell1X1, cell1Y1, cell2X1, cell2Y2, etc etc etc. Is

Maple Integration of two variables

谁说胖子不能爱 提交于 2020-01-25 20:14:15
问题 Im trying to find out how to type fig. 1 into maple: because when i do it myself i get fig. 2 This is about forced periodic vibrations. 回答1: It looks like you are integrating over "Tao" assuming everything else constant for integration. Why don't you redefine a new variable, say y = w*T and let maple evaluate? If it is just for typing as a text, you can first type in Math format and comment it out with # sign. 来源: https://stackoverflow.com/questions/36304861/maple-integration-of-two-variables

Is it possible to convert A string that is an equation with a variable into a equation?

萝らか妹 提交于 2020-01-25 12:16:34
问题 I need to convert a string returned from prompt into an equation, however the parseFloat returns as only the first number, and symbols in an equation, and stops at the variable. The variable will always = x . The program is designed to convert an algebraic expression say 15*x(5^4-56)*17/x=15 into an expression, and calculate the value of x. If someone could show me how to do this, it would help dramatically. I am currently using multiple prompts, having the user put in the equation before x ,

Is it possible to convert A string that is an equation with a variable into a equation?

大憨熊 提交于 2020-01-25 12:15:08
问题 I need to convert a string returned from prompt into an equation, however the parseFloat returns as only the first number, and symbols in an equation, and stops at the variable. The variable will always = x . The program is designed to convert an algebraic expression say 15*x(5^4-56)*17/x=15 into an expression, and calculate the value of x. If someone could show me how to do this, it would help dramatically. I am currently using multiple prompts, having the user put in the equation before x ,

Retrieve number via JSON and store in variable

China☆狼群 提交于 2020-01-25 12:09:26
问题 Alright so I am very new to programming and have only learned a little bit of basic C. https://api.vircurex.com/api/get_info_for_1_currency.json?base=DOGE&alt=BTC http://software.intel.com/en-us/html5/articles/how-to-access-JSON-data-in-HTML5-apps http://jsbin.com/IQUjUkiX/1/edit Basically what I want to do is retrieve the json from "http://pastebin.com/4SPcTFbQ" (Link 1) and store on of the numbers it returns in some sort of variable. (kind of like using scanf() to retrieve the number and

Printing line between variables, how do I stop this? [duplicate]

久未见 提交于 2020-01-25 10:12:09
问题 This question already has answers here : Python: Too much space between printing lines read from a text file [duplicate] (4 answers) Closed 5 days ago . Python code outputs a new line between first name, last name and email address, how can I stop this from happening? e.g. ogchu @gmail.com ogchu @yahoo.com ogchu @hotmail.com ogchu @aol.com ogchu @bigpond.com The first.txt and last.txt files have about 2,000 and 100 names respectively, so manually going through and doing stuff isn't really an

Objective-c Getting variable from another classe [duplicate]

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-25 07:50:06
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: Unable to access object of other class I've been working on a little project just to increase my comprehension of the objective-c syntaxe and functionalities but I'm stuck in my own project and can't find the answer. First I've got two classes and in my main one I have declare a object of my other class so I can use the functions from my other class. This is how I did it (I just wrote the thing that I thought

Struct not being populated

北城以北 提交于 2020-01-25 07:30:08
问题 I have a struct called Item and wish to populate its variables. struct Item { var title: String var others: [String] } Programs is an array of all the Item ’s created. var Programs = [Item]() I created a struct Item by the following: var entered = Item(title: hello1, others: ["hello2"]) The problem is that when I go to print the list of Items , the programs array is empty print(Programs) 回答1: You need to append it print("Before :",programs) let entered = Item(title: hello1, others: ["hello2"]