text:
Q: control ylim labels with scales=free in xyplot lattice I am trying to control the y axis labels in a xyplot when I have the scales argument set to free for the y axis.  I think I have been able  to set the ylim for each panel, but have not been able to figure out how to set the labels for the y axis.  Right now some panels have 2 labels and some panels have a label at the maximum y lim value.  I would like to have it consistent for all panels.
Data:
 dput(datan.1)
structure(list(Cruise = c(201501L, 201501L, 201502L, 201503L,
201501L, 201501L, 201502L, 201502L, 201503L, 201503L, 201503L,
201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 201503L,
201503L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L,
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201501L,
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L,
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201501L,
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L,
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201503L,
201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L,
201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 201503L,
201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 201502L,
201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 201503L,
201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 201501L,
201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L,
201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 201501L,
201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 201503L,
201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 201501L,
201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 201502L,
201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 201501L,
201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 201502L,
201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 201501L,
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L,
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201503L,
201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L,
201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 201503L,
201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 201502L,
201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 201503L,
201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 201501L,
201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L,
201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 201501L,
201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 201503L,
201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 201501L,
201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 201502L,
201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 201501L,
201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 201502L,
201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 201501L,
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L,
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201503L,
201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L,
201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 201503L,
201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 201502L,
201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 201503L,
201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 201501L,
201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L,
201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 201501L,
201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 201503L,
201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 201501L,
201501L, 201501L, 201502L, 201502L, 201502L, 201502L, 201502L,
201503L, 201503L, 201503L, 201503L, 201503L, 201501L, 201501L,
201501L, 201501L, 201501L, 201502L, 201502L, 201502L, 201502L,
201502L, 201503L, 201503L, 201503L, 201503L, 201503L, 201501L,
201501L, 201501L, 201501L, 201501L, 201502L, 201502L, 201502L,
201502L, 201502L, 201503L, 201503L, 201503L, 201503L, 201503L,
201501L, 201501L, 201501L, 201501L, 201501L, 201502L, 201502L,
201502L, 201502L, 201502L, 201503L, 201503L, 201503L, 201503L,
201503L, 201501L, 201501L, 201501L, 201501L, 201501L, 201502L,
201502L, 201502L, 201502L, 201502L, 201503L, 201503L, 201503L,
201503L, 201503L, 201501L, 201501L, 201501L, 201501L, 201501L,
201502L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L,
201503L, 201503L, 201503L, 201501L, 201501L, 201501L, 201501L,
201501L, 201502L, 201502L, 201502L, 201502L, 201502L, 201503L,
201503L, 201503L, 201503L, 201503L, 201501L, 201501L, 201501L,
201501L, 201502L, 201502L, 201502L, 201502L, 201503L, 201503L,
201503L, 201503L, 201501L, 201501L, 201502L, 201502L, 201502L,
201503L, 201503L, 201501L, 201501L), SAMS_region = structure(c(2L,
3L, 3L, 5L, 1L, 5L, 2L, 5L, 1L, 3L, 5L, 2L, 3L, 5L, 2L, 3L, 5L,
3L, 5L, 1L, 2L, 3L, 5L, 1L, 2L, 3L, 5L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L,
5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L,
1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L,
2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L,
3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L, 4L, 5L, 1L, 2L, 3L,
4L, 5L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L, 2L, 3L, 4L, 5L, 2L, 5L,
2L, 3L, 4L, 1L, 2L, 4L, 5L), .Label = c("DMV", "ET", "HC", "HCsr",
"LI"), class = "factor"), Length = c(7.5, 7.5, 7.5, 7.5, 12.5,
12.5, 12.5, 12.5, 12.5, 12.5, 12.5, 17.5, 17.5, 17.5, 17.5, 17.5,
17.5, 17.5, 17.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5, 22.5,
22.5, 22.5, 22.5, 22.5, 27.5, 27.5, 27.5, 27.5, 27.5, 27.5, 27.5,
27.5, 27.5, 27.5, 27.5, 27.5, 27.5, 27.5, 32.5, 32.5, 32.5, 32.5,
32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5, 32.5,
37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5, 37.5,
37.5, 37.5, 37.5, 37.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5,
42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 42.5, 47.5, 47.5, 47.5,
47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5, 47.5,
47.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5, 52.5,
52.5, 52.5, 52.5, 52.5, 52.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5,
57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 57.5, 62.5, 62.5,
62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5, 62.5,
62.5, 62.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 67.5,
67.5, 67.5, 67.5, 67.5, 67.5, 67.5, 72.5, 72.5, 72.5, 72.5, 72.5,
72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 72.5, 77.5,
77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5, 77.5,
77.5, 77.5, 77.5, 82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 82.5,
82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 82.5, 87.5, 87.5, 87.5, 87.5,
87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5, 87.5,
92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5, 92.5,
92.5, 92.5, 92.5, 92.5, 97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 97.5,
97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 97.5, 102.5, 102.5,
102.5, 102.5, 102.5, 102.5, 102.5, 102.5, 102.5, 102.5, 102.5,
102.5, 102.5, 102.5, 102.5, 107.5, 107.5, 107.5, 107.5, 107.5,
107.5, 107.5, 107.5, 107.5, 107.5, 107.5, 107.5, 107.5, 107.5,
107.5, 112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 112.5,
112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 112.5, 117.5, 117.5,
117.5, 117.5, 117.5, 117.5, 117.5, 117.5, 117.5, 117.5, 117.5,
117.5, 117.5, 117.5, 117.5, 122.5, 122.5, 122.5, 122.5, 122.5,
122.5, 122.5, 122.5, 122.5, 122.5, 122.5, 122.5, 122.5, 122.5,
122.5, 127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 127.5,
127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 127.5, 132.5, 132.5,
132.5, 132.5, 132.5, 132.5, 132.5, 132.5, 132.5, 132.5, 132.5,
132.5, 132.5, 132.5, 132.5, 137.5, 137.5, 137.5, 137.5, 137.5,
137.5, 137.5, 137.5, 137.5, 137.5, 137.5, 137.5, 137.5, 137.5,
137.5, 142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 142.5,
142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 142.5, 147.5, 147.5,
147.5, 147.5, 147.5, 147.5, 147.5, 147.5, 147.5, 147.5, 147.5,
147.5, 147.5, 147.5, 147.5, 152.5, 152.5, 152.5, 152.5, 152.5,
152.5, 152.5, 152.5, 152.5, 152.5, 152.5, 152.5, 152.5, 152.5,
152.5, 157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 157.5,
157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 157.5, 162.5, 162.5,
162.5, 162.5, 162.5, 162.5, 162.5, 162.5, 162.5, 162.5, 162.5,
162.5, 167.5, 167.5, 167.5, 167.5, 167.5, 167.5, 167.5, 172.5,
172.5), nwide = c(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 16,
0, 0, 0, 0, 0, 0, 0, 0, 1.5, 7.5, 0, 0, 0, 0, 0, 0, 0, 2, 0,
0, 0, 0, 26, 0, 0, 0, 0, 0, 0, 0, 0, 25.75, 1, 0, 5, 0, 72.5,
0, 0, 0, 0, 0, 4.1, 0, 0, 5, 74.5416666666667, 1.75, 0, 5, 0,
203, 3, 0, 0, 0, 108.75, 0, 0, 0, 14, 439.916666666667, 20, 0,
8.25, 1, 417.105, 6.5, 3.4, 0, 0, 387, 21.65, 0, 0, 48, 994.791666666667,
39.75, 0, 2, 1, 1002.365, 24, 0, 4, 4.95, 790.2, 35.475, 0, 0,
68.5, 1136.625, 38.25, 1.625, 1, 6, 1023.765, 60.25, 0, 14.3333333333333,
7.95, 855.55, 65.6, 0, 1, 40.375, 939.791666666667, 45.0416666666667,
4.25, 7, 4, 943.375, 32, 4.4, 16.2222222222222, 13.5, 826.9,
54.125, 0, 2, 12, 296.208333333333, 30.875, 7.5, 21, 3, 527.125,
56.05, 11.1, 54.7777777777778, 11.25, 467.45, 71.35, 3.2, 11.2,
11.5, 197.833333333333, 47.575, 7.45, 31.32, 7.875, 269.083333333333,
21.4, 19.8, 74.1111111111111, 16, 307.9, 33.225, 4.2, 19.4, 18.5,
151.916666666667, 48.35, 17, 51.73, 10.84, 163.15, 24.9, 59.4,
126.222222222222, 41.75, 118.75, 20.1, 12.2, 17.05, 18.5, 251.833333333333,
107.1, 27.5, 36.54, 40.16, 134.5, 27.5, 125, 111.111111111111,
77.665, 140.9, 8.51, 17.4, 22.15, 45.1, 629.875, 114.225, 37.2,
40.76, 55.715, 359.79, 65.9, 168.9, 87, 108.365, 294.4, 10.01,
24, 11.7, 57.9, 1496.45833333333, 141.925, 42.325, 34.26, 24.41,
1078.49833333333, 140.45, 215, 53, 115.95, 322.845, 23.01, 30.2,
21.9, 29.85, 2552.33333333333, 139.65, 36.375, 36.33, 53.045,
1728.72, 174.25, 164.6, 57.1111111111111, 166.395, 776.07, 150.245,
27.4, 30.3, 46.3, 2561.58333333333, 224.9, 34.3, 46.06, 89.36,
2101.99666666667, 237.55, 82.2, 56.2333333333333, 204.72, 922.745,
286.825, 24.2, 29.6, 202.355, 2898.625, 502.266666666667, 66.825,
75.03, 349.955, 3399.87833333333, 411.95, 116.1, 138.566666666667,
281.815, 1048.625, 626.795, 34.4, 84.05, 598.12, 4501.70833333333,
1488.5, 131.25, 307.65, 1020.96, 5593.03166666667, 971.5, 102.9,
316, 557.415, 1920.21, 1267.92, 80.8, 251.5, 857.17, 6830.79166666667,
2442.38333333333, 173.325, 467.34, 1344.51, 8411.34, 1650.5,
96.4, 552.844444444444, 1032.13, 3298.97, 1574.205, 102.2, 408.2,
725.27, 8797.41666666667, 2349, 150.375, 565.95, 1290.39, 9944.14833333333,
1595.05, 99.7, 626.011111111111, 1342.755, 7052.925, 1379.015,
158, 471.9, 653.68, 9980.20833333333, 1508.2, 110.525, 559.06,
798.92, 10267.5533333333, 1139.75, 110.2, 659.444444444444, 1461.34,
9324.13, 1002.965, 151.6, 524.15, 541.295, 7769.45833333333,
853.258333333333, 119, 497.31, 537.2, 8269.565, 843.65, 154.1,
646.055555555556, 1239.855, 7746.945, 707.575, 123.6, 537, 286.69,
4814.125, 490.85, 137.5, 418.13, 260.465, 4799.68333333333, 513.55,
129.7, 469.833333333333, 659.66, 5212.63, 383.635, 86.6, 439.5,
111.595, 1866.45833333333, 336.058333333333, 106.675, 308.08,
108.65, 2345.025, 264.9, 107.4, 293.2, 307.32, 2464.3, 271.185,
64.8, 282.35, 36.41, 522.5, 134.2, 69.825, 135.15, 50.6, 994.215,
112.6, 88.7, 164.333333333333, 96.165, 1254.82, 192.475, 45.2,
150.55, 9.99, 261.708333333333, 81.975, 52.2, 51.32, 18.5, 382.933333333333,
65, 55.4, 77.8, 43.915, 362.13, 101.585, 22, 71.5, 0, 117.625,
24.375, 19, 13.75, 7.75, 113.875, 30.5, 14.1, 20, 6.75, 89.095,
38.23, 4, 25.35, 1.33, 38.75, 17.75, 8.2, 2, 4.5, 74.7333333333333,
14.5, 9, 3, 13, 10, 13, 4, 4.2, 10, 2, 3, 1, 5.95, 11, 1, 2,
7.5, 8, 2, 4, 2, 0, 18.85, 4.25, 1, 1, 6, 1, 1.25), nfine = c(4.75,
1, 2.25, 1, 1, 5.2, 11, 3, 2, 5.8, 3.99, 11.5, 19.7, 2.2, 154,
17, 8, 1, 20.97, 5.25, 128.75, 141.75, 7.8, 0, 775, 95, 20, 46.8,
17.1, 5, 25.29, 17, 610.316666666667, 298.8, 3.2, 5.1, 1, 2529.97368421053,
347.9, 2, 42, 184.55, 60.2, 25.5, 73.32, 99.25, 2489.3, 734.85,
9.2, 16.2, 12.125, 5208.28070175439, 889.8, 1, 132, 16, 971.21,
202.3, 15, 268.1, 437.25, 6749.47333333333, 2213.35, 78.9736842105263,
31, 109, 12827.8605263158, 2692.25, 7.8, 406.3, 176, 3846.86,
749.26, 14.8, 584.86, 1374, 14372.1883333333, 4299.1, 144, 48.6,
399.5, 20266.4087719298, 5986.6, 18.6, 603.6, 753.985294117647,
9845.53, 2507.6, 83.4, 611.5, 2698.25, 18320.49, 6132.2, 233.373684210526,
108.6, 1253.5, 26216.85, 9642.65, 51.8, 764.25, 1971.71176470588,
17300.03, 6959.34, 229.7, 508.67, 2513.25, 15144.1366666667,
6179.05, 256.615789473684, 233.8, 1913.875, 23985.0385964912,
10083.1, 112.6, 1104.95, 3112.51470588235, 20598.95, 10323.21,
615.5, 1079.92, 1161.25, 8409.37166666667, 4277.35, 294.857894736842,
424.3, 1504.25, 13951.7043859649, 7022.275, 191.2, 2590.4, 2533.06764705882,
16143, 8043.1, 1112.5, 1999.34, 349, 2995.155, 2154.55, 342.294736842105,
783.9, 487.375, 5515.91315789474, 4247.075, 200, 3911.15, 839.594117647059,
7403.84, 4019.14, 1346.1, 2721.35, 107.25, 857.066666666667,
1091.55, 329.094736842105, 958.6, 151.75, 1273.05175438596, 2521.35,
285.2, 4145.35, 295.476470588235, 2354.6, 1741.46, 1392.4, 3844.68,
80.25, 373.6, 570.35, 372.426315789474, 1081.3, 146.375, 558.766666666667,
1189.475, 338.4, 3527.8, 336.582352941176, 591.91, 766.88, 980.7,
3879, 124.25, 544.313333333333, 408.95, 405.7, 724.7, 289.875,
761.837719298246, 798.475, 454, 2338.95, 622.164705882353, 693.87,
322.14, 572.4, 1666.23, 154.75, 1433.98333333333, 472.65, 345.457894736842,
422.6, 311.875, 1573.97035087719, 628.575, 583, 991.75, 922.711764705882,
1605.68, 334.49, 342.1, 708.1, 189.75, 2955.78333333333, 483.1,
241.642105263158, 239.1, 323.75, 2861.94377192982, 604.8, 492.2,
558.95, 1054.97058823529, 3434.17, 349.56, 159.2, 419.37, 113.5,
3496.37, 443.35, 115.494736842105, 147.5, 193.5, 3177.50157894737,
819.8, 277.4, 382.4, 736.211764705882, 4659.87, 477.12, 121.4,
198.95, 63, 2392.70666666667, 235.25, 67.8684210526316, 108.7,
151.375, 2168.86649122807, 568.9, 100.8, 257.9, 194.908823529412,
2618.79, 659.08, 88.6, 117.52, 97.25, 1167.39166666667, 247.45,
42.8, 83.6, 225.125, 1871.22640350877, 351.175, 78.6, 242.5,
194.385294117647, 919.31, 606.66, 52, 108.28, 142.75, 1279.59666666667,
362.85, 63.2, 109.3, 305.25, 2546.84675438597, 529.525, 54.2,
228, 456.8, 697.71, 840.01, 71.2, 144.91, 151, 1724.25166666667,
524.1, 40.5736842105263, 123.5, 439.875, 3762.77736842105, 607.3,
52.8, 214.1, 865.055882352941, 1122.59, 780.16, 42.4, 133.13,
134.25, 2667.27166666667, 516.6, 52, 123.1, 459.75, 4279.19236842105,
560.4, 43.6, 188.9, 675.567647058824, 1250.52, 610.56, 61, 163.07,
100.75, 2569.38333333333, 314.95, 28.3473684210526, 137.2, 284.375,
2968.87473684211, 316.35, 46.8, 225.55, 480.397058823529, 1283.47,
385.08, 41.8, 175.94, 84, 1978.4, 241.55, 27.1473684210526, 144,
140.375, 1972.64947368421, 253.3, 43, 186.15, 223.158823529412,
907.82, 238.26, 26.8, 141.92, 48.5, 1359.06166666667, 113.8,
22.9736842105263, 121.8, 45.5, 802.036052631579, 114.35, 48,
171.1, 52.9, 540.7, 122.99, 28.4, 117.87, 23, 670.626666666667,
46.2, 26.9736842105263, 89.7, 16.75, 320.805, 42.2, 23, 103.35,
18.45, 191, 63.36, 14, 79.66, 11.5, 192.466666666667, 29.05,
23.9736842105263, 51.5, 11, 72.08, 22.2, 22, 57.65, 4.8, 80.3,
47.41, 11.8, 56.36, 3, 117.99, 20.3, 4, 16.1, 1, 32.9, 8.2, 18.8,
21.4, 1, 20.95, 11.86, 5, 11, 2, 30.53, 12, 3, 5, 2.625, 12.1,
10.7, 11, 14.75, 0, 3.8, 8.66, 1, 3, 1, 23.555, 6, 2, 4, 0, 5.9,
3.2, 3, 1.75, 0, 0, 4, 0, 1, 37.6666666666667, 2, 0, 0, 7.2,
0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0)), .Names = c("Cruise",
"SAMS_region", "Length", "nwide", "nfine"), row.names = c(83L,
142L, 424L, 792L, 25L, 252L, 365L, 530L, 584L, 689L, 793L, 84L,
143L, 253L, 334L, 425L, 531L, 690L, 794L, 26L, 85L, 144L, 254L,
283L, 335L, 426L, 532L, 636L, 691L, 741L, 795L, 27L, 54L, 145L,
197L, 255L, 308L, 336L, 427L, 478L, 533L, 637L, 692L, 742L, 796L,
28L, 55L, 115L, 198L, 224L, 309L, 337L, 428L, 479L, 534L, 585L,
638L, 663L, 743L, 797L, 1L, 56L, 116L, 199L, 225L, 310L, 338L,
397L, 480L, 535L, 586L, 609L, 694L, 744L, 798L, 2L, 57L, 117L,
200L, 226L, 284L, 339L, 398L, 454L, 536L, 587L, 610L, 664L, 745L,
799L, 3L, 58L, 118L, 201L, 227L, 285L, 340L, 399L, 482L, 506L,
560L, 611L, 665L, 746L, 800L, 4L, 59L, 119L, 173L, 228L, 286L,
341L, 400L, 483L, 507L, 561L, 612L, 666L, 747L, 769L, 5L, 60L,
120L, 174L, 229L, 287L, 342L, 401L, 455L, 508L, 562L, 613L, 667L,
748L, 770L, 6L, 61L, 121L, 175L, 230L, 288L, 343L, 402L, 456L,
509L, 563L, 614L, 668L, 720L, 771L, 7L, 62L, 122L, 176L, 231L,
289L, 344L, 403L, 457L, 510L, 564L, 615L, 669L, 721L, 772L, 8L,
63L, 123L, 177L, 232L, 290L, 345L, 404L, 458L, 511L, 565L, 616L,
670L, 722L, 773L, 9L, 64L, 124L, 178L, 233L, 291L, 346L, 405L,
459L, 512L, 566L, 617L, 671L, 723L, 774L, 10L, 65L, 125L, 179L,
234L, 292L, 347L, 406L, 460L, 513L, 567L, 618L, 672L, 724L, 775L,
11L, 66L, 126L, 180L, 235L, 293L, 348L, 407L, 461L, 514L, 568L,
619L, 673L, 725L, 776L, 12L, 67L, 127L, 181L, 236L, 294L, 349L,
408L, 462L, 515L, 569L, 620L, 674L, 726L, 777L, 13L, 68L, 128L,
182L, 237L, 295L, 350L, 409L, 463L, 516L, 570L, 621L, 675L, 727L,
778L, 14L, 69L, 129L, 183L, 238L, 296L, 351L, 410L, 464L, 517L,
571L, 622L, 676L, 728L, 779L, 15L, 70L, 130L, 184L, 239L, 297L,
352L, 411L, 465L, 518L, 572L, 623L, 677L, 729L, 780L, 16L, 71L,
131L, 185L, 240L, 298L, 353L, 412L, 466L, 519L, 573L, 624L, 678L,
730L, 781L, 17L, 72L, 132L, 186L, 241L, 299L, 354L, 413L, 467L,
520L, 574L, 625L, 679L, 731L, 782L, 18L, 73L, 133L, 187L, 242L,
300L, 355L, 414L, 468L, 521L, 575L, 626L, 680L, 732L, 783L, 19L,
74L, 134L, 188L, 243L, 301L, 356L, 415L, 469L, 522L, 576L, 627L,
681L, 733L, 784L, 20L, 75L, 135L, 189L, 244L, 302L, 357L, 416L,
470L, 523L, 577L, 628L, 682L, 734L, 785L, 21L, 76L, 136L, 190L,
245L, 303L, 358L, 417L, 471L, 524L, 578L, 629L, 683L, 735L, 786L,
22L, 77L, 137L, 191L, 246L, 304L, 359L, 418L, 472L, 525L, 579L,
630L, 684L, 736L, 787L, 23L, 78L, 138L, 192L, 247L, 305L, 360L,
419L, 473L, 526L, 580L, 631L, 685L, 737L, 788L, 52L, 79L, 139L,
193L, 248L, 306L, 361L, 420L, 474L, 527L, 581L, 632L, 686L, 738L,
789L, 24L, 80L, 140L, 194L, 249L, 307L, 362L, 421L, 475L, 528L,
582L, 633L, 687L, 739L, 790L, 81L, 141L, 195L, 250L, 363L, 422L,
476L, 529L, 634L, 688L, 740L, 791L, 82L, 282L, 364L, 423L, 477L,
583L, 635L, 196L, 251L), class = "data.frame")

