text:
Q: Testing Keras Sequential Neural Network - predictions totally inaccurate I am working with Keras and TensorFlow in Python for the first time and looking to use it to create a computer player for a card game.  I have the following test code to prove I understand how to get a basic Neural Network setup, but the predictions are not what I expect - they have no resemblance to the outcomes in the input data.  Sometimes the predictions are all 1's, sometimes all 0's.
My test code:
from keras.models import Sequential
from keras.layers import Dense

# Define the keras model
model = Sequential()
model.add(Dense(6, input_dim=3, activation='relu'))
model.add(Dense(3, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])

trainingData = [[10,1900,1,1], # Features, Choice, Outcomes
                [20,1800,1,1],
                [90,1000,1,0],
                [80,1100,1,0],
                [10,1900,0,0],
                [20,1800,0,0],
                [90,1000,0,1],
                [80,1100,0,1],
                ]

# Split training data into features and outcomes
features = []
outcomes = []
for trainingDataRow in trainingData:
    features.append(trainingDataRow[:-1])
    outcomes.append(trainingDataRow[-1])

# fit the keras model on the dataset
model.fit(features, outcomes, epochs=15, batch_size=8)

# evaluate the keras model acuracy
_, accuracy = model.evaluate(features, outcomes)
print('Accuracy: %.2f' % (accuracy*100))

# Test model predictions against training data
predictions = model.predict_classes(features)
for i in range(0,len(features)):
    print('%s => %d (expected %d)' % (features[i], predictions[i], outcomes[i]))

# Print Text decission Tree
print(model.summary())

The output:
Epoch 1/15

1/1 - ETA: 0s - loss: 265.5195 - accuracy: 0.5000
1/1 -  15s 15s/step - loss: 265.5195 - accuracy: 0.5000
Epoch 2/15

1/1 - ETA: 0s - loss: 263.9588 - accuracy: 0.5000
1/1 - 0s 16ms/step - loss: 263.9588 - accuracy: 0.5000
Epoch 3/15

1/1 - ETA: 0s - loss: 262.4041 - accuracy: 0.5000
1/1 - 0s 16ms/step - loss: 262.4041 - accuracy: 0.5000
Epoch 4/15

[etc]

1/1 - ETA: 0s - loss: 248.6939 - accuracy: 0.5000
1/1   0s 16ms/step - loss: 248.6939 - accuracy: 0.5000
Epoch 13/15

1/1 - ETA: 0s - loss: 247.2033 - accuracy: 0.5000
1/1 - 0s 16ms/step - loss: 247.2033 - accuracy: 0.5000
Epoch 14/15

1/1 - ETA: 0s - loss: 245.7196 - accuracy: 0.5000
1/1 - 0s 16ms/step - loss: 245.7196 - accuracy: 0.5000
Epoch 15/15

1/1 - ETA: 0s - loss: 244.2428 - accuracy: 0.5000
1/1 - 0s 16ms/step - loss: 244.2428 - accuracy: 0.5000

1/1 - ETA: 0s - loss: 242.7730 - accuracy: 0.5000
1/1 - 0s 445ms/step - loss: 242.7730 - accuracy: 0.5000
Accuracy: 50.00

[20, 1800, 1] => 1 (expected 1)
[90, 1000, 1] => 1 (expected 0)
[80, 1100, 1] => 1 (expected 0)
[10, 1900, 0] => 1 (expected 0)
[20, 1800, 0] => 1 (expected 0)
[90, 1000, 0] => 1 (expected 1)
[80, 1100, 0] => 1 (expected 1)
Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
dense (Dense)                (None, 6)                 24
_________________________________________________________________
dense_1 (Dense)              (None, 3)                 21
_________________________________________________________________
dense_2 (Dense)              (None, 1)                 4
=================================================================
Total params: 49
Trainable params: 49
Non-trainable params: 0
_________________________________________________________________
None

All help and pointers appreciated.
Following conversation below, my updated code with more input data, more epoch's and other changes.  The variability of accuracy within even the last 10 epoch's is still huge though - between 56% and 83%.  Advice on how I should go about improving that welcomed?
Code:
from keras.models import Sequential
from keras.layers import Dense

# Define the keras model
model = Sequential()
model.add(Dense(12, input_dim=3, activation='relu'))
model.add(Dense(6, activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])

trainingData = [[10,1000,0,0],
[11,1001,0,0],
[12,1002,0,0],
[13,1003,0,0],
[14,1004,0,0],
[15,1005,0,0],
[16,1006,0,0],
[17,1007,0,0],
[18,1008,0,0],
[19,1009,0,0],
[20,1010,0,0],
[21,1011,0,0],
[22,1012,0,0],
[23,1013,0,0],
[24,1014,0,0],
[25,1015,0,0],
[26,1016,0,0],
[27,1017,0,0],
[28,1018,0,0],
[29,1019,0,0],
[30,1020,0,0],
[10,1000,1,0],
[11,1001,1,0],
[12,1002,1,0],
[13,1003,1,0],
[14,1004,1,0],
[15,1005,1,0],
[16,1006,1,0],
[17,1007,1,0],
[18,1008,1,0],
[19,1009,1,0],
[20,1010,1,0],
[21,1011,1,0],
[22,1012,1,0],
[23,1013,1,0],
[24,1014,1,0],
[25,1015,1,0],
[26,1016,1,0],
[27,1017,1,0],
[28,1018,1,0],
[29,1019,1,0],
[30,1020,1,0],
[10,9000,0,0],
[11,9001,0,0],
[12,9002,0,0],
[13,9003,0,0],
[14,9004,0,0],
[15,9005,0,0],
[16,9006,0,0],
[17,9007,0,0],
[18,9008,0,0],
[19,9009,0,0],
[20,9010,0,0],
[21,9011,0,0],
[22,9012,0,0],
[23,9013,0,0],
[24,9014,0,0],
[25,9015,0,0],
[26,9016,0,0],
[27,9017,0,0],
[28,9018,0,0],
[29,9019,0,0],
[30,9020,0,0],
[10,9021,1,1],
[11,9022,1,1],
[12,9023,1,1],
[13,9024,1,1],
[14,9025,1,1],
[15,9026,1,1],
[16,9027,1,1],
[17,9028,1,1],
[18,9029,1,1],
[19,9030,1,1],
[20,9031,1,1],
[21,9032,1,1],
[22,9033,1,1],
[23,9034,1,1],
[24,9035,1,1],
[25,9036,1,1],
[26,9037,1,1],
[27,9038,1,1],
[28,9039,1,1],
[29,9040,1,1],
[30,9041,1,1],
[70,1000,0,1],
[71,1001,0,1],
[72,1002,0,1],
[73,1003,0,1],
[74,1004,0,1],
[75,1005,0,1],
[76,1006,0,1],
[77,1007,0,1],
[78,1008,0,1],
[79,1009,0,1],
[80,1010,0,1],
[81,1011,0,1],
[82,1012,0,1],
[83,1013,0,1],
[84,1014,0,1],
[85,1015,0,1],
[86,1016,0,1],
[87,1017,0,1],
[88,1018,0,1],
[89,1019,0,1],
[90,1020,0,1],
[70,1000,1,0],
[71,1001,1,0],
[72,1002,1,0],
[73,1003,1,0],
[74,1004,1,0],
[75,1005,1,0],
[76,1006,1,0],
[77,1007,1,0],
[78,1008,1,0],
[79,1009,1,0],
[80,1010,1,0],
[81,1011,1,0],
[82,1012,1,0],
[83,1013,1,0],
[84,1014,1,0],
[85,1015,1,0],
[86,1016,1,0],
[87,1017,1,0],
[88,1018,1,0],
[89,1019,1,0],
[90,1020,1,0],
[70,9000,0,1],
[71,9001,0,1],
[72,9002,0,1],
[73,9003,0,1],
[74,9004,0,1],
[75,9005,0,1],
[76,9006,0,1],
[77,9007,0,1],
[78,9008,0,1],
[79,9009,0,1],
[80,9010,0,1],
[81,9011,0,1],
[82,9012,0,1],
[83,9013,0,1],
[84,9014,0,1],
[85,9015,0,1],
[86,9016,0,1],
[87,9017,0,1],
[88,9018,0,1],
[89,9019,0,1],
[90,9020,0,1],
[70,9000,1,1],
[71,9001,1,1],
[72,9002,1,1],
[73,9003,1,1],
[74,9004,1,1],
[75,9005,1,1],
[76,9006,1,1],
[77,9007,1,1],
[78,9008,1,1],
[79,9009,1,1],
[80,9010,1,1],
[81,9011,1,1],
[82,9012,1,1],
[83,9013,1,1],
[84,9014,1,1],
[85,9015,1,1],
[86,9016,1,1],
[87,9017,1,1],
[88,9018,1,1],
[89,9019,1,1],
[90,9020,1,1]]

# Split training data into features and outcomes
features = []
outcomes = []
for trainingDataRow in trainingData:
    features.append(trainingDataRow[:-1])
    outcomes.append(trainingDataRow[-1])
#print(features)
#print(outcomes)

# fit the keras model on the dataset
model.fit(features, outcomes, epochs=500, verbose=2)

# evaluate the keras model acuracy
_, accuracy = model.evaluate(features, outcomes)
print('Accuracy: %.2f' % (accuracy*100))

# Test model predictions against training data
#predictions = model.predict_classes(features)
predictions = (model.predict(features) > 0.5).astype("int32")
for i in range(0,160,4):
    print('%s => %d (expected %d)' % (features[i], predictions[i], outcomes[i]))

# Print Text decission Tree
print(model.summary())

