Most Popular

1500 questions
1165
votes
38 answers

How can I start PostgreSQL server on Mac OS X?

Final update: I had forgotten to run the initdb command. By running this command ps auxwww | grep postgres I see that postgres is not running > ps auxwww | grep postgres remcat 1789 0.0 0.0 2434892 480 s000 R+ 11:28PM 0:00.00…
Ramy
  • 20,541
  • 41
  • 103
  • 153
1164
votes
34 answers

"code ." is not working in on the command line for Visual Studio Code on OS X/Mac

The command code . doesn't work in this manual. All the other steps before that worked. How can I call the Visual Studio Code in an OS X terminal? pwd /Users/mona/nodejs/myExpressApp code . -bash: code: command not found I ended up opening it…
Mona Jalal
  • 34,860
  • 64
  • 239
  • 408
1164
votes
17 answers

How do I retrieve an HTML element's actual width and height?

Suppose that I have a
that I wish to center in the browser's display (viewport). To do so, I need to calculate the width and height of the
element. What should I use? Please include information on browser compatibility.
snortasprocket
  • 11,801
  • 3
  • 19
  • 8
1163
votes
20 answers

Difference between ( for... in ) and ( for... of ) statements?

I know what is a for... in loop (it iterates over the keys), but I have heard about for... of for the first time (it iterates over values). I am confused about for... of loop. var arr = [3, 5, 7]; arr.foo = "hello"; for (var i in arr) { …
Mukund Kumar
  • 21,413
  • 18
  • 59
  • 79
1163
votes
29 answers

Using ls to list directories and their total sizes

Is it possible to use ls in Unix to list the total size of a sub-directory and all its contents as opposed to the usual 4K that (I assume) is just the directory file itself? total 12K drwxrwxr-x 6 *** *** 4.0K 2009-06-19 10:10 branches drwxrwxr-x…
kmorris511
  • 16,392
  • 7
  • 28
  • 29
1162
votes
14 answers

Pretty-print an entire Pandas Series / DataFrame

I work with Series and DataFrames on the terminal a lot. The default __repr__ for a Series returns a reduced sample, with some head and tail values, but the rest missing. Is there a builtin way to pretty-print the entire Series / DataFrame? …
Dun Peal
  • 16,679
  • 11
  • 33
  • 46
1161
votes
24 answers

Angular: conditional class with *ngClass

What is wrong with my Angular code? I am getting the following error: Cannot read property 'remove' of undefined at BrowserDomAdapter.removeClass
  1. Step1
  2. daniel
    • 34,281
    • 39
    • 104
    • 158
1160
votes
3 answers

How to convert list to string

How can I convert a list to a string using Python?
Nm3
  • 11,707
  • 3
  • 16
  • 4
1159
votes
18 answers

Fling gesture detection on grid layout

I want to get fling gesture detection working in my Android application. What I have is a GridLayout that contains 9 ImageViews. The source can be found here: Romain Guys's Grid Layout. That file I take is from Romain Guy's Photostream application…
gav
  • 29,022
  • 23
  • 65
  • 90
1159
votes
13 answers

How can I move a tag on a git branch to a different commit?

I created a tag on the master branch called v0.1 like this: git tag -a v0.1 But then I realized there were still some changes I needed to merge into master for release 0.1, so I did that. But now my v0.1 tag is stuck on (to invoke the post-it note…
eedeep
  • 12,183
  • 3
  • 18
  • 14
1158
votes
18 answers

What is stdClass in PHP?

Please define what stdClass is.
Keira Nighly
  • 15,326
  • 8
  • 29
  • 28
1158
votes
11 answers

How to copy commits from one branch to another?

I've got two branches from my master: v2.1: (version 2) I've been working on for several months wss: that I created yesterday to add one specific feature to my master (in production) Is there a way to copy yesterday's commits from wss to v2.1?
Bob Walsh
  • 13,011
  • 4
  • 24
  • 21
1157
votes
20 answers

Return multiple values in JavaScript?

I am trying to return two values in JavaScript. Is this possible? var newCodes = function() { var dCodes = fg.codecsCodes.rs; var dCodes2 = fg.codecsCodes2.rs; return dCodes, dCodes2; };
Asim Zaidi
  • 27,016
  • 49
  • 132
  • 221
1157
votes
26 answers

How to initialize all members of an array to the same value?

I have a large array in C (not C++ if that makes a difference). I want to initialize all members of the same value. I could swear I once knew a simple way to do this. I could use memset() in my case, but isn't there a way to do this that is built…
Matt
  • 84,419
  • 25
  • 57
  • 67
1156
votes
16 answers

How to remove files from git staging area?

I made changes to some of my files in my local repo, and then I did git add -A which I think added too many files to the staging area. How can I delete all the files from the staging area? After I do that, I'll just manually do git add "filename".
omega
  • 40,311
  • 81
  • 251
  • 474