Most Popular

1500 questions
1210
votes
15 answers

How to reload .bash_profile from the command line

How can I reload file .bash_profile from the command line? I can get the shell to recognize changes to .bash_profile by exiting and logging back in, but I would like to be able to do it on demand.
markdorison
  • 139,374
  • 27
  • 55
  • 71
1210
votes
31 answers

No 'Access-Control-Allow-Origin' header is present on the requested resource—when trying to get data from a REST API

I'm trying to fetch some data from the REST API of HP Alm. It works pretty well with a small curl script—I get my data. Now doing that with JavaScript, fetch and ES6 (more or less) seems to be a bigger issue. I keep getting this error…
daniel.lozynski
  • 14,907
  • 6
  • 18
  • 21
1210
votes
16 answers

What do "branch", "tag" and "trunk" mean in Subversion repositories?

I've seen these words a lot around Subversion (and I guess general repository) discussions. I have been using SVN for my projects for the last few years, but I've never grasped the complete concept of these directories. What do they mean?
grapefrukt
  • 27,016
  • 6
  • 49
  • 73
1209
votes
8 answers

How can I do Base64 encoding in Node.js?

Does Node.js have built-in Base64 encoding yet? The reason why I ask this is that final() from crypto can only output hexadecimal, binary or ASCII data. For example: var cipher = crypto.createCipheriv('des-ede3-cbc', encryption_key, iv); var ciph =…
murvinlai
  • 48,919
  • 52
  • 129
  • 177
1209
votes
18 answers

What is the difference between --save and --save-dev?

What is the difference between: npm install [package_name] and: npm install [package_name] --save and: npm install [package_name] --save-dev What does this mean? And what is really the effect of --save and -dev keywords?
nfort
  • 12,234
  • 3
  • 13
  • 13
1209
votes
9 answers

What are POD types in C++?

I've come across this term POD-type a few times. What does it mean?
oz10
  • 153,307
  • 27
  • 93
  • 128
1209
votes
15 answers

Defining a variable with or without export

What is export for? What is the difference between: export name=value and name=value
flybywire
  • 261,858
  • 191
  • 397
  • 503
1208
votes
15 answers

How to understand nil vs. empty vs. blank in Ruby

I find myself repeatedly looking for a clear definition of the differences of nil?, blank?, and empty? in Ruby on Rails. Here's the closest I've come: blank? objects are false, empty, or a whitespace string. For example, "", " ", nil, [], and {}…
Arrel
  • 13,558
  • 7
  • 26
  • 24
1208
votes
25 answers

Find out which remote branch a local branch is tracking

See also: How can I see which Git branches are tracking which remote / upstream branch? How can I find out which remote branch a local branch is tracking? Do I need to parse git config output, or is there a command that would do this for me?
readonly
  • 343,444
  • 107
  • 203
  • 205
1207
votes
30 answers

Can't create handler inside thread that has not called Looper.prepare()

What does the following exception mean; how can I fix it? This is the code: Toast toast = Toast.makeText(mContext, "Something", Toast.LENGTH_SHORT); This is the exception: java.lang.RuntimeException: Can't create handler inside thread that has not…
michael
  • 106,540
  • 116
  • 246
  • 346
1206
votes
15 answers

How do I trim whitespace?

Is there a Python function that will trim whitespace (spaces and tabs) from a string? So that given input " \t example string\t " becomes "example string".
Chris
  • 21,549
  • 25
  • 71
  • 99
1205
votes
33 answers

How can you encode a string to Base64 in JavaScript?

I have a PHP script that can encode a PNG image to a Base64 string. I'd like to do the same thing using JavaScript. I know how to open files, but I'm not sure how to do the encoding. I'm not used to working with binary data.
username
  • 18,800
  • 11
  • 41
  • 45
1204
votes
23 answers

What is the best way to conditionally apply a class?

Lets say you have an array that is rendered in a ul with an li for each element and a property on the controller called selectedIndex. What would be the best way to add a class to the li with the index selectedIndex in AngularJS? I am currently…
respectTheCode
  • 42,348
  • 18
  • 73
  • 86
1204
votes
37 answers

Format number to always show 2 decimal places

I would like to format my numbers to always display 2 decimal places, rounding where applicable. Examples: number display ------ ------- 1 1.00 1.341 1.34 1.345 1.35 I have been using this:…
Varada
  • 16,026
  • 13
  • 48
  • 69
1204
votes
19 answers

What is the difference between statically typed and dynamically typed languages?

What does it mean when we say a language is dynamically typed versus statically typed?
Rachel
  • 100,387
  • 116
  • 269
  • 365