scripting

Can I run a windows batch file with hidden cmd window but see the programs started by the batch?

独自空忆成欢 提交于 2019-12-24 16:28:51
问题 I want to start a batch file in a hidden way. This discussion describes very well how it can be done: by using the CreateProcess API function. Using this method my started batch script is not visible. The problem is though that the programs (exes) called inside of the batch are hidden, too! My goal is to hide the started batch windows but show the windows of the applications called inside the batch. Is it possible? If so, how? Can I use the CreateProcess function for it or do I need another

Abaqus script measure/calculate surface area

流过昼夜 提交于 2019-12-24 15:58:00
问题 Is there a way to measure/calculate the surface area of a generated model with abaqus ? I'm familiar with Tools -> Query... -> Mass properties in abaqus CAE or the scripting version: from abaqus import * prop=mdb.models['Model'].rootAssembly.getMassProperties() However, I cannot find an equal command for surface area. Appreciate the help! 回答1: The function getArea() returns the surface area of a set of faces. For example: a = mdb.models['Model-1'].rootAssembly a.getArea(a.instances['Part-1-1'

Object Array Comparison with Custom Headers

匆匆过客 提交于 2019-12-24 15:22:57
问题 I have an object array of roles I pulled from two vcenters. I'm trying to make a formatted table that has 3 columns : roles, master, slave There would be "exists" or "missing" in the latter two columns. The problem I believe happening is when it finds that the role exists in the master, it somehow marks the slave column as "missing", even though I know it's there. I'm only a few months into Powershell, can anyone see anything wrong with my logic? edit: RoleTable.AllRoles, RoleTable

TSV: how to concatenate field 2s if field 1 is duplicate

折月煮酒 提交于 2019-12-24 14:52:48
问题 I'm building a Swedish-English sentence deck for ANKI from the Creative Common licensed content of tatoeba.org. Please help me turning sample 1 to sample 2 (preferably in bash): #sample1 a 1 a 2 b 3 c 4 c 5 #sample2 a 1<br>2 b 3 c 4<br>5 Duplicates in field 1 are always subsequent. Thank you! 回答1: One way using awk : awk 'p==$1{printf "<br>%s", $2;next}{if(p){print ""};p=$1;printf "%s", $0}END{print ""}' file a 1<br>2 b 3 c 4<br>5 回答2: perl -ape '$_ = ($l eq $F[0]) ? "<br>$F[1]" : "\n@F"; $l=

How to request nodal stress output in ABAQUS Python script

对着背影说爱祢 提交于 2019-12-24 14:50:18
问题 I need nodal stresses in the odb. I am aware that I can simply generate a query in the visualization module and therefore can obtain the averaged nodal stress (which I dont think will be of use as its performed after the analysis and I cannot do that in the odb as there is no nodal information for stresses). I can also edit the input file and use Position = NODES in the element output and then running the analysis by calling the input file as source. It generates stresses with nodal data and

Bash string operations unwanted remove new line characters

a 夏天 提交于 2019-12-24 13:51:02
问题 I'm completely new to bash scripting so excuse me.... I am trying to combine some html content with a template that contains standard headings, the template has a place-holder "REPLACEME" which I thought I could just find and replace on. The loop simply repeats the operation on all the files in the directory. REPLACEME="REPLACEME" for file in *.html do TEMPLATE=$(<../template/template.html) CONTENT=$(<$file) OUTPUT="${TEMPLATE/"$REPLACEME"/"$CONTENT"}" echo $OUTPUT > ../compiled/$file done

[: : integer expression expected Error

无人久伴 提交于 2019-12-24 13:25:54
问题 I am having issues with this script and don't know exactly what is happening. #Main Menu clear while [ "$input" -eq "0" ]; do clear #$input == 0 echo "Hello, What would you like me to do?" echo "" echo "1 = ALL TEH THINGZ!" echo "2 = Find the enemy postions and villages" echo "3 = Set the firewalls to my liking" echo "4 = Confuse the enemy" echo "5 = Deploy the spies!" echo "6 = DISABLED Run the TOP SECRET STUFF! (Note password is required)" echo "81 = Burn the bridges! (Cautian: Last Resort)

How do I populate a SQL Server Compact database?

ぃ、小莉子 提交于 2019-12-24 12:15:39
问题 So I'm building a windows app, and as a result, I'm going to use SQL Server Compact instead of the normal SQL Server as I figure it can then be run on any computer, not just one with SQL Server installed. The problem is from what I've seen, you can't seem to do any scripting in SQL Compact, you can't declare variables, you can only do one statement at one time. I generally have like a reference data script stored that I run everytime I rebuild the database. Is this possible in Compact? The

How to efficiently loop through the lines of a file in Bash?

纵饮孤独 提交于 2019-12-24 11:03:16
问题 I have a file example.txt with about 3000 lines with a string in each line. A small file example would be: >cat example.txt saudifh sometestPOIFJEJ sometextASLKJND saudifh sometextASLKJND IHFEW foo bar I want to check all repeated lines in this file and output them. The desired output would be: >checkRepetitions.sh found two equal lines: index1=1 , index2=4 , value=saudifh found two equal lines: index1=3 , index2=5 , value=sometextASLKJND I made a script checkRepetions.sh : #!bin/bash size=$

How can you make a php script only answer requests made from the same server?

孤者浪人 提交于 2019-12-24 10:56:56
问题 How can I get my PHP script to only answer requests if the requesting script is on the same domain? ** Edit: The PHP file is being accessed by an ajax request and is proxy, so I don't want others directly requesting it to come up, is this possible? 回答1: You could use $_SERVER['REMOTE_ADDR'] to compare the IP of the user requesting the page. Or you could simply make it a command line script that (obviously) requires you to run it from the command line. edit: You want to prevent people from