output:
Epoch 1/500
6/6 - 16s - loss: 1354.8107 - accuracy: 0.5000
Epoch 2/500
6/6 - 0s - loss: 1178.2457 - accuracy: 0.5000
Epoch 3/500
6/6 - 0s - loss: 999.3210 - accuracy: 0.5000
Epoch 4/500
6/6 - 0s - loss: 821.8029 - accuracy: 0.5000
Epoch 5/500
6/6 - 0s - loss: 651.4391 - accuracy: 0.5000
Epoch 6/500
6/6 - 0s - loss: 474.1348 - accuracy: 0.5000
Epoch 7/500
6/6 - 0s - loss: 312.3422 - accuracy: 0.5000
Epoch 8/500
6/6 - 0s - loss: 136.2285 - accuracy: 0.5000
Epoch 9/500
6/6 - 0s - loss: 18.8638 - accuracy: 0.4821
Epoch 10/500
6/6 - 0s - loss: 55.3453 - accuracy: 0.5000
Epoch 11/500
6/6 - 0s - loss: 62.0218 - accuracy: 0.5000
Epoch 12/500
6/6 - 0s - loss: 48.6303 - accuracy: 0.5000
Epoch 13/500
6/6 - 0s - loss: 24.6552 - accuracy: 0.5000
Epoch 14/500
6/6 - 0s - loss: 12.4640 - accuracy: 0.4524
Epoch 15/500
6/6 - 0s - loss: 11.6526 - accuracy: 0.3988
Epoch 16/500
6/6 - 0s - loss: 10.0779 - accuracy: 0.5000
Epoch 17/500
6/6 - 0s - loss: 4.5000 - accuracy: 0.3690
Epoch 18/500
6/6 - 0s - loss: 4.4624 - accuracy: 0.4940
Epoch 19/500
6/6 - 0s - loss: 3.5397 - accuracy: 0.4702
Epoch 20/500
6/6 - 0s - loss: 3.1084 - accuracy: 0.5060
Epoch 21/500
6/6 - 0s - loss: 3.3269 - accuracy: 0.4762
Epoch 22/500
6/6 - 0s - loss: 5.0356 - accuracy: 0.5000
Epoch 23/500
6/6 - 0s - loss: 4.5903 - accuracy: 0.3988
Epoch 24/500
6/6 - 0s - loss: 4.0782 - accuracy: 0.5238
Epoch 25/500
6/6 - 0s - loss: 4.2735 - accuracy: 0.4048
Epoch 26/500
6/6 - 0s - loss: 3.4100 - accuracy: 0.4048
Epoch 27/500
6/6 - 0s - loss: 3.4263 - accuracy: 0.4702
Epoch 28/500
6/6 - 0s - loss: 3.0845 - accuracy: 0.4881
Epoch 29/500
6/6 - 0s - loss: 3.6671 - accuracy: 0.4226
Epoch 30/500
6/6 - 0s - loss: 3.2743 - accuracy: 0.4881
Epoch 31/500
6/6 - 0s - loss: 2.7294 - accuracy: 0.5060
Epoch 32/500
6/6 - 0s - loss: 2.6796 - accuracy: 0.4702
Epoch 33/500
6/6 - 0s - loss: 2.3139 - accuracy: 0.5119
Epoch 34/500
6/6 - 0s - loss: 2.2984 - accuracy: 0.4821
Epoch 35/500
6/6 - 0s - loss: 2.5401 - accuracy: 0.4881
Epoch 36/500
6/6 - 0s - loss: 2.5181 - accuracy: 0.4881
Epoch 37/500
6/6 - 0s - loss: 2.2515 - accuracy: 0.4940
Epoch 38/500
6/6 - 0s - loss: 2.1356 - accuracy: 0.4821
Epoch 39/500
6/6 - 0s - loss: 2.0135 - accuracy: 0.4643
Epoch 40/500
6/6 - 0s - loss: 1.9647 - accuracy: 0.4821
Epoch 41/500
6/6 - 0s - loss: 2.4048 - accuracy: 0.3869
Epoch 42/500
6/6 - 0s - loss: 4.4917 - accuracy: 0.4940
Epoch 43/500
6/6 - 0s - loss: 2.9583 - accuracy: 0.4286
Epoch 44/500
6/6 - 0s - loss: 2.0616 - accuracy: 0.4048
Epoch 45/500
6/6 - 0s - loss: 2.2955 - accuracy: 0.4643
Epoch 46/500
6/6 - 0s - loss: 2.6275 - accuracy: 0.4107
Epoch 47/500
6/6 - 0s - loss: 2.1440 - accuracy: 0.4762
Epoch 48/500
6/6 - 0s - loss: 2.2715 - accuracy: 0.4643
Epoch 49/500
6/6 - 0s - loss: 1.6154 - accuracy: 0.4762
Epoch 50/500
6/6 - 0s - loss: 1.3189 - accuracy: 0.5179
[etc]
Epoch 100/500
6/6 - 0s - loss: 0.9070 - accuracy: 0.7143
Epoch 101/500
6/6 - 0s - loss: 1.2207 - accuracy: 0.6786
Epoch 102/500
6/6 - 0s - loss: 1.7759 - accuracy: 0.6429
Epoch 103/500
6/6 - 0s - loss: 2.3393 - accuracy: 0.6012
Epoch 104/500
6/6 - 0s - loss: 6.1804 - accuracy: 0.5000
Epoch 105/500
6/6 - 0s - loss: 4.0825 - accuracy: 0.5833
Epoch 106/500
6/6 - 0s - loss: 2.5547 - accuracy: 0.5060
Epoch 107/500
6/6 - 0s - loss: 2.1338 - accuracy: 0.6131
Epoch 108/500
6/6 - 0s - loss: 0.8321 - accuracy: 0.7619
Epoch 109/500
6/6 - 0s - loss: 1.0405 - accuracy: 0.6964
Epoch 110/500
6/6 - 0s - loss: 1.4533 - accuracy: 0.6190
Epoch 111/500
6/6 - 0s - loss: 2.4647 - accuracy: 0.5417
Epoch 112/500
6/6 - 0s - loss: 2.4917 - accuracy: 0.5476
Epoch 113/500
6/6 - 0s - loss: 2.2088 - accuracy: 0.5357
Epoch 114/500
6/6 - 0s - loss: 1.5922 - accuracy: 0.5952
Epoch 115/500
6/6 - 0s - loss: 0.9498 - accuracy: 0.6488
Epoch 116/500
6/6 - 0s - loss: 0.7612 - accuracy: 0.6905
Epoch 117/500
6/6 - 0s - loss: 0.9210 - accuracy: 0.7917
Epoch 118/500
6/6 - 0s - loss: 1.5319 - accuracy: 0.6012
Epoch 119/500
6/6 - 0s - loss: 2.8555 - accuracy: 0.5179
Epoch 120/500
6/6 - 0s - loss: 1.6090 - accuracy: 0.6131
Epoch 121/500
6/6 - 0s - loss: 1.9316 - accuracy: 0.5119
Epoch 122/500
6/6 - 0s - loss: 3.9357 - accuracy: 0.5060
Epoch 123/500
6/6 - 0s - loss: 1.2138 - accuracy: 0.6845
Epoch 124/500
6/6 - 0s - loss: 0.9364 - accuracy: 0.6726
Epoch 125/500
6/6 - 0s - loss: 1.7571 - accuracy: 0.6429
Epoch 126/500
6/6 - 0s - loss: 3.0547 - accuracy: 0.5298
Epoch 127/500
6/6 - 0s - loss: 0.5857 - accuracy: 0.7857
Epoch 128/500
6/6 - 0s - loss: 1.0959 - accuracy: 0.6964
Epoch 129/500
6/6 - 0s - loss: 2.6186 - accuracy: 0.4940
Epoch 130/500
6/6 - 0s - loss: 2.3914 - accuracy: 0.6250
Epoch 131/500
6/6 - 0s - loss: 1.3078 - accuracy: 0.6607
Epoch 132/500
6/6 - 0s - loss: 1.1346 - accuracy: 0.6548
Epoch 133/500
6/6 - 1s - loss: 0.9108 - accuracy: 0.7679
Epoch 134/500
6/6 - 0s - loss: 0.9480 - accuracy: 0.7024
Epoch 135/500
6/6 - 0s - loss: 2.3744 - accuracy: 0.5298
Epoch 136/500
6/6 - 0s - loss: 0.9875 - accuracy: 0.7262
Epoch 137/500
6/6 - 0s - loss: 3.0520 - accuracy: 0.5536
Epoch 138/500
6/6 - 0s - loss: 3.3804 - accuracy: 0.6250
Epoch 139/500
6/6 - 0s - loss: 2.2378 - accuracy: 0.6607
Epoch 140/500
6/6 - 0s - loss: 0.7141 - accuracy: 0.7202
Epoch 141/500
6/6 - 0s - loss: 1.0920 - accuracy: 0.6964
Epoch 142/500
6/6 - 0s - loss: 1.3448 - accuracy: 0.6905
Epoch 143/500
6/6 - 0s - loss: 1.8249 - accuracy: 0.6190
Epoch 144/500
6/6 - 0s - loss: 1.2369 - accuracy: 0.7321
Epoch 145/500
6/6 - 0s - loss: 1.9031 - accuracy: 0.6488
Epoch 146/500
6/6 - 0s - loss: 2.8954 - accuracy: 0.5774
Epoch 147/500
6/6 - 0s - loss: 3.6607 - accuracy: 0.5298
Epoch 148/500
6/6 - 0s - loss: 0.6843 - accuracy: 0.7976
Epoch 149/500
6/6 - 0s - loss: 0.4969 - accuracy: 0.8393
Epoch 150/500
6/6 - 0s - loss: 0.5488 - accuracy: 0.8333
[etc]
Epoch 200/500
6/6 - 0s - loss: 1.2898 - accuracy: 0.7619
Epoch 201/500
6/6 - 0s - loss: 0.5927 - accuracy: 0.7976
Epoch 202/500
6/6 - 0s - loss: 1.0875 - accuracy: 0.7262
Epoch 203/500
6/6 - 0s - loss: 1.1926 - accuracy: 0.7440
Epoch 204/500
6/6 - 0s - loss: 1.4880 - accuracy: 0.6845
Epoch 205/500
6/6 - 0s - loss: 1.3070 - accuracy: 0.7143
Epoch 206/500
6/6 - 0s - loss: 1.0667 - accuracy: 0.7321
Epoch 207/500
6/6 - 0s - loss: 1.7004 - accuracy: 0.6548
Epoch 208/500
6/6 - 0s - loss: 1.7348 - accuracy: 0.6964
Epoch 209/500
6/6 - 0s - loss: 1.3299 - accuracy: 0.6845
Epoch 210/500
6/6 - 0s - loss: 1.6381 - accuracy: 0.6071
Epoch 211/500
6/6 - 0s - loss: 3.2871 - accuracy: 0.5357
Epoch 212/500
6/6 - 0s - loss: 1.2281 - accuracy: 0.6786
Epoch 213/500
6/6 - 0s - loss: 0.7263 - accuracy: 0.7619
Epoch 214/500
6/6 - 0s - loss: 0.5449 - accuracy: 0.8155
Epoch 215/500
6/6 - 0s - loss: 0.8705 - accuracy: 0.7440
Epoch 216/500
6/6 - 0s - loss: 0.6476 - accuracy: 0.7738
Epoch 217/500
6/6 - 0s - loss: 0.6375 - accuracy: 0.7917
Epoch 218/500
6/6 - 0s - loss: 0.8303 - accuracy: 0.7440
Epoch 219/500
6/6 - 0s - loss: 1.6169 - accuracy: 0.7262
Epoch 220/500
6/6 - 0s - loss: 0.9138 - accuracy: 0.7321
Epoch 221/500
6/6 - 0s - loss: 0.6194 - accuracy: 0.8036
Epoch 222/500
6/6 - 0s - loss: 1.0605 - accuracy: 0.6905
Epoch 223/500
6/6 - 0s - loss: 2.4083 - accuracy: 0.5893
Epoch 224/500
6/6 - 0s - loss: 1.3246 - accuracy: 0.7440
Epoch 225/500
6/6 - 0s - loss: 2.6301 - accuracy: 0.5179
Epoch 226/500
6/6 - 0s - loss: 2.8703 - accuracy: 0.6429
Epoch 227/500
6/6 - 0s - loss: 2.3044 - accuracy: 0.6131
Epoch 228/500
6/6 - 0s - loss: 1.3211 - accuracy: 0.7262
Epoch 229/500
6/6 - 0s - loss: 1.6195 - accuracy: 0.7440
Epoch 230/500
6/6 - 0s - loss: 2.7555 - accuracy: 0.5357
Epoch 231/500
6/6 - 0s - loss: 1.5666 - accuracy: 0.6667
Epoch 232/500
6/6 - 0s - loss: 1.1756 - accuracy: 0.7083
Epoch 233/500
6/6 - 0s - loss: 1.1853 - accuracy: 0.7143
Epoch 234/500
6/6 - 0s - loss: 1.6407 - accuracy: 0.7024
Epoch 235/500
6/6 - 0s - loss: 2.0056 - accuracy: 0.6369
Epoch 236/500
6/6 - 0s - loss: 1.3144 - accuracy: 0.6905
Epoch 237/500
6/6 - 0s - loss: 1.4989 - accuracy: 0.6667
Epoch 238/500
6/6 - 0s - loss: 1.8646 - accuracy: 0.6845
Epoch 239/500
6/6 - 0s - loss: 2.2994 - accuracy: 0.6369
Epoch 240/500
6/6 - 0s - loss: 1.6436 - accuracy: 0.6429
Epoch 241/500
6/6 - 0s - loss: 1.0493 - accuracy: 0.7321
Epoch 242/500
6/6 - 0s - loss: 1.2539 - accuracy: 0.6607
Epoch 243/500
6/6 - 0s - loss: 0.9008 - accuracy: 0.7321
Epoch 244/500
6/6 - 0s - loss: 1.7432 - accuracy: 0.6488
Epoch 245/500
6/6 - 0s - loss: 0.5311 - accuracy: 0.8095
Epoch 246/500
6/6 - 0s - loss: 0.6543 - accuracy: 0.8155
Epoch 247/500
6/6 - 0s - loss: 1.8998 - accuracy: 0.6726
Epoch 248/500
6/6 - 0s - loss: 2.6555 - accuracy: 0.6429
Epoch 249/500
6/6 - 0s - loss: 1.2809 - accuracy: 0.7083
Epoch 250/500
6/6 - 0s - loss: 1.3445 - accuracy: 0.7262
[etc]
Epoch 300/500
6/6 - 0s - loss: 1.1862 - accuracy: 0.7560
Epoch 301/500
6/6 - 0s - loss: 1.5770 - accuracy: 0.7143
Epoch 302/500
6/6 - 0s - loss: 1.4353 - accuracy: 0.7083
Epoch 303/500
6/6 - 0s - loss: 1.4100 - accuracy: 0.6786
Epoch 304/500
6/6 - 0s - loss: 2.4307 - accuracy: 0.6488
Epoch 305/500
6/6 - 0s - loss: 2.6659 - accuracy: 0.6310
Epoch 306/500
6/6 - 0s - loss: 1.9433 - accuracy: 0.6905
Epoch 307/500
6/6 - 0s - loss: 1.5349 - accuracy: 0.6250
Epoch 308/500
6/6 - 0s - loss: 1.6226 - accuracy: 0.6250
Epoch 309/500
6/6 - 0s - loss: 2.4500 - accuracy: 0.7202
Epoch 310/500
6/6 - 0s - loss: 1.4430 - accuracy: 0.7381
Epoch 311/500
6/6 - 0s - loss: 0.4379 - accuracy: 0.7976
Epoch 312/500
6/6 - 0s - loss: 0.6183 - accuracy: 0.7917
Epoch 313/500
6/6 - 0s - loss: 2.0482 - accuracy: 0.6310
Epoch 314/500
6/6 - 0s - loss: 3.3638 - accuracy: 0.5774
Epoch 315/500
6/6 - 0s - loss: 3.8912 - accuracy: 0.5655
Epoch 316/500
6/6 - 0s - loss: 3.9136 - accuracy: 0.6488
Epoch 317/500
6/6 - 0s - loss: 2.2531 - accuracy: 0.6905
Epoch 318/500
6/6 - 0s - loss: 1.3046 - accuracy: 0.6488
Epoch 319/500
6/6 - 0s - loss: 1.2162 - accuracy: 0.7202
Epoch 320/500
6/6 - 0s - loss: 1.0580 - accuracy: 0.7440
Epoch 321/500
6/6 - 0s - loss: 1.8373 - accuracy: 0.6786
Epoch 322/500
6/6 - 0s - loss: 1.8425 - accuracy: 0.6905
Epoch 323/500
6/6 - 0s - loss: 2.7649 - accuracy: 0.6607
Epoch 324/500
6/6 - 0s - loss: 3.4705 - accuracy: 0.5833
Epoch 325/500
6/6 - 0s - loss: 3.1626 - accuracy: 0.5595
Epoch 326/500
6/6 - 0s - loss: 2.6431 - accuracy: 0.6310
Epoch 327/500
6/6 - 0s - loss: 3.6114 - accuracy: 0.5833
Epoch 328/500
6/6 - 0s - loss: 0.9896 - accuracy: 0.7321
Epoch 329/500
6/6 - 0s - loss: 0.6469 - accuracy: 0.7976
Epoch 330/500
6/6 - 0s - loss: 1.2563 - accuracy: 0.7202
Epoch 331/500
6/6 - 0s - loss: 0.5271 - accuracy: 0.8274
Epoch 332/500
6/6 - 0s - loss: 1.1875 - accuracy: 0.6369
Epoch 333/500
6/6 - 0s - loss: 2.5915 - accuracy: 0.6607
Epoch 334/500
6/6 - 0s - loss: 3.2393 - accuracy: 0.6012
Epoch 335/500
6/6 - 0s - loss: 1.5667 - accuracy: 0.6726
Epoch 336/500
6/6 - 0s - loss: 3.3724 - accuracy: 0.5893
Epoch 337/500
6/6 - 0s - loss: 4.6063 - accuracy: 0.5595
Epoch 338/500
6/6 - 0s - loss: 4.2892 - accuracy: 0.5655
Epoch 339/500
6/6 - 0s - loss: 3.1177 - accuracy: 0.6429
Epoch 340/500
6/6 - 0s - loss: 1.5357 - accuracy: 0.6726
Epoch 341/500
6/6 - 0s - loss: 1.7998 - accuracy: 0.7321
Epoch 342/500
6/6 - 0s - loss: 3.4708 - accuracy: 0.5952
Epoch 343/500
6/6 - 0s - loss: 1.6397 - accuracy: 0.6369
Epoch 344/500
6/6 - 0s - loss: 1.0144 - accuracy: 0.7143
Epoch 345/500
6/6 - 0s - loss: 0.5396 - accuracy: 0.8095
Epoch 346/500
6/6 - 0s - loss: 0.4824 - accuracy: 0.8333
Epoch 347/500
6/6 - 0s - loss: 0.6122 - accuracy: 0.8095
Epoch 348/500
6/6 - 0s - loss: 0.9176 - accuracy: 0.7262
Epoch 349/500
6/6 - 0s - loss: 1.0516 - accuracy: 0.7083
Epoch 350/500
6/6 - 0s - loss: 3.0169 - accuracy: 0.6964
[etc]
Epoch 400/500
6/6 - 0s - loss: 1.4745 - accuracy: 0.6905
Epoch 401/500
6/6 - 0s - loss: 1.0852 - accuracy: 0.7560
Epoch 402/500
6/6 - 0s - loss: 1.3118 - accuracy: 0.7440
Epoch 403/500
6/6 - 0s - loss: 1.1269 - accuracy: 0.7143
Epoch 404/500
6/6 - 0s - loss: 0.7287 - accuracy: 0.7917
Epoch 405/500
6/6 - 0s - loss: 0.4720 - accuracy: 0.8155
Epoch 406/500
6/6 - 0s - loss: 0.6519 - accuracy: 0.7917
Epoch 407/500
6/6 - 0s - loss: 1.4163 - accuracy: 0.7202
Epoch 408/500
6/6 - 0s - loss: 1.5731 - accuracy: 0.6964
Epoch 409/500
6/6 - 0s - loss: 2.1105 - accuracy: 0.6905
Epoch 410/500
6/6 - 0s - loss: 2.0785 - accuracy: 0.6190
Epoch 411/500
6/6 - 0s - loss: 2.7981 - accuracy: 0.6012
Epoch 412/500
6/6 - 0s - loss: 2.8780 - accuracy: 0.6607
Epoch 413/500
6/6 - 0s - loss: 2.8910 - accuracy: 0.6369
Epoch 414/500
6/6 - 0s - loss: 2.9615 - accuracy: 0.6369
Epoch 415/500
6/6 - 0s - loss: 4.4401 - accuracy: 0.5536
Epoch 416/500
6/6 - 0s - loss: 3.5945 - accuracy: 0.6012
Epoch 417/500
6/6 - 0s - loss: 2.9201 - accuracy: 0.7024
Epoch 418/500
6/6 - 0s - loss: 0.6884 - accuracy: 0.7917
Epoch 419/500
6/6 - 0s - loss: 0.6324 - accuracy: 0.7798
Epoch 420/500
6/6 - 0s - loss: 0.4122 - accuracy: 0.8571
Epoch 421/500
6/6 - 0s - loss: 0.5619 - accuracy: 0.8095
Epoch 422/500
6/6 - 0s - loss: 0.7549 - accuracy: 0.7798
Epoch 423/500
6/6 - 0s - loss: 1.7936 - accuracy: 0.6667
Epoch 424/500
6/6 - 0s - loss: 1.0680 - accuracy: 0.7024
Epoch 425/500
6/6 - 0s - loss: 1.1780 - accuracy: 0.7202
Epoch 426/500
6/6 - 0s - loss: 1.4397 - accuracy: 0.6845
Epoch 427/500
6/6 - 0s - loss: 2.2156 - accuracy: 0.6905
Epoch 428/500
6/6 - 0s - loss: 3.7839 - accuracy: 0.5774
Epoch 429/500
6/6 - 0s - loss: 4.7977 - accuracy: 0.6012
Epoch 430/500
6/6 - 0s - loss: 2.8695 - accuracy: 0.6488
Epoch 431/500
6/6 - 0s - loss: 2.0530 - accuracy: 0.6667
Epoch 432/500
6/6 - 0s - loss: 1.2545 - accuracy: 0.7381
Epoch 433/500
6/6 - 0s - loss: 0.6428 - accuracy: 0.7619
Epoch 434/500
6/6 - 0s - loss: 0.5938 - accuracy: 0.7560
Epoch 435/500
6/6 - 0s - loss: 0.6733 - accuracy: 0.8274
Epoch 436/500
6/6 - 0s - loss: 0.6819 - accuracy: 0.7798
Epoch 437/500
6/6 - 0s - loss: 0.9188 - accuracy: 0.7738
Epoch 438/500
6/6 - 0s - loss: 0.7398 - accuracy: 0.7560
Epoch 439/500
6/6 - 0s - loss: 0.5840 - accuracy: 0.7857
Epoch 440/500
6/6 - 0s - loss: 0.5400 - accuracy: 0.7976
Epoch 441/500
6/6 - 0s - loss: 0.4590 - accuracy: 0.8095
Epoch 442/500
6/6 - 0s - loss: 0.5159 - accuracy: 0.7917
Epoch 443/500
6/6 - 0s - loss: 1.0400 - accuracy: 0.7321
Epoch 444/500
6/6 - 0s - loss: 0.8215 - accuracy: 0.7679
Epoch 445/500
6/6 - 0s - loss: 0.4529 - accuracy: 0.8571
Epoch 446/500
6/6 - 0s - loss: 0.4551 - accuracy: 0.8214
Epoch 447/500
6/6 - 0s - loss: 1.3074 - accuracy: 0.7619
Epoch 448/500
6/6 - 0s - loss: 1.7789 - accuracy: 0.7024
Epoch 449/500
6/6 - 0s - loss: 1.5543 - accuracy: 0.7440
Epoch 450/500
6/6 - 0s - loss: 0.7703 - accuracy: 0.7679
Epoch 451/500
6/6 - 0s - loss: 0.6668 - accuracy: 0.7857
Epoch 452/500
6/6 - 0s - loss: 0.4969 - accuracy: 0.7917
Epoch 453/500
6/6 - 0s - loss: 0.7541 - accuracy: 0.7560
Epoch 454/500
6/6 - 0s - loss: 0.6923 - accuracy: 0.7619
Epoch 455/500
6/6 - 0s - loss: 0.4974 - accuracy: 0.7798
Epoch 456/500
6/6 - 0s - loss: 0.9360 - accuracy: 0.7202
Epoch 457/500
6/6 - 0s - loss: 0.8772 - accuracy: 0.7262
Epoch 458/500
6/6 - 0s - loss: 0.5241 - accuracy: 0.7976
Epoch 459/500
6/6 - 0s - loss: 0.6441 - accuracy: 0.8452
Epoch 460/500
6/6 - 0s - loss: 0.8062 - accuracy: 0.7798
Epoch 461/500
6/6 - 0s - loss: 0.5682 - accuracy: 0.7738
Epoch 462/500
6/6 - 0s - loss: 1.2154 - accuracy: 0.7083
Epoch 463/500
6/6 - 0s - loss: 0.9338 - accuracy: 0.7440
Epoch 464/500
6/6 - 0s - loss: 0.5318 - accuracy: 0.7798
Epoch 465/500
6/6 - 0s - loss: 0.4244 - accuracy: 0.7679
Epoch 466/500
6/6 - 0s - loss: 0.7675 - accuracy: 0.7857
Epoch 467/500
6/6 - 0s - loss: 1.0929 - accuracy: 0.7024
Epoch 468/500
6/6 - 0s - loss: 2.7063 - accuracy: 0.6071
Epoch 469/500
6/6 - 0s - loss: 3.1285 - accuracy: 0.5714
Epoch 470/500
6/6 - 0s - loss: 1.4364 - accuracy: 0.7262
Epoch 471/500
6/6 - 0s - loss: 1.3276 - accuracy: 0.7143
Epoch 472/500
6/6 - 0s - loss: 0.5895 - accuracy: 0.8274
Epoch 473/500
6/6 - 0s - loss: 0.7874 - accuracy: 0.7202
Epoch 474/500
6/6 - 0s - loss: 0.8847 - accuracy: 0.7560
Epoch 475/500
6/6 - 0s - loss: 2.4059 - accuracy: 0.6190
Epoch 476/500
6/6 - 0s - loss: 0.5856 - accuracy: 0.7976
Epoch 477/500
6/6 - 0s - loss: 1.6138 - accuracy: 0.6726
Epoch 478/500
6/6 - 0s - loss: 3.6635 - accuracy: 0.6190
Epoch 479/500
6/6 - 0s - loss: 1.5387 - accuracy: 0.6786
Epoch 480/500
6/6 - 0s - loss: 1.5804 - accuracy: 0.7202
Epoch 481/500
6/6 - 0s - loss: 1.1936 - accuracy: 0.7500
Epoch 482/500
6/6 - 0s - loss: 0.5385 - accuracy: 0.8274
Epoch 483/500
6/6 - 0s - loss: 0.5614 - accuracy: 0.7679
Epoch 484/500
6/6 - 0s - loss: 0.8756 - accuracy: 0.7500
Epoch 485/500
6/6 - 0s - loss: 0.6093 - accuracy: 0.7560
Epoch 486/500
6/6 - 0s - loss: 1.9588 - accuracy: 0.6310
Epoch 487/500
6/6 - 0s - loss: 1.7198 - accuracy: 0.7083
Epoch 488/500
6/6 - 0s - loss: 0.9304 - accuracy: 0.7321
Epoch 489/500
6/6 - 0s - loss: 0.5345 - accuracy: 0.8095
Epoch 490/500
6/6 - 0s - loss: 2.6957 - accuracy: 0.5893
Epoch 491/500
6/6 - 0s - loss: 2.6077 - accuracy: 0.6607
Epoch 492/500
6/6 - 0s - loss: 4.0575 - accuracy: 0.5774
Epoch 493/500
6/6 - 0s - loss: 3.4324 - accuracy: 0.5655
Epoch 494/500
6/6 - 0s - loss: 3.7296 - accuracy: 0.6131
Epoch 495/500
6/6 - 0s - loss: 2.2588 - accuracy: 0.7262
Epoch 496/500
6/6 - 0s - loss: 3.1585 - accuracy: 0.6250
Epoch 497/500
6/6 - 0s - loss: 2.1257 - accuracy: 0.6905
Epoch 498/500
6/6 - 0s - loss: 1.3597 - accuracy: 0.7381
Epoch 499/500
6/6 - 0s - loss: 0.5437 - accuracy: 0.8155
Epoch 500/500
6/6 - 0s - loss: 0.4785 - accuracy: 0.7976

