parameters

How can I convert a PHP function's parameter list to an associative array?

I want to convert the arguments to a function into an associative array with keys equal to the parameter variable names, and values equal to the parameter values. PHP: function my_function($a, $b, $c) { // <--- magic goes here to create the $params array var_dump($params['a'] === $a); // Should result in bool(true) var_d...

Python __init__ setattr on arguments?

It seems that often __init__ methods are similar to this: def __init__(self, ivar1, ivar2, ivar3): self.ivar1 = ivar1 self.ivar2 = ivar2 self.ivar3 = ivar3 Is there someway to turn the arguments into a list (without resorting to *args or **kwargs) and then using setattr to set the instance variables, with the name of the p...

Converting C++ function to Delphi: what to do with void* parameter?

I'm writing a DLL in Delphi using the below C++ example: USERDLL_API double process_message (const char* pmessage, const void* param) { if (pmessage==NULL) { return 0; } if (param==NULL) { return 0; } if (strcmp(pmessage,"state")==0) { current_state *state = (current_state*) param; return process_state( (cu...

getting charconversion exception for " %" value in query parameter?

i am getting adding some of parameter in query string.value of these param can be "a%%","%" etc.on java code side .while parsing query parameter i m getting char conversionexception as shown below in exception log. 13:14:39,555 ERROR [STDERR] java.io.CharConversionException: EOF 13:14:39,555 ERROR [STDERR] at org.apache.tom...

Passing Parameters to New Sub of a User Control

Hi, In ASP.Net, is it possible to pass parameters to the "New" constructor of a User Control class? In VB.Net: Public Sub New(ByVal pRequiredParam As String) 'Do something with required Param End Sub When I use this user control in a generic ASP.Net page, it doesn't prompt me for "pRequiredParam". Of course, if this was a "normal...

How to process URL without specifying parameters

I was wondering if I could process an URL without specifing parameters. For example: http://www.example.com/Sometext_I_want_to_process I don't want to use: http://www.example.com/index.php?text=Sometext_I_want_to_process The site has to redirect to a different page after processing. What language choice do I have? ...

Hide autoincrement ids in GET parameter (PHP)

Hello! Problem: I have dynamic pages in PHP where the content is shown according to the given id. The id is always submitted via a GET parameter: page.php?id=X This causes a problem: Site visitors can enumerate the ids and simply walk through all the different content pages. This shouldn't be possible, of course. How could this be sol...

Where to perform argument validation in JavaScript?

Yeah, read properly. In the last time I saw different patterns of argument validation in JavaScript (functions) and wondered which of them would be best-practice. At first I'll show two example code snippets. The first shows an (in my words) "immediate" argument/condition validation and the second one a "delayed" validation. Each of them...

What Perl modules are useful for validating subroutine arguments?

I'm looking for a general-purpose module to take the drudgery out of validating subroutine and method arguments. I've scanned through various possibilities on CPAN: Params::Validate, Params::Smart, Getargs::Mixed, Getargs::Long, and a few others. Any information regarding pros and cons of these or other modules would be appreciated. Tha...

Include ":" character in parameter using Apache's mod_rewrite

I use something like that to pass to the parameter 'text' what follows after the domain RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?text=$1 [L,QSA] So if I have www.example.com/tralala I get $text='tralala' But I want it to be possible to have in the parameter the character ":...

Is it possible to pass parameters into a translated sentence in a .po translation file?

Hi, I am using .po and .mo files for translating my website. My question is, is it possible to pass parameters into a translated sentence in a .po translation file? For example: en -> Hi, my name is Sarah, and I am an alcoholic I want to translate that sentence using two params, name (Sarah) and profession (an alcoholic). Thank you ...

[C++/Templates] How to use a template parameter in another template parameter declared before

Hello, a template parameter can be used in another template parameter that follows it this way : template<typename T, T N> struct s { }; But is it possible to reference "T" if it is declared after "N" ? This does not work : template<T N, typename T> struct s { }; Can we help the compiler by pre-declaring "T" or doing anything els...

SPROC to update record: how to handle unchanged values

I'm calling a update SPROC from my DAL, passing in all(!) fields of the table as parameters. For the biggest table this is a total of 78. I pass all these parameters, even if maybe just one value changed. This seems rather inefficent to me and I wondered, how to do it better. I could define all parameters as optional, and only pass t...

Does SqlCommandParameter need SqlType to be set as SqlImage if value is bigger then 8KB?

Long time back in past I had read somewhere that if we want to enter data in "image" typed field of table whose value is more then 8kb, then we must explicitly specify parameter type to SqlImage. Is this true? I don't find any such documentation about it anymore. I tried to use Reflector to reverse engineer the SqlClient in order to see...

JSR168 portlet request cuts param value after # symbol

One of parameters for action link looks like: itemUrl=feedLink.html#xtor=RSS-3208 when I execute next code in backend in processAction(): String itemUrl = (String) request.getParameter("itemUrl"); ,that I get next value: feedLink.html e.g. request cuts itemUrl value after # symbol escapeXml="true" in .jsp file doesn't help. ...

Can JavaFX read and distinguish between repeating key value pairs?

There seems to be multiple ways to pass parameters to a JavaFX application. This will make the key value pairs for arg_# and their value accessible. <script src="http://dl.javafx.com/1.1/dtfx.js"&gt;&lt;/script&gt; <script> javafx( { archive: "JavaFXApplication.jar", width: 1014, he...

Characters allowed in GET parameter

Hello! Which characters are allowed in GET parameters without encoding or escaping them? I mean something like this: http://www.example.org/page.php?name=XYZ What can you have there instead of XYZ? I think only the following characters: a-z (A-Z) 0-9 - _ Is this the full list or are there additional characters allowed? I hope you...

MySQL rejecting parameter

Ok, I'm going crazy on this one. MySQL is throwing a fit about this bit of SQL: INSERT INTO `test_table` ( `column1`, `column2` ) VALUES ( ?COURSEID, ?COURSENAME ) You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'COURSENAME )' at line 1 My d...

Reporting Services 2005 - Parameter reliant on cascading parameters

Good day I have the following: In a SSRS 2005 report I have three report parameters: FinancialPeriodType ("Month" or "Week" in a DropDownList), FinancialPeriod (cascading DropDownList populated depending on first selection) and another parameter, OpeningBalance, of type float. The first two parameters are cascading i.e. the first par...

Java : logging execution history as XML

For debugging purposes, I need to follow the execution of some piece of code, within a class. I would like to generate a log for all method calls, in XML, like : <call class='pack.age.MyClass' method='myMethod1'> <param name='param1'>param1.toString() value</param> ... <call>Call to other method within myMethod1; you get the...