How to make a sticky footer in react?

Here’s an idea (sandbox example link). Include a phantom div in your footer component that represents the footer’s position that other dom elements will respect (i.e. affecting page flow by not being position: ‘fixed’;). var style = { backgroundColor: “#F8F8F8”, borderTop: “1px solid #E7E7E7”, textAlign: “center”, padding: “20px”, position: “fixed”, left: “0”, bottom: “0”, height: …

Read more

Are there any macros to determine if my code is being compiled to Windows? [duplicate]

[Edit: I assume you want to use compile-time macros to determine which environment you’re on. Maybe you want to determine if you’re running on Wine under Linux or something instead of Windows, but in general, your compiler targets a specific environment, and that is either Windows (DOS) or it isn’t, but it’s rarely (never?) both.] …

Read more

Set a default value to a property

No, there is no built-in way to set the value of a property with metadata. You could use a factory of some sort that would build instances of a class with reflection and then that could set the default values. But in short, you need to use the constructors (or field setters, which are lifted …

Read more

Solving random crashes

Try Valgrind (it’s free, open-source): The Valgrind distribution currently includes six production-quality tools: a memory error detector, two thread error detectors, a cache and branch-prediction profiler, a call-graph generating cache profiler, and a heap profiler. It also includes two experimental tools: a heap/stack/global array overrun detector, and a SimPoint basic block vector generator. It runs …

Read more

“Roll-Back” or Undo Any Manipulators Applied To A Stream Without Knowing What The Manipulators Were [duplicate]

Yes. You can save the state and restore it: #include <iostream> #include <iomanip> using namespace std; int main() { std::ios state(NULL); state.copyfmt(std::cout); cout << “Hello” << hex << 42 << “\n”; // now i want to “roll-back” cout to whatever state it was in // before the code above, *without* having to know what modifiers …

Read more

Dynamic error pages in Rails 3

In rails 3.2, it’s easier than that: Add this to config/application.rb: config.exceptions_app = self.routes That causes errors to be routed via the router. Then you just add to config/routes.rb: match “/404”, :to => “errors#not_found” I got this info from item #3 on the blog post “My five favorite hidden features in Rails 3.2” by By …

Read more

Entity Framework 4.1 InverseProperty Attribute

I add an example for the InversePropertyAttribute. It cannot only be used for relationships in self referencing entities (as in the example linked in Ladislav’s answer) but also in the “normal” case of relationships between different entities: public class Book { public int ID {get; set;} public string Title {get; set;} [InverseProperty(“Books”)] public Author Author …

Read more