Less mixin with optional parameters

To supply a parameter that far down the string of arguments, you have to also supply the expected variable it is to define. So this: .fontStyle(‘NimbusSansNovCon-Reg’, 12px, @letter-spacing: 0.1em); Produces this (note how color, font-weight, and font-style used the defaults): font-family: ‘NimbusSansNovCon-Reg’; font-size: 12px; color: #ffffff; font-weight: normal; font-style: normal; letter-spacing: 0.1em;

In scala can I pass repeated parameters to other methods?

Java makes an assumption that you want to automatically convert the Array args to varargs, but this can be problematic with methods that accept varargs of type Object. Scala requires that you be explicit, by ascribing the argument with : _*. scala> def bar(args:String*) = println(“count=”+args.length) bar: (args: String*)Unit scala> def foo(args:String*) = bar(args: _*) … Read more

When is using the C# ref keyword ever a good idea?

The Framework Design Guidelines (a book by Krzysztof Cwalina and Brad Abrams) recommend to avoid both ref and out parameters. AVOID using out or ref parameters. Using out or ref parameters requires experience with pointers, understanding how value types and reference types differ, and handling methods with multiple return values. Also, the difference between out … Read more

Mutually exclusive powershell parameters

You can use the parameter attribute to declare multiple parameter sets. You then simply assign parameters that are mutually exclusive to different parameter sets. EDIT: This is also documented in ‘about_Functions_Advanced_Parameters’, under the section “ParameterSetName Named Argument”. This is how different sets of parameters is handled with cmdlets like Get-Random (which has mutually exclusive parameters): … Read more

How to set table name in dynamic SQL query?

To help guard against SQL injection, I normally try to use functions wherever possible. In this case, you could do: … SET @TableName=”<[db].><[schema].>tblEmployees” SET @TableID = OBJECT_ID(TableName) –won’t resolve if malformed/injected. … SET @SQLQuery = ‘SELECT * FROM ‘ + QUOTENAME(OBJECT_NAME(@TableID)) + ‘ WHERE EmployeeID = @EmpID’

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)