Git "error: The branch 'x' is not fully merged"
Here are the commands I used from the master branch ``` git branch experiment git checkout experiment ``` Then I made some changes to my files, committed the changes, and pushed the new branch to Git...
- Modified
- 21 Aug at 18:53
What to do with commit made in a detached head
Using git I made something like this ``` git clone git checkout {a rev number tree rev before} (here I started to be in a detached head state) //hacking git commit //hacking git commit (some commit w...
- Modified
- 19 Feb at 00:3
Remove all special characters, punctuation and spaces from string
I need to remove all special characters, punctuation and spaces from a string so that I only have letters and numbers.
What does 'var that = this;' mean in JavaScript?
In a JavaScript file I saw: ``` function Somefunction(){ var that = this; ... } ``` What is the purpose of declaring `that` and assigning `this` this to it?
- Modified
- 20 Nov at 22:28
Should I size a textarea with CSS width / height or HTML cols / rows attributes?
Every time I develop a new form that includes a `textarea` I have the following dilemma when I need to specify its dimensions: Use or use the `textarea`'s attributes `cols` and `rows`? What are the...
Iterating over result of getElementsByClassName using Array.forEach
I want to iterate over some DOM elements, I'm doing this: ``` document.getElementsByClassName( "myclass" ).forEach( function(element, index, array) { //do stuff }); ``` but I get an error: > doc...
- Modified
- 30 Mar at 16:44
What's the scope of a variable initialized in an if statement?
This could be a simple scoping question. The following code in a Python file (module) is confusing me slightly: ``` if __name__ == '__main__': x = 1 print x ``` In other languages I've worke...
- Modified
- 29 Dec at 00:47
What is a Maven artifact?
What is an artifact and why does Maven need it?
Java Pass Method as Parameter
I am looking for a way to pass a method by reference. I understand that Java does not pass methods as parameters, however, I would like to get an alternative. I've been told interfaces are the alter...
- Modified
- 5 Nov at 14:49
What causes and what are the differences between NoClassDefFoundError and ClassNotFoundException?
What is the difference between `NoClassDefFoundError` and `ClassNotFoundException`? What causes them to be thrown? How can they be resolved? I often encounter these throwables when modifying existin...
- Modified
- 24 Sep at 21:47
Assigning out/ref parameters in Moq
Is it possible to assign an `out`/`ref` parameter using Moq (3.0+)? I've looked at using `Callback()`, but `Action<>` does not support ref parameters because it's based on generics. I'd also preferab...
- Modified
- 29 Aug at 17:55
Git merge reports "Already up-to-date" though there is a difference
I have a git repository with 2 branches: master and test. There are differences between master and test branches. Both branches have all changes committed. If I do: A screen full of changes appe...
How to find the size of an array (from a pointer pointing to the first element array)?
First off, here is some code: ``` int main() { int days[] = {1,2,3,4,5}; int *ptr = days; printf("%u\n", sizeof(days)); printf("%u\n", sizeof(ptr)); return 0; } ``` Is there a...
Convert a Pandas DataFrame to a dictionary
I have a DataFrame with four columns. I want to convert this DataFrame to a python dictionary. I want the elements of first column be `keys` and the elements of other columns in same row be `values`. ...
- Modified
- 11 Dec at 17:14
Maven skip tests
I am using Maven 2.2.1 and to build my project I used this command ``` mvn clean install -Dmaven.test.skip=true ``` However, the build failed saying it couldn't find one of the artifact. However, w...
- Modified
- 13 Jul at 22:54
How do I convert a Java 8 IntStream to a List?
I'm looking at the docs for the `IntStream`, and I see an `toArray` method, but no way to go directly to a `List<Integer>` Surely there is a way to convert a `Stream` to a `List`?
Apply multiple functions to multiple groupby columns
The [docs](http://pandas.pydata.org/pandas-docs/dev/groupby.html#applying-multiple-functions-at-once) show how to apply multiple functions on a groupby object at a time using a dict with the output co...
- Modified
- 31 Oct at 13:43
Running code in main thread from another thread
In an android service I have created thread(s) for doing some background task. I have a situation where a thread needs to post certain task on main thread's message queue, for example a `Runnable`. Is...
- Modified
- 7 Oct at 15:2
Can PHP cURL retrieve response headers AND body in a single request?
Is there any way to get both headers and body for a cURL request using PHP? I found that this option: ``` curl_setopt($ch, CURLOPT_HEADER, true); ``` is going to return the , but then I need to par...
Android Log.v(), Log.d(), Log.i(), Log.w(), Log.e() - When to use each one?
The different `LogCat` methods are: ``` Log.v(); // Verbose Log.d(); // Debug Log.i(); // Info Log.w(); // Warning Log.e(); // Error ``` What are the appropriate situations to use each type of Logg...
Using String Format to show decimal up to 2 places or simple integer
I have got a price field to display which sometimes can be either 100 or 100.99 or 100.9, What I want is to display the price in 2 decimal places only if the decimals are entered for that price , for ...
- Modified
- 6 Aug at 10:10
node.js require all files in a folder?
How do I require all files in a folder in node.js? need something like: ``` files.forEach(function (v,k){ // require routes require('./routes/'+v); }}; ```
- Modified
- 5 May at 15:32
How do I disable a Pylint warning?
I'm trying to disable warning C0321 ("more than one statement on a single line" -- I often put `if` statements with short single-line results on the same line), in Pylint 0.21.1 (if it matters: astng ...
Understanding __get__ and __set__ and Python descriptors
I am to understand what Python's descriptors are and what they are useful for. I understand how they work, but here are my doubts. Consider the following code: ``` class Celsius(object): def __i...
- Modified
- 12 Jun at 01:12
Else clause on Python while statement
I've noticed the following code is legal in Python. My question is why? Is there a specific reason? ``` n = 5 while n != 0: print n n -= 1 else: print "what the..." ``` --- `if``else``...
- Modified
- 12 Aug at 05:28