How to pass a variable to the SelectCommand of a SqlDataSource?

Try this instead, remove the SelectCommand property and SelectParameters: <asp:SqlDataSource ID=”SqlDataSource1″ runat=”server” ConnectionString=”<%$ ConnectionStrings:itematConnectionString %>”> Then in the code behind do this: SqlDataSource1.SelectParameters.Add(“userId”, userId.ToString()); SqlDataSource1.SelectCommand = “SELECT items.name, items.id FROM items INNER JOIN users_items ON items.id = users_items.id WHERE (users_items.user_id = @userId) ORDER BY users_items.date DESC” While this worked for me, the following code also … Read more

Should I use the same name for a member variable and a function parameter in C++?

That is correct, and allowed by the Standard. But a better approach is to use some naming-convention for member variables. For example, you could use m_ prefix for all member variables, then anyone could infer what m_state is. It increases the readability of the code, and avoids common mistakes. Also, if m_state is the member, … Read more

What does -n mean in Bash?

The -n argument to test (aka [) means “is not empty”. The example you posted means “if $1 is not not empty. It’s a roundabout way of saying [ -z “$1” ]; ($1 is empty). You can learn more with help test. $1 and others ($2, $3..) are positional parameters. They’re what was passed as … Read more

RSpec testing redirect to URL with GET params

From the documentation, the expected redirect path can match a regex: expect(response).to redirect_to %r(\Ahttp://example.com) To verify the redirect location’s query string seems a little bit more convoluted. You have access to the response’s location, so you should be able to do this: response.location # => http://example.com?foo=1&bar=2&baz=3 You should be able to extract the querystring params … Read more

Groovy: isn’t there a stringToMap out of the box?

You might want to try a few of your scenarios using evaluate, it might do what you are looking for. def stringMap = “[‘a’:2,’b’:4]” def map = evaluate(stringMap) assert map.a == 2 assert map.b == 4 def stringMapNested = “[‘foo’:’bar’, baz:[‘alpha’:’beta’]]” def map2 = evaluate(stringMapNested) assert map2.foo == “bar” assert map2.baz.alpha == “beta”

Access parameter from the Command Class

Simple way, let command extend ContainerAwareCommand $this->getContainer()->getParameter(‘parameter_name’); or You should create seperate service class $service = $this->getContainer()->get(‘less_css_compiler’); //services.yml services: less_css_compiler: class: MyVendor\MyBundle\Service\LessCompiler arguments: [%less_compiler%] In service class, create constructor like above you mentioned public function __construct($less_compiler) { $this->less_compiler = $less_compiler; } Call the service from command class. Thats it. Reason: You are making command class … Read more

tech