1/6 [====>.........................] - ETA: 2s - loss: 0.0759 - accuracy: 1.0000
6/6 [==============================] - 1s 3ms/step - loss: 0.5537 - accuracy: 0.8333

Accuracy: 83.33

[10, 1000, 0] => 0 (expected 0)
[14, 1004, 0] => 0 (expected 0)
[18, 1008, 0] => 0 (expected 0)
[22, 1012, 0] => 0 (expected 0)
[26, 1016, 0] => 0 (expected 0)
[30, 1020, 0] => 0 (expected 0)
[13, 1003, 1] => 0 (expected 0)
[17, 1007, 1] => 0 (expected 0)
[21, 1011, 1] => 0 (expected 0)
[25, 1015, 1] => 0 (expected 0)
[29, 1019, 1] => 0 (expected 0)
[12, 9002, 0] => 1 (expected 0)
[16, 9006, 0] => 1 (expected 0)
[20, 9010, 0] => 1 (expected 0)
[24, 9014, 0] => 1 (expected 0)
[28, 9018, 0] => 1 (expected 0)
[11, 9022, 1] => 1 (expected 1)
[15, 9026, 1] => 1 (expected 1)
[19, 9030, 1] => 1 (expected 1)
[23, 9034, 1] => 1 (expected 1)
[27, 9038, 1] => 1 (expected 1)
[70, 1000, 0] => 1 (expected 1)
[74, 1004, 0] => 1 (expected 1)
[78, 1008, 0] => 1 (expected 1)
[82, 1012, 0] => 1 (expected 1)
[86, 1016, 0] => 1 (expected 1)
[90, 1020, 0] => 1 (expected 1)
[73, 1003, 1] => 0 (expected 0)
[77, 1007, 1] => 0 (expected 0)
[81, 1011, 1] => 0 (expected 0)
[85, 1015, 1] => 1 (expected 0)
[89, 1019, 1] => 1 (expected 0)
[72, 9002, 0] => 1 (expected 1)
[76, 9006, 0] => 1 (expected 1)
[80, 9010, 0] => 1 (expected 1)
[84, 9014, 0] => 1 (expected 1)
[88, 9018, 0] => 1 (expected 1)
[71, 9001, 1] => 1 (expected 1)
[75, 9005, 1] => 1 (expected 1)
[79, 9009, 1] => 1 (expected 1)
Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #
=================================================================
dense (Dense)                (None, 12)                48
_________________________________________________________________
dense_1 (Dense)              (None, 6)                 78
_________________________________________________________________
dense_2 (Dense)              (None, 1)                 7
=================================================================
Total params: 133
Trainable params: 133
Non-trainable params: 0
_________________________________________________________________
None

