Most Popular

1500 questions
1408
votes
15 answers

How do I move to end of line in Vim?

I know how to generally move around in command mode, specifically, jumping to lines, etc. But what is the command to jump to the end of the line that I am currently on?
salt.racer
  • 21,903
  • 14
  • 44
  • 51
1407
votes
20 answers

How can I pass arguments to a batch file?

I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file. Here's what the command line looks like: test.cmd admin P@55w0rd > test-log.txt
Keng
  • 52,011
  • 32
  • 81
  • 111
1406
votes
14 answers

How can I undo pushed commits using git?

I have a project in a remote repository, synchronized with a local repository (development) and the server one (prod). I've been making some commited changes already pushed to remote and pulled from the server. Now, I want to undo those changes. So…
Manolo
  • 24,020
  • 20
  • 85
  • 130
1405
votes
8 answers

Why is executing Java code in comments with certain Unicode characters allowed?

The following code produces the output "Hello World!" (no really, try it). public static void main(String... args) { // The comment below is not a typo. // \u000d System.out.println("Hello World!"); } The reason for this is that the Java…
Reg
  • 10,717
  • 6
  • 37
  • 54
1404
votes
24 answers

How to use SSH to run a local shell script on a remote machine?

I have to run a local shell script (windows/Linux) on a remote machine. I have SSH configured on both machine A and B. My script is on machine A which will run some of my code on a remote machine, machine B. The local and remote computers can be…
Arun
1404
votes
24 answers

In Python, how do I determine if an object is iterable?

Is there a method like isiterable? The only solution I have found so far is to call hasattr(myObj, '__iter__') But I am not sure how fool-proof this is.
willem
  • 25,977
  • 22
  • 75
  • 115
1403
votes
18 answers

Determine whether an array contains a value

I need to determine if a value exists in an array. I am using the following function: Array.prototype.contains = function(obj) { var i = this.length; while (i--) { if (this[i] == obj) { return true; } } …
Prasad
  • 58,881
  • 64
  • 151
  • 199
1403
votes
39 answers

How can I check for an active Internet connection on iOS or macOS?

I would like to check to see if I have an Internet connection on iOS using the Cocoa Touch libraries or on macOS using the Cocoa libraries. I came up with a way to do this using an NSURL. The way I did it seems a bit unreliable (because even Google…
Brock Woolf
  • 46,656
  • 50
  • 121
  • 144
1402
votes
15 answers

How to drop rows of Pandas DataFrame whose value in a certain column is NaN

I have this DataFrame and want only the records whose EPS column is not NaN: >>> df STK_ID EPS cash STK_ID RPT_Date 601166 20111231 601166 NaN NaN 600036 20111231 600036 NaN 12 600016 20111231 600016 …
bigbug
  • 55,954
  • 42
  • 77
  • 96
1399
votes
23 answers

How can I uninstall npm modules in Node.js?

As commonly known, any npm module can be installed by running a simple command: npm install . I have installed a few modules that I do not use any more and I just want to get them off. I have a few questions regarding this: Do we have…
Manish Kumar
  • 15,269
  • 5
  • 18
  • 27
1399
votes
14 answers

Multiline string literal in C#

Is there an easy way to create a multiline string literal in C#? Here's what I have now: string query = "SELECT foo, bar" + " FROM table" + " WHERE id = 42"; I know PHP has <<
Chet
  • 21,375
  • 10
  • 40
  • 58
1397
votes
27 answers

How do I create multiline comments in Python?

How do I make multi-line comments? Most languages have block comment symbols like: /* */
Dungeon Hunter
  • 19,827
  • 13
  • 59
  • 82
1397
votes
20 answers

How do I combine a background-image and CSS3 gradient on the same element?

How do I use CSS3 gradients for my background-color and then apply a background-image to apply some sort of light transparent texture?
Ronald
  • 16,033
  • 9
  • 27
  • 29
1397
votes
34 answers

How to kill a process running on particular port in Linux?

I tried to close the tomcat using ./shutdown.sh from tomcat /bin directory. But found that the server was not closed properly. And thus I was unable to restartMy tomcat is running on port 8080. I want to kill the tomcat process running on 8080. I…
veer7
  • 20,074
  • 9
  • 46
  • 74
1395
votes
12 answers

How can I grep recursively, but only in files with certain extensions?

I'm working on a script to grep certain directories: { grep -r -i CP_Image ~/path1/; grep -r -i CP_Image ~/path2/; grep -r -i CP_Image ~/path3/; grep -r -i CP_Image ~/path4/; grep -r -i CP_Image ~/path5/; } | mailx -s GREP email@domain.example How…
Jasmine
  • 15,375
  • 10
  • 30
  • 48