plotting code
xyplot(nfine~Length|as.factor(Cruise)*SAMS_region,data=datan.1,
    scales=list(y=list(relation="free")),
    key=list(space="bottom",lines=list(col=c("red","blue")),text=list(c("Survey","CFTDD")),cex=.6,columns=2,padding.text=8),
    ylab=list("Number",cex=.8),xlab=list("Length (mm)",cex=.8),
    strip = strip.custom(bg="white",strip.levels = T),
    prepanel=function(x,y,subscripts,...){
    list(ylim=c(0,max(y)))
    },
    panel=function(x,y,subscripts, ...){
    panel.xyplot(x,y,type="l",col="blue")
    panel.xyplot(datan.1$Length[subscripts],datan.1$nwide[subscripts],col="red",type="l")
    },as.table=T,subscripts=T)

R session information
 sessionInfo ()
R version 3.2.1 (2015-06-18)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] datasets  utils     stats     graphics  grDevices methods
[7] base

other attached packages:
 [1] plotrix_3.5-12      reshape2_1.4.1      reshape_0.8.5
 [4] qpcR_1.4-0          Matrix_1.2-1        robustbase_0.92-5
 [7] rgl_0.95.1435       minpack.lm_1.2-0    lmtest_0.9-34
[10] zoo_1.7-12          dplyr_0.4.2         plyr_1.8.3
[13] MASS_7.3-40         RODBC_1.3-12        latticeExtra_0.6-26
[16] RColorBrewer_1.1-2  lattice_0.20-31

loaded via a namespace (and not attached):
 [1] Rcpp_0.11.6     magrittr_1.5    R6_2.1.0
 [4] stringr_1.0.0   tools_3.2.1     parallel_3.2.1
 [7] grid_3.2.1      DBI_0.3.1       lazyeval_0.1.10