Thanks very much
Kevin

A: Could it be that you just don't have enough training data? Usually you train on 1000s of data points, not just 8. If this was the case, the network weights post-training would be very similar to what they were pre-training.
It does look like your loss is dropping from epoch to epoch though, so I think you should be good if you just train for more epochs. That would effectively do the same thing as adding more training data, assuming you can't come up with more combinations of features and actions. If you can, definitely do that before just cranking up the number of epochs.


text:
Q: Como colocar este article alineado con los demas Tengo un problema, esto me pasa cuando on responsive hago la pantalla mas pequeña ya que el texto no cabe:

Son 4 articles en cols de Bootstrap, he intentado darle clearfix detrás de todos los article así todos deberían agrandarse, pero no va. Mi única solución fue darle padding:0, le quito lo que antes tenia asi no me estorba, pero es una forma muy pobre, ¿alguna idea de cómo solucionarlo?
Éste es mi código:

/*------------- GENERAL ------------*/
body {
  /*NOT NECESSARY*/
  /*overflow-x: hidden;*/
  color: #8d8d8d;
}

i:not(.sinColorSepia) {
  color: rgb(122, 76, 30);
}

section {
  padding: 70px 0;
}

.row {
  padding: 12px 0;
}

/*---------------SECTION 2 ARTICLES---------------*/

section:nth-child(2) {
  padding: 40px;
  text-align: center;
  background: #000 url('../img/backgrounds/bg-skills.jpg') no-repeat fixed center / cover;
  color: white;
}

.section2 i {
  font-size: 30px;
  padding-bottom: 10px;
  position: relative;
}

.relativoParaVelo {
  position: relative;
}

.section2 article div {
  font-size: 30px;
  position: relative;
}

.section2 article {
  border: 1px solid white;
  padding: 30px;
  position: relative;
}

.section2 article::before {
  content: '';
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, .08);
  top: 0;
  left: 0;
  position: absolute;
}

.section2 article p {
  font-size: 15px;
  font-style: oblique;
}

/*------------------------COLORES LINEAS----------------------------*/

@media screen and (max-width: 1028px) {
  .section2 article {
    /*padding: 20px;*/
  }
}

@media screen and (max-width: 992px) {
  /*------------------------GENERAL----------------------------*/
  .section2 article {
    margin: 10px;
  }
}

<link href="https://fonts.googleapis.com/css?family=Lato:100,300|Montserrat|Open+Sans" rel="stylesheet">

<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap-reboot.css">
<link type="text/css" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0/css/bootstrap-grid.css">
<link type="text/css" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

752

Proyectos realizados

495

Clientes satisfechos

16

Premios ganados

+900

Litros de café

A: yo lo veo sencillo de solucionar, al .col-lg-3 lo conviertes en un padre flexible y al article pasa a ser un hijo flexible y le agregas la siguiente propiedad flex: 1 0 auto;
te queda de la siguiente manera:
 .col-lg-3{
     display: flex;
 }
 article{
     flex: 1 0 auto;
 }

redpajama_set_name: RedPajamaStackExchange


text:
Q: I'm trying to get an input in node js, but the program immediately runs the after that coming instructions Thats my code:
async function startPro(){
    await sendIt();
    const genKey = 1234

    const readline = require('readline').createInterface({
        input: process.stdin,
        output: process.stdout
    });

    readline.question('Please enter your key?', discKey => {
        console.log(`Your key: ${discKey}!`);
    });

    console.log(discKey.length);
    if (discKey.length == 4) {
        for (var x = 1; x <= taskNr; x++){
            openBrowser();
        }
    }
    else{
        console.log('nope')
    }
}
startPro();

This is the part that should make an input-field, but it kind of just gets skipped, which results in an error.
const readline = require('readline').createInterface({
        input: process.stdin,
        output: process.stdout
    });

    readline.question('Please enter your key?', discKey => {
        console.log(`Your key: ${discKey}!`);
    });

Does somebody know how to fix that?
I tried a lot of things, but nothing worked.


text:
Q: Capture output of command which contains quotes and env vars I know I can capture the output of a bash command like this:
OUTPUT="$(ls -1)"
echo "${OUTPUT}"

But my command itself contains a lot of quotes:
OUTPUT="$(curl -v -u ${USER}:${PASSWD} -X POST -H "Content-Type: application/json" -d '{
"xxx": true,
"xxx2": "date",
...
}' https://${ENV}/${ROOT}/api/try)"

but this returns an empty string:
echo $OUTPUT

How can I capture the output of this command?

A: Just create a function with your complex command:
cmdfn() {
   curl -v -u ${USER}:${PASSWD} -X POST -H "Content-Type: application/json" -d '{
   "xxx": true,
   "xxx2": "date",
   ...
   }' https://${ENV}/${ROOT}/api/try
}

Then call it in command substitution as:
output="$(cmdfn)"

A: Two ways, either escape the quotes inside the string with \", or use single quotes, i.e.
% BLA="bla \"a\""
% echo $BLA
bla "a"
% BLA='bla "a"'
% echo $BLA
bla "a"

A: Bash handles nested quotes and parentheses very well. This is not the case
OUTPUT="$(curl -v -u ${USER}:${PASSWD} -X POST -H "Content-Type: application/json" -d '{
"xxx": true,
"xxx2": "date",
...
}' https://${ENV}/${ROOT}/api/try)"

It's possible that curl itself is not echoing anything.


text:
Q: How to get RSSI of Bluetooth, specfically HC-05 We purchased a Bluetooth device EGBT-045MS in hope that we will be able to get its RSSI. Do you have any idea how to do this?

A: First you send an INQM command (Set inquiry access mode), e.g.
AT+INQM=1,9,48

1 specifies access mode RSSI, 9 specifies the max # of devices to be discovered, and 48 is a timeout value
Follow this by a INQ command (Query Nearby Discoverable Devices)
AT+INQ

It will respond with lines like:
+INQ:1234:56:0,1F1F,FFC0

(up to nine responses in this case, set by the INQM command).  Last entry is followed by an OK.
The first parameter is the address of the discovered Bluetooth device; all digits are hexadecimal.  As shown here, it is in what is called NAP:UAP:LAP format.
The middle parameter is a type field.
The last parameter in the returned string is the RSSI value.  Different makers of Bluetooth modules encode the RSSI value in different ways. From what I can tell looking at other documents, this module always returns 16-bit negative numbers in the range FF80 (or maybe FFC0) to FFFF.  So a higher number probably means a high signal strength.


text:
Q: How to implement Tabs UI in android I have existed code for two activities(ActivityA and ActivityB).
Now I need to have a another activity, which will act as my first and only screen of my application. This activity will be having two tabs on its header part and I need to display each of my Activity when user press on each tab.
I have done some search on this and found TabAcivity will be suitable choice, but it is deprecated now.
I saw many posts which are suggesting Fragments. But I dont want to change my existing code. Can any one suggest me easy method to incorporate this.

A: you can use Android Tab Layout with Swipeable Views
here i give Link in this link step by step information given. so i think you can get batter idea from that.
Tab Layout with Swipeable Views
you can also download code from this site and also see video in given sit


text:
Q: Grouping elements in a list such that each seed produces unique combination I have a unique problem . Let us consider we have a list of elements [1,2,3,4,5,6] .  I need to select certain set of elements to form pools based on the pool size. i.e. if pool size is 3 and my list size is 6 then there are total 6C3 possible combinations possible. This can be done by random sample
But here is the catch lets say I have a bigger list and I have to group all the members in the list such that all of them are present in a group for one iteration(lets call this seed).
Now for the next seed I will again group the elements in a different combinations but the combinations I get must be unique from the combinations I got in the previous seed.
Example:
elements are [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18]
Now my pool size is 3
my seeds 3
seed1-'[[1,2,3],[4,5,6],[7,8,9],[10,11,12],[13,14,15],[16,17,18]]'

seed2-'[[1,5,3],[4,2,6],[7,11,9],[10,8,12],[13,17,15],[16,14,18]]'

seed3-'[[1,5,6],[4,2,3],[7,11,12],[10,8,9],[13,17,18],[16,14,15]]'

Note that all elements must be present once in a seed and none of the combinations in any of the seeds must be repeated. It may look simple for small set of elements but Iam trying to implement this on a element size of 300 with 500 seeds

A: Provided that the number of seeds you generate does not come close to exhausting the possible combinations, what you can do is a shuffle of the whole list of numbers that you then break down in chunks of the pool size.  Then keep track of the pools used so far and generate another shuffle when you have a conflict.
This can be done in a generator function so that you don't need to predetermine the number of seeds you're going to generate:
from random import sample
def seedPools(elements,poolSize):
    used = set()
    while True:
        shuffled = sample(elements,len(elements))
        seed     = [ tuple(shuffled[i:i+poolSize])
                     for i in range(0,len(elements),poolSize)]
        if any(pool in used for pool in seed): continue
        yield seed
        used.update(seed)

Sample output:
seedGen = seedPools(list(range(1,19)),3)
for _ in range(10): print(next(seedGen))

[(9, 13, 18), (10, 15, 12), (14, 16, 2), (3, 1, 17), (4, 5, 8), (6, 11, 7)]
[(16, 7, 6), (14, 12, 5), (15, 4, 17), (3, 10, 8), (9, 11, 2), (13, 18, 1)]
[(6, 8, 7), (10, 9, 15), (2, 1, 14), (17, 18, 12), (11, 3, 4), (5, 16, 13)]
[(12, 1, 3), (6, 5, 16), (2, 14, 9), (7, 8, 15), (10, 13, 11), (17, 4, 18)]
[(7, 14, 12), (4, 10, 13), (9, 17, 5), (16, 3, 2), (1, 11, 18), (8, 15, 6)]
[(18, 13, 10), (12, 1, 14), (8, 6, 15), (3, 2, 5), (16, 9, 11), (17, 4, 7)]
[(6, 5, 12), (8, 2, 13), (1, 15, 14), (17, 10, 7), (3, 11, 4), (16, 9, 18)]
[(14, 6, 1), (11, 5, 18), (12, 10, 16), (8, 13, 17), (15, 9, 2), (4, 7, 3)]
[(10, 16, 11), (1, 15, 5), (4, 3, 12), (6, 14, 2), (17, 18, 9), (7, 8, 13)]
[(11, 10, 1), (12, 8, 14), (17, 13, 6), (18, 7, 5), (9, 15, 4), (3, 16, 2)]

To generate 500 seeds from 300 items, you can use a list comprehension (or you could add a parameter to the generator function)
seedGen  = seedPools(list(range(1,301)),3)
bigSeeds = [ next(seedGen) for _ in range(500) ] # 0.14 second on my computer

Note: I assumed that you don't want any of the pools to repeat across seeds.  If the pools are allowed to repeat, then you only need to check if tuple(seed) in used: continue to try another shuffle, and of course record the whole seed instead of individual pools in the usedset after yielding a unique seed: used.add(tuple(seed))
[EDIT] Here is the function adjusted to spread extra values to random pools so that all pools have at least the requested pool size:
from random import sample
def seedPools(elements,poolSize,seedCount):
    used = set()
    while seedCount > 0:
        shuffled = sample(elements,len(elements))
        seed     = [ tuple(shuffled[i:i+poolSize])
                     for i in range(0,len(elements),poolSize)]
        if len(seed[-1])<poolSize:
            lastPool = seed.pop(-1)
            spread   = sample(range(len(seed)),len(lastPool))
            for p,v in zip(spread,lastPool):
                seed[p] += (v,)
        if any(pool in used for pool in seed): continue
        yield seed
        used.update(seed)
        seedCount -= 1

for seed in seedPools(list(range(1,20)),3,10): print(seed)

[(14, 11, 18), (2, 12, 9), (8, 3, 4), (7, 6, 13), (16, 17, 15), (1, 19, 10, 5)]
[(9, 15, 11), (1, 3, 2), (14, 10, 19), (8, 5, 12, 7), (6, 16, 4), (18, 17, 13)]
[(19, 10, 18), (5, 9, 2), (4, 1, 6, 16), (13, 11, 15), (12, 8, 17), (14, 7, 3)]
[(1, 5, 15, 12), (2, 6, 14), (18, 8, 11), (16, 13, 19), (3, 17, 4), (10, 7, 9)]
[(7, 14, 8), (12, 18, 6, 2), (17, 9, 16), (15, 5, 3), (13, 11, 10), (4, 19, 1)]
[(15, 6, 17), (2, 10, 3), (7, 19, 16, 9), (4, 11, 5), (8, 13, 12), (14, 1, 18)]
[(1, 16, 2), (19, 14, 18), (12, 17, 5, 7), (13, 11, 4), (9, 6, 3), (15, 10, 8)]
[(2, 17, 19), (8, 13, 5, 18), (7, 11, 1), (16, 15, 6), (14, 12, 4), (10, 3, 9)]
[(3, 12, 7, 15), (4, 11, 2), (17, 1, 14), (19, 10, 6), (13, 9, 5), (18, 8, 16)]
[(13, 15, 12), (9, 1, 18), (5, 3, 10), (16, 4, 14), (11, 17, 7), (19, 2, 6, 8)]


