How do I get the App version and build number using Swift?
I have an IOS app with an Azure back-end, and would like to log certain events, like logins and which versions of the app users are running. How can I return the version and build number using Swift?...
How can I post data as form data instead of a request payload?
In the code below, the AngularJS `$http` method calls the URL, and submits the xsrf object as a "Request Payload" (as described in the Chrome debugger network tab). The jQuery `$.ajax` method does the...
- Modified
- 15 Aug at 22:21
Flatten an irregular (arbitrarily nested) list of lists
Yes, I know this subject has been covered before: - [Python idiom to chain (flatten) an infinite iterable of finite iterables?](https://stackoverflow.com/questions/120886)- [Flattening a shallow list ...
- Modified
- 7 Sep at 07:39
How to uncheck a radio button?
I have group of radio buttons that I want to uncheck after an AJAX form is submitted using jQuery. I have the following function: ``` function clearForm(){ $('#frm input[type="text"]').each(functio...
- Modified
- 28 Sep at 13:32
Expanding tuples into arguments
Suppose I have a function like: ``` def myfun(a, b, c): return (a * 2, b + c, c + b) ``` Given a tuple `some_tuple = (1, "foo", "bar")`, how would I use `some_tuple` to call `myfun`? This should ...
- Modified
- 27 Feb at 21:19
Link vs compile vs controller
When you create a directive, you can put code into the compiler, the link function or the controller. In the docs, they explain that: - - However, for me it is not clear, which kind of code shoul...
- Modified
- 24 May at 02:58
How to unstash only certain files?
I stashed my changes. Now I want to unstash only some files from the stash. How can I do this?
Using cURL to upload POST data with files
I would like to use cURL to not only send data parameters in HTTP POST but to also upload files with specific form name. How should I go about doing that ? HTTP Post parameters: userid = 12345 filec...
- Modified
- 1 Apr at 16:59
Creating a new dictionary in Python
I want to build a dictionary in Python. However, all the examples that I see are instantiating a dictionary from a list, etc . .. How do I create a new empty dictionary in Python?
- Modified
- 4 Feb at 17:3
For..In loops in JavaScript - key value pairs
I was wondering if there's a way to do something like a PHP `foreach` loop in JavaScript. The functionality I'm looking for is something like this PHP Snippet: ``` foreach($data as $key => $value) { ...
- Modified
- 22 Feb at 13:29
Reverting to a specific commit based on commit id with Git?
With `git log`, I get a list of commits that I have made so far. ``` commit f5c5cac0033439c17ebf905d4391dc0705dbd5f1 Author: prosseek Date: Fri Sep 3 14:36:59 2010 -0500 Added and modified t...
- Modified
- 29 Jun at 00:10
Append values to a set in Python
How do I add values to an existing `set`?
How to handle screen orientation change when progress dialog and background thread active?
My program does some network activity in a background thread. Before starting, it pops up a progress dialog. The dialog is dismissed on the handler. This all works fine, except when screen orientation...
- Modified
- 15 Jan at 20:16
What happens when using mutual or circular (cyclic) imports?
In Python, what happens when two modules attempt to `import` each other? More generally, what happens if multiple modules attempt to `import` in a cycle? --- [What can I do about "ImportError: Cann...
- Modified
- 29 Nov at 00:30
When to favor ng-if vs. ng-show/ng-hide?
I understand that `ng-show` and `ng-hide` affect the class set on an element and that `ng-if` controls whether an element is rendered as part of the DOM. `ng-if``ng-show``ng-hide`
- Modified
- 5 Nov at 21:37
Return value in a Bash function
I am working with a bash script and I want to execute a function to print a return value: ``` function fun1(){ return 34 } function fun2(){ local res=$(fun1) echo $res } ``` When I execute `f...
- Modified
- 11 Apr at 21:45
How to change or add theme to Android Studio?
I have just installed Android Studio in my Window 7 64bit. When I launch the application the background of the screen where we write the code is white. I would prefer black or any other color. I am no...
- Modified
- 27 Feb at 16:0
Compare two files in Visual Studio
I saw the new comparison tool in Visual Studio 2012 for comparing two files or two versions of a file. I like it. But when I tried to find it I couldn't it, because I don't use [TFS](https://en.wikipe...
- Modified
- 14 Aug at 13:0
How do you reinstall an app's dependencies using npm?
Is there a simple way to reinstall packages that my app depends on (i.e. they are in my apps node_modules folder)?
Is there a way to include commas in CSV columns without breaking the formatting?
I've got a two column CSV with a name and a number. Some people's name use commas, for example `Joe Blow, CFA.` This comma breaks the CSV format, since it's interpreted as a new column. I've read up ...
- Modified
- 17 Jan at 09:3
Git: How to update/checkout a single file from remote origin master?
The scenario: 1. I make some changes in a single file locally and run git add, git commit and git push 2. The file is pushed to the remote origin master repository 3. I have another local repository...
- Modified
- 4 Feb at 20:52
Cleanest way to write retry logic?
Occasionally I have a need to retry an operation several times before giving up. My code is like: ``` int retries = 3; while(true) { try { DoSomething(); break; // success! } catch { ...
Decode Base64 data in Java
I have an image that is Base64 encoded. What is the best way to decode that in Java? Hopefully using only the libraries included with Sun Java 6.
Print <div id="printarea"></div> only?
How do I print the indicated div (without manually disabling all other content on the page)? I want to avoid a new preview dialog, so creating a new window with this content is not useful. The page ...
- Modified
- 22 Aug at 21:56
Why is volatile needed in C?
Why is `volatile` needed in C? What is it used for? What will it do?
- Modified
- 27 May at 17:57