What REALLY happens when you don't free after malloc before program termination?
We are all taught that you MUST free every pointer that is allocated. I'm a bit curious, though, about the real cost of not freeing memory. In some obvious cases, like when `malloc()` is called insid...
How to implement class constants?
In TypeScript, the `const` keyword cannot be used to declare class properties. Doing so causes the compiler to an error with "A class member cannot have the 'const' keyword." I find myself in need to ...
- Modified
- 28 Dec at 23:59
Java 8 Distinct by property
In Java 8 how can I filter a collection using the `Stream` API by checking the distinctness of a property of each object? For example I have a list of `Person` object and I want to remove people with...
- Modified
- 10 Nov at 08:40
How do I create a folder in a GitHub repository?
I want to create a folder in a GitHub repository and want to add files in that folder. How do I achieve this?
- Modified
- 10 Nov at 13:56
How to change to an older version of Node.js
I am running Node.js version `v0.5.9-pre` on Ubuntu 10.10. I would like to be using version `v0.5.0-pre`. How do I roll back to the older version of node?
- Modified
- 11 Jun at 02:25
How do I pick randomly from an array?
I want to know if there is a much cleaner way of doing this. Basically, I want to pick a random element from an array of variable length. Normally, I would do it like this: ``` myArray = ["stuff", "...
What are the true benefits of ExpandoObject?
The [ExpandoObject](http://msdn.microsoft.com/en-us/library/system.dynamic.expandoobject(VS.100).aspx) class being added to .NET 4 allows you to arbitrarily set properties onto an object at runtime. ...
Is there a simple way to remove multiple spaces in a string?
Suppose this string: ``` The fox jumped over the log. ``` Turning into: ``` The fox jumped over the log. ``` What is the simplest (1-2 lines) to achieve this, without splitting and going ...
How to retrieve an element from a set without removing it?
Suppose the following: ``` >>> s = set([1, 2, 3]) ``` How do I get a value (any value) out of `s` without doing `s.pop()`? I want to leave the item in the set until I am sure I can remove it - some...
Xcode 6 Bug: Unknown class in Interface Builder file
I upgraded to Xcode 6 beta 4 and now my App continuously crashes with the message > Unknown class X in Interface Builder file. It crashes because supposedly Xcode can't find my custom classes that I...
- Modified
- 2 Feb at 05:50
What is related_name used for?
What is the `related_name` argument useful for on `ManyToManyField` and `ForeignKey` fields? For example, given the following code, what is the effect of `related_name='maps'`? ``` class Map(db.Model...
- Modified
- 22 Aug at 04:30
PHP expects T_PAAMAYIM_NEKUDOTAYIM?
Does anyone have a `T_PAAMAYIM_NEKUDOTAYIM`?
- Modified
- 11 Apr at 23:17
How can I remove a package from Laravel using PHP Composer?
What is the correct way to remove a package from Laravel using PHP Composer? So far I've tried: 1. Remove declaration from file composer.json (in the "require" section) 2. Remove any class aliases fr...
- Modified
- 22 Jun at 13:19
How to download a file with Node.js (without using third-party libraries)?
How do I download a file with Node.js ? I don't need anything special. I only want to download a file from a given URL, and then save it to a given directory.
- Modified
- 29 Jan at 14:27
How to set the y-axis limit
I need help with setting the limits of y-axis on matplotlib. Here is the code that I tried, unsuccessfully. ``` import matplotlib.pyplot as plt plt.figure(1, figsize = (8.5,11)) plt.suptitle('plot t...
- Modified
- 14 Sep at 14:1
What characters are valid for JavaScript variable names?
Which characters can be used for naming a JavaScript variable? I want to create a small "extension library" for my non-JavaScript users here at work (who all seem to be squeamish when it comes to the...
- Modified
- 7 Jun at 15:42
Why Is `Export Default Const` invalid?
I see that the following is fine: ``` const Tab = connect( mapState, mapDispatch )( Tabs ); export default Tab; ``` However, this is incorrect: ``` export default const Tab = connect( mapState, ma...
- Modified
- 28 Mar at 11:16
"echo -n" prints "-n"
I have a problem with `echo` in my script: ``` echo -n "Some string..." ``` prints ``` -n Some string... ``` and moves to the next line. In the console it's working correcly without newline: ``...
- Modified
- 26 Feb at 06:18
How to check for an undefined or null variable in JavaScript?
We are frequently using the following code pattern in our JavaScript code ``` if (typeof(some_variable) != 'undefined' && some_variable != null) { // Do something with some_variable } ``` Is th...
- Modified
- 9 Mar at 10:27
Are the PUT, DELETE, HEAD, etc methods available in most web browsers?
I've seen a couple questions around here like [How to debug RESTful services](https://stackoverflow.com/questions/165720/how-to-debug-restful-services), which mentions: > Unfortunately that same brow...
- Modified
- 23 May at 10:31
JWT (JSON Web Token) automatic prolongation of expiration
I would like to implement JWT-based authentication to our new REST API. But since the expiration is set in the token, is it possible to automatically prolong it? I don't want users to need to sign in ...
- Modified
- 13 Feb at 09:13
What does a lock statement do under the hood?
I see that for using objects which are not thread safe we wrap the code with a lock like this: ``` private static readonly Object obj = new Object(); lock (obj) { // thread unsafe code } ``` So,...
- Modified
- 8 Mar at 03:33
JavaScript variable number of arguments to function
Is there a way to allow "unlimited" vars for a function in JavaScript? Example: ``` load(var1, var2, var3, var4, var5, etc...) load(var1) ```
- Modified
- 8 Apr at 09:50
How to make layout with rounded corners..?
How can I make a layout with rounded corners? I want to apply rounded corners to my `LinearLayout`.
- Modified
- 24 Mar at 21:2
What does a just-in-time (JIT) compiler do?
What does a JIT compiler specifically do as opposed to a non-JIT compiler? Can someone give a succinct and easy to understand description?
- Modified
- 28 Dec at 21:8