parameters

bash command output as parameters

夙愿已清 提交于 2019-12-10 15:30:15
问题 Assume that the command alpha produces this output: a b c d If I run the command beta $(alpha) then beta will be executed with four parameters, "a" , "b" , "c" and "d" . But if I run the command beta "$(alpha)" then beta will be executed with one parameter, "a b c d" . What should I write in order to execute beta with two parameters, "a b c" and "d" . That is, how do I force $(alpha) to return one parameter per output line from alpha ? 回答1: Similar to anubhava's answer, if you are using bash

What are the RESTful best practices on defining a query parameter with an or condition?

隐身守侯 提交于 2019-12-10 14:58:26
问题 I would like to know, following RESTful best practices in which ways should I define an url like the following: /people?q="email=aa@aa.com||phone=11111" The point would be to search for a person either by their email address or phone depending on what they've inserted on a search box. I've been reading a few guides on best practices in using RESTful services but none seem to talk about this situation. 回答1: REST means you follow standards by building the (uniform) application interface.

can't use an undefined value as a symbol perl

最后都变了- 提交于 2019-12-10 14:46:49
问题 I'm trying to write in file some value taken from an array. But I'm having some error ''Can't use an undefined variables as a symbol reference at... line 81: foreach $k (sort keys %{$value2}){ print $value4 $k." = ".%{$value2{$k}}. $value3; sub printit{ $value1 = $_[0];#"ipadress" is a string $value2 = $_[1];#%hash2 $value3 = $_[3];#"paquet" is a string $value4 = $_[4];#SOURCE is the file name foreach $k (sort keys %{$value2}){ print $value4 $k." = ".%{$value2{$k}}. $value3; if (%{$value2{$k}

Avoid certain parameter combinations in GridSearchCV

笑着哭i 提交于 2019-12-10 14:42:27
问题 I'm using scikit-learn's GridSearchCV to iterate over a parameter space to tune a model. Specifically, I'm using it to test different hyperparameters in a neural network. The grid is as follows: params = {'num_hidden_layers': [0,1,2], 'hidden_layer_size': [64,128,256], 'activation': ['sigmoid', 'relu', 'tanh']} The problem is that I end up running redundant models when hidden num_hidden_layers is set to 0 . It will run a model with 0 hidden layers and 64 units, another with 128 units, and

how to pass a function name via JSON and call it in javascript/jQuery?

旧时模样 提交于 2019-12-10 14:17:09
问题 I have a JSON string which includes a function I need to call. My JSON looks like this: { "type":"listview", // the function I would like to call "content":"dynoData.getRetailers()", "custom_classes":["","nMT pickList","",""], "lib":"static_listview.html", "tmp":"tmp_listview_inset", "lang":"locale_search", ... I'm using this to assemble a jQuery Mobile listview on the client. To get the dynamic data, I need to call dynoData.getRetailers() . However I'm struggling to make the call :-) This is

How can I pass a null value for date in vb.net to sql stored procedure?

萝らか妹 提交于 2019-12-10 14:15:07
问题 My application is asp.net with vb. In my page I have a textbox for passing date. If I didn't enter date and on clicking submit, I have to pass null value to the stored procedure. I tried following codes such as DBNull.Value and DateTime.MinValue . In that case instead of null, "#12:00:00#" is passing. I have to pass Null. 回答1: Just assign the parameter the value DBNull.Value [EDIT] If you are using SqlParameter (thanks Jon) then you can set it like this if it gives any error parameter.Value =

Properly used NSGetExecutablePath

不打扰是莪最后的温柔 提交于 2019-12-10 13:57:30
问题 I try to get the path to my application at runtime. I found some old sources from C and converted it accordingly to the functions parameter type definition: var path = [Int8] (count:1024, repeatedValue: 0) var bufsize : UInt32 = 1024 if _NSGetExecutablePath(&path, &bufsize) == 0 { println("executable path is \(path)") } It runs, but I need an Int8 array, not a string. So I have to search for the end of the character chain and convert it back to a string. What is the correct way to use this

How to determine if optional arguments are passed in Ruby

送分小仙女□ 提交于 2019-12-10 13:56:22
问题 If I have the following method in Ruby: def foo(arg1, arg2 = "bar") puts arg1 puts arg2 end Is there a way of determining if a user passed a value in for arg2 within the method? Obviously I could just add if arg2 == "bar" to the method, but this doesn't catch the case where the user manually passed in "bar" herself. Of course, I could set the default to be something that no user would ever pass in, but then that gets pretty ugly pretty quickly. Is there anything elegant out there? 回答1: I am

Laravel 5 route parameters not send

☆樱花仙子☆ 提交于 2019-12-10 13:35:38
问题 With Laravel 5 I'm not able to setup get route parameters. My route is setup like this: Route::get('test', 'TestController@test'); And my TestController looks like this: public function test(Request $request) { var_dump($request->input('foo')); } When I browse to that route with a parameter /test?foo=bar the result is NULL. Can anybody tell me what I'm doing wrong? The Input::get('foo') syntax doesn't work either (and is not even mentioned in the documentation for L5). Update: I'm using

Passing id through an link href in Laravel

前提是你 提交于 2019-12-10 13:34:26
问题 is it possible to pass id through an link href in Laravel and display that page like /projects/display/2. I have this link: <td><a href="{{ url('projects/display', $projects->id) }}" class="btn btn-info">View</a></td> It displays the id when hovering over the link as /projects/display/2. But whenever i click on the link i get an error message of: Sorry, the page you are looking for could not be found. I have a view setup called projects/display, plus routes and controller. routes: <?php Route