Is there functionality to generate a random character in Java?
Does Java have any functionality to generate random characters or strings? Or must one simply pick a random integer and convert that integer's ascii code to a character?
Mockito - NullpointerException when stubbing Method
So I started writing tests for our Java-Spring-project. What I use is JUnit and Mockito. It's said, that when I use the when()...thenReturn() option I can mock services, without simulating them or s...
How do you specify the Java compiler version in a pom.xml file?
I wrote some Maven code in Netbeans that has approximately more than 2000 lines. When I compile it on Netbeans, everything is fine, but if I want to run it on command line, I will get these errors: ``...
Using Python String Formatting with Lists
I construct a string `s` in Python 2.6.5 which will have a varying number of `%s` tokens, which match the number of entries in list `x`. I need to write out a formatted string. The following doesn't w...
- Modified
- 27 Sep at 11:51
How to replace list item in best way
``` if (listofelements.Contains(valueFieldValue.ToString())) { listofelements[listofelements.IndexOf(valueFieldValue.ToString())] = value.ToString(); } ``` I have replaced like above. Is there ...
- Modified
- 10 Sep at 20:7
How do you tell if a string contains another string in POSIX sh?
I want to write a Unix shell script that will do various logic if there is a string inside of another string. For example, if I am in a certain folder, branch off. Could someone please tell me how to ...
How to add items to a spinner in Android?
How to add items to a spinner?
Does Internet Explorer 8 support HTML 5?
Is there any HTML5 support in IE8? Is it on the IE8 roadmap?
- Modified
- 21 Dec at 22:27
Maven error: Could not find or load main class org.codehaus.plexus.classworlds.launcher.Launcher
I have installed a latest `maven-3.0.4` on : The installation details are as follows: Installation Path : ``` C:\apache-maven-3.0.4 ``` Environment Variables are: ``` M2_HOME C:\apache-maven-3.0.4\ap...
How do you specifically order ggplot2 x axis instead of alphabetical order?
I'm trying to make a `heatmap` using `ggplot2` using the `geom_tiles` function here is my code below: ``` p<-ggplot(data,aes(Treatment,organisms))+geom_tile(aes(fill=S))+ scale_fill_gradient(low = ...
How to create a directory and give permission in single command
How to create a directory and give permission in single command in Linux? I have to create lots of folder with full permission `777`. ### Commands ``` mkdir path/foldername chmod 777 path/foldernam...
How to replace part of string by position?
I have this string: `ABCDEFGHIJ` I need to replace from position 4 to position 5 with the string `ZX` It will look like this: `ABCZXFGHIJ` But not to use with `string.replace("DE","ZX")` - I need t...
Changing EditText bottom line color with appcompat v7
I am using appcompat v7 to get the look consistent on Android 5 and less. It works rather well. However I cannot figure out how to change the bottom line color and the accent color for EditTexts. Is i...
- Modified
- 4 Jun at 21:34
How to read/write from/to a file using Go
I've been trying to learn Go on my own, but I've been stumped on trying read from and write to ordinary files. I can get as far as `inFile, _ := os.Open(INFILE, 0, 0)`, but actually getting the conten...
Send message to specific client with socket.io and node.js
I'm working with socket.io and node.js and until now it seems pretty good, but I don't know how to send a message from the server to an specific client, something like this: ``` client.send(message, ...
- Modified
- 1 Oct at 15:36
PHP: How to check if image file exists?
I need to see if a specific image exists on my cdn. I've tried the following and it doesn't work: ``` if (file_exists(http://www.example.com/images/$filename)) { echo "The file exists"; } else {...
How to allow only integers in a textbox?
In my form I want to allow typing of integer values only in a textbox. How to do that?
- Modified
- 17 Apr at 12:41
MySQL: Cloning a MySQL database on the same MySql instance
I would like to write a script which copies my current database `sitedb1` to `sitedb2` on the same mysql database instance. I know I can dump the sitedb1 to a sql script: ``` mysqldump -u root -p sit...
How to define Gradle's home in IDEA?
I am trying to import a Gradle project into IntelliJ, and when I get to the `Gradle Home` textbox, it is not automatically populated, nor will typing in the path of `Gradle Home` result in a valid loc...
- Modified
- 2 Jan at 08:34
Matplotlib scatter plot legend
I created a 4D scatter plot graph to represent different temperatures in a specific area. When I create the legend, the legend shows the correct symbol and color but adds a line through it. The code I...
- Modified
- 21 Jan at 14:9
reducing number of plot ticks
I have too many ticks on my graph and they are running into each other. How can I reduce the number of ticks? For example, I have ticks: ``` 1E-6, 1E-5, 1E-4, ... 1E6, 1E7 ``` And I only want: ...
- Modified
- 13 Feb at 00:3
Format date and Subtract days using Moment.js
I would like a variable to hold yesterday's date in the format `DD-MM-YYYY` using Moment.js. So if today is 15-04-2015, I would like to subtract a day and have 14-4-2015. I've tried a few combination...
- Modified
- 6 Mar at 07:11
Pure Javascript listen to input value change
Is there any way I can create a constant function that listens to an input, so when that input value changes, something is triggered immediately? I am looking for something using pure javascript, no ...
- Modified
- 5 Jan at 05:44
How can I enable or disable the GPS programmatically on Android?
I know that the question about turning on/off GPS programatically on android [has](https://stackoverflow.com/questions/3745884/how-to-enable-the-gps-setting-automatic) [been](https://stackoverflow.com...
how to add a jpg image in Latex
I want to insert a .jpg image(that is in my current folder, where the .tex file is) after a paragraph. How can I do it in Latex? What should I include / what commands should I use?
- Modified
- 15 Sep at 16:36