How to check if a variable is a dictionary in Python?
How would you check if a variable is a dictionary in Python? For example, I'd like it to loop through the values in the dictionary until it finds a dictionary. Then, loop through the one it finds: ```...
- Modified
- 17 Dec at 12:27
Can Android Studio be used to run standard Java projects?
For those times when you want to isolate the Java and give it a quick test.. Can you run non-Android Java projects in Android studio as in Eclipse?
- Modified
- 10 Apr at 15:22
How to get list of all installed packages along with version in composer?
I have been working on a project using Symfony 2.1 on my local machine. I have uploaded it to my server but when I try and install the vendor bundles using Composer, I'm getting a lot of dependency e...
- Modified
- 1 Nov at 11:1
How to use filter, map, and reduce in Python 3
`filter`, `map`, and `reduce` work perfectly in Python 2. Here is an example: ``` >>> def f(x): return x % 2 != 0 and x % 3 != 0 >>> filter(f, range(2, 25)) [5, 7, 11, 13, 17, 19, 23] >>> de...
- Modified
- 12 Mar at 11:44
Ignoring a class property in Entity Framework 4.1 Code First
My understanding is that the `[NotMapped]` attribute is not available until EF 5 which is currently in CTP so we cannot use it in production. How can I mark properties in EF 4.1 to be ignored? I no...
- Modified
- 25 Nov at 16:45
Sort array of objects by single key with date value
I have an array of objects with several key value pairs, and I need to sort them based on 'updated_at': ``` [ { "updated_at" : "2012-01-01T06:25:24Z", "foo" : "bar" }, { ...
- Modified
- 17 Jul at 18:38
What does SQL clause "GROUP BY 1" mean?
Someone sent me a SQL query where the `GROUP BY` clause consisted of the statement: `GROUP BY 1`. This must be a typo right? No column is given the alias 1. What could this mean? Am I right to assume...
What's the correct way to convert bytes to a hex string in Python 3?
What's the correct way to convert bytes to a hex string in Python 3? I see claims of a `bytes.hex` method, `bytes.decode` codecs, and have tried [other](http://docs.python.org/py3k/library/functions....
- Modified
- 29 Sep at 14:16
How to get MD5 sum of a string using python?
In the [Flickr API docs](http://www.flickr.com/services/api/auth.howto.web.html), you need to find the MD5 sum of a string to generate the `[api_sig]` value. How does one go about generating an MD5 s...
How to use putExtra() and getExtra() for string data
Can someone please tell me how exactly to use `getExtra()` and `putExtra()` for intents? Actually I have a string variable, say str, which stores some string data. Now, I want to send this data from o...
- Modified
- 14 Oct at 14:37
std::vector versus std::array in C++
What are the difference between a `std::vector` and an `std::array` in C++? When should one be preferred over another? What are the pros and cons of each? All my textbook does is list how they are the...
PHP append one array to another (not array_push or +)
How to append one array to another without comparing their keys? ``` $a = array( 'a', 'b' ); $b = array( 'c', 'd' ); ``` At the end it should be: `Array( [0]=>a [1]=>b [2]=>c [3]=>d )` If I use som...
Print in one line dynamically
I would like to make several statements that give standard output without seeing newlines in between statements. Specifically, suppose I have: ``` for item in range(1,100): print item ``` The ...
Detect changes in the DOM
I want to execute a function when some div or input are added to the html. Is this possible? For example, a text input is added, then the function should be called.
- Modified
- 6 Dec at 21:39
Is recursion ever faster than looping?
I know that recursion is sometimes a lot cleaner than looping, and I'm not asking anything about when I should use recursion over iteration, I know there are lots of questions about that already. Wha...
- Modified
- 25 Oct at 00:32
Update statement with inner join on Oracle
I have a query which works fine in MySQL, but when I run it on Oracle I get the following error: > SQL Error: ORA-00933: SQL command not properly ended 00933. 00000 - "SQL command not properly end...
- Modified
- 20 Nov at 09:39
What is the difference between the dot (.) operator and -> in C++?
What is the difference between the dot (.) operator and -> in C++?
How can I reverse a NSArray in Objective-C?
I need to reverse my `NSArray`. As an example: `[1,2,3,4,5]` must become: `[5,4,3,2,1]` What is the best way to achieve this?
- Modified
- 30 Jun at 18:16
Is there a way to force npm to generate package-lock.json?
I deleted it by accident and have made many changes to `package.json` since. An `npm install` or `npm update` do not generate `package-lock.json` anymore. I tried clearing my npm cache and my nvm cach...
- Modified
- 10 Jun at 18:41
Format date as dd/MM/yyyy using pipes
I'm using the `date` pipe to format my date, but I just can't get the exact format I want without a workaround. Am I understanding pipes wrongly or is just not possible? ``` //our root app component ...
- Modified
- 2 Nov at 22:40
Pandas DataFrame to List of Dictionaries
I have the following DataFrame: which I want to translate it to list of dictionaries per row ``` rows = [ { 'customer': 1, 'item1': 'apple', 'item2': 'milk', 'item...
- Modified
- 30 Mar at 10:26
How do I check when a UITextField changes?
I am trying to check when a text field changes, equivalent too the function used for textView - `textViewDidChange` so far I have done this: ``` func textFieldDidBeginEditing(textField: UITextField)...
- Modified
- 27 Sep at 10:16
Pandas Replace NaN with blank/empty string
I have a Pandas Dataframe as shown below: ``` 1 2 3 0 a NaN read 1 b l unread 2 c NaN read ``` I want to remove the NaN values with an empty string so that it looks like ...
Using Pandas to pd.read_excel() for multiple worksheets of the same workbook
I have a large spreadsheet file (.xlsx) that I'm processing using python pandas. It happens that I need data from two tabs (sheets) in that large file. One of the tabs has a ton of data and the other ...
How to select a single field for all documents in a MongoDB collection?
In my MongoDB, I have a student collection with 10 records having fields `name` and `roll`. One record of this collection is: ``` { "_id" : ObjectId("53d9feff55d6b4dd1171dd9e"), "name" : "Sw...
- Modified
- 18 Feb at 11:54