Questions tagged [dynamic]

Dynamic is a widely used term that, in general, describes a decision made by the program at run-time rather than at compile time.

Programs that perform some common tasks based on program inputs in contrast with programs that predetermine the task beforehand. Dynamic is often used to mean:

  • The dynamic keyword
  • using JavaScript to manipulate web pages in the browser.
  • have features that allow the of a variable to be bound at run-time.
  • Program generated content, especially content in contrast with web pages created by a person and stored on disk, ready to serve.
27209 questions
81
votes
4 answers

Dynamic Class Definition WITH a Class Name

How do I dynamically define a class in Ruby WITH a name? I know how to create a class dynamically without a name using something like: dynamic_class = Class.new do def method1 end end But you can't specify a class name. I want to create a class…
Mike Bethany
77
votes
7 answers

Why can't I do this: dynamic x = new ExpandoObject { Foo = 12, Bar = "twelve" }

Am I doing something wrong, or is the following code really not possible? dynamic x = new ExpandoObject { Foo = 12, Bar = "twelve" }; If this really isn't possible, is there another one-line way to instantiate an ExpandoObject with two…
devuxer
  • 41,681
  • 47
  • 180
  • 292
76
votes
10 answers

ImageView be a square with dynamic width?

I have a GridView with ImageViews inside. I have 3 of them for each row. I can set correctly the width with WRAP_CONTENT and scaleType = CENTER_CROP, but I don't know how to set the ImageView's size to be a square. Here's what I did until now, it…
Andrea
  • 4,262
  • 4
  • 37
  • 56
75
votes
2 answers

Objective C calling method dynamically with a string

Im just wondering whether there is a way to call a method where i build the name of the method on the fly with a string. e.g. I have a method called loaddata -(void)loadData; to call this i would normally call it like [self loadData]; But i want…
IPadHackAndSlash
  • 955
  • 2
  • 7
  • 7
75
votes
12 answers

What is the correct way to write HTML using Javascript?

It seems that experienced web developers frown upon using document.write() in JavaScript when writing dynamic HTML. Why is this? and what is the correct way?
Gary Willoughby
  • 50,926
  • 41
  • 133
  • 199
73
votes
3 answers

How To have Dynamic SQL in MySQL Stored Procedure

How do you build and use dynamic sql in a MySQL stored procedure?
Brian Boatright
  • 36,294
  • 34
  • 81
  • 102
72
votes
4 answers

Angular Material Table Dynamic Columns without model

I need to use angular material table without model, because I don't know what will come from service. So I am initializing my MatTableDataSource and displayedColumns dynamically in component like that : TableComponent : ngOnInit()…
mevaka
  • 1,980
  • 2
  • 17
  • 24
71
votes
9 answers

Dynamic static method call in PHP?

Please could someone experienced in PHP help out with the following. Somewhere in my code, I have a call to a public static method inside a non-instantiated class: $result = myClassName::myFunctionName(); However, I would like to have many such…
Tom
  • 30,090
  • 27
  • 90
  • 124
70
votes
8 answers

When should one use dynamic keyword in c# 4.0?

When should one use dynamic keyword in c# 4.0?.......Any good example with dynamic keyword in c# 4.0 that explains its usage....
ACP
  • 34,682
  • 100
  • 231
  • 371
69
votes
10 answers

Dynamic WHERE clause in LINQ

What is the best way to assemble a dynamic WHERE clause to a LINQ statement? I have several dozen checkboxes on a form and am passing them back as: Dictionary> (Dictionary>) to my LINQ query. public…
Keith Barrows
  • 24,802
  • 26
  • 88
  • 134
69
votes
2 answers

Creating an anonymous type dynamically?

I wanna create an anonymous type that I can set the property name dynamically. it doesn't have to be an anonymous type. All I want to achieve is set any objects property names dynamically. It can be ExpandoObject, but dictionary will not work for…
ward87
  • 3,026
  • 7
  • 27
  • 27
69
votes
3 answers

Create dynamic number of input elements with R/Shiny

I'm writing a Shiny app for visualizing insurance benefit plans at my company. Here is what I'd like to happen: I'll have a selectInput or sliderInput where the user will choose the number of individuals on their medical plan A matching number of…
Hendy
  • 10,182
  • 15
  • 65
  • 71
68
votes
6 answers

Add Bean Programmatically to Spring Web App Context

Because of a plug-in architecture, I'm trying to add a bean programmatically to my webapp. I have a Spring bean created through the @Component annotation, and i am implementing the ApplicationContextAware interface. My override function looks like…
user146714
  • 731
  • 2
  • 7
  • 9
68
votes
2 answers

Create an instance of a class in ES6 with a dynamic name?

I want to be able to instantiate a particular ES6 class by passing a string variable to a function. Depending on the value of the variable, a different class will be created. Example - I have 2 classes, ClassOne, ClassTwo. I want to be able to pass…
codewithfeeling
  • 6,236
  • 6
  • 41
  • 53
68
votes
4 answers

How are JavaScript arrays represented in physical memory?

It is my understanding that I can store mixed data in a JavaScript array, as well as change any element in the array to some other type. How does the interpreter keep track of what place in physical memory any element is at. Also how is the…
user3056052
  • 1,387
  • 2
  • 13
  • 16