parameters

Why couldn't deduce const& template parameter?

允我心安 提交于 2020-01-03 17:05:34
问题 Consider this code: constexpr int TEN = 10; template < const int& > struct Object { }; template < const int& II > void test(Object<II>) { } Then the calls: test<TEN>(Object<TEN>{}); // passes test(Object<TEN>{}); // FAILS The second call fails to compile with error message: error: no matching function for call to ‘test(Object<TEN>) note: candidate: template<const int& II> void test(Object<II>) note: template argument deduction/substitution failed: note: couldn't deduce template parameter ‘II’

C# ShortCut Path Modification

我只是一个虾纸丫 提交于 2020-01-03 15:33:25
问题 I've created a program which generates a shortcut to a specific EXE selected via the open file dialog, using some library. I got it to work but I want the program to add a parameter to the Target path to make it look like this: ( "E:\Cod4\iw3mp.exe" +Seta Map mp_crash ). What can I do to add the ( + Seta Map mp_Crash ) part after the " mark without removing it or ruining the extension of the .exe? Here is block of the code I wrote to add the parameter: label1.Text = openFileDialog1.FileName;

Dispose object that has been instantiated as method parameter c#

£可爱£侵袭症+ 提交于 2020-01-03 14:05:10
问题 I have the following classes: private static readonly string ConnectionString = "Dummy"; public static SqlConnection GetConnection() { SqlConnection Connection = new SqlConnection(ConnectionString); return Connection; } public static SqlDataAdapter GetDataAdapter(string Query) { SqlDataAdapter Adapt = new SqlDataAdapter(Query, GetConnection()); return Adapt; } How do I dispose the SqlConnection object that is instantiated when GetConnection() is passed as parameter in my SqlDataAdapter

HttpUrlConnection addRequestProperty Method Not Passing Parameters

微笑、不失礼 提交于 2020-01-03 08:58:10
问题 I have some working java code which does the following: URL myUrl = new URL("http://localhost:8080/webservice?user=" + username + "&password=" + password + "&request=x"); HttpURLConnection myConnection = (HttpURLConnection) myUrl.openConnection(); myConnection.setRequestMethod("POST"); // code continues to read the response stream However, I noticed that my webserver access log contained the plaintext password for all of the users who connected. I would like to get this out of the access log,

Is it possible to marshal ref parameters in SAFEARRAY

旧时模样 提交于 2020-01-03 07:44:33
问题 Here is my C# server method: public void Exec(out int status, string output) { status = 3; Console.WriteLine("Exec({0}, ...)", status); output = string.Format("Hello from .NET {0}", DateTime.Now); Console.WriteLine("Exec(..., {0})", output); } My C++ client is setting up and calling this method. This works fine, but the status and output variables don't appear to be chaining. It's as though they're being passed by value instead of by reference. Here's my client code: InitCLR(); LONG index = 0

Escape apostrophe when passing parameter in onclick event

时间秒杀一切 提交于 2020-01-03 07:30:34
问题 I'm passing the company name to an onclick event. Some company names have apostrophes in them. I added '.Replace("'", "'")' to the company_name field. This allows the onclick event to fire, but the confirm message displays as "Jane&# 39;s Welding Company". <a href="#" onclick="return Actionclick('<%= Url.Action("Activate", new {id = item.company_id}) %>', '<%= Html.Encode(item.company1.company_name.Replace("'", "'")) %>');" class="fg-button fg-button-icon-solo ui-state-default ui-corner-all">

Pass Parameters in render - Rails 3

我与影子孤独终老i 提交于 2020-01-03 07:27:28
问题 I've seen a couple questions on this but haven't been able to solve it... I'm trying to pass a parameter while rendering a partial (similar to domainname.com/memory_books/new?fbookupload=yes) Right now, I use this line: <%= render :partial => '/memory_books/new', :fbookupload => "yes" %> and in the partial, I have tried to get the content of fbookupload by using: <%= fbookupload %> which gives an "undefined local variable" error and <%= params.inspect %> which does not show fbookupload as a

Accepting an optional parameter only as named, not positional

佐手、 提交于 2020-01-03 07:22:08
问题 I'm writing a PowerShell script that's a wrapper to an .exe. I want to have some optional script params, and pass the rest directly to the exe. Here's a test script: param ( [Parameter(Mandatory=$False)] [string] $a = "DefaultA" ,[parameter(ValueFromRemainingArguments=$true)][string[]]$ExeParams # must be string[] - otherwise .exe invocation will quote ) Write-Output ("a=" + ($a) + " ExeParams:") $ExeParams If I run with the a named param, everything is great: C:\ > powershell /command \temp

Changing parameters within function for use with ODE solver

余生颓废 提交于 2020-01-03 05:47:10
问题 Is is it possible to use an ODE solver, such as ode45, and still be able to 'change' values for the parameters within the called function? For example, if I were to use the following function: function y = thisode(t, Ic) % example derivative function % parameters a = .05; b = .005; c = .0005; d = .00005; % state variables R = Ic(1); T = Ic(2); y = [(R*a)-(T/b)+d; (d*R)-(c*T)]; with this script: clear all % Initial conditions It = [0.06 0.010]; % time steps time = 0:.5:10; % ODE solver [t,Ic1]

Multiple optional query parameters with PostgreSQL

眉间皱痕 提交于 2020-01-03 05:45:08
问题 I use PostgreSQL10 and I want to built queries that have multiple optional parameters. A user must input area name, but then it is optional to pick none or any combination of the following event, event date, category, category date, style So a full query could be "all the banks (category), constructed in 1990 (category date) with modern architecture (style), that got renovated in 1992 (event and event date) in the area of NYC (area) ". My problem is that all those are in different tables,