Nested calc operations
Apparently you have to assign px or % to all numbers that are not being multiplied or divided. width: calc((100% / 7) – 2px); Well I feel dumb now. Haha.
Apparently you have to assign px or % to all numbers that are not being multiplied or divided. width: calc((100% / 7) – 2px); Well I feel dumb now. Haha.
The below regex will match the strings that start and end with an alpha character. /^[a-z].*[a-z]$/igm The a string also starts and ends with an alpha character, right? Then you have to use the below regex. /^[a-z](.*[a-z])?$/igm DEMO Explanation: ^ # Represents beginning of a line [a-z] # Alphabetic character .* # Any character 0 … Read more
The code to create the expression dynamically would be like this: ParameterExpression parameter = Expression.Parameter(typeof (GoalsModelUnitOfWork), “i”); MemberExpression property = Expression.Property(parameter, “AcademicCycles”); var queryableType = typeof (IQueryable<>).MakeGenericType(typeof (AcademicCycle)); var delegateType = typeof (Func<,>).MakeGenericType(typeof (GoalsModelUnitOfWork), queryableType); var yourExpression = Expression.Lambda(delegateType, property, parameter); The result will have the desired type, but the problem is that the return … Read more
Why don’t you try this: http://wiki.tcl.tk/11415 or something like this too: http://wiki.tcl.tk/13885 I hope these are easy to use alternatives for the mentioned utility.
=~ succeeds if the string on the left contains a match for the regex on the right. If you want to know if the string matches the regex, you need to “anchor” the regex on both sides, like this: regex=’^[0-9][0-9][_][0-9][0-9][_][0-9][0-9]$’ if [[ $incoming_string =~ $regex ]] then # Do awesome stuff here fi The ^ … Read more
The simplest way is to use OrderBy(e => String.IsNullOrEmpty(e.TeamName) This doesn’t require any extension method or custom IComparer implementation etc. var entries = repository.Race.Where(e => e.EventId == id) .OrderBy(e => String.IsNullOrEmpty(e.TeamName)) .ThenBy(e => e.LastName) .ThenBy(e => e.FirstName);
Sure… you just need to compile your lambda and then invoke it… object input = 4; var compiledLambda = lambda.Compile(); var result = compiledLambda.DynamicInvoke(input); Styxxy brings up an excellent point… You would be better served by letting the compiler help you out. Note with a compiled expression as in the code below input and result … Read more
In simple terms, if you mix types of the same rank (in the sequence of int, long int, long long int), the unsigned type “wins” and the calculations are performed within that unsigned type. The result is of the same unsigned type. If you mix types of different rank, the higher-ranked type “wins”, if it … Read more
I didn’t find any answer, so here is the performance test: using System; using System.Diagnostics; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; namespace ExpressionTest { public interface IFoo { int Bar(); } public sealed class FooImpl : IFoo { public int Bar() { return 0; } } class Program { static void Main(string[] args) { var … Read more