[10] assertthat_0.1  stringi_0.5-5   DEoptimR_1.0-4

Thanks for any help.

A: It isn't clear to me what you want for "consistent".  The number of labels depends on the range of data. The number of labels printed depends on spacing.  If you resize the graphic device, you may see different labels printed.
If you rotate the labels to horizontal, you may get labels for all the tick marks, which is more consistent in some sense. Again, depending on the size of the graphic device. Use rot=c(0,90) and alternating=FALSE.
xyplot(nfine~Length|as.factor(Cruise)*SAMS_region,data=datan.1,
       scales=list(y=list(relation="free"),rot=c(0,90),alternating=FALSE),
       key=list(space="bottom",lines=list(col=c("red","blue")),
                text=list(c("Survey","CFTDD")),cex=.6,columns=2,padding.text=8),
       ylab=list("Number", cex=.8),xlab=list("Length (mm)", cex=.8),
       strip = strip.custom(bg="white",strip.levels = T),
       #   prepanel=function(x,y,subscripts,...){
       #   list(ylim=c(0,max(y)))
       #   },
       panel=function(x,y,subscripts, ...){
         panel.xyplot(x,y,type="l",col="blue")
         panel.xyplot(datan.1$Length[subscripts],datan.1$nwide[subscripts],col="red",type="l")
       },as.table=T,subscripts=T)

Note the prepanel function doesn't seem to be necessary.
EDIT
Following the example in the Lattice Book to get fixed number of y axis ticks.
axis.CF <- function(side, ...) {
 if (side == "left") {
 ylim <- current.panel.limits()$ylim
 top=round(ylim[2],-2)+100
 panel.axis(side = side, outside = TRUE,text.cex=.7, at = 0:4*top/4)
}
else axis.default(side = side, ...)
 }

xyplot(nfine~Length|as.factor(Cruise)*SAMS_region,data=datan.1,
    scales=list(y=list(relation="free"),rot=c(0,90),alternating=FALSE),
   key=list(space="bottom",lines=list(col=c("red","blue")),text=list(c("Survey","CFTDD")),cex=.6,columns=2,padding.text=8),
   ylab=list("Number",cex=.8),xlab=list("Length (mm)",cex=.8),
    strip = strip.custom(bg="white",strip.levels = T),axis=axis.CF,
 #    prepanel=function(x,y,subscripts,...){
 #   list(ylim=c(0,max(y)+100))
 #    },
    panel=function(x,y,subscripts, ...){
    panel.xyplot(x,y,type="l",col="blue")
    panel.xyplot(datan.1$Length[subscripts],datan.1$nwide[subscripts],col="red",type="l")
    },
as.table=T,subscripts=T)


text:
Q: Variables that can contain string and/or number I have a variable that can contain string and/or number but in some case i have to remove numeric characters. So i am basicly;
if defined ARG2 (
    for %%b in (0 1 2 3 4 5 6 7 8 9) do set ARG2=!ARG2:%%b=!
)

It works almost all cases but there is a problem. If ARG2 contain nothing but numeric characters its changing ARG2 value to something like  9= . How can i fix this issue or is there a better way to remove numeric characters from variable?

A: When inputting 888 your for loop will reach 8 and remove all characters from the string. Therefore you have an empty variable. So when you try to remove 9 it expands to nothing, then for some reason (not entirely sure why) cmd doesn't consider the string manipulation, and just displays it (similarly 666 will output 7= and so on). To fix this you simply need to add a check, to see if ARG2 is empty or not.
if defined ARG2 (
    for %%b in (0 1 2 3 4 5 6 7 8 9) do if "!ARG2!"=="" ( goto :break ) else set ARG2=!ARG2:%%b=!
)
:break

This will just goto the :break label if ARG2 expands to nothing.
The answers here - How does the Windows Command Interpreter (CMD.EXE) parse scripts? - should give some better explanation of why.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Updating published post/page in wordpress I have a plugin which should update post_title and post_content of a post. Because of layout problems or other security stuff, I would love to create a new revision for the post and guide the user to the wordpress post details where it can be reviewed. After checking the changes, the user should be able to set this changes live. If the post is still in draft, it is not needed.
I am using wp_update_post() to update post_title and post_content. I also tried to set status to "draft" but then the published content is not online anymore.
Any ideas how to do it?

A: You can use wp_insert_post() instead.
$my_post = array(
  'post_title'    => $title,
  'post_content'  => $content,
  'post_type'   => 'revision',
  'post_status'   => 'inherit',
  'post_parent'   => $YOUR_POST_ID,
  //'post_name'     => $YOUR_POST_ID.'-autosave-'.uniqid()
);
wp_insert_post( $my_post );


text:
Q: Mounting Fedora 25 LVM partition returns unknown filesystem type 'LVM2_member' I have been trying to mount a partition (/dev/sda4 is this detail helps) to /mnt so I can chroot into it from Ubuntu 16.04. But whenever I try to mount it I get the error:
mount: unknown filesystem type 'LVM2_member'

Now I have tried installing lvm2 with APT. I have also tried starting the lvm2-lvmetad service and socket, but I still get this same error. I have seen this answer but it was not helpful to me for two reasons:

*

*Firstly, it seems to pertain to a system with multiple LVM2 partitions where in there is a need to distinguish between their labels. I have only one LVM2 partition and its label is fedora.

*Secondly, it provides no real details on how to rename a partition group (merely says "using vgrename", as opposed to giving a specific command to do this).
If it helps here is my partition table (which I got by running fdisk /dev/sda -l):
Disk /dev/sda: 931.5 GiB, 1000204886016 bytes, 1953525168 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: 70714BA5-A85F-4BEB-BA64-79D0AD3EB7B8

Device          Start        End    Sectors  Size Type
/dev/sda1        2048    1050623    1048576  512M EFI System
/dev/sda2     1050624 1154484223 1153433600  550G Linux filesystem
/dev/sda3  1920108544 1953523711   33415168   16G Linux swap
/dev/sda4  1154484224 1867401215  712916992  340G Linux LVM

Partition table entries are not in disk order.

EDIT:
pvscan returns:
  PV /dev/sda4   VG fedora          lvm2 [339.94 GiB / 12.00 MiB free]
  Total: 1 [339.94 GiB] / in use: 1 [339.94 GiB] / in no VG: 0 [0   ]

while lvscan returns:
  ACTIVE            '/dev/fedora/root' [339.93 GiB] inherit

A: You need to mount the LVM logical disk, not the LVM physical disk. In your specific case, you want to mount /dev/fedora/root.
 fsck -p /dev/fedora/root
 mount /dev/fedora/root /mnt


text:
Q: DocumentRoot is not a directory, or is not readable I'm trying to Install Apache PHP MySQL phpMyAdmin on Windows 10, so I started with Apache so I downloaded it and I installed it as a service with :
>httpd.exe -k install

and then I typed httpd.exe -k start
and this problem shows up

when I open httpd.config file and change it from :

to :

and run httpd.exe -k start the error's not there anymore but when I head up to my browser and type http://localhost
I'm supposed to get a page saying : it works
but instead I got this :

I read this
Apache restart causes DocumentRoot must be a directory, even though it is a directory and there seem to be no privilege issues
https://forums.centos.org/viewtopic.php?t=1053
but it didn't help. How can I fix this error?

A: you need to use /
"C:/Program Files (x86)/Apache Software Foundation/Apache24"
not this
"C:\Program Files (x86)\Apache Software Foundation\Apache24"


text:
Q: Portable way in c++ to get the routing table I need to get the routing table for a machine in a portable fashion.  I'm using C++ and the Boost library is already available if that helps.
No calling external commands like "route" because that isn't portable and the external command may not be available.

A: Certainly calling route isn't advisable as forking and executing is rarely the way.
Unfortunately, I can tell you [as the founder of the Net-SNMP project, where we report routes for many many platforms in C], there is no platform independent way.  You'll need to learn how each one stores its information and how it's accessed.  EG in linux, you can get it from /proc.  In other OSes you can get it through API calls.  You're not likely to be happy to find out that what you want doesn't exist.  And then, you'll even find some platforms that may differ between IPv4 and IPv6!
You are, however, freely available to go dig down into the Net-SNMP code and look for all the ways it's done there.  See agent/mibgroup/ip-forward-mib/data_access/ and agent/mibgroup/mibII/var_route.c for starters.

A: You could look into a third party portability library, like libdnet (BSD license).
https://code.google.com/p/libdnet/


text:
Q: HP Pavillion 17-e67cl Black screen Ubuntu 14.04, only boots with vga in During the boot up of the livecd of ubuntu, the screen was black.
I connected the computer to VGA to see what was happening. Once ubuntu started up (I used the try ubuntu option) I could then see everything so I disconnected the VGA.
I installed it fine. I then turn on the computer to find that it stays at a black screen and from the fans and lack of login sound, I know that it is stuck at some startup process. (I had it set to log in automatically) I try again with the vga attached and it went in perfectly to the desktop and the desktop showed on the laptop screen again.
I tried setting the Grub to nosetmode and have had no luck researching this problem. The black screen is on grub, the loading screen, and the login screen. (The lock screen and login screen work fine if you log out or lock computer, only a problem when just turning computer on)
The 2 issues:

*

*Needs VGA to load ubuntu

*Screen shows black during everything before login.

Computer: HP Pavillion 17-e67cl
Ubuntu: 14.04-LTS
This is getting marked as a duplicate when in fact it is not a duplicate, please read fully through a question before setting it to duplicate moderators. I already had a reply claiming it was a duplicate and I explained that nomodeset did not work. The solution in the other thread does not work, I need a new solution. I did however get another reply which I will be testing soon. I also wrote that there are 2 issues, UBUNTU will not start up unless vga is plugged in, I can tell this by the fans. When i tried recovery mode and did failsafe graphics it had an error code. No Monitor Attatched. This is a laptop therefore there is clearly a monitor attatched. The computer does not read the laptop monitor as being attatched until I am logged in.

A: I have a HP Pavilion DV5 and I always needed to use fn+F3 to increase brightness.
To correct this issue I needed add the acpi_backlight=vendor in Grub.

Open the grub file:
gksudo gedit /etc/default/grub

Locate this line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

and add the option acpi_backlight=vendor:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash acpi_backlight=vendor"

Save and close the file
Update the Grub with this command:
sudo update-grub

Then, restart your system.


text:
Q: Disable re-initialisation of selected tab when pressed again I am having trouble with my UITabBarController. In my application I have 4 tabs, each corresponding to their own root view controller. I can change tabs with no problem and the state of the tab is intact when I switch back. However, if I were to re-select the same tab, the view controller refreshes taking me back to the root.
This is something that I wish to disable in my app and I am wondering if there is any possible way of doing this?

A: Upon researching the issue further, I discovered the solution to this issue was to add the following code:
First add UITabBarControllerDelegate to the header file (in my case, AppDelegate), then add to the main file:
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{

bool r = ([tabBarController.viewControllers indexOfObject:viewController] != tabBarController.selectedIndex);

return r;

}


text:
Q: Multiclass classification problem with loose (not quite accurate) labeling. How to approach? I'm looking for alt. ways to to build multiclass classification problem described below. The problem with using regular classification algorithms like Decision Tree or Logistic Regression is that they consider one value only to be True Positive, while in my data some classification are loosely done, and by that I mean instead of one single right label, 2 or more could be kindof "right", some of them just a bit more accurate than the others, but only one is always chosen. Here is example to demonstrate what I meant:

Feature
Label

1. "My credentials do not work"
"Can't login"

2. "I do not get email with confirmation code"
"Two Factor Verification Issue"

3. "Do not get a receipt"
"Billing issue"

Feature #2 is classified as "Two Factor Verification Issue" in the training set, but could be classified as "Can't login", which is Ok too. The classification was done by human in the past, and it was up to human how to label the feature, and someone did really classified "2-factor verification" issues as just "can't login". The dataset is huge and re-labeling is not possible. Due to such labeling ambiguity training score comes out pretty lame.
I think about ways to better measure quality of a training: What if algorithm offers 2-3 options of classification outcome, and if at least one of them matches defined label, we count it as a successful guess. However a gap in my knowledge of machine learning algorithms do not let me figure out how to do that. Any suggestions? Thanks