text:
Q: How to extract only file name return from diff command? I am trying to prepare a bash script for sync 2 directories. But I am not able to file name return from diff. everytime it converts to array.
Here is my code :
 #!/bin/bash
 DIRS1=`diff -r /opt/lampp/htdocs/scripts/dev/ /opt/lampp/htdocs/scripts/www/ `
 for DIR in $DIRS1
 do
    echo $DIR
 done

And if I run this script I get out put something like this :
Only
in
/opt/lampp/htdocs/scripts/www/:
file1
diff
-r
"/opt/lampp/htdocs/scripts/dev/File
1.txt"
"/opt/lampp/htdocs/scripts/www/File
1.txt"
0a1
>
sa
das
Only
in
/opt/lampp/htdocs/scripts/www/:
File
1.txt~
Only
in
/opt/lampp/htdocs/scripts/www/:
file
2
-
second

Actually I just want to file name where I find the diffrence so I can take perticular action either copy/delete.
Thanks

A: I don't think diff produces output which can be parsed easily for your purposes. It's possible to solve your problem by iterating over the files in the two directories and running diff on them, using the return value from diff instead (and throwing the diff output away).
The code to do this is a bit long, but here it is:
DIR1=./one # set as required
DIR2=./two # set as required

# Process any files in $DIR1 only, or in both $DIR1 and $DIR2
find $DIR1 -type f -print0 | while read -d $'\0' -r file1; do
    relative_path=${file1#${DIR1}/};
    file2="$DIR2/$relative_path"
    if [[ ! -f "$file2" ]]; then
        echo "'$relative_path' in '$DIR1' only"
        # Do more stuff here
    elif diff -q "$file1" "$file2" >/dev/null; then
        echo "'$relative_path' same in '$DIR1' and '$DIR2'"
        # Do more stuff here
    else
        echo "'$relative_path' different between '$DIR1' and '$DIR2'"
        # Do more stuff here
    fi
done

# Process files in $DIR2 only
find $DIR2 -type f -print0 | while read -d $'\0' -r file2; do
    relative_path=${file2#${DIR2}/};
    file1="$DIR1/$relative_path"
    if [[ ! -f "$file2" ]]; then
        echo "'$relative_path' in '$DIR2 only'"
        # Do more stuff here
    fi
done

This code leverages some tricks to safely handle files which contain spaces, which would be very difficult to get working by parsing diff output. You can find more details on that topic here.
Of course this doesn't do anything regarding files which have the same contents but different names or are located in different directories.
I tested by populating two test directories as follows:
echo "dir one only" > "$DIR1/dir one only.txt"
echo "dir two only" > "$DIR2/dir two only.txt"
echo "in both, same" > $DIR1/"in both, same.txt"
echo "in both, same" > $DIR2/"in both, same.txt"
echo "in both, and different" > $DIR1/"in both, different.txt"
echo "in both, but different" > $DIR2/"in both, different.txt"

My output was:
'dir one only.txt' in './one' only
'in both, different.txt' different between './one' and './two'
'in both, same.txt' same in './one' and './two'

A: Use -q flag and avoid the for loop:
diff -rq /opt/lampp/htdocs/scripts/dev/ /opt/lampp/htdocs/scripts/www/

If you only want the files that differs:
diff -rq /opt/lampp/htdocs/scripts/dev/ /opt/lampp/htdocs/scripts/www/ |grep -Po '(?<=Files )\w+'|while read file; do
   echo $file
done

   -q  --brief
          Output only whether files differ.

But defitnitely you should check rsync: http://linux.die.net/man/1/rsync


text:
Q: How to set dynamical text with images and videos In my Xcode project I download text and image/video links from a server. Now i want to set this informations into textview's / imageview's. But I don't know how to set the height of a textview because the text have a different length. So what i mean is - I want to have a dynamical view.
When I parse the sample text:
SampleTextSampleTextSampleTextSampleTextSampleTextSampleText #Video# SampleTextSampleTextSampleTextSampleText #Image# SampleTextSampleText
Now I want to set the different Images und Videos for the tags (#Video# and #Image#)
I hope you know what I mean

A: try:
[textView sizeToFit];

it should work.


text:
Q: Javascript trouble with .show after hide it can someone help me, i have some javascript problem, i just want to hide $('#uploaded_image'), and i can do it with .hide(); but after that, i want to show it again with onclick="$(#uploaded_image).html.show(); in html tags inside javascript, but it still hide, what i must do then??? here's the code:
$('#a').hide();
$('#thumbnail_form').hide();
$('#uploaded_image').hide();
$('#a').show().html('<input type="button" value="  Ok  " onclick="window.location.reload()"> For Crop<input type="button" value="Click Here" onclick="$(#uploaded_image).html.show();">');

$('#uploaded_image').html('

Select Image Area For Crop

')

Sorry For my bad language, i'm not an europeans...

A: Instead of this $(#uploaded_image).html.show() do this $('#uploaded_image').show()
You apply the .show() or .hide() to the selected element, not to its contents.
Also, don't forget the quotes (see the second part)

A: Syntax is wrong, $(#uploaded_image).html.show(). You are missing quotes & html is not needed since you dont want to set any content.
If you want to just show the element again use $(\'#uploaded_image\').show()

A: Your syntax in your onclick handler is wrong and you also forgot the quotation marks:
onclick="$(#uploaded_image).html.show();">

Replace it with
onclick="$(\'#uploaded_image\').show();">


text:
Q: EF and LINQ query to database speed I just wondering if I am wasting my time or is there anything I could to improve this query which in turn will improve performance.
Inside a Repository, I am trying to get the 10 most recent items
    public List<entity> GetTop10
    {
        get
        {
            return m_Context.entity.Where(x => x.bool == false).OrderByDescending(x => x.Created).Take(10).ToList();
        }
    }

But this is taking a long time as the table its querying has over 11000 rows in it. So my question is, is there anyway I could speed up this kind of query?
I am trying to get my SQL hat on regarding performance, I know the order would slow it down, but how I could I achieve the same result?
Thanks

A: The particular query you posted is a potential candidate for using a filtered index. Say you have a SQL table:
CREATE TABLE Employees
(
    ID INT IDENTITY(1,1) PRIMARY KEY,
    Name NVARCHAR(100),
    IsAlive BIT
)

You can imagine that generally you only want to query on employees that have not (yet) died so will end up with SQL like this:
SELECT Name FROM Employees WHERE IsAlive = 1

So, why not create a filtered index:
CREATE INDEX IX_Employees_IsAliveTrue
ON Employees(IsAlive)
WHERE IsAlive = 1

So now if you query the table it will use this index which may only be a small portion of your table, especially if you've had a recent zombie invasion and 90% of your staff are now the walking dead.
However, an Entity Framework like this:
var nonZombies = from e in db.Employees
                 where e.IsAlive == true
                 select e;

May not be able to use the index (SQL has a problem with filtered indexes and parameterised queries). To get round this, you can create a view in your database:
CREATE VIEW NonZombies
AS
SELECT ID, Name, IsAlive FROM Employees WHERE IsAlive = 1

Now you can add that to your framework (how you do this will vary depending on if you are using code/model/database first) and you will now be able to decide which employees deserve urgent attention (like priority access to food and weapons):
var nonZombies = from e in db.NonZombies
                 select e;

A: From your LINQ query will be created SQL SELECT similar to this:
SELECT TOP(10) * FROM entity
WHERE bool = 0
ORDER BY Created DESC

Similar because instead of the '*' will server select concrete columns to map these to entity object.
If this is too slow for you. The error is in the database, not in the EntityFramework.
So try adding some indexes to your table.


text:
Q: Change a dynamic variable name with rxSetVarInfo Trying to change a variable name of an XDF with rxSetVarInfo.
I want to merge several data sets with common var names.  (I know rxMerge can/will append to filenames where needed.  I want to have more control than that.)
This works:
outLetter<- "A"
exp <- list(pct.A = list(newName = paste0("X.pct.",outLetter)))
rxSetVarInfo(varInfo = exp, data = tempXDFFile)

That's where I know the original column name, pct.A. What if that's dynamic?  What if this is in a function that gets called several times with different outLetter's.  (The "A" isn't hardcoded.)
This does not work:
function(outLetter){
  exp <- list(paste0("pct.",outLetter) = list(newName = paste0("X.pct.",outLetter)))
  rxSetVarInfo(varInfo = exp, data = tempXDFFile)
}

Nor does:
exp <- parse(text = exp)
rxSetVarInfo(varInfo = exp, data = tempXDFFile)

Yes, I can hardcode all the permutations.  Trying to find a more elegant approach.

A: Please try this code:
dynamicName <- function(outLetter){
  exp <- vector(mode="list", length=1)
  names(exp) <- paste0("pct.",outLetter)
  exp[[paste0("pct.",outLetter)]] = list(newName = paste0("X.pct.",outLetter))
  rxSetVarInfo(varInfo = exp, data = tempXDFFile)
}

Before the call to rxSetVarInfo(), "exp" contains:
$pct.A
$pct.A$newName
[1] "X.pct.A"

Running your "this works" case, I see:
> outLetter<- "A"
> exp <- list(pct.A = list(newName = paste0("X.pct.",outLetter)))
>
> exp
$pct.A
$pct.A$newName
[1] "X.pct.A"

Hope this helps!
Note, please make sure that your dynamic naming function has access to the variable "tempXDFFile", you may want to consider passing it as a parameter, like:
dynamicName <- function(outLetter, data){
  exp <- vector(mode="list", length=1)
  names(exp) <- paste0("pct.",outLetter)
  exp[[paste0("pct.",outLetter)]] = list(newName = paste0("X.pct.",outLetter))
  rxSetVarInfo(varInfo = exp, data = data)
}


text:
Q: What tick rate are the Fortnite servers using? I have been playing Fortnite quite a bit, and noticed there is sometimes lag between progress bar's finishing and actions completing (moving too soon and interrupting a potion, etc).
I was curious as CSGO has the "tick" rate fairly public, but Fortnite only shows packet rate.
What is the tick rate on the Fortnite servers?

A: Read it somewhere that they have 18 tick rate servers.
Cannot remember exactly where but the same value seems to be in this thread also:
https://www.reddit.com/r/FortNiteBR/comments/79pl3r/fnbr_performance_update/

A: 18 Hz tickrate is an average value.
I think all these tickrate values are from videos from Battle(non)sense. And this is one of the videos where he shows all the values for fortniet and pubg


text:
Q: "Third Time's A Charm" has conflicting descriptions? When I looked on the Winterbash 2016 page where they describe about each of the hats, there is a description of "Third Time's A Charm".
Which says:

hit the reputation cap on three different days

But on the answer for regular hats on hat list post, there is something else:

Which one should we follow to get the Hat?

A: The criteria listed on Meta is the more updated one.
The criteria posted on Meta is the more accurate one since those are updated by users who have already gotten the hat. They are collated from the Winter Bash chatroom and the secret hats Docs. In this case, bluefeet mentioned it in the chatroom.
Similarly, there are also other hats with additional criteria that not mentioned in the Winter Bash page, such as Lifesaver (which requires at least an upvote) and conflicting criteria for Snaphat (due to a bug).
That being said, the criteria listed on the Meta list and the official Winter Bash page doesn't differ a lot. Hitting the reputation normally means getting at least 200 reputation (unless you include bounties and accepted answers).


text:
Q: FirstOrDefaultAsync() & SingleOrDefaultAsync() vs FindAsync() EFCore We have 3 different approaches to get  single items from EFCore they are FirstOrDefaultAsync(), SingleOrDefaultAsync() (including its versions with not default value returned, also we have FindAsync() and maybe more with the same purpose like LastOrDefaultAsync().
var findItem = await dbContext.TodoItems
    .FindAsync(request.Id)
    .ConfigureAwait(false);

var firstItem = await dbContext.TodoItems
    .FirstOrDefaultAsync(i => i.Id == request.Id)
    .ConfigureAwait(false);

var singleItem = await dbContext.TodoItems
    .SingleOrDefaultAsync(i => i.Id == request.Id)
    .ConfigureAwait(false);

I would like to know the differences between each one of them. So far what I know is that we FirstOrDefaultAsync() to get the first given a condition, (usually using this because we know that more than one item can satisfy the condition), on the other hand we use  SingleOrDefaultAsync() because we know that there is only one possible match to find, and FindAsync() to get an item given its primary key.
I think FirstOrDefaultAsync() & SingleOrDefaultAsync() always hit the database (not sure about this), and FindAsync() this is what Microsoft docs says:

Asynchronously finds an entity with the given primary key values. If
an entity with the given primary key values exists in the context,
then it is returned immediately without making a request to the store.
Otherwise, a request is made to the store for an entity with the given
primary key values and this entity, if found, is attached to the
context and returned. If no entity is found in the context or the
store, then null is returned.

So my question is, if our given condition used for FirstOrDefault(), SingleOrDefault() and FindAsync() is the primary key, do we have any actual difference?
What I think is that the first time they are used always hit the db, but what about the next calls?. And probably EFCore could use the same context to get the values for FirstOrDefault() and SingleOrDefault() as it does for FindAsync(), maybe?.

A: FindAsync

In much of the scaffolded code, FindAsync can be used in place of
  FirstOrDefaultAsync.

SingleOrDefaultAsync

fetches more data and does unnecessary work. throws an exception if
  there's more than one entity that fits the  filter part.

FirstOrDefaultAsync

doesn't throw if there's more than one entity that fits the filter
  part.

https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/crud?view=aspnetcore-2.2#singleordefaultasync-vs-firstordefaultasync

A: FindAsync:

*

*Accepts primary key

*Optimized for finding an entity with a primary key, by returning the
entity without hitting the database if the entity was tracked.

*Can't use the include method with FindAsync.

*Returns default value if no match was found.

FirstOrDefaultAsync:

*

*Accepts Expression.

*Better choice over FindAsync if related entities are needed.

*Returns default value if no match was found.

SingleOrDefaultAsync:

*

*Accepts Expression.

*Returns default value if no match was found.

*Throws an exception if more than one match were found.


text:
Q: Java 8 Stream | Add a value of the stream to another List/Collection without using foreach or any terminal Operation So far i tried to add values from a stream to a list with peek() but later I found out that peek() is only used "to support debugging, where you want to see the elements as they flow past a certain point in a pipeline".
Now my question is whats the coding-convention here ?
Do I map it in a second stream or can I map it one String like my Code with Peek() ?
    final int range = 9;

    List <String> help = new ArrayList<String>();

    //random numbers to fill help
    for(int i = 5;i< range;i++)
    {
        help.add(String.valueOf(i+(i*2)+(i*(i+2))) );
    }

    List<Test> others = new LinkedList<>();

    List<Test> tests = help.stream().map(s-> new Test(s,(int) Integer.valueOf("10")))
    .peek(t->System.out.println(t.getText()))
    .peek(t-> others.add(t)).collect(Collectors.toList());

The class Test looks like this:
public class Test
{
    String text;
    int id;

    public Test(String text, int id) {
        this.text = text;
        this.id = id;
    }

    public String getText() {
        return text;
    }

    public int getId() {
        return id;
    }
}

A: You could add that functionality to the lambda in the mapping part:
List<Test> tests = help.stream().map(
    s-> {
      Test t = new Test(s,(int) Integer.valueOf("10")));
      System.out.println(t.getText());
      others.add(t)
      return t;
    }
.collect(Collectors.toList());

That simply moves your extra steps into an existing step, avoiding any further loops etc


text:
Q: Form Submission Opens New Tab/Window?
Possible Duplicate:
submit a form in a new tab

How can i open a new window when i submit one form?
    <form method="post" action="<?php echo $PHP_SELF;?>">
    First Name:<input type="text" size="12" maxlength="12" name="Fname">:

    Last Name:<input type="text" size="12" maxlength="36" name="Lname">:

    <input type="submit">
    </form>

A: you can use code like this
    <form action="#" method="post" target="_blank">
      ...
    </form>


text:
Q: Using ampscript to get all records in a data extension between 2 dates Using Marketing Cloud:
I have a data extension with a date field.
On a cloudpage, using ampscript, i need to get all the records from that data extension where the date field is between/including 2 dates.
The LookupRows function seems to be the best available but i can only directly compare values to each other, it can't use a "between" statement.
What would be the best way to achieve this ?
( Other than executing a LookupRows for each date separately )


text:
Q: Can `SpringApplicationBuilder` be used to wire parent/child relationships between `@SpringBootApplication` and `@SpringBootTest`? The following allows the app to start:
public static void main(String[] args) {
  new SpringApplicationBuilder(MyMain.class)
      .run(args);
}

but once I add a @SpringBootTest-annotated class as a child, startup fails due to various beans not being found:
public static void main(String[] args) {
  new SpringApplicationBuilder(MyMain.class)
      .child(MySpringBootTest.class)
      .run(args);
}

How can such a relationship be wired?
Context: We want a Spring Boot App to contain some end-to-end tests and be able to run these tests. Simply having the application use the JUnitRunner to execute the @SpringBootTest winds up with non-unique bean definitions (or something similar).


text:
Q: Sympy patterns for functions In Wolfram Research Mathematica it is possible to define a sustitution rule of the type
sustitution = g_[arg___] -> g[Sequence @@ Reverse[{arg}]]

Then it is possible to apply it to different expressions involving functions with the following results:
f[x, y] /. sustitution   >>  f[y,x]
g[x1,x2,x3]              >>  g[x3,x2,x1]
h[1,z,w,t]/.sustitution  >>  h[t,w,z,1]

As it is possible to use a pattern with name, g_, for the name of the function and another pattern, arg___, for the arguments, the same sustitution rule is valid no matter the name of the function that appears in the expression.
Is it possible to use WildFunction symbols along with replace to obtain a similar efect with Sympy?

A: The arg__ is not necessary for a SymPy type arg-remapping function since the args can be retrieved from the function call itself:
>>> from sympy.abc import x,y,z
>>> from sympy import Function
>>> f = Function('f')
>>> g_ = lambda f: f.func(*list(reversed(f.args)))
>>> g_(f(x,y,z))
f(z, y, x)

Another way of changing all user-defined functions the same way within an expression is to use replace as follows:
>>> from sympy.abc import *
>>> from sympy import Function, AppliedUndef
>>> f,g,h,F=symbols('f,g,h,F',cls=Function)
>>> eq=f(x,y,z)+g(y,x,w)*h(1,u,t)**cos(F(x,y,1,w))
>>> eq.replace(
... lambda x: isinstance(x, AppliedUndef),
... lambda x: x.func(*list(reversed(x.args))))
f(z, y, x) + g(w, x, y)*h(t, u, 1)**cos(F(w, 1, y, x))

If you wanted to apply such a transformation to all functions then use Function instead of AppliedUndef.


text:
Q: Azure Data lake with SSIS Data Filtering I am using Data lake as a source in SSIS but i want to fetch or filter some specific rows in SSIS. Could you please suggest how can we filter Azure data lake data in SSIS.

A: You could use a conditional Split or Derived Column after the Data Lake Store Source in the Data Flow
I'm not sure how you want to filter some specific rows. I assume like filter the row which is having first two characters as AB
(DT_STR,5000,1252)SUBSTRING([Column 0],1,2) != "AB"


text:
Q: show total number of unread notification like Fb in react native i want show to total number of unread notification in my react native app like it shows in facebook top navigation icon like i am using raact native nodejs mongo db

A:  try {

      const val = JSON.parse(await AsyncStorage.getItem('details'))
      const count = await AsyncStorage.getItem('Countn')
      console.log('this local count ', count)

      fetch(link + 'notification/getCustomerNotificationsCount?customerId=' + val.id)
        .then((response) => response.json())
        .then(async (responseJson) => {
          console.log('Notification Count', responseJson);

          if (responseJson.result  >count) {
            console.log('this is if ', count);
            await AsyncStorage.setItem('Countn', JSON.stringify(responseJson.result))
            this.setState({ Nflag: val-count, })

          }
          else {
            console.log('this.is else', responseJson, count,  this.state.Nflag);
            await AsyncStorage.setItem('Countn',JSON.stringify(responseJson.result))

          }

        }).catch((e) => {
          console.log(e);
        })

    } catch (e) {

    }


text:
Q: Merge one branch into multiple other branches using single git command I have been looking for a solution through which It's possible to merge one branch into multiple other branches with single git command, but couldn't find an answer.
Why I want to do it and What I want to do it?
Is: I have a single Base branch that contains all base code and that will be merged into multiple other branches as:

base branch: main-code

other branches: website-clone-1, website-clone-2, website-clone-3 ...

So actually, I have multiple websites configured with a single repository but on different branches. So normally, If there is a change that needs to be replicated on all other websites, I will do it firstly on the main-code branch and then would need to check out each of the website branches and then merge theirs.
So to overcome this repetitive process I'm looking for a solution through which it would be easier for me to merge changes into all other branches with a single line of command instead of doing it on all branches one by one.
Any kind of help will be appreciated.
Cheers!

A: I am not aware of any way to do this with a single command but nothing stops you from creating an alias for a simple script like:
git for-each-ref --format="%(refname:lstrip=2)" refs/heads/website-clone-* |
while read branch
do
    git checkout $branch
    git merge -m "your commit message" main-code
done

git-foreach-ref loops over the branches that starts with website-clone-* and returns their abbreviated refname. With lstrip you remove the first n slashes, so make sure you do not insert any additional subpath when naming a branch. The alternative would be to use :short, but it returns the shortest unambiguous refname. This means that if you have a tag and a branch with the same name, it will return the complete refname, which would take the checkout to a detached state, without merging the actual branch.
The worst part of this script is the fixed commit message, that you cannot extensively customize: the only variables you can use are the branch names that are going to be merged, despite not being very useful for a commit message.


text:
Q: Does having a codimension-1 embedding of a closed manifold $M^n \subset \mathbb{R}^{n+1}$ require $M$ to be orientable? I'm trying to follow a proof about immersing/embedding $\mathbb{RP}^n$ into $\mathbb{R}^{n+1}$, which goes roughly as follows:
Write $\tau=T\mathbb{RP}^n$.  The normal bundle $\nu$ has rank 1, so its Steifel-Whitney class is $w(\nu)=1$ or $w(\nu)=1+x$.  In every case, we need $w(\nu)\cdot w(\tau) = w(\nu \oplus \tau) = w(\epsilon^{n+1})=1$.  If $w(\nu)=1$, then $w(\tau)=(1+x)^{n+1}=1$, so $n+1=2^r$.  If $w(\nu)=1+x$, then similarly $(1+x)^{n+2}=1$ so $n+2=2^r$.  If the immersion is an embedding, the former case must hold.
Why is this true?  I feel like there should be an easy reason, but none of the people I talked with were able to nail down anything precise.  This could be wrong, but it seems like this is tacitly saying that a codimension-1 embedding of a closed manifold must be in fact of an orientable manifold, which is the same as saying that the the normal line bundle has trivial $w_1$ (since line bundles are totally classified by their orientability, i.e. by $w_1$).  Is this true?

A: Any compact, connected manifold $M$ of dimension $n$ embedded in $\mathbb{R}^{n+1}$ is orientable.
This follows from the fact that there exists a smooth function $f$ on $\mathbb{R}^{n+1}$ s.t. $M$ is the zero locus of $f$ and the derivative of $f$ does not vanish on $M$ (so the gradient of $f$ gives a smooth normal vector field).
This also proves Jordan-Brouwer's theorem ($M$ cuts $\mathbb{R}^{n+1}$ in two parts: $f>0$ and $f<0$).
The existence of $f$ is a "technical lemma" ;)
First, using compactness, you can show that there is an $\epsilon > 0$ and a covering $\left( V_x \right)_{x \in M}$ of $M$ such that $B=\left\{ y \in \mathbb{R}^{n+1}\ |\ d(y,M) \lt \epsilon \right\}$ is the disjoint union of the $\left\{ x + t n_x \ |\ -\epsilon \lt t \lt \epsilon \right\}$ ($n_x$ being a vector of norm one orthogonal to $T_x M$), and so $B$ is locally $V_x \times ]-\epsilon,\epsilon[$.
From there you can deduce that $\mathbb{R^{n+1}}$ has an open covering $\left(A_i\right)_i$ with smooth functions $f_i$ on $A_i$ s.t. whenever $A_i \cap A_j \neq \emptyset$, $f_i = \pm f_j$ locally on $A_i \cap A_j$, and $\cup_i f_i^{-1}(0) = M$ has empty interior (for this you need to take a smooth  non-decreasing function $\lambda : \mathbb{R} \rightarrow \mathbb{R}$ s.t. $f(x)=-1$ when $x \lt -\epsilon/2$, $f(x)=1$ when $x \gt \epsilon/2$, and $f$ is increasing inbetween. then for $(y,t) \in V_x \times ]-\epsilon,\epsilon[$, define $f_i(y,t)=\lambda(t)$, and take the $f_i$s to be $1$ outside the $\epsilon/2$-neighbourhood of $M$).
This, together with the simple connectedness of $\mathbb{R}^{n+1}$, gives a smooth function $f$ on $\mathbb{R}^{n+1}$ locally equal to the $\pm f_i$, and you are done.
Now you have a long exercise to solve your technical problem ;)
I'm sorry I couldn't just give you a reference, but the only one I have (and from which I took the above sketch of proof) is a french book: Thèmes d'analyse pour l'agrégation, Calcul différentiel by Stéphane Gonnord and Nicolas Tosel (p. 100).
EDIT: actually they give a reference: Elon L. Lima, The Jordan-Brouwer separation theorem for smooth hypersurfaces, American Mathematical Monthly, Volume 95 Issue 1, Jan. 1988

A: Here's a nice solution I just thought of, which may in fact be logically equivalent to Jim's (if it's even correct!).  I welcome comments addressing that.
Compactify $\mathbb{R}^{n+1}$ to $S^{n+1}$, so we consider $M \subset S^{n+1}$.  By Alexander duality, $$\tilde{H}_0(S^{n+1} \backslash M ; \mathbb{Z}/2) \cong \tilde{H}^{(n+1)-0-1}(M;\mathbb{Z}/2) = \tilde{H}^n(M;\mathbb{Z}/2)=\mathbb{Z}/2,$$ so $H_0(S^{n+1}\backslash M;\mathbb{Z}/2)=\mathbb{Z}/2 \oplus \mathbb{Z}/2$.  Hence $M$ separates $S^{n+1}$.

A: The normal bundle of a codimension 1 embedding of a compact closed manifold $M$ in $\mathbb R^{n+1}$ is indeed trivial. Otherwise, you could find a simple closed curve in $\mathbb R^{n+1}$ that intersects $M$ in a single point. This implies that both the curve and $M$ represent nontrivial mod $2$ homology classes in $\mathbb R^{n+1}$; this is because the intersection product is dual to the cup product and cannot be nonzero on trivial homology classes. However there are no nontrivial homology classes in $\mathbb R^{n+1}$ since it is contractible. So we get a contradiction.
Once the normal bundle is seen to be trivial, one can use the ambient orientation of $\mathbb R^{n+1}$ to locally orient the manifold, since there is a well defined positive normal direction.


text:
Q: How fix this error: returned non-zero exit status 1 in Mallet? Please help me with the following error. I tried a lot to fix it but with no help.
The code:
MALLET_PATH = './Mallet/bin/mallet'

def topic_model_coherence_generator(corpus, texts, dictionary, start_topic_count=2, end_topic_count=10, step=1,cpus=1):
    models = []
    coherence_scores = []
    for topic_nums in tqdm(range(start_topic_count, end_topic_count + 1, step)):
        mallet_lda_model = gensim.models.wrappers.LdaMallet(mallet_path=MALLET_PATH, corpus=corpus, num_topics=topic_nums, id2word=dictionary, iterations=500, workers=cpus)

        cv_coherence_model_mallet_lda = gensim.models.CoherenceModel(model=mallet_lda_model, corpus=corpus, texts=texts, dictionary=dictionary, coherence='c_v')
        coherence_score = cv_coherence_model_mallet_lda.get_coherence()
        coherence_scores.append(coherence_score)
        models.append(mallet_lda_model)
    return models, coherence_scores

lda_models, coherence_scores = topic_model_coherence_generator(corpus=bow_corpus, texts=norm_corpus_bigrams, dictionary=dictionary, start_topic_count=2, end_topic_count=30, step=1, cpus=16)

The error:
0%|          | 0/29 [00:00<?, ?it/s]'.' is not recognized as an internal or external command,
operable program or batch file.
subprocess.CalledProcessError: Command './Mallet/bin/mallet import-file --preserve-case --keep-sequence --remove-stopwords --token-regex "\S+" --input C:\Users\yaiza\AppData\Local\Temp\b44add_corpus.txt --output C:\Users\yaiza\AppData\Local\Temp\b44add_corpus.mallet' returned non-zero exit status 1.

If I write   MALLET_PATH = 'C:/Program files/Mallet/bin/mallet' or 'MALLET_PATH = 'rC:/Program files/Mallet/bin/mallet', return the same error but in first sentence changes to
0%|          | 0/29 [00:00<?, ?it/s]'C:/Program files' is not recognized as an internal or external command,
operable program or batch file..

Thank you

A: Make sure you installed the Java Developers Kit (JDK).
The credit goes to this another answer
After installing the JDK & restarting your computer for changes to take effect, the following codes for the LDA Mallet worked like charm!
import os
from gensim.models.wrappers import LdaMallet

os.environ.update({'MALLET_HOME':r'C:/mallet/mallet-2.0.8/'})
mallet_path = r'C:/mallet/mallet-2.0.8/bin/mallet.bat'

lda_mallet = LdaMallet(
        mallet_path,
        corpus = corpus_bow,
        num_topics = n_topics,
        id2word = dct,
    )


text:
Q: Using time to increase velocity due to gravity problem (fail to get perfect elasticity) I am just trying to bounce a ball to the same height it was at originally. But as soon as I introduce time, rather than frame, i lose momentum somewhere.
Taking the code down to its bare minimum I have the following:
public void onDrawFrame(GL10 gl) {

float timeDelta = System.currentTimeMillis() - startTime;
startTime = System.currentTimeMillis();

update(timeDelta);
}

float gravity = -1.0f;
float PosY = 2400;
float VelocityY = 0;

public void update(float timeDelta){

PosY+=VelocityY;
if(PosY<=0){
    VelocityY=Math.abs(VelocityY);
} else{
    VelocityY+=gravity*timeDelta;
}
Log.d(SystemSingleton.sLogDebug,String.format("Pos: y%f. y%f, timeDelta: %f",PosY, VelocityY, timeDelta));

}

Ive left the time delta as milliseconds (rather than dividing by 1000 to give me seconds as you would expect) to make sure I'm not losing anything due to casts or rounding.
If I ignore timeDelta and just apply the entire gravity every frame, this works fine, the peak of its bounce will be exactly 2400 (it's starting position). But taking timedelta into account, it is always less than 2400 and slowly degrades and then every now and again jumps up a significant amount (sometimes way above 2400) before it begins to degrade again.
Ive obviously got something quite drastically wrong but I can't see it.
Any help is appreciated.

A: You need to take the time step (timeDelta) into account when you calculate the new position.  Instead of doing this:
PosY += VelocityY;  // no!!

Do this:
PosY += VelocityY * timeDelta;

Even better, do this:
PosY += VelocityY * timeDelta + 0.5 * gravity * timeDelta * timeDelta;

Also, I would change the bounce detection a little.  Here is some new code to try:
// Perform the integration
PosY      += VelocityY * timeDelta + 0.5 * gravity * timeDelta * timeDelta;
VelocityY += gravity * timeDelta;

// Check whether it's time to bounce
if (PosY<=0 && VelocityY<0){
    VelocityY = Math.abs(VelocityY);
}
Log.d(...)

A: float timeDelta = System.currentTimeMillis() - startTime;
startTime = System.currentTimeMillis();

My guess is this is the cause. Calling currentTimeMillis could give you two different numbers. What I would do:
float currentTime = System.currentTimeMillis();
float delta = currentTime - startTime;
startTime = currentTime;


text:
Q: Using FileReader only displays Last Line of Text File? I'm trying to display the information from a text file in a JTextArea I've created in a GUI. I've figured out how to get the info from the file to the JTextArea, but it's only grabbing the last line of the file. I need to display all of the lines. I keep changing the loop around, but can't figure this one out. Any help would be greatly appreciated. Here's a look at my code:
public TextArea() {
    initComponents();

    try {
        FileReader one = new FileReader ("info.txt");
        BufferedReader buf = new BufferedReader(one);

        String line = "";
        StringTokenizer st = null;
        int lineNumber = 0, tokenNumber = 0;
        //textArea.setText(line);

        while ((line = buf.readLine()) != null) {
            lineNumber++;

            //break comma separated line using ","
            st = new StringTokenizer(line, ",");

            while (st.hasMoreTokens()) {
                //display csv values
                tokenNumber++;
                line = ("Title: " + st.nextToken()
                        + "\n" + "Make:" + st.nextToken()
                        + "\n" + "Model:" + st.nextToken()
                        + "\n" + "Year:" + st.nextToken()
                        + "\n" + "Price:" + st.nextToken()
                        + "\n" + "Notes:" + st.nextToken()
                        + "\n" + "Details:" + st.nextToken()
                        + "\n");

                textArea.setText(line);
            }

            //reset token number
            tokenNumber = 0;
            //textArea.setText(line);
        }

    } catch (FileNotFoundException e) {
        JOptionPane.showMessageDialog(this, "File not found");
    } catch (IOException e){
        JOptionPane.showMessageDialog(this, "Data not read");
    }

A: Look at your code:
while (st.hasMoreTokens()) {
            //display csv values
            tokenNumber++;
            line = ("Title: " + st.nextToken()
                    + "\n" + "Make:" + st.nextToken()
                    + "\n" + "Model:" + st.nextToken()
                    + "\n" + "Year:" + st.nextToken()
                    + "\n" + "Price:" + st.nextToken()
                    + "\n" + "Notes:" + st.nextToken()
                    + "\n" + "Details:" + st.nextToken()
                    + "\n");

            textArea.setText(line);
        }

Everytime you find a new  token you set the textarea val to last token found.
So obviously text area will display only last line.
You can try something like:
textArea.setText(textArea.getText() + line);

A: I think You are overriding the line variable.
line+=...

Concatenate, and then set the value of the whole line concatenated outside the loop.

A: while (st.hasMoreTokens()) {
            //display csv values
            tokenNumber++;
            line = line +"\n"+("Title: " + st.nextToken()
                    + "\n" + "Make:" + st.nextToken()
                    + "\n" + "Model:" + st.nextToken()
                    + "\n" + "Year:" + st.nextToken()
                    + "\n" + "Price:" + st.nextToken()
                    + "\n" + "Notes:" + st.nextToken()
                    + "\n" + "Details:" + st.nextToken()
                    + "\n");

        }
 textArea.setText(line);


text:
Q: Semantic Issue with UITextfield I'm new to iOS. I've searched on here for UITextfield Sematic Issues here, as well as variations on that. I'm trying to make a pretty simple app, that you:
Enter text into a text filed
Press A button
It changes a label to the text entered in the text field.
But I keep on getting this strange sematic error and I don't know how to fix it.
Code is here:
The .m file.
#import <UIKit/UIKit.h>

@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet UITextField *myTextField;

@property (weak, nonatomic) IBOutlet UILabel *myLabel;

- (IBAction)changeLabel:(id)sender;

@end

The .h
#import "ViewController.h"

@interface ViewController ()

@end
@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)changeLabel:(id)sender {
    NSString *message = [[NSString alloc] initWithFormat:@"Hello %@", [myTextField text]];
    [myLabel setText:message];
}

Thanks.

A: The problem is that you are referencing your properties directly without a "self.". Replace your m file contents with this:
@interface ViewController ()

@end
@implementation ViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)changeLabel:(id)sender {
    NSString *message = [[NSString alloc] initWithFormat:@"Hello %@", [self.myTextField text]];
    [self.myLabel setText:message];
}

@end

A: I'm expecting error like unknown Reciever 'myTextField' error it means,
in IOS 6 apple providing Synthesize property by default so you can use
Either
NSString *message = [[NSString alloc] initWithFormat:@"Hello %@", [_myTextField text]];

or
NSString *message = [[NSString alloc] initWithFormat:@"Hello %@", [self.myTextField text]];


text:
Q: Getting only first result from foreach loop, I need second result also foreach ($myassignment->result() as $e){
    $courseId=$e->courseId;
}

$getassign=$this->Usermodel->getmysubassignment($courseId);

There are two result in $myassignment. I need 2 courseId from that but I am getting only one. How to get second one.

A: Store the values in an array like below:
$courseId = [];
foreach ($myassignment->result() as $e){
    $courseId[] = $e->courseId;
}

$getassign1 = $this->Usermodel->getmysubassignment($courseId[0]);
$getassign2 = $this->Usermodel->getmysubassignment($courseId[1]);
.
.
.

A: your assign code is out side of the loop
foreach ($myassignment->result() as $e){
    $courseId=$e->courseId;
$getassign[]=$this->Usermodel->getmysubassignment($courseId);
}

A: foreach ($myassignment->result() as $e){
    $courseId[]=$e->courseId;
}

$getassign=$this->Usermodel->getmysubassignment($courseId[0]);
$getassign=$this->Usermodel->getmysubassignment($courseId[1]);

try this

A: $courseId can only hold one variable. You overwrite the first entry from $myassignment->result() with the second one.
Use an array instead:
foreach ($myassignment->result() as $e){
    $courseId[]=$e->courseId;
}

A: foreach ($myassignment->result() as $e){
    $courseId[]=$e->courseId;
}
for($i=0;$i<2;$i++){
$getassign=$this->Usermodel->getmysubassignment($courseId[$i]);
}

using for loop (if you want in the future to increase the result you can do it by one change to this for loop)


text:
Q: javascript store variable in object for use in function 2nd version of question (first below)
I am web-scraping with permission using Cheerio. Each store website has a different traversal path for its information. I have an array of objects containing store website information. With help from a response below I am using an arrow function for the productTitle key, but it is returning blank.
const sellerArray = [
    {
        sellerUrl: 'https://www.thebeststoreever.com',
        sellerName: 'The Best Store Ever',
        productTitleFn: ($) => $(this).find('h3').text().trim()
    }
];

axios(sellerArray[0].sellerUrl)
    .then(response => {
        const html = response.data;
        const $ = cheerio.load(html);
        const productTable = $('.plusplus');
        productTable.each(function () {
            const id=uuid();
            const seller = sellerArray[0].sellerName;
            const productTitle = $(this).find('h3').text().trim();
            console.log(productTitle); //returns "The Greatest Product Ever"
            const productTitleFn = sellerArray[0].productTitleFn($);
            console.log(productTitleFn); //returns blank
        });
    })
    .catch(console.error);

First version of question:
I am web-scraping with permission using Cheerio. Each store website has a different traversal path for its information. I have an array of objects containing store website information. I would like to map this array to a function using variables that are valid inside the function but not inside the object. If I code it like below, I get the error 'html is not defined'. If I put quotes around the 'productTitle' value, of course it just passes a string. How should I approach this?
const sellerArray = [
    {
        sellerUrl: 'https://beststoreever.com'
        sellerName: 'Best Store Ever',
        producTitleTraversalPath: html(this).find('h3').text().trim(),
    },
    {
        sellerUrl: 'https://2ndbeststoreever.com',
        sellerName: '2nd Best Store Ever',
        producTitleTraversalPath: html(this).find('.myProduct').children[0].text().trim(),
    }
]

function parseStoreInfo(seller, data) {
    const html = cheerio.load(data);
    const products = html('.sellerProductsTableName');

    products.map(item => {
        const id=uuid();
        const sellerName = seller.sellerName;
        const productTitle = seller.productTitleTraversalPath;

        //push to myProductArray for future use
    });
}

sellerArray.map(seller => axios(seller.sellerUrl)
    .then(response => {
        parseStoreInfo(seller, response.data);
    })
    .catch(console.error));

A: Try defining the "Extracting the Title" part as a function inside the array, something like this:
productTitleTraversalFn: function(obj) { return obj.find('h3').text().trim(); }

Or using arrow function notation:
productTitleTraversalFn: obj => obj.find('h3').text().trim();

You can then call that function when the object has loaded, along the lines of
const productTitle = productTitleTraversalFn($(this));

A: Turns out this was a "this" problem:
Got it! I changed the function inside the object to (do not use 'this' in this line of code):
productTitleFn: ($, item) => $(item).find('h3').text().trim()

and I changed the function call to:
const productTitleFn = sellerArray[0].productTitleFn($, this);


text:
Q: PROVEtech:TA doesnt start gRPC Server defined in TM.ini I am using PROVEtech:TA 2021 SE SP3 64 bit.
I have defined the gRPC Address / Port to listen to in the TM.ini defined in the TA.ini (shown in settings) as such.
[gRPC1]
Listen=127.0.0.1:9876

Restarted P:TA.
A call from a gRPC Client gives me this error:
Status(StatusCode="Unavailable", Detail="Error connecting to subchannel.", DebugException="System.Net.Sockets.SocketException (10061)

I checked the ports the P:TA Computer is listening to and it does not show the TCP in the following command:
netstat -n -a -o
It used to work, then P:TA crashed and had to be reinstalled / repaired, now it doesn't work anymore. Does anyone have any pointers as to where to check / what to do?
Thanks :)

A: The issue here was multiple instances of Provetech:TA installed on the computer.
We had PROVEtech:TA 2021 SE SP3 64 bit and PROVEtech:TA 2022 SP3 64 bit installed on the device.
This apparently stopped the gRPC Server from initializing.
If you run into this issue, try uninstalling all instances of PROVEtech:TA from your device - then reinstalling the instance you require. This should solve this issue.


text:
Q: Is it possible to pass php variables in a while loop to html table? Is there a way to pass the variables in the while-loop at the bottom of the script into the table? When I run this in my browser no table is displaying. Any advice on how to solve this issue would be greatly appreciated, being new to html/php/sql I'm not sure how to fix this.
This is a front end page to my database for searching people records:
<?php
session_start();
include_once 'dbconnect.php';

if (!isset($_SESSION['userSession'])) {
    header("Location: index.php");
}

$query = $DBcon->query("SELECT * FROM tbl_users WHERE user_id=".$_SESSION['userSession']);
$userRow=$query->fetch_array();
$DBcon->close();

?>
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome - <?php echo $userRow['username']; ?></title>

<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="bootstrap/css/bootstrap-theme.min.css" rel="stylesheet" media="screen">

<link rel="stylesheet" href="style.css" type="text/css" />

          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            Toggle navigation

          </button>
          Sparrowhawk

Home

Vehicles

 Persons

  <?php echo $userRow['username']; ?>

  Logout

    <?php
include_once 'crud3.php';
?>
<!DOCTYPE html>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Person Search</title>
<link rel="stylesheet" href="style2.css" type="text/css" />

Person Search

<form method="post">

<input type="text" name="q1" placeholder="Names / License Number" ;  ?>

<button type="submit" name="search" value="go">Search</button>

</form>

<?php
    $conn = mysqli_connect("localhost", "root", "", "dbtest");

    if(mysqli_connect_errno()){
        echo "Failed to connect: " . mysqli_connect_error();
    }

    if(isset($_GET['q1']) && $_GET['q1'] !== ' '){
        $searchq = $_GET['q1'];

        $q = mysqli_query($conn, "SELECT * FROM people WHERE fn LIKE '%$searchq%'") or die(mysqli_error());
        $c = mysqli_num_rows($q);
        if($c == 0){
            $output = 'No search results for "' . $searchq . '"';
        } else {
            while($row = mysqli_fetch_array($q))
                $id = $row['id'];
                $fn = $row['fn'];
                $ln = $row['ln'];
                $pa = $row['People_address'];
                $pl = $row['People_licence'];
            }
        }

    } else {
        die(mysqli_error($conn));
    }
    mysqli_close($conn);
?>

  <?php echo "$id"; ?>
  <?php echo "$fn"; ?>
  <?php echo "$ln"; ?>

A: You can close the PHP tags to alternate between HTML and PHP, that will allow you to do this:

    <?php while($row = mysqli_fetch_array($q))
    {

            $id = $row['id'];
            $fn = $row['fn'];
            $ln = $row['ln'];
            $pa = $row['People_address'];
            $pl = $row['People_licence'];
    ?>

            <?php echo "$id"; ?>
            <?php echo "$fn"; ?>
            <?php echo "$ln"; ?>

    <?php } ?>

Maybe this will be more readable:

<?php
    while($row = mysqli_fetch_array($q)):
        $id = $row['id'];
        $fn = $row['fn'];
        $ln = $row['ln'];
        $pa = $row['People_address'];
        $pl = $row['People_licence'];
?>

        <?php echo "$id"; ?>
        <?php echo "$fn"; ?>
        <?php echo "$ln"; ?>

<?php endwhile; ?>

A:
Is there a way to pass the variables in the while-loop at the bottom of the script into the table?

You're looping and updating the variables without ever outputting them, and then you output a table with possibly no data.
What you should do is build the table within the while:
    $table = '
';

    ...

    } else {
        while($row = mysqli_fetch_array($q)) {
            $table .= <<<HTML_ROW

    {$row['id']}
    {$row['fn']}
    Other data

HTML_ROW;
        }
    }
    $table .= '
';

    ...

    print $table;

(Also, your while code as shown will not work as indented because you seem to have forgotten an opening brace)

A: Remember, scoping of variable matters, the scope of below variable ends within else block.
$ln = $row['ln'];
$pa = $row['People_address'];
$pl = $row['People_licence'];

On the other hand, you were trying to access above variable after else block. So, could move table html to while loop

A: you output the table as youre looping through:
<?php
if(isset($_GET['q1']) && $_GET['q1'] !== ' '){
        $searchq = $_GET['q1'];

        $q = mysqli_query($conn, "SELECT * FROM people WHERE fn LIKE '%$searchq%'") or die(mysqli_error());
$c = mysqli_num_rows($q);
?>

<?php if ($c == 0): ?>
  No search results for <?php echo $searchq ?>
<?php else: ?>

    <?php while($row = mysqli_fetch_array($q)): ?>

         <?php echo $row['id'] ?>

    <?php endwhile; ?>


text:
Q: How to finalize a Dialog when the file has finished downloading? I was using the method onCreateDialog but was dreprecated.
Now, I am using a class to be able to make Dialogs with DialogFragment, but I have problem when closing the Dialog.
CustomDialogFragment Class:
package com.teste.dialogfragment;

import android.app.Dialog;
import android.app.DialogFragment;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.Window;

public class CustomDialogFragment extends DialogFragment {

private ProgressDialog pDialog;

public static DialogFragment newInstance(int id) {
    CustomDialogFragment frag = new CustomDialogFragment();
    Bundle args = new Bundle();
    args.putInt("dialog_id", id);
    frag.setArguments(args);
    return frag;
}

@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
    Log.i("teste RETORNO:", String.valueOf(getDialogId()));

    switch (getDialogId()) {
        case 0: // setamos como 0 (horizontal)
            pDialog = new ProgressDialog(getActivity());
            pDialog.setMessage("Wait...downlading file.");
            pDialog.setIndeterminate(false);
            pDialog.setMax(100);
            pDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);
            pDialog.setCancelable(true);
            pDialog.show();
            return pDialog;
        default:
            return null;
    }

}

@Override
public void onCancel(DialogInterface dialog) {
    // use switch statement as the number of cancellable dialogs increase
    //if (getDialogId() == Constants.SHOW_LOGIN_DIALOG) {
        // cancel login here
    //}
    pDialog.dismiss();;
}

public int getDialogId() {
    return getArguments().getInt("dialog_id");
}

}
And the Main class.
public class Activity_dashboard extends Activity{
Button btnShowProgress;

public static final int progress_bar_type = 0;

private DialogFragment mDialogFragment = null;

// files to download
private static String file_url_file_01   = "http://www.teste.com.br/teste_01.json";
private static String file_url_file_02 = "http://www.teste.com.br/teste_02.json";
private static String file_url_file_03 = "http://www.teste.com.br/teste_03.json";
private static String file_url_file_04   = "http://www.teste.com.br/teste_04.json";

public static int MY_COUNT = 4;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.dashboard);

    btnShowProgress = (Button) findViewById(R.id.btGetFiles);
    btnShowProgress.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            MY_COUNT = 4;

            // starting new Async Task
            new DownloadFileFromURL().execute(file_url_auditar, "teste_01.json");
            new DownloadFileFromURL().execute(file_url_hospitais, "teste_02.json");
            new DownloadFileFromURL().execute(file_url_pacientes, "teste_03.json");
            new DownloadFileFromURL().execute(file_url_login, "teste_04.json");
        }
    });
}

