dynamic

How can I use collection initializer syntax with ExpandoObject?

徘徊边缘 提交于 2019-12-20 18:49:07
问题 I've noticed that the new ExpandoObject implements IDictionary<string,object> which has the requisite IEnumerable<KeyValuePair<string, object>> and Add(string, object) methods and so it should be possible to use the collection initialiser syntax to add properties to the expando object in the same way as you add items to a dictionary. Dictionary<string,object> dict = new Dictionary<string,object>() { { "Hello", "World" } }; dynamic obj = new ExpandoObject() { { "foo", "hello" }, { "bar", 42 },

How to share web content between eclipse projects

北城余情 提交于 2019-12-20 17:33:18
问题 While the J2EE module reference feature allows your to create common Java library projects, I can't find a neat way to do this for web content. I have common JSPs, CSS files, JavaScript libraries and even descriptor fragments that I would like to use across a number of Dynamic Web Projects, so that these artefacts are edited i only one place, but will be exported into each of the Dynamic WebProject WAR files. I am surprised that I can't find a way to promote reusability in the web space

How to add dynamically attribute in VueJs

折月煮酒 提交于 2019-12-20 16:20:48
问题 I'm using vuejs and I wanna know how to have control on inputs (add disabled attribute when necessary). Is there any way to add dynamically attribute in vuejs ? Below my Textfield component : <template> <input type="text" placeholder="{{ placeholder }}" v-model="value"> </template> <script> export default { props: { disabled: {type: Boolean, default: false}, placeholder: {type: String, default: ""}, value: {twoWay: true, default: ""} } } </script> Usage : <textfield placeholder="Name" value

How to add dynamically attribute in VueJs

别来无恙 提交于 2019-12-20 16:19:07
问题 I'm using vuejs and I wanna know how to have control on inputs (add disabled attribute when necessary). Is there any way to add dynamically attribute in vuejs ? Below my Textfield component : <template> <input type="text" placeholder="{{ placeholder }}" v-model="value"> </template> <script> export default { props: { disabled: {type: Boolean, default: false}, placeholder: {type: String, default: ""}, value: {twoWay: true, default: ""} } } </script> Usage : <textfield placeholder="Name" value

How can I dynamically require assets in the Rails 3.1 asset pipeline?

六眼飞鱼酱① 提交于 2019-12-20 13:34:41
问题 I have a plugin-based system that I use for application development in Rails. Each plugin implements an engine with MVC components, etc. The main application is simply an empty harness that delegates all the work to the plugins that are installed. I'm currently upgrading to Rails 3.1 from Rails 2.3.5, and am trying to get the asset pipeline working with my framework. The problem I'm having is trying to programmatically require my plugin's assets into, for example, the application.js manifest.

Expression Trees with dynamic parameter

南楼画角 提交于 2019-12-20 12:41:53
问题 I want to convert this: Func<dynamic, object> myFunc = t => return t.Name + " " + t.Surname; Into an Expression Tree. What I have came up with, is this: ParameterExpression target = ExpressionParameter(typeof(dynamic), "target"); ParameterExpression result = ExpressionParameter(typeof(object), "result"); BlockExpression block = Expression.Block( new [] { result }, Expression.Assign( result, Expression.Add( Expression.Add( Expression.Property(target, "Name"), Expression.Constant(" ", typeof

Reading a dynamic property map into Spring managed bean

旧巷老猫 提交于 2019-12-20 12:38:22
问题 I have a properties file like this: my.properties file: app.One.id=1 app.One.val=60 app.Two.id=5 app.Two.val=75 And I read these values into a map property in my bean in Spring config file like this: spring-config.xml: <bean id="myBean" class="myClass" scope="singleton"> <property name="myMap"> <map> <entry key="${app.One.id}" value="${app.One.val}"/> <entry key="${app.Two.id}" value="${app.Two.val}"/> </map> </property> </bean> This way if I add a new id/val to the properties file, I must

Printing Dynamic Usercontrol via document paginator in WPF : Datagrid is printed empty

落花浮王杯 提交于 2019-12-20 12:35:50
问题 I am trying to print a wpf document. I am using documentpaginator for pagination and a user control to create actual visual to print. My user control has few textboxes and a datagrid binded to data objects which are passed to the user control at runtime. Now the code works great when printing to an XPS document but when it prints to a physical printer, my datagrid is printed empty though other textboxes are printing perfectly. Below is the code for paginator class GetPage Method :

Why doesn't the c# compiler check “staticness” of the method at call sites with a dynamic argument?

邮差的信 提交于 2019-12-20 11:22:09
问题 Why doesn't the C# compiler tell me that this piece of code is invalid? class Program { static void Main(string[] args) { dynamic d = 1; MyMethod(d); } public void MyMethod(int i) { Console.WriteLine("int"); } } The call to MyMethod fails at runtime because I am trying to call a non-static method from a static method. That is very reasonable, but why doesn't the compiler consider this an error at compile time? The following will not compile class Program { static void Main(string[] args) {

Why doesn't the c# compiler check “staticness” of the method at call sites with a dynamic argument?

折月煮酒 提交于 2019-12-20 11:21:54
问题 Why doesn't the C# compiler tell me that this piece of code is invalid? class Program { static void Main(string[] args) { dynamic d = 1; MyMethod(d); } public void MyMethod(int i) { Console.WriteLine("int"); } } The call to MyMethod fails at runtime because I am trying to call a non-static method from a static method. That is very reasonable, but why doesn't the compiler consider this an error at compile time? The following will not compile class Program { static void Main(string[] args) {