Most Popular
1500 questions
1576
votes
26 answers
Where to place the 'assets' folder in Android Studio?
I am confused about the assets folder. It doesn't come auto-created in Android Studio, and almost all the forums in which this is discussed talk about Eclipse.
How can the Assets directory be configured in Android Studio?
Harshad Kale
- 17,446
- 7
- 30
- 44
1575
votes
47 answers
How do I update the GUI from another thread?
Which is the simplest way to update a Label from another Thread?
I have a Form running on thread1, and from that I'm starting another thread (thread2).
While thread2 is processing some files I would like to update a Label on the Form with the…
CruelIO
- 18,196
- 16
- 40
- 58
1574
votes
14 answers
Convert integer to string in Python
How do I convert an integer to a string?
42 ⟶ "42"
For the reverse, see How do I parse a string to a float or int?. Floats can be handled similarly, but handling the decimal points can be tricky because floating-point values are not precise.…
Hick
- 35,524
- 46
- 151
- 243
1574
votes
22 answers
How to directly initialize a HashMap (in a literal way)?
Is there some way of initializing a Java HashMap like this?:
Map test =
new HashMap{"test":"test","test":"test"};
What would be the correct syntax? I have not found anything regarding this. Is this possible? I am…
jens
- 16,455
- 4
- 21
- 20
1574
votes
18 answers
How to put the legend outside the plot
I have a series of 20 plots (not subplots) to be made in a single figure. I want the legend to be outside of the box. At the same time, I do not want to change the axes, as the size of the figure gets reduced.
I want to keep the legend box outside…
pottigopi
- 15,759
- 3
- 15
- 4
1573
votes
13 answers
How can I flush the output of the print function?
How do I force Python's print function to flush the buffered output to the screen?
See also: Disable output buffering if the goal is to change the buffering behaviour generally. This question is about explicitly flushing output after a specific…
Walter Nissen
- 16,451
- 4
- 26
- 27
1572
votes
66 answers
How can I concatenate two arrays in Java?
I need to concatenate two String arrays in Java.
void f(String[] first, String[] second) {
String[] both = ???
}
Which is the easiest way to do this?
Antti Kissaniemi
- 18,944
- 13
- 54
- 47
1571
votes
5 answers
How do I find Waldo with Mathematica?
This was bugging me over the weekend: What is a good way to solve those Where's Waldo? ['Wally' outside of North America] puzzles, using Mathematica (image-processing and other functionality)?
Here is what I have so far, a function which reduces…
Arnoud Buzing
- 15,383
- 3
- 20
- 50
1570
votes
31 answers
How can I drop all the tables in a PostgreSQL database?
How can I drop all tables in PostgreSQL, working from the command line?
I don't want to drop the database itself, just all tables and all the data in them.
AP257
- 89,519
- 86
- 202
- 261
1569
votes
32 answers
How can I rename a database column in a Ruby on Rails migration?
I wrongly named a column hased_password instead of hashed_password.
How do I update the database schema, using migration to rename this column?
user1994764
- 15,889
- 5
- 19
- 11
1565
votes
15 answers
echo that outputs to stderr
Is there a standard Bash tool that acts like echo but outputs to stderr rather than stdout?
I know I can do echo foo 1>&2 but it's kinda ugly and, I suspect, error prone (e.g. more likely to get edited wrong when things change).
BCS
- 75,627
- 68
- 187
- 294
1562
votes
36 answers
How can you get the build/version number of your Android application?
I need to figure out how to get or make a build number for my Android application. I need the build number to display in the UI.
Do I have to do something with AndroidManifest.xml?
Fahad Ali Shaikh
- 15,645
- 3
- 15
- 4
1560
votes
26 answers
How to get GET (query string) variables in Express.js on Node.js?
Can we get the variables in the query string in Node.js just like we get them in $_GET in PHP?
I know that in Node.js we can get the URL in the request. Is there a method to get the query string parameters?
XMen
- 29,384
- 41
- 99
- 151
1557
votes
19 answers
Is there a "null coalescing" operator in JavaScript?
Is there a null coalescing operator in Javascript?
For example, in C#, I can do this:
String someString = null;
var whatIWant = someString ?? "Cookies!";
The best approximation I can figure out for Javascript is using the conditional operator:
var…
Daniel Schaffer
- 56,753
- 31
- 116
- 165
1556
votes
19 answers
Why is Dictionary preferred over Hashtable in C#?
In most programming languages, dictionaries are preferred over hashtables.
What are the reasons behind that?
Nakul Chaudhary
- 25,572
- 15
- 44
- 47