A: Firstly, it seems that the classes of your labels are not mutually exclusive. There is a overlap among classes and there are genuine cases where more then one label are right. This is usually not a good idea and can happen when you are looking at classes at too high level.
The right way would be to redefine the classes to maybe something more clear and low level such as: "email loss", "credential mismatch" etc. Higher level classes, such as "login issue", can be a combination of such low level classes in application but model should only look at low level classes.
However since you already have the data and can't re-label as you mentioned I would recommend doing 2 things.

*

*Define the problem as a multi-label problem instead of a multi-classification problem. In multi label you are trying to give a separate score to each class of label and multiple classes can get high score as it's not a one-vs-all.

*Your dataset only has one label for each datapoint when in reality multiple are possible. So you should augment your dataset. Below is one method I can think of

First create a similarity measure for the input items. Idea is you should be able to score 2 items based on how similar they are. It could be based on jaccard similarity of words, doc2vec embedding or some other similarity measure that works for the data.
Then for each input item, you should get a list of new additional labels based on labels of top-n most similar item to itself.
This way you will get much better list of labels and multi label problem should work well


text:
Q: May I know what is the expected value of the second ball being taken, and the expected value of the product? I am trying to solve this problem:
'In a bag n balls numbered 1 ,2,....,n, and each ball is equally likely to be taken. A ball is taken out of the bag. The number on the ball is noted and the ball is not replaced int he bag. Another ball is taken out of the bag and the number on this ball is noted. What is the expected value of the number of the second ball being taken out?'
So, my thought is that:
If the second ball is one, the probability would be:
$$\frac{n-1}{n} \times \frac{1}{n-1} = \frac{1}{n}$$
This is because I think that in order to have number 1 in the second ball, we would have to not take the number '1' at the first ball, and take the number '1' at the second ball. So, due to the fact that each number would have the same probability being taken out, the expected value of the number of the second ball would be:
$$\frac{n+1}{2}$$
May I know why I am wrong? Thank you very much users.
Update:
Thank you very much users. So, the thing that I don't understand is that why isn't the expected value of the product of the two balls $$\frac{(n+1)^2}{4}$$

A: The answer is correct. The working should be clearer.
Let $k$ be any integer in the range $[1,n]$.
The ball with value $k$ will be drawn on the second turn if and only if a ball of value other than $k$ is drawn on the first turn and the ball with value $k$ is drawn on the second turn.
If we let $p(k)$ be the probability of the ball labelled $k$ being drawn on the second turn, then $\displaystyle p(k) = \frac{n-1}n \cdot \frac 1{n-1} = \frac 1n$, which is independent of $k$.
Then the expected value of the second ball is given by $\displaystyle \sum_{k=1}^n kp(k) = \frac 1n \sum_{k=1}^n k = \frac 1n \cdot \frac 12 n(n+1) = \frac{n+1}2$.

A: Another way to think of the expected value of the second ball is to see you do nothing with the number on the first, so imagine drawing one ball, then a second, then swap them and look at the number on the (now) second ball.  It is the first ball drawn, which has an expected value of $\frac {n+1}2$.


text:
Q: whick keyring backend on rhel7 Linux to avoid extra password when storing credential? I install the following packages (not all can be install on both platform) :

*

*Python 3.5.4 :: Anaconda custom (64-bit)

*keyring 9.3.1

*keyring_jeepney 0.2

*keyrings.alt 1.2

*SecretStorage 2.3.1

on both a Windows 7 machine:
Window 7

and on on a RHEL7 Linux machine:
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.3 (Maipo)

$ cat /proc/version
Linux version 3.10.0-514.26.2.el7.x86_64 (sandman@node3res7) (gcc version 4.8.5 20150623 (SuSE 4.8.5-11) (GCC) ) #1 SMP Tue Jul 4 13:45:36 UTC 2017

On Windows the login and password are store in a secure older as expected and without any additional password. I think the WinVaultKeyring is only unlock when the correct user log in if I undertood everything correctly :
>>> from keyring import get_keyring

>>> get_keyring()

<keyring.backends.Windows.WinVaultKeyring object at 0x000000000361CAC8>

On Linux, it is a litttle bit different, a extra password is asked when you start to store loging and password. Evrry time I need to access a loging+password then this last password is requested: Please enter password for encrypted keyring:
You can a see the system storage keyring.backends is different:
>>> from keyring import get_keyring

>>> get_keyring()

<EncryptedKeyring at /home/Cxxxx/.local/share/python_keyring/crypted_pass.cfg>

So my question is which backend for keyring should I use on Linux RHEL7 to avoid this issue of extra password to access the login and password stored with keyring ? Which the actual backend it doesn't seems to be possible to disable it (I tried to put the same password as the linux one or empty password as suggested on forums but none of this work. I don't have admin right to install based packages but I can install python packages without any issue. I look at the doc https://pypi.python.org/pypi/keyring but didn't find the info I was looking at. The reason is that I need to run some code with a cron job and I need to access the few passwords: proxy, api and database.

A: This is actually what just helped me connect the dots:
https://pypi.org/project/keyring/#linux
The very first code example they had I used verbatim on my RHEL environment with success:
>>> import keyring
>>> keyring.set_password("system", "username", "password")
>>> keyring.get_password("system", "username")

Looks like a command line utility is also sent along with:
$ keyring --help
$ keyring set system username
$ keyring get system username

Hope this helps if you hadn't gotten along any further.


text:
Q: Slow down tab select animation I am doing a Intro Activity that consists in a TabLayout with three fragments.
I have two buttons below my TabLayout - one for "Skip" the intro and the other for "Next" screen/tab. They are working fine but I would like to make some changes on the "Next" function:
When I click the "Next" button he does this:
tabLayout.getTabAt(tabLayout.getSelectedTabPosition() + 1).select()

And he is indeed selecting the next tab, but I was wondering if I could slow down the slide/swap animation of the tab. Can I somewhat Override de animation so I can slow it down?
EDIT
I created a custom class that extends TabLayout:
public class CustomTabLayout extends TabLayout {

    public CustomTabLayout(Context context) {
        super(context);
    }

    public CustomTabLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }
}

And I noticed that the TabLayout class has this method:
 private void animateToTab(int newPosition) {
    if (newPosition == Tab.INVALID_POSITION) { return; }

    if (getWindowToken() == null || !ViewCompat.isLaidOut(this) || mTabStrip.childrenNeedLayout()) {
        setScrollPosition(newPosition, 0f, true);
        return;
    }

    final int startScrollX = getScrollX();
    final int targetScrollX = calculateScrollXForTab(newPosition, 0);

    if (startScrollX != targetScrollX) {
        ensureScrollAnimator();

        mScrollAnimator.setIntValues(startScrollX, targetScrollX);
        mScrollAnimator.start();
    }

    mTabStrip.animateIndicatorToPosition(newPosition, ANIMATION_DURATION);
}

The problem is that ANIMATION_DURATION is a private static final constant set to 300 in the TabLayout class. Can I somewhat change this value to 1000 for example to slow down the animation?
EDIT 2
As suggested by azizbekian, I am trying to change this value using reflection:
public CustomTabLayout(Context context, AttributeSet attrs, int defStyleAttr) {
    super(context, attrs, defStyleAttr);
    setAnimationDuration();
}

static void setAnimationDuration() {
    try {
        Field field = TabLayout.class.getDeclaredField("ANIMATION_DURATION");
        field.setAccessible(true);
        field.set(field.get(TabLayout.class), 2000);

        int v = (int) field.get(TabLayout.class);
        //  v == 2000; so I guess that I changed the value successfully
    } catch (Exception e) { e.printStackTrace(); }
}

But when my tabs are created, it still has the same transaction duration (to fast). Am I doing something wrong with reflection? Or this "ANIMATION_DURATION" is not the correct value to change?

A: As you can see in sources, animation duration is not customizable:
private static final int ANIMATION_DURATION = 300;
...
mScrollAnimator.setDuration(ANIMATION_DURATION);

So, it cannot be configured neither from styles (xml), nor through Java code.
Only thing you can try to do is to change the value of private static final field through reflection.


text:
Q: How to pass settings to rq task? I wonder what's the best approach to pass settings from a RQ worker to task function?
I want to keep all of my settings outside of the app in text file, then read it while worker is starting and then have those values for performing the actual task.
Right now I'm using os.environ.
Thanks!

A: It appears from the documentation from the section "Custom worker classes" that the way to do this is to write a custom worker class. Here is a pattern that I've been using which loads a section from a ConfigParser file into a virtual python module named config:
import configparser
import rq.worker
import sys
import types

class ConfigurableWorker(rq.worker.Worker):
    """An RQ Worker class which loads configuration from config.ini"""

    def work(self, *args, **kwargs):
        """Perform RQ work"""

        # Store some configuration on a virtual module
        sys.modules['config'] = types.ModuleType('config')
        import config
        config_reader = configparser.ConfigParser()
        config_reader.read('config.ini')
        for key, value in config_reader['rq'].items():
            setattr(config, key, value)

        # Do work
        super().work(*args, **kwargs)

And then from the job function:
def my_bunch_of_work():
    import config
    con = db_connection(url=config.my_db_connection)

Running the rq worker with a customer worker class can be done with the --worker-class argument.
$ rq worker --worker-class my.prog.ConfigurableWorker

It might be nice to do some kind of connection pooling setup in the ConfigurableWorker.work method, but I'm unsure of the safety of that without knowing too much about RQ worker fork model with os.fork()

A: Assuming you are taking about python-rq, you may want to read this page here and for config file here.

A: Try using the os module.
#IN WORKER
import os
os.environ['TOKEN'] = 'xxx'

# IN JOB
#Open child processes via os.system(), popen() or fork() and execv()

someVariable = os.environ['TOKEN']


text:
Q: using a variable name within dataframe name I have two dataframes namely a_df and b_df and have defined them separately under two different if conditions.
Once, outside the conditions I want to use them like {i}_df['col'] where the value is input by user and can be a, or b. How do I incorporate a variable into the name of dataframe as such.

A: I think that the a valuable solution in this case is to use a dictionary for mapping the user input with the actual dataframe. For example:
my_dict={'a':a_df,'b':b_df}

Then, you select the correct element according to the provided input. Something like the following:
user_input=input('Your choice: ')

try:
    print(my_dict[user_input])
except:
    print("Not valid!")

Hope it helps!


text:
Q: Add an optional parameter to every method in class which inherits from base class C# I don't know if this is possible in any way but what I try to get is to force developers who inherit from some base class to implement a specific parameter in every method in this class.
Something like:
class SomeClass : BaseClass
{
     public void SomeMethod(bool iAmAForcedParameter = false)
     {

     }
}

The reason for this is that we have services which can be called from the MVC Project (which is our frontend) or can be consumed from other services.
If the service will be called from the frontend it should write the changes to the database after everything has been done. If the service gets used from another service it should only make the changes (in memory) and NOT write them to the database.
Another idea I head is to determine who is the caller and if he is from a specific type the method should not send the data. How ever, I don't know how to do this or if this is even possible without huge performance impacts.
Greetings and thanks for your help in advance.

A:
implement a specific parameter in every method in this class.

I think you're just looking for a property on the class, which you then can check in every method.

A: Its strange that each of your methods has two responsibilities. I'd rather created two derived classes. One with methods which persist data to database, and other, which don't:
class SomeInMemoryClass : BaseClass
{
   public override void SomeMethod() {}
}

class SomeSqlClass : BaseClass
{
   public override void SomeMethod() {}
}

Anyway - passing boolean to method is a design smell. It tells that your method does two things. Better to have two methods, which tell caller what they are doing:
void SomeInMemoryMethod()
void SomeSqlMethod()

Don't you think it's more maintainable, than
void SomeMethod(false)

For your last edit: Pass SomeInMemoryClass object to type which should not save data to database. Other types should use SomeSqlClass instances.

A: I also don't understand the second part.
For the first item, just use
public void SomeMethod(bool iAmAForcedParameter)

