How do I pass command line arguments to a Node.js program?
I have a web server written in [Node.js](http://en.wikipedia.org/wiki/Node.js) and I would like to launch with a specific folder. I'm not sure how to access arguments in JavaScript. I'm running node l...
- Modified
- 14 Jun at 04:3
How do I see the differences between two branches?
How do I see the differences between branches `branch_1` and `branch_2`?
Convert string "Jun 1 2005 1:33PM" into datetime
How do I convert the following string to a [datetime](https://docs.python.org/3/library/datetime.html#datetime-objects) object? ``` "Jun 1 2005 1:33PM" ```
What is the difference between the 'COPY' and 'ADD' commands in a Dockerfile?
What is the difference between the `COPY` and `ADD` commands in a Dockerfile, and when would I use one over the other? ``` COPY <src> <dest> ``` > The COPY instruction will copy new files from `<sr...
- Modified
- 16 Sep at 05:12
Find the current directory and file's directory
How do I determine: 1. the current directory (where I was in the shell when I ran the Python script), and 2. where the Python file I am executing is?
How do I detect a click outside an element?
I have some HTML menus, which I show completely when a user clicks on the head of these menus. I would like to hide these elements when the user clicks outside the menus' area. Is something like this...
- Modified
- 4 Jan at 19:7
What are the correct version numbers for C#?
What are the correct version numbers for C#? What came out when? Why can't I find any answers about ? This question is primarily to aid those who are searching for an answer using an incorrect versio...
- Modified
- 1 Mar at 15:9
How can I save an activity state using the save instance state?
I've been working on the Android SDK platform, and it is a little unclear how to save an application's state. So given this minor re-tooling of the 'Hello, Android' example: ``` package com.android.he...
- Modified
- 13 Sep at 14:18
Using async/await with a forEach loop
Are there any issues with using `async`/`await` in a `forEach` loop? I'm trying to loop through an array of files and `await` on the contents of each file. ``` import fs from 'fs-promise' async funct...
- Modified
- 12 Mar at 12:19
How can I create an executable/runnable JAR with dependencies using Maven?
I want to package my project in a single executable JAR for distribution. How can I make a Maven project package all dependency JARs into my output JAR?
- Modified
- 15 Oct at 10:6
Determine installed PowerShell version
How can I determine what version of PowerShell is installed on a computer, and indeed if it is installed at all?
- Modified
- 6 Dec at 14:49
Encode URL in JavaScript
How do you safely encode a URL using JavaScript such that it can be put into a GET string? ``` var myUrl = "http://example.com/index.html?param=1&anotherParam=2"; var myOtherUrl = "http://example.com...
- Modified
- 27 Nov at 22:10
Ignore files that have already been committed to a Git repository
I have an already initialized Git repository that I added a `.gitignore` file to. How can I refresh the file index so the files I want ignored get ignored?
- Modified
- 25 May at 23:17
What's the difference between dependencies, devDependencies and peerDependencies in npm package.json file?
[This documentation](https://docs.npmjs.com/files/package.json) answers my question very poorly. I didn't understand those explanations. Can someone say in simpler words? Maybe with examples if it's h...
- Modified
- 6 Aug at 09:36
How can I remove a key from a Python dictionary?
I want to remove a key from a dictionary if it is present. I currently use this code: ``` if key in my_dict: del my_dict[key] ``` Without the `if` statement, the code will raise `KeyError` if the...
- Modified
- 23 Feb at 08:25
How do I split a string on a delimiter in Bash?
I have this string stored in a variable: ``` IN="bla@some.com;john@home.com" ``` Now I would like to split the strings by `;` delimiter so that I have: ``` ADDR1="bla@some.com" ADDR2="john@home.co...
How to mkdir only if a directory does not already exist?
I am writing a shell script to run under the KornShell (ksh) on AIX. I would like to use the `mkdir` command to create a directory. But the directory may already exist, in which case I do not want to ...
Find (and kill) process locking port 3000 on Mac
How do I find (and kill) processes that listen to/use my TCP ports? I'm on macOS. Sometimes, after a crash or some bug, my Rails app is locking port 3000. I can't find it using `ps -ef`... When runnin...
Homebrew install specific version of formula?
How do I install a specific version of a formula in homebrew? For example, postgresql-8.4.4 instead of the latest 9.0.
- Modified
- 8 Aug at 11:50
Why shouldn't I use mysql_* functions in PHP?
What are the technical reasons for why one shouldn't use `mysql_*` functions? (e.g. `mysql_query()`, `mysql_connect()` or `mysql_real_escape_string()`)? Why should I use something else even if they w...
How do I vertically center text with CSS?
I have a `<div>` element which contains text and I want to align the contents of this `<div>` vertically center. Here is my `<div>` style: ``` #box { height: 170px; width: 270px; background: #00...
- Modified
- 16 Sep at 07:13
How can I fix 'android.os.NetworkOnMainThreadException'?
I got an error while running my Android project for RssReader. Code: ``` URL url = new URL(urlToRssFeed); SAXParserFactory factory = SAXParserFactory.newInstance(); SAXParser parser = factory.newSA...
- Modified
- 22 Jul at 10:25
Compare two dates with JavaScript
Can someone suggest a way to compare the values of greater than, less than, and not in the past using JavaScript? The values will be coming from text boxes.
- Modified
- 27 Feb at 19:37
How do I sort a list of dictionaries by a value of the dictionary?
How do I sort a list of dictionaries by a specific key's value? Given: ``` [{'name': 'Homer', 'age': 39}, {'name': 'Bart', 'age': 10}] ``` When sorted by `name`, it should become: ``` [{'name': 'Bart...
- Modified
- 4 Jun at 21:35