arguments

Passing multiple arguments to a UNIX shell script

牧云@^-^@ 提交于 2020-01-31 18:26:09
问题 I have the following (bash) shell script, that I would ideally use to kill multiple processes by name. #!/bin/bash kill `ps -A | grep $* | awk '{ print $1 }'` However, while this script works is one argument is passed: end chrome (the name of the script is end) it does not work if more than one argument is passed: $end chrome firefox grep: firefox: No such file or directory What is going on here? I thought the $* passes multiple arguments to the shell script in sequence. I'm not mistyping

Takes exactly 3 arguments (4 given)

▼魔方 西西 提交于 2020-01-28 09:59:35
问题 i'm refactoring code in order to add object orientation and am just testing the code. pattern = r"((([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])[ (\[]?(\.|dot)[ )\]]?){3}([01]?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))" class Lineobject(object): def __init__(self, pattern, line): self.ip = self.getip(self, pattern, line) def getip (self, pattern, line): for match in re.findall(pattern, line): results = '' ips = match[0] usergeneratedblacklist.write(ips) usergeneratedblacklist.write('\n') return ips When

Problems with code when updating to Swift 2.0. “Cannot convert value..”

徘徊边缘 提交于 2020-01-26 04:00:32
问题 I have updated Swift to 2.0 and converted the code automatically but I have seen some errors yet that I would like to fix. One of them is : "cannot convert value of type '[AnyObject]' to expected argument type '[String]? This VC is created to launch an e mail screen in order to help users contact to me. Error is in the following line in func lanzarEmail : mailController?.setToRecipients(recipients) The code: import UIKit import MessageUI class tuPropiaHistoriaVC: UIViewController

Is it possible to have a CUDA kernel with varying number of parameters?

那年仲夏 提交于 2020-01-25 20:22:27
问题 I would like to make a kernel which takes a number of arguments, that is not set. Is this possible? I guess this does not work? But why? 回答1: if you are asking about typical C style vargs, then no. But because kernels support C++ linkage, there are template and name mangling tricks which can be used to instantiate different versions of a kernel with length and different types of argument lists. Note also that CUDA 7.0 introduces C++11 variadic template support. So there are options to do this

two level splatter TCL

半世苍凉 提交于 2020-01-25 19:01:05
问题 If I have a procedure or a command in TCL, with variable number of arguments, one can use, if a list's elements are as an input, the "splatter" operator, for example: set a [list "ko" ] set m [ list "ok" "bang" ] lappend a {*}$m But, what if I want to "twice splatter"? I.e., flatten 2 levels? Using it twice, in sequence, does not work: set a [list "ko" ] set m [ list [ list "ok" ] [ list "bang" ] ] lappend a {*}{*}$m Will error out on extra character. 回答1: You've noticed that {*}

Problem starting program (vcom) with multiple arguments in TCL

坚强是说给别人听的谎言 提交于 2020-01-24 21:09:05
问题 I'm trying to start a program (vcom) from a TCL script with extra options: set compilationArgs "-quiet -93" vcom $compilationArgs -work work polar2rect/sc_corproc.vhd But when I run this, I get following error message: # Model Technology ModelSim ALTERA vcom 6.5e Compiler 2010.02 Feb 27 2010 # ** Error: (vcom-1902) Option "-quiet -93" is either unknown, requires an argument, or was given with a bad argument. # Use the -help option for complete vcom usage. # /opt/altera/10.0/modelsim_ase

.htaccess mod rewriterule and ampersands

て烟熏妆下的殇ゞ 提交于 2020-01-24 17:21:04
问题 I've been struggling with this for two days right now. At the moment I have the following rewrite rule: RewriteRule ^(.*)$ index.php?u=$1 [NC,L] Which ports everything behind example.com/ to index.php as the GET variable u. Which is being processed in index.php with an explode to define te different arguments being: the city (between the first slashes) en the location (the second argument) THis works perfectly for the following urls: example.com/City/location/ or example.com/City/location

Python 3 Exception: TypeError: function missing 1 required positional argument: 'words'

大兔子大兔子 提交于 2020-01-24 13:43:45
问题 My function needs one argument words, but i want the program not to crash if no argument. def get_count(words): try: consonants_str = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ" vowels_str = "aeiouAEIOU" consonants_ls = [] vowels_ls = [] words_ls = [] result = {"vowels": 0, "consonants": 0}` for element in consonants_str: consonants_ls.append(element) for element in vowels_str: vowels_ls.append(element) if type(words) != type(None): for element in words: words_ls.append(element) for element

Python 3 Exception: TypeError: function missing 1 required positional argument: 'words'

限于喜欢 提交于 2020-01-24 13:43:27
问题 My function needs one argument words, but i want the program not to crash if no argument. def get_count(words): try: consonants_str = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ" vowels_str = "aeiouAEIOU" consonants_ls = [] vowels_ls = [] words_ls = [] result = {"vowels": 0, "consonants": 0}` for element in consonants_str: consonants_ls.append(element) for element in vowels_str: vowels_ls.append(element) if type(words) != type(None): for element in words: words_ls.append(element) for element

Python 3 Exception: TypeError: function missing 1 required positional argument: 'words'

我是研究僧i 提交于 2020-01-24 13:42:46
问题 My function needs one argument words, but i want the program not to crash if no argument. def get_count(words): try: consonants_str = "bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ" vowels_str = "aeiouAEIOU" consonants_ls = [] vowels_ls = [] words_ls = [] result = {"vowels": 0, "consonants": 0}` for element in consonants_str: consonants_ls.append(element) for element in vowels_str: vowels_ls.append(element) if type(words) != type(None): for element in words: words_ls.append(element) for element