So without the optional argument.
In case you want to have the optional argument anyway use
public void SomeMethod(bool iAmAForcedParameter)
{
    SomeMethodX(iAmAForcedParameter)
}

public void SomeMethodX((bool iAmAForcedParameter = false)


text:
Q: Could not deduce error when using type constraints I am using Haskell to implement a linear algebra example. However, I run into a problem when declaring the magnitude function.
My implementation is as follows:
magnitude :: (Foldable t, Functor t, Floating a) => t a -> a
magnitude = sqrt $ Data.Foldable.foldr1 (+) $ fmap (^2)

The idea is that magnitude will accept Vec2D, Vec3D, or Vec4D, and return the square root of the sum of the squares of their components.
Each of the three vector types implements Functor and Foldable. For example,
newtype Vec2D = Vec2D (a, a) deriving (Eq, Show)
instance Functor Vec2D where
    fmap f (Vec2D (x, y)) = Vec2D (f x, f y)
instance Foldable Vec2D where
    foldr f b (Vec2D (x, y)) = f x $ f y b

However, I receive a multitude of errors:
LinearAlgebra.hs:9:13:
    Could not deduce (Floating (t a -> a)) arising from a use of `sqrt'
    from the context (Foldable t, Functor t, Floating a)
      bound by the type signature for
                 magnitude :: (Foldable t, Functor t, Floating a) => t a -> a
      at LinearAlgebra.hs:8:14-60
    Possible fix: add an instance declaration for (Floating (t a -> a))
    In the expression: sqrt
    In the expression: sqrt $ Data.Foldable.foldr1 (+) $ fmap (^ 2)
    In an equation for `magnitude':
        magnitude = sqrt $ Data.Foldable.foldr1 (+) $ fmap (^ 2)

LinearAlgebra.hs:9:20:
    Could not deduce (Foldable ((->) (t a -> a)))
      arising from a use of `Data.Foldable.foldr1'
    from the context (Foldable t, Functor t, Floating a)
      bound by the type signature for
                 magnitude :: (Foldable t, Functor t, Floating a) => t a -> a
      at LinearAlgebra.hs:8:14-60
    Possible fix:
      add an instance declaration for (Foldable ((->) (t a -> a)))
    In the expression: Data.Foldable.foldr1 (+)
    In the second argument of `($)', namely
      `Data.Foldable.foldr1 (+) $ fmap (^ 2)'
    In the expression: sqrt $ Data.Foldable.foldr1 (+) $ fmap (^ 2)

LinearAlgebra.hs:9:41:
    Could not deduce (Num (t a -> a)) arising from a use of `+'
    from the context (Foldable t, Functor t, Floating a)
      bound by the type signature for
                 magnitude :: (Foldable t, Functor t, Floating a) => t a -> a
      at LinearAlgebra.hs:8:14-60
    Possible fix: add an instance declaration for (Num (t a -> a))
    In the first argument of `Data.Foldable.foldr1', namely `(+)'
    In the expression: Data.Foldable.foldr1 (+)
    In the second argument of `($)', namely
      `Data.Foldable.foldr1 (+) $ fmap (^ 2)'
Failed, modules loaded: none.

I'm not entirely comfortable with Functor or Foldable yet - and I believe this is the indirect reason for the errors.
Can someone explain to me what the error messages are pointing at?

A: You ought to combine your functions into a pipeline with (.) not ($). This error is occurring because, for instance, Data.Foldable.foldr1 (+) expects to be applied to a Foldable type like [a] but you're actually applying it directly to fmap (^2) which is a function.
magnitude :: (Foldable t, Functor t, Floating a) => t a -> a
magnitude = sqrt . Data.Foldable.foldr1 (+) . fmap (^2)

or
magnitude :: (Foldable t, Functor t, Floating a) => t a -> a
magnitude ta = sqrt $ Data.Foldable.foldr1 (+) $ fmap (^2) $ ta

both will do better.


text:
Q: Resizing an ASP.Net image to scale in Visual Studio I am working on a Visual Studio master page, and trying to add the company logo.
I have imported the JPEG into my project, added an Image control and have set the ImageUrl property to my JPEG.
The problem is my image is massive! I am trying to resize it to scale, by holding down shift (which works in other MS products) but it's not working properly, and when trying to resize manually, I just can't get it to look right.
So my question is, how do I resize an image to scale in ASP.Net using Visual Studio 2010?

A: Visual studio is not for image scaling. You can scale the image on design view. After spefying image url for image you can re-size it as you do in powerpoint. But this is not a good practice as this will add height and width tag with specific value in your html for image.
So re-size the image using any tool as per your need and use it as this will make the page lighter.

A: If I'm understanding correctly, you want to change the dimensions of an image in Visual Studio.
Changing the dimensions of the image will just make the image appear smaller; it won't actually resample it and reduce its size in bytes. For both these reasons, take the extra minute or two to use another program to properly resize the image.

*

*Resampling: smooths the image according to an algorithm and properly handles things like edges

*Reducing size in bytes: this one is obvious. Your post is tagged with ASP.Net; you don't want a "massize" image being sent over the network.


text:
Q: Error during source generation: "is not a part of this compilation. Is this a mistake for" I have jenkins build machine with sources mounted on SSD drive. During compilation and source generation I'm getting following error:

[ERROR]
  file:/mnt/raid0/var/lib/jenkins/workspace/VIS_Constructor/vis-web/src/main/webapp/concentrator/binding.xml[13,53]
  com.sun.istack.SAXParseException2; systemId:
  file:/mnt/raid0/var/lib/jenkins/workspace/VIS_Constructor/vis-web/src/main/webapp/concentrator/binding.xml;
  lineNumber: 13; columnNumber: 53;
  "file:/mnt/raid0/var/lib/jenkins/workspace/VIS_Constructor/vis-web/src/main/webapp/concentrator/concentratorSub.xsd" is not a part of this compilation. Is this a mistake for
  "file:/var/lib/jenkins/workspace/VIS_Constructor/vis-web/src/main/webapp/concentrator/concentratorSub.xsd"?

binding.xml and xsd file are in the same directory.
Here is the piece of binding.xml
<jxb:bindings schemaLocation="concentratorSub.xsd">
    <jxb:schemaBindings>
        <jxb:package name="com.ats.vis.services.concentrator" />
    </jxb:schemaBindings>
</jxb:bindings>

I'm running out of ideas how to fix this.
Any help will be appriciated. Thanks.


text:
Q: Disprove $(2^n)^{\frac{1}{3}} \in \theta(2^n)$ I know we can prove this simply by saying we can't find such $c_1,c_2$ but the question asks me to prove this by proving its negation is true. (the hint of the problem says this will be hard)
We negate the definition, $\exists c_{1}, c_{2}, \forall n \geq n_{0}, c_{1} 2^{n} \leq\left(2^{n}\right)^{\frac{1}{3}} \leq c_{2} 2^{n}$, and get $\forall c_{1}, n_{0} \exists n \geq n_{0},\left(2^{n}\right)^{\frac{1}{3}} \leq c_{1} 2^{n}$.
I'm thinking of breaking $c_1$into either positive or negative case. What I felt confused about is $\forall n_0,\exists n\geq n_0$, How can we approach this? Is there any difference between this and $\exists n_0 \forall n\geq n_0$?

A: If $2^n \leq C (2^n)^{\frac13}$ then $2^{\frac{2n}{3}} \leq C$. This can't hold as $n\to\infty$.
In other words, $2^n$ grows faster than $2^{\frac n3}$.
It's better to try to understand problems intuitively than to write a bunch of formal symbols and get yourself mixed up.
Abstractly, $\exists y\ \forall x$ says the same $y$ works for every $x$.
Whereas $\forall y\ \exists x$ says you're allowed to pick a different $y$ for each $x$.

A: You need to show that for all constants $c_1$, and for all $n_0\in \mathbb N$, there will exist $n\ge n_0$ such that $$c_12^n> 2^{n/3}.$$ This will prove the lowed bound cannot be satisfied. This is equivalent to $n> \frac32\log_2(1/c_1)$, so simply choose $n$ to be $\max(n_0,\lceil \frac32\log_2(1/c_1)\rceil)$.


text:
Q: How to use Accept header in nginx index I want to serve a markdown version of my blog. Imagine http://myblog.com/some/post/ and two requests:

*

*Accept: text/html -> http://myblog.com/some/post/index.html

*Accept: text/markdown -> http://myblog.com/some/post/index.md
How do I configure nginx to do this?
I read the documentation on index but it didn't mention content negotiation at all.

A: If you just need to use content negotiation with your index files, you could use the index directive with a variable defined using a map. See this document for details.
For example:
map $http_accept $myindex {
    default          index.html;
    ~*text/markdown  index.md;
}

index $myindex index.html;


text:
Q: unescape special characters in ajax response data I have an ajax request with dataType: 'json'
The json received (being well formed) contains strings with newlines escaped
i.e '{ "a"  :  "x\\r\\nx" }'
unfortunately the resultant data object in the ajax done function now also contains the newline in that form ("\\r\\n")
I want all string fields in the ajax result data object to be unescaped so that in this case I will get
data = { a:"xNEWLINEx" }
Is there a general way to do this ? assume data may have nested arrays and dictionaries each containing strings which can have newlines (or other escaped special characters)

A: Building on the response from yangguang, here is a complete solution:
    // 'unescape' all special characters in all strings in an object that was created from JSON (ie, ajax reply)
    function jUnescape(obj) {
       var j = JSON.stringify(obj);
       ['b', 'f', 'n', 'r', 't', 'u'].forEach(function(c) {
          j=j.split('\\\\' + c).join('\\' + c);
       });
       j = j.split('\\\\\\"').join('\\"');
       j = j.split('\\\\\\\\').join('\\\\');
       return JSON.parse(j);
    }

see jsfiddle

A: You can use replace:
data.a = data.a.replace('\\', '\');

You can also use unescape(Warning: Deprecated):
data.a = unescape(data.a);

Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/unescape
For Objects:
for (var key in data) {
    data[key] = unescape(data[key]);
}

A: you can try:
var data = { a: "x\\r\\nx" };
data = JSON.parse(JSON.stringify(data));
console.log('data', data);
//Object {a: "x\r\nx"}

for more "\", you can try:
var data = { a: "x\\\\r\\\\nx" };
data = JSON.stringify(data);
data = data.replace(/\\+r\\+n/g,'\\\\r\\\\n');
data = JSON.parse(data);
console.log('data', data);
//Object {a: "x\r\nx"}


text:
Q: Why does LightDM only show a custom wallpaper on the login screen if I have selected one of the default wallpapers?
Possible Duplicate:
How do I add customized wallpapers so they appear in the dynamic unity greeter?

LightDM only changes wallpapers if I have selected one of the default wallpapers. If I choose another image from my pictures, LightDM shows the default wallpaper.
Why is this happening, and how can I make LightDM show my wallpaper if it is not one of the defaults?
As @doug said in his answer, it works if you click on the little + symbol in the appearance settings: after you do that, LightDM changes wallpapers.

A: I bet you use an encrypted home folder - which is readable not before you log in. What you can do is to copy your background image for instance to /usr/share/backgrounds (as root, i.e.: sudo cp ~/Pictures/backgroundimage.png /usr/share/backgrounds/) and set it as background image out of this un-encrypted folder.

A: Not sure what the problem in LightDM really is but i solved this by scaling my wallpaper to my screens resolution.
I moved them to /usr/share/backgrounds (location of the default wallpapers) as well. Not sure what did the trick but it works for me.

A: Still works fine here, either from ~/Pictures, added from the dropdown or any other location, added from the little + under the wallpapers in Appearance window
The directory holding your chosen Background image must allow Others execute permission so maybe check the permissions of the folder holding your image
Ex. of the min necessary permissions
$ ls -ld Pictures
drwxr-xr-x 2 doug doug 4096 Apr 30 00:02 Pictures

A: I can confirm that it's not a matter of "+" button. You can either use a cp command, a "+" or Nautilus. It will not work UNTIL you resize the image to your screen resolution.
Now it works!
Thank to all.
^Pepe^

A: You don't even need to copy the picture in /usr/share/backgrounds folder. You just need to use full path to the image. I've tested that and working.

*

*Go to This answer to get help on changing lightdm wallpaper.

*Follow all the commands begining from sudo -i to disable user background

*Before the last command which sets the background image, Do this command
export $(dbus-launch)

It will say, no protocol specified but ignore those warning.

*In the last command where you are going to change the wallpaper, use  full path. For example, I used this command to set a picture in my home directory
gsettings set com.canonical.unity-greeter background '/home/anwar/Below_Clouds_by_kobinho.jpg'

Please note: Make sure to use ' mark in the start and end of location.
That's it. Logout to see your image.

A: If your desktop wallpaper is in some other partition than the root, then it won't show up. The reason being that other partitions don't automatically get mounted, you mount them after you log in.
I think copying the wallpaper in Pictures or Home directory should help.


text:
Q: why is finding a point in a non-convex polygon harder than in a convex polygon? I've heard a lot of people say that programmatically finding a point in a non-convex polygon is harder than finding a point in a convex polygon. I'm having trouble wrapping my head around this. Is this true? If so, why?

A: For a convex polygon, you can choose any point p inside the polygon (e.g. the center of mass of all the vertices) and then sort the vertices in a circular array according to the angle they make with p.  Then, given a query point x, you can compute the angle from p to x, and search through the array and find the two neighboring vertices in the array for which the angle to x is between the angles to the two vertices.  Then you compute the intersection between the line from p to x, and the edge between the two vertices.  If the distance from p to the intersection point is greater than or equal to the distance from p to x, then x is inside the polygon, otherwise x is outside the polygon.  This gives O(log n) time to determine is a point is inside or outside of a convex polygon.  On the other hand, the best known algorithm to determine if a point is inside or outside a non-convex polygon is O(n) time.  Note however you can make a hybrid algorithm depending on how much "non-convexity" you have in your polygon.  You can always decompose a polygon into a union of convex polygons, by adding extra internal edges; suppose your polygon only has a few "turns" in it and you can decompose into k convex polygons where k is small.  Then you can use the strategy for convex polygons to determine if a point is inside or outside in O(k log n) time.  So in general, the "more convexity" you have, the faster you can determine if a point is inside the polygon.

A: So you want to check whether point P is inside a polygon or outside.
If the polygon is convex, then you can iterate over each line segment making up the polygon, and check which side of that line P lies on.  P is on the inside of the polygon if it is on the right-hand side of every line segment, going clockwise.
If the polygon is concave, this algorithm doesn't work.  An algorithm that works for concave polygons is to trace from P in an arbitrary direction to infinity, and count the number of times an edge of the polygon is crossed.  P is inside the polygon if and only if the number of crossings is odd.  This algorithm has a bunch of edge cases to consider and is generally more complicated, so it will take a lot more programmer effort to write the algorithm.
In the sense that the algorithm is more difficult to write correctly, yes, it is harder.
In the sense of computational complexity, both algorithms have Θ(N) asymptotic running time.  In that sense, both problems are equally hard.


text:
Q: I can't use the library react-native-image-header-scroll-view type error
"Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports"
I followed the instructions but it doesn't seem to work
here is my code
import HeaderImageScrollView from 'react-native-image-header-scroll-view';
const windowWidth = Dimensions.get('window').width;
const MIN_HEIGHT = Platform.OS === 'ios' ? 90 : 55;
const MAX_HEIGHT = 400;

const ProductDetailImage = () => {

  return (
    <View>
      <HeaderImageScrollView
        maxHeight={MAX_HEIGHT}
        minHeight={MIN_HEIGHT}
        maxOverlayOpacity={0.6}
        minOverlayOpacity={0.3}
        ScrollViewComponent={FlatList}
        data={product.image}
        renderHeader={({item, index}) => (
          <Image source={item} />
        )}></HeaderImageScrollView>
    </View>

I have followed this with no success

A: Looks like you forgot to export your component:
export default ProductDetailImage;


text:
Q: Replace a specific string character index into 0 I have built a table chart application. I have a calculate button with an action event. So, first of all, the action event will getText from a textfield button named field. After that it will convert the string into int. But, I want to check one thing before converting the string into int. That is, I would like to check if the string character index [0] is equal to '-', if so then it will be changed to 0. I have tried to put an if condition like
if(text.charAt[0] == "-"){text.setCharAt(0, "0")}

but it is saying condition is not comparable from char to string.
Is there any other way to replace an index character into 0?
Here's the action listener code:
calculate = JButton; result = JTextArea; field = JTextField;
calculate.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent evt) {
    result.setText(null);
    String text = field.getText();
    Integer i = Integer.valueOf(text);
    for (int j = 1; j <= 10; j++){
    result.append((i + " " + "x" + " " + j + "=" + " " +(i * j)) + "\n");
}});

I have tried the code below but i can't figure out how to assign 'text' to 'str':
    if(text.charAt(0) == '-'){
     StringBuilder str = new StringBuilder(text);
     str.setCharAt(0, '0');
}

Moreover; when the new string is set to 'str' instead of 'text', I could not assign str as a string, such as StringBuilder str = new StringBuilder(str); Therefore; I am basically stuck in this line.

A: In :
text.charAt[0] == "-"

*

*text.charAt[0] is a char.

*"-" is a String.

Moreover, you should never use == on a Character or a String. Use equals() instead.
Try
text.charAt[0].equals('-');

A: try
    if(text.charAt[0] == '-'){text.setCharAt(0, '0')}
"a" - String
'a' - char

A: text.charAt[0] == "-"

In this line checking a string "-"  change it as '-'
Instead of == , use equals() as follows:
text.charAt[0].equals('-')


text:
Q: Why is direct current needed to produce an electromagnetic field using a solenoid? I am performing an experiment for school investigating the magnetic force of a solenoid. While doing this experiment I realized that I needed to connect the solenoid to the DC output of the power supply instead of the AC.
I am perplexed since for current induction, fluxtuations in the magnetic field are needed. I thought this would be the same "the other way round", i.e. using a fluxtuating current to create a magnetic field.

A: To produce a steady magnetic field by a current in a coil you need a direct current. If you use an ac current the magnetic field would change with time and change direction every half period of the ac current.

A: To be fair, you don't actually need continuous DC current, but you do need a waveform that is always in the positive (or always in the negative) voltage range. An AC source with a simple half-wave or full-wave rectifier (4 diode) will work fine without the need for a transformer or DC converter. It is still DC, it's just unregulated. Note that a half wave rectifier will only let you use half of the energy, with the same voltage but a 50% duty cycle pulse train. It might cause issues, depending what you are doing.

The important part is that the waveform does not go say from 0V to 12V to 0v to -12v etc... With AC, every time the voltage is positive the field will go in one direction, and in reverse when negative, so overall it is approximately cancelled.


text:
Q: neural network: cost is erratic I implemented a simple neural network for classification (one class) of images in python. Layers are simple (image_matrix, 5,1). Using relu and sigmoid for the hidden layers.
I am iterating 5000 times. At first it looks like the cost goes down gradually in a sensible way.
However, no matter how many training examples I use, or what my learning_rate is, the costs starts behaving erratically after around 3000 iterations every time...
cost (click to see image)
Can someone help me understand what's going on?
Thanks

A: In training models, you should remember that their are multiple local minima for the its cost. Your graph shows that you're cost is moving around this local minima whilst finding your global minimum, which is the goal finding the best performance for a model.
1st -  you should probably try checking for accuracy, f1-score, or loss per iteration/epoch to check if the performance is actually improving.
2nd - do cross validation and check for same metrics above for validation
3rd - implement an early stopping function that should check if you're model is improving or not.
*note: find the best alpha that would help you find the global minimum better.


text:
Q: rake task OR bundle exec rake task (Note: I found the same issue on stackoverflow but it didn't solve my issue so I'm going to provide more information about.)
I set up an RoR environment. It contains rvm, ruby, ruby on rails and bundler. Everything seems to be correct.
I switch into this folder which contains a RoR application and try to reset the database
katarina@katarina-VirtualBox:~/RubymineProjects/prototyp1$ rake db:reset
rake aborted!
cannot load such file -- bundler/setup

(See full trace by running task with --trace)
katarina@katarina-VirtualBox:~/RubymineProjects/prototyp1$

Error: "Cannot load such file -- bundler/setup"
On the other side "bundle exec rake db:reset" works as expected.
Here my environment values:
I. ruby installation:

katarina@katarina-VirtualBox:~/RubymineProjects/prototyp1$ rvm list
rvm rubies
ruby-1.9.3-p194 [ x86_64 ]
   =*  ruby-1.9.3-p429 [ x86_64 ]
     ruby-2.0.0-p195 [ x86_64 ]

So "ruby-1.9.3-p429" is my current and default ruby version.
II. used gemset

katarina@katarina-VirtualBox:~/RubymineProjects/prototyp1$ rvm gemset
  list
gemsets for ruby-1.9.3-p429 (found in
  /home/katarina/.rvm/gems/ruby-1.9.3-p429)
     (default)
     global
=> prototyp1

So I'm using prototyp1 gemset created inside the current ruby version.
III. contained gems:
NOte: $GEM_HOME points to the proper gemset and gem list returns an item containing the bundler.
katarina@katarina-VirtualBox:~/RubymineProjects/prototyp1$ cd $GEM_HOME
katarina@katarina-VirtualBox:~/.rvm/gems/ruby-1.9.3-p429@prototyp1$ gem list

*** LOCAL GEMS ***

actionmailer (3.2.8)
actionpack (3.2.8)
activemodel (3.2.8)
activerecord (3.2.8)
activeresource (3.2.8)
activesupport (3.2.8)
addressable (2.3.4, 2.3.3)
arel (3.0.2)
bcrypt-ruby (3.0.1)
better_errors (0.9.0)
binding_of_caller (0.7.2)
bootstrap-sass (2.3.2.0)
builder (3.0.4, 3.0.3)
bundler (1.2.0)
cancan (1.6.10)
capybara (2.1.0)
chunky_png (1.2.6)
coderay (1.0.9)
coffee-rails (3.2.2)
coffee-script (2.2.0)
coffee-script-source (1.6.2, 1.4.0, 1.3.3)
compass (0.12.2)
cucumber (1.3.2)
cucumber-rails (1.3.1)
daemons (1.1.9)
database_cleaner (1.0.1)
debug_inspector (0.0.2)
devise (2.2.4)
diff-lcs (1.2.4, 1.1.3)
email_spec (1.4.0)
erubis (2.7.0)
eventmachine (1.0.3)
excon (0.16.10)
execjs (1.4.0)
factory_girl (4.2.0)
factory_girl_rails (4.2.1)
faraday (0.8.7)
figaro (0.6.4)
fssm (0.2.9)
gherkin (2.12.0)
hashie (2.0.5)
heroku (2.35.0)
heroku-api (0.3.8)
hike (1.2.3, 1.2.1)
httpauth (0.2.0)
hub (1.10.6)
i18n (0.6.4)
journey (1.0.4)
jquery-rails (3.0.1, 2.1.4, 2.1.2)
json (1.8.0, 1.7.5)
jwt (0.1.8)
launchy (2.3.0, 2.2.0)
libv8 (3.11.8.17 x86_64-linux, 3.3.10.4 x86_64-linux)
mail (2.4.4)
mime-types (1.23, 1.19)
mini_portile (0.5.0)
multi_json (1.7.7, 1.4.0, 1.3.6)
multipart-post (1.2.0)
netrc (0.7.7)
nokogiri (1.6.0, 1.5.5)
oauth (0.4.7)
oauth2 (0.8.1)
omniauth (1.1.4)
omniauth-facebook (1.4.1)
omniauth-linkedin (0.1.0)
omniauth-oauth (1.0.1)
omniauth-oauth2 (1.1.1)
omniauth-twitter (0.0.17)
orm_adapter (0.4.0)
pg (0.14.1)
polyglot (0.3.3)
quiet_assets (1.0.2)
rack (1.5.2, 1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3, 1.3.2)
rack-test (0.6.2, 0.6.1)
rails (3.2.8)
railties (3.2.8)
rake (10.0.4, 10.0.2, 0.9.2.2)
rdoc (3.12.2, 3.12)
ref (1.0.5)
rest-client (1.6.7)
rolify (3.2.0)
rspec (2.11.0, 2.0.1)
rspec-core (2.13.1, 2.11.1, 2.0.1)
rspec-expectations (2.13.0, 2.11.3, 2.0.1)
rspec-mocks (2.13.1, 2.11.3, 2.11.2, 2.0.1)
rspec-rails (2.13.2, 2.11.0, 2.0.1)
rubygems-bundler (1.1.0)
rubyzip (0.9.9)
rvm (1.11.3.5)
sass (3.2.9, 3.2.3, 3.2.1)
sass-rails (3.2.6, 3.2.5)
simple_form (2.1.0)
sprockets (2.1.3)
sqlite3 (1.3.7, 1.3.6)
therubyracer (0.11.4, 0.10.2)
thin (1.5.1, 1.5.0)
thor (0.18.1, 0.16.0)
tilt (1.4.1, 1.3.3)
treetop (1.4.14, 1.4.12, 1.4.10)
tzinfo (0.3.37, 0.3.35, 0.3.33)
uglifier (2.1.1, 1.3.0)
warden (1.2.1)
webrat (0.7.1)
webrick (1.3.1)
xpath (2.0.0)

Why am I getting the error when executing rake?
Is it an "old-fashioned" way to execute rake tasks? It is recommended to execute "bundle exec .." rather than "rake ..."?
Thank you in advance.
golbie

A: It is strongly recommended to execute tasks with bundle exec. It ensures the task to be executed in the context of current bundle.


text:
Q: Symfony2 how to inject UserProviderInterface into service? (or correct way of injecting UserRepository into UserProvider) I developing own User Provider. For retrieving User I have injected my UserRepository:
app_bundle.api_key_user_provider:
    class: AppBundle\Security\User\ApiKeyUserProvider
    factory: ["@doctrine.orm.entity_manager", "getRepository"]
    arguments:
        - AppBundle\Entity\User

I also added EntityManager into __construct() method of my provider:
class ApiKeyUserProvider implements UserProviderInterface
{
    public function __construct(EntityManager $em)
    {
        $this->em = $em;
    }

    public function loadUserByUsername($email)
    {
        $user = $this->em->findBy(array('email' => $email));

        if (!$user) {
            throw new UsernameNotFoundException('User not found!');
        }

        $this->user = $user;

        return $user;
    }

    public function refreshUser(UserInterface $user)
    {
        return $user;
    }

    public function supportsClass($class)
    {
        return $class === 'AppBundle\Entity\User';
    }
}

But when Provider is called, I got next error:

Catchable Fatal Error: Argument 1 passed to
  Symfony\Component\Security\Core\Authentication\Provider\DaoAuthenticationProvider::__construct()
  must implement interface
  Symfony\Component\Security\Core\User\UserProviderInterface, instance
  of AppBundle\Repository\UserRepository given

I have tried to inject Symfony\Component\Security\Core\User\UserProviderInterface, but have no success. I pass as argument to services.yml provider definition next strings:

*

*Symfony\Component\Security\Core\User\UserProviderInterface (got error "class not exists")

*Vendor\Symfony\Component\Security\Core\User\UserProviderInterface (got same error)

Also I've searched for needed service in SecurityBundle, but found nothing.
My question: How can I inject Symfony\Component\Security\Core\User\UserProviderInterface to my ApiKeyUserProvider or what else I can do to solve this problem?
Thanks a lot for help!

A: Your ApiKeyUserProvider expects EntityManager as a dependency. Your service definition is wrong in that case - just put this into services.yml
app_bundle.api_key_user_provider:
    class: AppBundle\Security\User\ApiKeyUserProvider
    arguments: ["@doctrine.orm.entity_manager"]

This will also need some adjustments in your class, since EntityManager does not have findBy method as you're trying to use it. So you need to change
$user = $this->em->findBy(array('email' => $email));

into
$user = $this->em->getRepository('AppBundle:User')->findBy(array('email' => $email));

EDIT: Basing on your comment I assume that you want to inject UserRepository, not whole EntityManager. To do so, you should define your UserRepository as a service and inject it into your class.
services.yml
app_bundle.user_repository:
    class: Doctrine\ORM\EntityRepository
    factory: ["@doctrine.orm.entity_manager", getRepository]
    arguments:
        - AppBundle\Entity\User

app_bundle.api_key_user_provider:
    class: AppBundle\Security\User\ApiKeyUserProvider
    arguments: ["@app_bundle.user_repository"]

ApiKeyUserProvider
class ApiKeyUserProvider implements UserProviderInterface
{
    public function __construct(UserRepository $repository)
    {
        $this->repository = $repository;
    }

    public function loadUserByUsername($email)
    {
        $user = $this->repository->findBy(array('email' => $email));
    }
}


text:
Q: What is the meaning of the " 's " in this sentence? I'm currently studying to pass the TOEFL test with a high score, but I have encountered a sentence in an app that I fail to see why it is correct:
"The committee members resented the president's not informing them of the meeting."
Can someone explain to me how the mentioned sentence works?

A: The title of your question refers only to the "'s" in the sentence, so I am going to explain this.
This is a common genitive. So, the president's is the genitive (possessive) to the gerund construction not informing them. The question is "Whose not informing them?", and the answer is "the president's".
The confusing part may be the word not, but just think of dropping it:

The committee members resented the president's informing them of the meeting.

The construction not informing them is a gerund, that is a construction derived from a verb (to inform) that is used as subject or object, as in:

Sailing is fun. (subject position)
I enjoy singing. (object position)

The original sentence (which has the gerund in object position) could be rephrased in a subclause (taking care of the tense then):

The commitee member resented that the president had not informed them of the meeting.


text:
Q: Where has an image been dropped with fineuploader? Is it possible to know where an image has been dropped?
Assume we have a checkerboard with different divs

......

A: First of all, your code will only designate the first ffup div (A1) as it currently stands.  You will need to pass a selector for each individual drop zone into your extraDropzones array.  The jQuery wrapper will only pass the first element covered by your jQuery selector to the library.  Ideally, it would pass along all items represented by the selector, but, to do this, it would have to be aware of the intended type of the parameter.  The jQuery wrapper must convert all jQuery objects to HTMLElements before passing the data on to Fine Uploader's core code (which is not aware of jQuery).  This is something I'd like to look into more in the future, but this is the way it has worked since 3.0.  Note that this limitation does NOT apply to the target of a Fine Uploader plug-in instance, i.e. $(".myTarget").fineUploader(...).
As to your question, Fine Uploader does not currently pass any information along to callbacks that would allow you to determine which drop zone received an associated file.  This is an interesting feature, and I can see how it may be useful.  Please open up a feature request in the issue tracker so we can discuss and prioritize this for a future release.


text:
Q: Define for all $B⊆E$ with $B\not=∅: cl(B) = B ∪ A$, while $cl(∅) = ∅$. Prove that $cl$ is a Kuratowsky closure operator. Let $E$ be a set and $A⊆E$. Define for all $B⊆E$ with $B\not=∅: cl(B) = B ∪ A$,
while $cl(∅) = ∅$. Prove that $cl$ is a Kuratowsky closure operator. What is the associated topology?
i) closure operator :$cl(∅) = ∅ \\ \forall B \subseteq E, B \subseteq A \cup B = cl(B) \\ \forall B \subseteq E, (B \cup A) \cup A = B\cup A \Rightarrow cl(cl(B)) = cl(B) \\ B_1, B_2 \subseteq E, (B_1 \cup A) \cup (B_2 \cup A) = (B_1 \cup B_2) \cup A \implies cl(B_1) \cup cl(B_2) = cl(B_1\cup B_2)  $
So $cl$ is a closure operator.
ii) associated topology:
 I am not sure what the associated topology is, say $\tau$ is this wanted topology on $E$
