Most Popular
1500 questions
1312
votes
36 answers
How to set or change the default Java (JDK) version on macOS?
How can you change the default version of Java on a mac?
Venkat
- 13,247
- 3
- 14
- 6
1311
votes
13 answers
Git push rejected after feature branch rebase
OK, I thought this was a simple git scenario, what am I missing?
I have a master branch and a feature branch. I do some work on master, some on feature, and then some more on master. I end up with something like this (lexicographic order implies the…
Yuval Adam
- 161,610
- 92
- 305
- 395
1311
votes
23 answers
How do I run two commands in one line in Windows CMD?
I want to run two commands in a Windows CMD console.
In Linux I would do it like this
touch thisfile ; ls -lstrh
How is it done on Windows?
flybywire
- 261,858
- 191
- 397
- 503
1311
votes
39 answers
Get the first element of an array
I have an array:
array( 4 => 'apple', 7 => 'orange', 13 => 'plum' )
I would like to get the first element of this array. Expected result: string apple
One requirement: it cannot be done with passing by reference, so array_shift is not a good…
hsz
- 148,279
- 62
- 259
- 315
1311
votes
20 answers
How do I access the $scope variable in browser's console using AngularJS?
I would like to access my $scope variable in Chrome's JavaScript console. How do I do that?
I can neither see $scope nor the name of my module myapp in the console as variables.
murtaza52
- 46,887
- 28
- 84
- 120
1310
votes
11 answers
How to merge a specific commit in Git
I have forked a branch from a repository in GitHub and committed something specific to me. Now I found the original repository had a good feature which was at HEAD.
I want to merge it only without previous commits. What should I do? I know how to…
netawater
- 15,214
- 4
- 24
- 21
1310
votes
15 answers
How do I limit the number of rows returned by an Oracle query after ordering?
Is there a way to make an Oracle query behave like it contains a MySQL limit clause?
In MySQL, I can do this:
select *
from sometable
order by name
limit 20,10
to get the 21st to the 30th rows (skip the first 20, give the next 10). The rows are…
Mathieu Longtin
- 15,922
- 6
- 30
- 40
1310
votes
13 answers
Redefine tab as 4 spaces
My current setting assumes 8 spaces; how could I redefine it?
Ricky
- 34,377
- 39
- 91
- 131
1309
votes
52 answers
How to trim whitespace from a Bash variable?
I have a shell script with this code:
var=`hg st -R "$path"`
if [ -n "$var" ]; then
echo $var
fi
But the conditional code always executes, because hg st always prints at least one newline character.
Is there a simple way to strip whitespace…
too much php
- 88,666
- 34
- 128
- 138
1309
votes
21 answers
How do I pass environment variables to Docker containers?
How can one access an external database from a container? Is the best way to hard code in the connection string?
# Dockerfile
ENV DATABASE_URL amazon:rds/connection?string
AJcodez
- 31,780
- 20
- 84
- 118
1309
votes
9 answers
How to overlay one div over another div
I need assistance with overlaying one individual div over another individual div.
My code looks like this:
Unfortunately I cannot nest the…
tonyf
- 34,479
- 49
- 157
- 246
1309
votes
36 answers
How to parse JSON in Java
I have the following JSON text. How can I parse it to get the values of pageName, pagePic, post_id, etc.?
{
"pageInfo": {
"pageName": "abc",
"pagePic": "http://example.com/content.jpg"
},
"posts": [
{
"post_id":…
Muhammad Maqsoodur Rehman
- 33,681
- 34
- 84
- 124
1309
votes
21 answers
Which version of PostgreSQL am I running?
I'm in a corporate environment (running Debian Linux) and didn't install it myself. I access the databases using Navicat or phpPgAdmin (if that helps). I also don't have shell access to the server running the database.
Highly Irregular
- 38,000
- 12
- 52
- 70
1308
votes
39 answers
Enumerations on PHP
I know that PHP doesn't yet have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto-completion features could understand.
Constants do the…
Henrik Paul
- 66,919
- 31
- 85
- 96
1308
votes
34 answers
Retrieving the last record in each group - MySQL
There is a table messages that contains data as shown below:
Id Name Other_Columns
-------------------------
1 A A_data_1
2 A A_data_2
3 A A_data_3
4 B B_data_1
5 B B_data_2
6 C C_data_1
If…
Vijay Dev
- 26,966
- 21
- 76
- 96