/**
 * Background Async Task
 * */
class DownloadFileFromURL extends AsyncTask<String, String, String> {

    @Override
    protected void onPreExecute() {
        if(MY_COUNT == 4){
            super.onPreExecute();
            FragmentManager manager = getFragmentManager();
            mDialogFragment  = CustomDialogFragment.newInstance(progress_bar_type);
            mDialogFragment.show(manager, "dialog");
        }
    }

    @Override
    protected String doInBackground(String... f_url) {
        int count;
        try {

            URL url = new URL(f_url[0]);
            URLConnection conection = url.openConnection();
            conection.connect();
            // this will be useful so that you can show a tipical 0-100% progress bar
            int lenghtOfFile = conection.getContentLength();

            //file name
            File pathToWrite = new File(Environment.getExternalStorageDirectory() + "/teste/");
            File myFile = new File(pathToWrite, f_url[1]);

            if(!pathToWrite.exists()){
                pathToWrite.mkdirs();
            }

            // download the file
            InputStream input = new BufferedInputStream(url.openStream(), 8192);

            // Output stream
            OutputStream output = new FileOutputStream(myFile, false);

            byte data[] = new byte[1024];
            long total = 0;

            while ((count = input.read(data)) != -1) {
                total += count;
                // publishing the progress....
                // After this onProgressUpdate will be called
                publishProgress(""+(int)((total*100)/lenghtOfFile));

                // writing data to file
                output.write(data, 0, count);
            }

            // flushing output
            output.flush();

            // closing streams
            output.close();
            input.close();

            MY_COUNT--;

        } catch (Exception e) {
            Log.e("Error: ", e.getMessage());
        }

        return null;
    }