$cl(\emptyset) = \emptyset$ and $cl(E) = E \cup A = E$ so $\emptyset, E \in \tau$
but now I am not sure how to define it further as closure operator gives closed sets. Seems that taking the complements of these closures may be the idea.
EDIT: $(cl(B))^c = (A \cup B)^c = (A^c \cap B^c) $ something along these lines possibly because $cl(E)^c = \emptyset, cl(\emptyset)^c = E$

A: A set $A$ is open if and only if its complement $E \setminus A$ is closed.
$E \setminus A$ is closed if and only if $E \setminus A = cl(E \setminus A) = B \cup (E \setminus A)$.
$E \setminus A = B \cup (E \setminus A)$ if and only if $B \subset E \setminus A$.
$B \subset E \setminus A$ if and only if $A \subset E \setminus B$ if and only if $A \cap B = \emptyset$.
So, a set $A$ is open in this topology if and only if $A \cap B = \emptyset$.


text:
Q: Change colors of status indicator in Resharper's marker bar I really like Resharper's marker bar, but I have a form of partial color blindness (deuteranopia), and I'd like to make the green and yellow status indicators more distinguishable. Obviously it's not a big deal since I can inspect the bar for yellow ticks, but if changing it is possible it'd be a nice touch.

A: With Resharper 7 / Visual Studio 2008: go to Tools > Options > Fonts and Colors. In Display items, scroll to "ReSharper Code Analysis Error Marker on Error Stripe" and update the Item foreground color. The horizontal bars on the Marker Bar will appear as this color for errors.
Same process for warnings and suggestions.
This does not seem to work for Visual Studio 2010, however.

