Questions tagged [dynamic-properties]

75 questions
2
votes
0 answers

Is it bad practice to define a dynamic property on String.prototype?

I recently came across the idea that it would be great(/easy/convenient) to define dynamic properties on the Javascript String prototype, so you can use your string literals and variables kinda like it works in ruby. Take this example: // Using…
sebwas
  • 99
  • 1
  • 8
2
votes
1 answer

can I convert String to Boolean in @ComponentScan::lazyInit?

In application.properties: app.lazy_init=true and in Main class : @ComponentScan(lazyInit = "${app.lazy_init: false}") public class Main(){...} But the lazyInit is a Boolean, how can I convert a String to a Boolean in @ComponentScan::lazyInit?
viewking
  • 675
  • 1
  • 6
  • 8
2
votes
1 answer

How to Apply KVO to @dynamic properties created on runtime?

I'm doing my best to explain how this works, but it's pretty confusing and lengthy. Let me know if there's something I can do to clarify. I am stucked in KVC and KVO concepts. I have a Entry Class (NSObject). Entry Class has private variable…
2
votes
1 answer

I am trying to read a graph from Graphviz DOT file by Boost graph library. how to read unknown number of properties which is stored in an array?

int const SIZE=10; struct DotVertex { int Attribute[SIZE]; }; struct DotEdge { std::string label; }; typedef boost::adjacency_list graph_t; int main() { graph_t…
2
votes
3 answers

Retrieve the list of dynamic properties added to class in MATLAB OOP

With MATLAB it is possible to add dynamic properties to a class instance like this: % Define a class supporting for dynamic properties classdef DynamicClass < dynamicprops end % Add a dynamic property named 'toto' to some instance c =…
CitizenInsane
  • 4,755
  • 1
  • 25
  • 56
2
votes
1 answer

Dynamic object properties within a nested AngularJS repeat statement

I have a repeater within a repeater, like so:
What I'm trying to do is access property y of object x, something like... {{ x.{{y} }}} or {{ x[ {{y}} ]…
E-Rock
  • 180
  • 7
2
votes
3 answers

Php - Dynamically added method is not callable

I have some confusions! I've a simple class as given below class MyClass { public $bar; } Then I made an instance $cls = new MyClass; Then I've assigned value to my public property $bar from outside of the class $cls->bar='Bar'; Then I've…
The Alpha
  • 143,660
  • 29
  • 287
  • 307
1
vote
1 answer

How to write GraphML file to Boost Graph with custom graph_bundle Property?

I am not able to compile below , where I want to use graph_bundle property of boost graph. struct VertexProps { std::string VertexName; }; struct EdgeProps { std::string edgeName; }; struct GraphProps { std::string…
1
vote
2 answers

Properties is not being overwritten with DynamicPropertySource for Spring reactive integration test with Testcontainers to postgreSQL database

I am trying to do a simple test by calling an endpoint and asserting the response. It is a Spring Reactive project where I have an r2dbc postgreSQL database. The test is spinning up a testcontainer with a postgreSQL database. I can put a breakpoint…
1
vote
1 answer

How to use a type with static and dynamic typed properties

I am trying to use a type that has all the properties of one type, but also allows adding dynamic properties of another type (similar to this question). Types are defined like this: type Foo = string | string[] type Bar = { n: number, str?: string…
KrohnicDev
  • 355
  • 2
  • 12
1
vote
1 answer

Problem with Typescript interface and dynamic properties using generics

This function function abc( param: K, ) { const z: { [p in K]: string } = { [param]: 'abc', }; } gives the following error: TS2322: Type '{ [x: string]: string; }' is not assignable to type '{ [p in K]: string;…
ztp
  • 11
  • 3
1
vote
1 answer

How to Create [Key: string] Properly in Typescript?

I want to create this as end result: {"customerName: {"contains": "bri"}}, but I keep getting the name of the variable written instead. I've tried a multitude of things and just can't get it to go as I want. Hoping this is simple and I'm just…
Briana Finney
  • 1,171
  • 5
  • 12
  • 22
1
vote
1 answer

How to convert map entry from yaml into property in Spring?

I have the following property list in my application.yml: foo: bar: - id: baz item: value // ... Then I want to overwrite item value in tests using @DynamicPropertySource: @DynamicPropertySource @JvmStatic …
pixel
  • 24,905
  • 36
  • 149
  • 251
1
vote
1 answer

How do you access a dynamic property in an object?

I am casting an array as an object and attempting to access the key (or property), but it is not working. The below code returns type 8 -- Undefined property: stdClass::$2. I attempted to use property_exists(), but that also failed. $var =…
Bobby Bruce
  • 341
  • 5
  • 12
1
vote
0 answers

Getting a "is not a member of" error in VB, but can see the property in Visual Studio debugger

I've got a function in VB like the following: Public Overrides Sub FnName(param1 As ISomeInterface) Dim TempVar As String = param1.prop1 End Sub When I try to build the code in Visual Studio, I get the following error: "prop1" is not a member…
HartleySan
  • 7,404
  • 14
  • 66
  • 119