Lots of first chance Microsoft.CSharp.RuntimeBinderExceptions thrown when dealing with dynamics

Whenever a property on a dynamic object is resolved, the runtime tries to find a property that is defined at compile time. From DynamicObject doco: You can also add your own members to classes derived from the DynamicObject class. If your class defines properties and also overrides the TrySetMember method, the dynamic language runtime (DLR) … Read more

Why can’t I index into an ExpandoObject?

how the Expando was able to hide the method of one of its interfaces. Because as you correctly found out in the documentation, the indexer is an explicit interface implementation. From Explicit Interface Implementation Tutorial: A class that implements an interface can explicitly implement a member of that interface. When a member is explicitly implemented, … Read more

Modifying CSS class property values on the fly with JavaScript / jQuery

Contrary to some of the answers here, editing the stylesheet itself with Javascript is not only possible, but higher performance. Simply doing $(‘.myclass’).css(‘color: red’) will end up looping through every item matching the selector and individually setting the style attribute. This is really inefficient and if you have hundreds of elements, it’s going to cause … Read more

Getting static property from a class with dynamic class name in PHP

If you are using PHP 5.3.0 or greater, you can use the following: $classname::$$propertyname; Unfortunately, if you are using a version lower than 5.3.0, you are stuck using eval() (get_class_vars() will not work if the value is dynamic). $value = eval($classname.’::$’.$propertyname.’;’); EDIT: I’ve just said get_class_vars() wouldn’t work if the value is dynamic, but apparently, … Read more

What is the difference between dynamic programming and greedy approach?

Based on Wikipedia’s articles. Greedy Approach A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the hope of finding a global optimum. In many problems, a greedy strategy does not in general produce an optimal solution, but nonetheless a greedy heuristic may … Read more

How do I express a void method call as the result of DynamicMetaObject.BindInvokeMember?

This is similar to: DLR return type You do need to match the return type specified by the ReturnType property. For all of the standard binaries this is fixed to object for almost everything or void (for the deletion operations). If you know you’re making a void call I’d suggest wrapping it in: Expression.Block( call, … Read more

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