Most Popular

1500 questions
1532
votes
49 answers

Message "Support for password authentication was removed."

I got this error on my console when I tried to use git pull: remote: Support for password authentication was removed on August 13, 2021. remote: Please see…
Daemes
  • 14,239
  • 3
  • 6
  • 13
1532
votes
9 answers

Read environment variables in Node.js

Is there a way to read environment variables in Node.js code? Like for example Python's os.environ['HOME'].
Jayesh
  • 51,787
  • 22
  • 76
  • 99
1532
votes
87 answers

Merge/flatten an array of arrays

I have a JavaScript array like: [["$6"], ["$12"], ["$25"], ["$25"], ["$18"], ["$22"], ["$10"]] How would I go about merging the separate inner arrays into one like: ["$6", "$12", "$25", ...]
Andy
  • 18,723
  • 12
  • 46
  • 54
1528
votes
35 answers

How do I create a file and write to it?

What's the simplest way to create and write to a (text) file in Java?
Drew Johnson
  • 18,973
  • 9
  • 32
  • 35
1527
votes
53 answers

How do I pass data between Activities in Android application?

I have a scenario where, after logging in through a login page, there will be a sign-out button on each activity. On clicking sign-out, I will be passing the session id of the signed in user to sign-out. Can anyone guide me on how to keep session id…
UMAR-MOBITSOLUTIONS
  • 77,236
  • 95
  • 209
  • 278
1527
votes
9 answers

Difference between git stash pop and git stash apply

I've been using git stash pop for quite some time. I recently found out about the git stash apply command. When I tried it out, it seemed to work the same as git stash pop. What is the difference between git stash pop and git stash apply?
Sandeep Raju Prabhakar
  • 18,652
  • 8
  • 35
  • 44
1526
votes
9 answers

Find when a file was deleted in Git

I have a Git repository with n commits. I have a file that I need, and that used to be in the repository, and that I suddenly look for and think "Oh! Where'd that file go?" Is there a (series of) Git command(s) that will tell me that "file…
JohnMetta
  • 18,782
  • 5
  • 31
  • 57
1524
votes
61 answers

How to find the sum of an array of numbers

Given an array [1, 2, 3, 4], how can I find the sum of its elements? (In this case, the sum would be 10.) I thought $.each might be useful, but I'm not sure how to implement it.
akano1
  • 40,596
  • 19
  • 54
  • 67
1522
votes
7 answers

What is the preferred Bash shebang ("#!")?

Is there any Bash shebang objectively better than the others for most uses? #!/usr/bin/env bash #!/bin/bash #!/bin/sh #!/bin/sh - etc I vaguely recall a long time ago hearing that adding a dash to the end prevents someone passing a command to your…
bgibson
  • 17,379
  • 8
  • 29
  • 45
1521
votes
12 answers

Default behavior of "git push" without a branch specified

I use the following command to push to my remote branch: git push origin sandbox If I say git push origin does that push changes in my other branches too, or does it only update my current branch? I have three branches: master, production and…
Debajit
  • 46,327
  • 33
  • 91
  • 100
1521
votes
11 answers

How to redirect output to a file and stdout

In bash, calling foo would display any output from that command on the stdout. Calling foo > output would redirect any output from that command to the file specified (in this case 'output'). Is there a way to redirect output to a file and have it…
SCdF
  • 57,260
  • 24
  • 77
  • 113
1519
votes
24 answers

Can I recover a branch after its deletion in Git?

If I run git branch -d XYZ, is there a way to recover the branch? Is there a way to go back as if I didn't run the delete branch command?
prosseek
  • 182,215
  • 215
  • 566
  • 871
1519
votes
34 answers

How to manage a redirect request after a jQuery Ajax call

I'm using $.post() to call a servlet using Ajax and then using the resulting HTML fragment to replace a div element in the user's current page. However, if the session times out, the server sends a redirect directive to send the user to the login…
Elliot Vargas
  • 20,499
  • 11
  • 34
  • 36
1519
votes
13 answers

How to join (merge) data frames (inner, outer, left, right)

Given two data frames: df1 = data.frame(CustomerId = c(1:6), Product = c(rep("Toaster", 3), rep("Radio", 3))) df2 = data.frame(CustomerId = c(2, 4, 6), State = c(rep("Alabama", 2), rep("Ohio", 1))) df1 # CustomerId Product # 1 Toaster # …
Dan Goldstein
  • 24,229
  • 18
  • 37
  • 41
1517
votes
53 answers

What's a quick way to comment/uncomment lines in Vim?

I have a Ruby code file open in vi, there are lines commented out with #: class Search < ActiveRecord::Migration def self.up # create_table :searches do |t| # t.integer :user_id # t.string :name # t.string :all_of # …
Ethan
  • 57,819
  • 63
  • 187
  • 237