    //protected void onProgressUpdate(Integer... values) {
        //mDialogFragment.setProgress(values[0]);
    //}

    @Override
    protected void onPostExecute(String file_url) {
       if(MY_COUNT == 0){

            Toast.makeText(getBaseContext(), "Files Updated!", Toast.LENGTH_LONG).show();
            getFragmentManager().beginTransaction().remove(mDialogFragment).commitAllowingStateLoss();
            mDialogFragment.dismiss();
    }
}

}
Look what I call the AsyncTask 4 times because I have to download 4 files. It turns out that opens the Dialog, but when I call OnPostExecute, he closes the Dialog:
protected void onPostExecute(String file_url) {
if(MY_COUNT == 0){
            Toast.makeText(getBaseContext(), "Files Updated!", Toast.LENGTH_LONG).show();
            getFragmentManager().beginTransaction().remove(mDialogFragment).commitAllowingStateLoss();
            mDialogFragment.dismiss();
        }
}

}
It also has the problem, that I could not pass the progress for the progress bar to go as we were updating by downloading
protected void onProgressUpdate(Integer... values) {
        mDialogFragment.setProgress(values[0]);
    }

A: You have to initialize MY_COUNT with 0 and increment it in onPreExecute. Like this:
public static int MY_COUNT = 0;

@Override
protected void onPreExecute() {
    if(MY_COUNT++ == 0){
        super.onPreExecute();
        FragmentManager manager = getFragmentManager();
        mDialogFragment  = CustomDialogFragment.newInstance(progress_bar_type);
        mDialogFragment.show(manager, "dialog");
    }
}

In your code, if(MY_COUNT == 4) is always true, because you decrement it only after the download is complete, that's why it was called 4 times.


text:
Q: How to limit results between two parties in MySQL? I have the below MySQL query, but I am looking to limit the result to recent 5 conversations between the same starter and responder (I have a auto incrementing ID column and also a timestamp column if that helps), how would I achieve this? Simply adding LIMIT 5 to the end - will limit all results.
SELECT * FROM conversations WHERE starter = '%d' OR responder = '%d'

Hope this makes sense?

A: You can add:
ORDER BY (name of your date column) DESC LIMIT 0, 5

To the end of your current query