How to convert String to long in Java?
I got a simple question in Java: How can I convert a `String` that was obtained by `Long.toString()` to `long`?
How do I get the path to the current script with Node.js?
How would I get the path to the script in Node.js? I know there's `process.cwd`, but that only refers to the directory where the script was called, not of the script itself. For instance, say I'm in ...
- Modified
- 17 Dec at 12:3
Remove all special characters from a string
I am facing an issue with URLs, I want to be able to convert titles that could contain anything and have them stripped of all special characters so they only have letters and numbers and of course I w...
How can I check if a program exists from a Bash script?
How would I validate that a program exists, in a way that will either return an error and exit, or continue with the script? It seems like it should be easy, but it's been stumping me.
- Modified
- 1 Jan at 01:6
What's the best UML diagramming tool?
I'm trying to choose a tool for creating UML diagrams of all flavours. Usability is a major criteria for me, but I'd still take more power with a steeper learning curve and be happy. Free (as in beer)...
Where are Docker images stored on the host machine?
I managed to find the containers under directory `/var/lib/docker/containers`, but I can't find the images. What are the directories and files under `/var/lib/docker`?
- Modified
- 29 Mar at 16:26
ERROR 1452: Cannot add or update a child row: a foreign key constraint fails
I have created tables in MySQL Workbench as shown below : ``` CREATE TABLE Ordre ( OrdreID INT NOT NULL, OrdreDato DATE DEFAULT NULL, KundeID INT DEFAULT NULL, CONSTRAINT Ordre_pk PRIM...
- Modified
- 2 Oct at 18:23
Dealing with "java.lang.OutOfMemoryError: PermGen space" error
Recently I ran into this error in my web application: > java.lang.OutOfMemoryError: PermGen space It's a typical Hibernate/JPA + IceFaces/JSF application running on Tomcat 6 and JDK 1.6. Apparently ...
- Modified
- 22 Mar at 06:44
How to avoid the "divide by zero" error in SQL?
I have this error message: > Msg 8134, Level 16, State 1, Line 1 Divide by zero error encountered. What is the best way to write SQL code so that I will never see this error message again? I could ...
- Modified
- 28 Mar at 06:36
How do I split a string, breaking at a particular character?
I have this string ``` 'john smith~123 Street~Apt 4~New York~NY~12345' ``` Using JavaScript, what is the fastest way to parse this into ``` var name = "john smith"; var street= "123 Street"; //etc...
- Modified
- 1 Jul at 12:5
'password authentication failed for user "postgres"'
I have installed PostgreSQL 8.4, Postgres client and Pgadmin 3. Authentication failed for user "postgres" for both console client and Pgadmin. I have typed user as "postgres" and password "postgres", ...
- Modified
- 10 Jun at 14:58
img src SVG changing the styles with CSS
``` <img src="logo.svg" alt="Logo" class="logo-img"> ``` ``` .logo-img path { fill: #000; } ``` The above svg loads and is natively `fill: #fff` but when I use the above `css` to try change ...
How to change the status bar color in Android?
First of all it's not a duplicate as in [How to change the background color of android status bar](https://stackoverflow.com/questions/9044970/how-to-change-the-background-color-of-android-status-bar)...
- Modified
- 21 May at 16:12
AsyncTask Android example
I was reading about `AsyncTask`, and I tried the simple program below. But it does not seem to work. How can I make it work? ``` public class AsyncTaskActivity extends Activity { Button btn; ...
- Modified
- 24 Jan at 14:5
JavaScript isset() equivalent
In PHP you can do `if(isset($array['foo'])) { ... }`. In JavaScript you often use `if(array.foo) { ... }` to do the same, but this is not exactly the same statement. The condition will also evaluate t...
- Modified
- 9 Feb at 01:19
How do I show the changes which have been staged?
I staged a few changes to be committed. How do I see the diffs of all files which are staged for the next commit? Is there a handy one-liner for this? [git status](http://git-scm.com/docs/git-status) ...
How to add 30 minutes to a JavaScript Date object?
I'd like to get a Date object which is 30 minutes later than another Date object. How do I do it with JavaScript?
- Modified
- 11 Jul at 16:6
How can I count all the lines of code in a directory recursively?
We've got a PHP application and want to count all the lines of code under a specific directory and its subdirectories. We don't need to ignore comments, as we're just trying to get a rough idea. ``` w...
Convert Set to List without creating new List
I am using this code to convert a `Set` to a `List`: ``` Map<String, List<String>> mainMap = new HashMap<>(); for (int i=0; i < something.size(); i++) { Set<String> set = getSet(...); //returns di...
- Modified
- 8 May at 12:48
Smooth scrolling when clicking an anchor link
I have a couple of hyperlinks on my page. A FAQ that users will read when they visit my help section. Using Anchor links, I can make the page scroll towards the anchor and guide the users there. Is ...
- Modified
- 14 Mar at 17:49
Deserialize JSON into C# dynamic object?
Is there a way to deserialize JSON content into a C# dynamic type? It would be nice to skip creating a bunch of classes in order to use the `DataContractJsonSerializer`.
- Modified
- 13 Aug at 19:42
Proper way to wait for one function to finish before continuing?
I have two JS functions. One calls the other. Within the calling function, I'd like to call the other, wait for that function to finish, then continue on. So, for example/pseudo code: ``` function fi...
- Modified
- 3 Feb at 01:11
MySQL: Select DISTINCT / UNIQUE, but return all columns?
``` SELECT DISTINCT field1, field2, field3, ...... FROM table; ``` I am trying to accomplish the following SQL statement, but I want it to return . Is this possible? Something like this: ``` SELECT D...
Click button copy to clipboard
How do I copy the text inside a div to the clipboard? I have a div and need to add a link which will add the text to the clipboard. Is there a solution for this? ``` <p class="content">Lorem Ipsum i...
What's causing my java.net.SocketException: Connection reset?
We are seeing frequent but intermittent `java.net.SocketException: Connection reset` errors in our logs. We are unsure as to where the `Connection reset` error is actually coming from, and how to go ...
- Modified
- 24 Jan at 12:39