A: Resharper 7's status bar is much more colorblind friendly, since it uses icons instead of just changing the color of the square.


text:
Q: I was trying to access "UserController@edit" but it doesn't found, what did i do wrong? This is my link
id.'/edit') }}">edit

This is my web.php
Route::resource('/', UserController::class);

When i run php artisan route:list this is the return

GET|HEAD  | {}/edit  | edit    | App\Http\Controllers\UserController@edit    | web

A: It should be
id) }}">edit

and
Route::resource('user', UserController::class);

The first argument of the resource should be the name of the route group and not the route.


text:
Q: iOS Read file lines into array I have a file containing a couple thousands words on individual lines. I need to load all of these words into separate elements inside an array so first word will be Array[0], second will be Array[1] etc.
I found some sample code elsewhere but Xcode 4.3 says it's using depreciated calls.
NSString *tmp;
NSArray *lines;
lines = [[NSString stringWithContentsOfFile:@"testFileReadLines.txt"]
                   componentsSeparatedByString:@"\n"];

NSEnumerator *nse = [lines objectEnumerator];

while(tmp = [nse nextObject]) {
    NSLog(@"%@", tmp);
}

A: Yes, + (id)stringWithContentsOfFile:(NSString *)path has been deprecated.
See Apple's documentation for NSString
Instead use + (id)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error
Use as follows:
lines = [[NSString stringWithContentsOfFile:@"testFileReadLines.txt"
                                   encoding:NSUTF8StringEncoding
                                      error:nil]
            componentsSeparatedByString:@"\n"];

Update: - Thanks to JohnK
NSCharacterSet *newlineCharSet = [NSCharacterSet newlineCharacterSet];
NSString* fileContents = [NSString stringWithContentsOfFile:@"testFileReadLines.txt"
                                                   encoding:NSUTF8StringEncoding
                                                      error:nil];
NSArray *lines = [fileContents componentsSeparatedByCharactersInSet:newlineCharSet];

A: Check this. You might have to use an updated method.


text:
Q: When I simulate for non blocking assignement in verilog, simulation time is not advancing? module blocking( );
reg a,c,d,e,f ;
reg b = 'b0;
always
begin
a <= #10 b ;
c <= #10 a;
end

always
begin
#100;
$stop;
end
always
#10 b = ~b;

endmodule

A: The first always block has no delays in its process. All always blocks insatiate loping procedural threads. Use always_comb and it will wait for a change on b or c to being its loop.


text:
Q: sql to build categories menu that have products I have 3 tables (mysql)
products
product_id,
title
categories
category_id,
parent_id,
title
products_categories
product_id,
category_id
The depth of the category tree is unknown.
Is there a way to know with one query which categories have categories etc. that have products?

A: Yep, try :
select c1.*, c2.* from categories c1, categories c2, products_categories pc where c1.category_id = c2.parent_id and pc_category_id = c1.category_id;

