Skip to main content
58 votes
Accepted

Professional way to produce a large problem without filling up huge arrays: C++, free memory from part of an array

What you describe, "smoothing by fives", is a finite impulse response (FIR) digital filter. Such filters are implemented with circular buffers. You keep only the last N values, you keep an index ...
John R. Strohm's user avatar
31 votes
Accepted

Why is C# considered a statically-typed language, although it contains keywords such as `dynamic` and `var`?

C# has a static type system. So it is reasonable to describe it as a statically typed language. Just like any other OOP language, it also provides for some degree of dynamic typing. C# goes a lot ...
amon's user avatar
  • 134k
28 votes

Why is C# considered a statically-typed language, although it contains keywords such as `dynamic` and `var`?

C# is flexible and versatile language that is not 100% bound to a specific paradigm. At its core it is statically typed but also has dynamic features, as you have correctly noted. There is no ...
Rumen Georgiev's user avatar
16 votes

Why is C# considered a statically-typed language, although it contains keywords such as `dynamic` and `var`?

Per the comment, "var" just means "infer the static type as if I'd written it here". It compiles as if you'd written a specific type there. Dynamic is a little different. Let's see ...
pjc50's user avatar
  • 13.4k
13 votes

Professional way to produce a large problem without filling up huge arrays: C++, free memory from part of an array

Every problem can be solved by adding an additional level of indirection. So do that. You can't delete part of an array in C++. But you can create a new array holding just the data you want to keep, ...
Nicol Bolas's user avatar
  • 11.9k
11 votes
Accepted

Why generic interface cannot implement dynamic type?

This is not allowed, as Chris Burrows (who helped create and implement dynamic) explains: Well, for one thing, it doesn’t actually give you anything that you didn’t already have. The first thing ...
Mason Wheeler's user avatar
4 votes

Professional way to produce a large problem without filling up huge arrays: C++, free memory from part of an array

The FIR and SMA answers you got are good in your case, however I'd like to take the opportunity to push forward a more generic approach. What you have here is a stream of data: instead of structuring ...
Matthieu M.'s user avatar
  • 14.9k
2 votes

Dynamically add/change attributes of values in C#

I like the struct/class alternative that contains both the variable and the quality. I don't like to use static stuff without a darn good reason. Except I also don't like squishing together two ...
candied_orange's user avatar
2 votes

Why is C# considered a statically-typed language, although it contains keywords such as `dynamic` and `var`?

From a compiler/language theory perspective, you're confusing static/dynamic typing with implicit/explicit typing. Implicit typing is also called type inference. In an explicitly typed language, the ...
David's user avatar
  • 161
1 vote

How to implement adaptive routing?

Once you've figured out how to consolidate the current statistics you want to incorporate into your adaptive algorithm, it's a matter of consolidating all of that information into a single score. ...
Berin Loritsch's user avatar
1 vote

Dynamic execution of Template Literals using a Map

No. Use inheritance instead -- it is unnecessary to create a Map as there is no advantage to re-defining a handler for each event and to have to suffer the added processing time. It will be much much ...
Greg Patnude's user avatar
1 vote
Accepted

Is there a design for C# that removes the need for dynamic?

Something like this should work: public class ClassModule : NancyModule { public ClassModule(IRepositoryPlan repoPlan, IRepositoryFlan repoFlan) { Get["/RetrievePlan"] = _ => ...
Euphoric's user avatar
  • 37.4k
1 vote
Accepted

Dynamically add/change attributes of values in C#

This is basically a expansion over @CandiedOrange's answer, go pop an upvote to them if you end up liking this. Why not implementing something similar to a nullable? Enters the "Qualitable" class: ...
T. Sar's user avatar
  • 2,108
1 vote

Am I allowed to use a GPL dynamically-linked library if I'm developing on a proprietary runtime engine?

You're correct that you can't use the "raw" GPL in this way, but you could use the GPL with a linking exception specifying that your code may be linked with the runtime engine. Note that if you do ...
Philip Kendall's user avatar
1 vote
Accepted

Hide Away Technical Abstraction of an Object from Users without needing Static Rules

If I understand well, your question is about the mapping between technical attributes in model objects and non-technical attributes in the object's view: So instead of having a direct mapping between ...
Christophe's user avatar
  • 77.3k
1 vote

Dynamic Scheduling Algorithm

I think a simpler approach may be enough. First determine on a minimum and maximum time to wait between checking a mailbox, like 5 minutes and 1 hour. Start with a a waiting period of 10 minutes for ...
Kwebble's user avatar
  • 345

Only top scored, non community-wiki answers of a minimum length are eligible