parameters

Hibernate positional parameters zero based

有些话、适合烂在心里 提交于 2019-12-10 13:28:42
问题 I'm migrating a project from Hibernate 4.2.6 to 5.2.0. I noticed that for Hibernate 5.2.0, the native queries now require zero based parameter positionning. According to the JPA 2.1 Specification 3.10.13 Positional Parameters Only positional parameter binding and positional access to result items may be portably used for native queries, except for stored procedure queries for which named parameters have been defined. When binding the values of positional parameters, the numbering starts as “1

How can I pass nested parameter value to service in Symfony2

£可爱£侵袭症+ 提交于 2019-12-10 13:19:55
问题 For example, in my services.yml file next code: parameters: social: facebook: app_id: 123456789 secret: dkl41a5dw1daw11d1wa135451awwlflaw google: id: 12548411654 services: bw.user.social: class: BW\UserBundle\Service\SocialService arguments: [%social.facebook%] This method does not work. I can use this: services: bw.user.social: class: BW\UserBundle\Service\SocialService arguments: [%social%] But it's not exactly what I need. How can I pass only facebook value without google and , it's very

Namespace constraint with generic class declaration

↘锁芯ラ 提交于 2019-12-10 13:18:31
问题 I would like to know if (and if so how) it is possible to define a namespace as a constraint parameter in a generic class declaration. What I have is this: namespace MyProject.Models.Entities <-- Contains my classes to be persisted in db namespace MyProject.Tests.BaseTest <-- Obvious i think Now the decleration of my 'BaseTest' class looks like so; public class BaseTest<T> This BaseTest does little more (at the time of writing) than remove all entities that were added to the database during

How can I pass a variable name as part of a parameter to a batch file and then use it?

杀马特。学长 韩版系。学妹 提交于 2019-12-10 13:18:19
问题 I'm trying to run a batch file that accepts a string which includes a variable name. The variable will then be used in the batch file. For example... C:\>test.bat user%num% In the batch file... set num=1 (This is where I need help... Somehow set domainusername=user1) echo %domainusername% set num=2 ... The idea is to allow the batch call to work in the same way regardless of where the variable name is. Examples.. C:\>test.bat %num%user or C:\>test.bat us%num%er Edit: I've already done a fair

Key value pair as a param in a console app

自闭症网瘾萝莉.ら 提交于 2019-12-10 13:18:17
问题 Is there an easy way to allow a collection of Key/Value pairs (both strings) as command line parameters to a console app? 回答1: If you mean having a commandline looking like this: c:> YourProgram.exe /switch1:value1 /switch2:value2 ... This can easily be parsed on startup with something looking like this: private static void Main(string[] args) { Regex cmdRegEx = new Regex(@"/(?<name>.+?):(?<val>.+)"); Dictionary<string, string> cmdArgs = new Dictionary<string, string>(); foreach (string s in

Convert list to params C#

笑着哭i 提交于 2019-12-10 13:02:30
问题 I have this following list: var myList = new List<KeyValuePair<string, object>>(); And this function: public void Test(params KeyValuePair<string, object>[] list) How can I do a conversion of the list to params when using the function? Like that: Test(myList); 回答1: You method declaration KeyValuePair<string, object>[] list states that it will accept an array so you need to convert your list to array like this Test(myList.ToArray()); 回答2: Given the original question, I think it's worth

should I include the @ when using SqlCommand.Parameters.AddWithValue?

£可爱£侵袭症+ 提交于 2019-12-10 12:55:43
问题 I have always included the at sign in the parameter name when using AddWithValue, but I just noticed some code written by someone else that doesn't use it. Is one way more correct than the other? cmd.Parameters.AddWithValue("ixCustomer", ixCustomer); or cmd.Parameters.AddWithValue("@ixCustomer", ixCustomer); 回答1: No, both are equivalent in the end. I personally tend to use the notation with the @ sign myself, to be consistent with the T-SQL code for stored proc I write. But as far as I know,

VBScript: Passing a parameter with a null value to a stored procedure?

亡梦爱人 提交于 2019-12-10 12:35:34
问题 In VBScript (ASP environment), is it possible to pass a parameter with a null value to a stored procedure? 回答1: Passing null to a stored procedure, using a command object. Set cn = CreateObject("ADODB.Connection") Set cmd = CreateObject("ADODB.Command") cn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Data Source=.\Test" Set cmd.ActiveConnection = cn cmd.CommandText = "TestTable.sp_ModifyData" cmd.CommandType = 4 cmd.NamedParameters = True set cnParam = cmd.CreateParameter("@RowID",3,3,,

Replacing named 'parameters' within a string in PHP

三世轮回 提交于 2019-12-10 12:16:23
问题 SOLVED: Thanks to @SJFrK, my issue has been solved. The following class allows me to do what I need. The question follows the class. class Redirects { /* |-------------------------------------------------------------------------- | Placeholder Types |-------------------------------------------------------------------------- | | An array of placeholder types thatalow specific characters in a source | route or URL. | */ private static $placeholders = array( ':all' => '.*', ':alpha' => '[a-z]+',

Plotting a function with one parameter (MATLAB)

烂漫一生 提交于 2019-12-10 12:07:54
问题 I would like to plot an function fx(y) = 3*y-y.^(3)-x with x being a parameter. I would like to graph fx(y) versus y for x varying over 0:0.5:6 all in one graph. For some reason it only works when you give x a single value and then use a anonymous function, but this is not what I need. x=@(y) 3.*y-y.^(3)-x; ezplot(fx) This gives me 3y-y^(3)-x = 0, but this is not what I need. I need to have a graph of fx versus y for the parameter x changing from 0 to 6 in steps of 0.5. This would give me