c1, c2 gives us the transitive closure for your tree, pc gives us the leaves of the tree.

A: I guess there is a better way to do that - but this should work:
SELECT tb1.* FROM categories AS tb1 JOIN products_categories AS tb2 ON tb1.category_id=tb2.category_id AND tb2.product_id IN (SELECT tb3.product_id FROM products AS tb3 JOIN products_categories AS tb4 ON tb3.product_id=tb4.product_id WHERE tb3.product_id=tb2.product_id)


text:
Q: what is ^ used for in ruby?
Possible Duplicate:
Use of caret symbol( ^ ) in Ruby

So I was playing around with some code and I tried to play around with the power operator.  So I thought that perhaps I could use the caret (^) for this purpose, but after using it in:
for i in 0..10
  puts "#{i}   #{1^i}\n"
end

I got some really funky results
0   -  1
1   -  0
2   -  3
3   -  2
4   -  5
5   -  4
6   -  7
7   -  6
8   -  9
9   -  8
10  -  11

The only pattern I see is -1 on an odd number and +1 on an even number, but then when I try:
for i in 0..10
  puts "#{i}   #{2^i}\n"
end

i get:
0   -  2
1   -  3
2   -  0
3   -  1
4   -  6
5   -  7
6   -  4
7   -  5
8   -  10
9   -  11
10  -  8

wth!  So then I kept going up to 4^i and plotted them, the 1^i & 3^i came out with decent patterns but 2^i & 4^i were just all over the place with no visible patterns (though highly unlikely) with just 11 plotting points, so I've come to you ladies and gents asking you:
What on earth is ^ used for?!

A: In most programming languages, ^ is the XOR operator (Exclusive Or in Wikipedia). XOR is one of the most essential operations in the CPU, it often employed to zero registers (think of a ^= a) because it is fast and has a short opcode.
For the power function, you have to use e.g. ** (e.g. in ruby), java.lang.Math.pow, math.pow, pow etc.
In fact, I couldn't name a programming language that uses ^. It is used in LaTeX for formatting (as superscript, not power function, technically). But the two variants I see all the time are ** (as the power function is directly related to multiplication) and pow(base, exp).
Note that you can compute integer powers of 2 faster using shifts.


text:
Q: How to convert repeating-linear-gradient of an element to a base64 image or any other format? I can't seem to find a way to convert the repeat-linear-gradient to a base64 image format.
background-image: repeating-linear-gradient(-45deg, transparent, transparent 5px, white 5px, white 10px);

My problem is I want to print an HTML page with html2canvas and jsPDF but since html2canvas doesn't support support repeat-linear-gradient, I would like to know if there is a way to convert the value to base64.
Also, since the background image is rendered by the gantt-chart library, I can't change how it is set

A: Since it's a repeating gradient, you can identify the smallest portion that you can export as image and that will allow you to have the same background by repeating this image.
You are dealing with +-45deg and the last color stop is 10px so the smallest portion is 10px*sqrt(2) = 14.14px for the height and width:

.box {
  height: 14.14px;
  width: 14.14px;
  background: repeating-linear-gradient(-45deg, transparent, transparent 5px, blue 5px, blue 10px);
}

You save this as an image and you use any online tool that convert a png to base64:

.box {
  height: 100px;
  margin: 5px;
  background: url('data:image/png;base64,[encoded data, 6816 characters]');
}

For a dynamic solution I will consider the code used in this previous answer

var box = document.querySelector(".box");

domtoimage.toPng(box)
  .then(function(dataUrl) {
    console.log(dataUrl)
    var image = new Image();
    image.onload = function() {
        document.body.appendChild(image);
    };
    image.src = dataUrl;
  })
.box {
  height: 100px;
  margin:5px;
  background: repeating-linear-gradient(-45deg, transparent, transparent 5px, blue 5px, blue 10px);
}

Also like this:

var box = document.querySelector(".box");

domtoimage.toPng(box)
  .then(function(dataUrl) {
    console.log(dataUrl);
    document.querySelector(".alt").style.background='url('+dataUrl+')';
  })
.box {
  height: 14.14px;
  width: 14.14px;
  background: repeating-linear-gradient(-45deg, transparent, transparent 5px, blue 5px, blue 10px);
}

.alt {
  height:100px;
  margin:5px;
}


text:
Q: PHP filesize stat failed when user exits the page I have a script that creates a video from images on the server and let's the user download the video. After the video is downloaded the script removes the video file from the server.
When the video file is being downloaded the header content-length gives the correct file size with file size() function. But after or during the file download, if the user clicks any link on the website he gets the file size() stat failed error.
Here's the code:
exec('/usr/bin/mencoder "mf://' . $images . '" -mf fps=25 -o ' . $outputvideo . ' -ovc lavc -lavcopts vcodec=mjpeg:vbitrate=800');

if (file_exists($outputvideo)){
header('Content-Type: video/x-msvideo');
header('Content-Disposition: attachment; filename=' . $outputfilename . '');
header('Content-Length: ' . filesize($outputfilename));
ob_clean();
readfile($outputvideo);
unlink($outputvideo);
exit();
}

A: I was able to fix this by commenting out / removing the following line:
header('Content-Length: ' . filesize($outputfilename));


text:
Q: Size image with CSS Grid I am trying to size my image using a CSS grid.
This is my CSS Code:
/* General */
* {
    padding: 0;
    margin: 0;
}
html {
    height: 100%;
    background-image: url("/assets/images/background.png");
    background-repeat: repeat;
}
body {
    height: 100%;
}
/* Grid */
.grid-container {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12, 1fr);
}
/* Menu-Logged-Out */
.menu-logged-out {
    grid-column: 3 / 11;
    grid-row: 2;
}
.menu-logged-out img {
    min-width: 100%;
    min-height: 100%;
    display: block;
    object-fit: cover
}

And the following is my HTML code:
!DOCTYPE html>

    <meta charset='utf-8'>
    <meta http-equiv='X-UA-Compatible' content='IE=edge'>
    <title>asd</title>
    <meta name='viewport' content='width=device-width, initial-scale=1'>
    <link rel='stylesheet' type='text/css' media='screen' href='/assets/css/header.css'>

But the image overflows my CSS grid, and it looks something like this:

How could I fix that?
Greetings
Dominik :)

A: I have changed several properties, I believe this is what you want

* {
    padding: 0;
    margin: 0;
}
html {
    height: 100%;
}
body {
    height: 100%;
}
/* Grid */
.grid-container {
    height: 100%;
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: repeat(12, 8.5%);
}
/* Menu-Logged-Out */
.menu-logged-out {
    grid-column: 3 / 11;
    grid-row: 2;
    width: 100%;
    height: 100%;
    border: solid 1px red;
}
.menu-logged-out img {
    max-width: 100%;
    max-height: 100%;
    display: block;
    object-fit: cover
}


text:
Q: Storing configuration data (json) tl;dr Why storing configuration data in json files is considered a de facto standard?
I've recently read some parts of the Maintainable Javascript book, specially the Storing configuration data chapter.
This is a quote from the chapter:

Configuration data is best stored in a separate file to create a clean separation between
  it and application logic. A good starting point is to have a separate JavaScript file for
  configuration data. Once the configuration data is in a separate file, it opens up more
  possibilities for managing that data. A worthwhile option is moving your configuration
  data into a non-JavaScript file.
Even though you're writing a JavaScript application, JavaScript isn't a great way to store
  configuration data. That's because the syntax is still that of a programming language,
  so you need to be sure you haven't introduced syntax errors.

He basically says that storing configuration data in .json files or .js files is a bad practice and should be avoided.
From json.org:

JSON (JavaScript Object Notation) is a lightweight data-interchange format.

Interchange means to me to send and receive data, to communicate two processes in a well-formatted way.
A lot of people are storing the data in json files, which adds a lot of noise: curly braces, indentation, double quotes, commas, cannot write comments, etc.
Java uses key-value lines, is there a simpler way to store this data?
a 1

And with json format (1):
{
  "a": 1
}

And with js format (2):
module.exports = {
  a: 1
}

Microsoft likes to use .ini files which add sections to these key-value lines.
Unix configuration files also use key-value lines.
Then, if all the world uses key-value lines because they are easy to read/write by humans, why are json files a de facto standard in the node.js world? Please don't tell me that's because json and javascript are practically synonyms and because developers are too lazy and prefer to call require("./config.json").
In the above examples, the first option (1) was born to ease the data interchangeability. And the second, imo, it's just bad. This is the same as storing configuration data in a Java class. If I want to read this file from php because I have an apache server and nodejs for real-time things, how I'm supposed to parse that file? I'd need a javascript parser.
Both options shouldn't have syntax errors or the program might crash.

A: PS - IMHO you are right about comments, that's terrible to work with the format without comments
PPS - I'm Javascript developer, on post is Javascript tag - so answer subjectivelly from this side
Why storing configuration data in JSON?
It's very simple. In Javascript. Because JSON is formatted as an Object in JS, so you can have the same syntax for server-side objects, client-side objects and data stores. When you want to debug something, you can just grab whole JSON and put into your code like var obj = JSON and it works. You can find more on http://www.json.org/ Crockford's website.
Why is important "a lot of noise as curly braces, identation, double quotes .." ?
First reason is, of course, the syntax error detection. If you have strong syntax instead of "pure key/pair values" you are able to detect much faster and easily missing semicolons or braces. Also what is very important - parsing of big files is faster.
Second reason is different syntax for arrays, objects, strings and boolean. You want to have option of string "true", boolean true and number true - 1, because you want work with many databases, storages, APIs, programming languages - you need to support the whole scale.
Identation and JSON relationship is not an issue. JSON can be one-lined. In configuration files it's quite unpractical (users of stackoverflow can parse it ;DDD but "normal humans" no).
Third reason is parent-children relationship. Let's have a sample:
[
    {
        "email": "samuel@dude.com",
        "isAdmin" : true,
        "password": "KMLA#SLDOPW#",
        "modules" : [ "html", "js", "css" ],
        "creditcard" : {
            "number" : 3288942398329832,
            "expiration" : "2011-07-14T19:43:37+0100"
        }
    },
    {
        "email": "bill@dude.com",
        "isAdmin" : true,
        "password": "KMLA#SLDOPW#",
        "modules" : [ "js", "nodejs" ],
        "creditcard" : {
            "number" : 20432943092423,
            "expiration" : "2011-07-14T19:43:37+0100"
        }
    },
    {
        "email": "thomas@dude.com",
        "isAdmin" : false,
        "password": "KMLA#SLDOPW#",
        "modules" : [ "ruby", "python", "css" ],
        "creditcard" : {
            "number" : 4239093223423,
            "expiration" : "2011-07-14T19:43:37+0100"
        }
    }
]

.. do you want to log all emails into console?
jsonobj.forEach(function(ele){ console.log(ele.email); });
.. do you want have access to first user's credit card number?
jsonobj[0].creditcard.number
.. do you want to add next user?
jsonobj.push({ email: "peter@dude.com:, isAdmin: false })
.. do you want to parse file without external library?
JSON.parse(jsonrawfile);
JSON vs. XML
Very simular way is to have XML. But about this try to google some differences. I think front-end developers are as fans XML as fans IE6. There is more reasons why its like that. Try google for it.
Hope that it quite helped.


text:
Q: Set number of angular grid lines to a fixed value for a PolarPlot with jfreechart I'm facing an issue using PolarPlot with jFreeChart. My code plots a single dot with an arbitrary angle and a radius of maximum 1. Everytime I redraw the plot, the number of radial grid lines changes. This makes the program very ugly.
How can I constrain the number of lines to a predefined number?

A: So I found a satisfying solution:
final JFreeChart chart = ChartFactory.createPolarChart("", dataset, true, true, false);
final PolarPlot plot = (PolarPlot) chart.getPlot();
((NumberAxis)plot.getAxis()).setTickUnit(new NumberTickUnit(0.25));
plot.getAxis().setRange(-1, 1);

Important is the last line, where you set the Range, else if you only plot one single dot the spacing is correct, but the plot will be scaled and the plotted dot lies on the border.