text:
Q: ML model that finds relationships across the rows I have extracted a ball x,y coordinates from tennis match video
P.S. x,y coordinates are in the following format

coords2 = [(985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (985.0, 325.0), (978.0, 345.0), (969.8571428571429, 375.0), (961.7142857142857, 405.0), (953.5714285714286, 435.0), (945.4285714285714, 465.0), (937.2857142857143, 495.0), (929.1428571428571, 525.0), (921.0, 555.0), (918.0, 574.0), (918.0, 574.0), (904.0, 613.0), (895.0, 644.0), (886.0, 649.0), (877.0, 654.0), (870.0, 658.0), (870.0, 658.0), (861.0, 664.0), (853.0, 672.0), (846.0, 679.0), (837.0, 688.0), (827.0, 695.0), (827.0, 695.0), (821.0, 707.0), (812.0, 716.0), (803.3333333333334, 729.0), (794.6666666666666, 742.0), (786.0, 755.0), (786.0, 755.0), (782.0, 769.0), (782.0, 746.0), (786.0, 730.0), (793.0, 700.0), (800.0, 677.0), (800.0, 677.0), (803.0, 656.0), (807.0, 640.0), (814.0, 620.0), (819.0, 593.0), (819.0, 579.0), (819.0, 579.0), (825.0, 562.0), (831.0, 546.0), (834.0, 532.0), (833.5, 668.5), (833.0, 805.0), (833.0, 805.0), (837.5714285714286, 751.0), (842.1428571428571, 697.0), (846.7142857142857, 643.0), (851.2857142857143, 589.0), (855.8571428571429, 535.0), (860.4285714285714, 481.0), (865.0, 427.0), (867.0, 418.0), (871.0, 409.0), (872.0, 400.0), (877.0, 392.0), (877.0, 392.0), (877.0, 385.0), (883.0, 377.0), (883.0, 369.0), (887.0, 366.0), (890.0, 358.0), (890.0, 357.0), (892.0, 352.0), (894.0, 346.0), (897.0, 340.0), (898.0, 336.0), (900.0, 332.0), (900.0, 332.0), (902.0, 329.0), (905.0, 325.0), (905.0, 322.0), (908.0, 320.0), (910.0, 316.0), (910.0, 316.0), (912.0, 315.0), (914.0, 314.0), (916.0, 310.0), (919.0, 308.0), (919.0, 306.0), (919.0, 306.0), (920.0, 305.0), (924.0, 306.0), (922.0, 306.0), (926.0, 305.0), (928.0, 305.0), (926.0, 307.0), (930.0, 306.0), (930.0, 305.0), (932.0, 305.0), (933.0, 307.0), (935.0, 310.0), (935.0, 308.0), (936.0, 310.0), (937.0, 313.0), (938.0, 314.0), (940.0, 316.0), (942.0, 319.0), (942.0, 319.0), (942.0, 322.0), (943.0, 323.0), (945.0, 324.0), (946.0, 316.0), (945.0, 306.0), (945.0, 306.0), (945.0, 298.0), (946.0, 291.0), (947.0, 284.0), (947.0, 278.0), (950.0, 272.0), (949.0, 273.0), (950.0, 266.0), (951.0, 261.0), (950.0, 255.0), (950.0, 251.0), (951.0, 245.0), (951.0, 245.0), (953.0, 241.0), (952.0, 237.0), (950.0, 236.0), (945.0, 237.0), (939.0, 240.0), (938.0, 239.0), (934.0, 242.0), (928.0, 244.0), (922.0, 250.0), (917.0, 252.0), (911.0, 256.0), (911.0, 256.0), (905.0, 263.0), (899.0, 267.0), (896.0, 274.0), (890.0, 278.0), (883.0, 286.0), (883.0, 286.0), (878.0, 293.0), (873.0, 300.0), (869.0, 309.0), (863.0, 318.0), (858.0, 329.0), (858.0, 329.0), (851.0, 338.0), (846.0, 349.0), (840.0, 359.0), (835.0, 371.0), (830.0, 384.0), (830.0, 384.0), (825.0, 397.0), (818.0, 410.0), (812.0, 424.0), (807.25, 437.875), (802.5, 451.75), (797.75, 465.625), (793.0, 479.5), (788.25, 493.375), (783.5, 507.25), (778.75, 521.125), (774.0, 535.0), (773.0, 537.0), (768.0, 550.0), (761.0, 572.0), (754.0, 592.0), (750.0, 615.0), (748.0, 624.0), (748.0, 624.0), (739.0, 652.0), (733.0, 674.0), (728.0, 698.0), (727.0, 718.0), (718.0, 733.0), (718.0, 733.0), (714.0, 732.0), (709.0, 729.0), (705.0, 728.0), (702.0, 729.0), (694.0, 728.0), (696.0, 728.0), (692.0, 728.0), (688.0, 730.0), (684.0, 730.0), (678.0, 731.0), (675.0, 734.0), (675.0, 734.0), (673.0, 737.0), (667.0, 741.0), (664.0, 743.0), (659.0, 749.0), (653.0, 755.0), (653.0, 755.0), (650.0, 759.0), (647.0, 765.0), (642.0, 774.0), (636.0, 780.0), (633.0, 786.0), (633.0, 787.0), (630.0, 796.0), (625.0, 804.0), (629.0, 769.0), (634.0, 737.0), (633.0, 718.0), (633.0, 718.0), (640.0, 697.0), (644.0, 657.0), (649.0, 640.0), (651.0, 616.0), (655.0, 592.0), (654.0, 591.0), (654.0, 578.0), (656.0, 560.0), (659.0, 544.0), (662.0, 525.0), (663.5, 514.25), (665.0, 503.5), (666.5, 492.75), (668.0, 482.0), (670.3333333333334, 470.6666666666667), (672.6666666666666, 459.3333333333333), (675.0, 448.0), (675.0, 448.0), (676.0, 437.5), (677.0, 427.0), (677.0, 419.0), (678.0, 410.0), (678.0, 404.0), (678.0, 404.0), (679.0, 394.0), (682.0, 394.0), (682.0, 385.0), (682.0, 380.0), (683.0, 374.0), (683.0, 374.0), (684.0, 370.0), (684.0, 367.0), (684.0, 364.0), (685.0, 361.0), (686.0, 359.0), (686.0, 359.0), (686.0, 357.0), (686.0, 356.0), (687.0, 353.0), (686.0, 353.0), (687.0, 352.0), (687.0, 352.0), (688.0, 350.0), (687.0, 339.0), (685.0, 329.0), (687.0, 318.0), (686.0, 309.0), (687.0, 309.0), (681.0, 300.0), (686.0, 293.0), (688.0, 283.0), (689.0, 273.0), (688.0, 268.0), (689.0, 270.0), (689.0, 261.0), (688.0, 256.0), (688.0, 250.0), (689.0, 243.0), (688.0, 238.0), (688.0, 238.0), (690.0, 237.0), (690.0, 231.0), (690.0, 228.0), (691.0, 226.0), (696.0, 227.0), (699.0, 226.0), (705.0, 227.0), (710.3, 227.7), (715.6, 228.4), (720.9, 229.1), (726.2, 229.8), (731.5, 230.5), (736.8, 231.2), (742.1, 231.9), (747.4, 232.6), (752.7, 233.3), (758.0, 234.0), (758.0, 234.0), (762.0, 239.0), (769.0, 241.0), (775.0, 243.0), (780.0, 246.0), (787.0, 250.0), (787.0, 250.0), (793.0, 253.0), (800.0, 256.0), (806.0, 261.0), (812.0, 263.0), (820.0, 266.0), (820.0, 266.0), (826.0, 271.0), (832.0, 274.0), (840.0, 279.0), (845.0, 283.0), (851.0, 289.0), (852.0, 289.0), (858.0, 296.0), (866.0, 299.0), (874.0, 306.0), (879.0, 312.0), (888.0, 318.0), (888.0, 318.0), (893.0, 323.0), (900.0, 330.0), (908.0, 338.0), (914.0, 344.0), (922.0, 350.0), (922.0, 350.0), (928.0, 360.0), (937.0, 367.0), (945.0, 378.0), (950.0, 384.0), (955.6666666666666, 390.0), (961.3333333333334, 396.0), (967.0, 402.0), (974.0, 411.0), (980.0, 421.0), (989.0, 428.0), (995.5, 437.0), (1002.0, 446.0), (1008.5, 455.0), (1015.0, 464.0), (1021.5, 473.0), (1028.0, 482.0), (1034.5, 491.0), (1041.0, 500.0), (1047.5, 509.0), (1054.0, 518.0), (1061.0, 533.0), (1066.0, 543.0), (1076.0, 557.0), (1077.0, 558.0), (1087.0, 569.0), (1093.0, 585.0), (1101.0, 601.0), (1110.0, 614.0), (1119.0, 629.0), (1119.0, 629.0), (1128.0, 642.0), (1136.0, 662.0), (1142.25, 667.0833333333334), (1148.5, 672.1666666666666), (1154.75, 677.25), (1161.0, 682.3333333333334), (1167.25, 687.4166666666666), (1173.5, 692.5), (1179.75, 697.5833333333334), (1186.0, 702.6666666666666), (1192.25, 707.75), (1198.5, 712.8333333333334), (1204.75, 717.9166666666666), (1211.0, 723.0), (1216.0, 718.0), (1220.0, 719.0), (1226.0, 719.0), (1227.0, 718.0), (1232.0, 718.0), (1238.0, 719.0), (1243.0, 721.0), (1252.0, 721.0), (1256.0, 721.0), (1256.0, 721.0), (1262.0, 725.0), (1268.0, 728.0), (1273.0, 731.0), (1280.0, 734.0), (1286.0, 737.0), (1286.0, 737.0), (1293.0, 742.0), (1298.0, 746.0), (1305.0, 749.0), (1302.0, 720.0), (1299.0, 691.0), (1299.0, 691.0), (1295.0, 668.0), (1295.0, 649.0), (1288.0, 623.0), (1285.0, 597.0), (1280.0, 571.0), (1280.0, 571.0), (1277.0, 552.0), (1274.4444444444443, 538.4444444444445), (1271.888888888889, 524.8888888888889), (1269.3333333333333, 511.3333333333333), (1266.7777777777778, 497.77777777777777), (1264.2222222222222, 484.22222222222223), (1261.6666666666667, 470.6666666666667), (1259.111111111111, 457.1111111111111), (1256.5555555555557, 443.55555555555554), (1254.0, 430.0), (1249.0, 417.0), (1249.0, 417.0), (1246.0, 409.0), (1242.0, 399.0), (1239.0, 392.0), (1237.0, 384.0), (1234.0, 379.0), (1234.0, 379.0), (1231.0, 373.0), (1230.0, 367.0), (1227.0, 364.0), (1225.0, 361.0), (1222.0, 358.0), (1222.0, 358.0), (1220.0, 356.0), (1219.0, 353.0), (1214.0, 353.0), (1212.0, 352.0), (1209.0, 350.0), (1209.0, 350.0), (1207.0, 351.0), (1206.0, 350.0), (1204.0, 352.0), (1202.0, 350.0), (1202.0, 335.0), (1202.0, 335.0), (1200.0, 324.0), (1198.0, 313.0), (1196.0, 302.5), (1194.0, 292.0), (1195.0, 281.0), (1195.0, 281.0), (1194.0, 273.0), (1191.0, 263.0), (1191.0, 256.0), (1191.0, 247.0), (1190.0, 239.0), (1190.0, 239.0), (1189.0, 234.0), (1189.0, 228.0), (1189.0, 221.0), (1188.0, 216.0), (1186.0, 213.0), (1187.0, 212.0), (1184.0, 209.0), (1183.0, 205.0), (1182.0, 200.0), (1181.0, 195.0), (1181.0, 195.0), (1181.0, 195.0), (1178.4, 195.16190476190476), (1175.8, 195.32380952380953), (1173.2, 195.4857142857143), (1170.6, 195.64761904761906), (1168.0, 195.8095238095238), (1165.4, 195.97142857142856), (1162.8, 196.13333333333333), (1160.2, 196.2952380952381), (1157.6, 196.45714285714286), (1155.0, 196.61904761904762), (1152.4, 196.78095238095239), (1149.8, 196.94285714285715), (1147.2, 197.10476190476192), (1144.6, 197.26666666666668), (1142.0, 197.42857142857142), (1139.4, 197.59047619047618), (1136.8, 197.75238095238095), (1134.2, 197.9142857142857), (1131.6, 198.07619047619048), (1129.0, 198.23809523809524), (1126.4, 198.4), (1123.8, 198.56190476190477), (1121.2, 198.72380952380954), (1118.6, 198.8857142857143), (1116.0, 199.04761904761904), (1113.4, 199.2095238095238), (1110.8, 199.37142857142857), (1108.2, 199.53333333333333), (1105.6, 199.6952380952381), (1103.0, 199.85714285714286), (1100.4, 200.01904761904763), (1097.8, 200.1809523809524), (1095.2, 200.34285714285716), (1092.6, 200.5047619047619), (1090.0, 200.66666666666666), (1087.4, 200.82857142857142), (1084.8, 200.9904761904762), (1082.2, 201.15238095238095), (1079.6, 201.31428571428572), (1077.0, 201.47619047619048), (1074.4, 201.63809523809525), (1071.8, 201.8), (1069.2, 201.96190476190475), (1066.6, 202.1238095238095), (1064.0, 202.28571428571428), (1061.4, 202.44761904761904), (1058.8, 202.6095238095238), (1056.2, 202.77142857142857), (1053.6, 202.93333333333334), (1051.0, 203.0952380952381), (1048.4, 203.25714285714287), (1045.8, 203.41904761904763), (1043.2, 203.58095238095237), (1040.6, 203.74285714285713), (1038.0, 203.9047619047619), (1035.4, 204.06666666666666), (1032.8, 204.22857142857143), (1030.2, 204.3904761904762), (1027.6, 204.55238095238096), (1025.0, 204.71428571428572), (1022.4, 204.8761904761905), (1019.8, 205.03809523809525), (1017.2, 205.2), (1014.6, 205.36190476190475), (1012.0, 205.52380952380952), (1009.4, 205.68571428571428), (1006.8, 205.84761904761905), (1004.2, 206.0095238095238), (1001.6, 206.17142857142858), (999.0, 206.33333333333334), (996.4, 206.4952380952381), (993.8, 206.65714285714284), (991.2, 206.8190476190476), (988.6, 206.98095238095237), (986.0, 207.14285714285714), (983.4, 207.3047619047619), (980.8, 207.46666666666667), (978.2, 207.62857142857143), (975.6, 207.7904761904762), (973.0, 207.95238095238096), (970.4, 208.11428571428573), (967.8, 208.27619047619046), (965.2, 208.43809523809523), (962.6, 208.6), (960.0, 208.76190476190476), (957.4, 208.92380952380952), (954.8, 209.0857142857143), (952.2, 209.24761904761905), (949.6, 209.40952380952382), (947.0, 209.57142857142858), (944.4, 209.73333333333335), (941.8, 209.89523809523808), (939.2, 210.05714285714285), (936.6, 210.21904761904761), (934.0, 210.38095238095238), (931.4, 210.54285714285714), (928.8, 210.7047619047619), (926.2, 210.86666666666667), (923.5999999999999, 211.02857142857144), (921.0, 211.1904761904762), (918.4, 211.35238095238094), (915.8, 211.5142857142857), (913.2, 211.67619047619047), (910.5999999999999, 211.83809523809524), (908.0, 212.0), (906.0, 222.0), (901.0, 235.0), (900.0, 235.0), (898.0, 249.0), (893.0, 263.0), (888.0, 276.0), (883.0, 292.0), (878.0, 303.0), (871.0, 426.3333333333333), (864.0, 549.6666666666666), (857.0, 673.0), (860.0, 519.0), (863.0, 365.0), (859.0, 384.0), (859.0, 384.0), (855.0, 398.0), (851.0, 411.0), (849.0, 412.0), (845.0, 413.0), (841.0, 414.0), (841.0, 414.0), (837.0, 414.0), (835.0, 413.0), (830.0, 415.0), (828.0, 416.0), (825.0, 416.0), (825.0, 416.0), (821.0, 419.0), (817.0, 421.0), (816.0, 424.0), (813.0, 425.0), (809.0, 423.0), (809.0, 423.0), (805.0, 405.0), (804.0, 378.0), (803.0, 360.0), (799.0, 340.0), (800.0, 324.0), (800.0, 324.0), (797.6666666666666, 307.3333333333333), (795.3333333333334, 290.6666666666667), (793.0, 274.0), (791.0, 259.0), (788.0, 248.0), (788.0, 248.0), (787.0, 235.0), (783.0, 224.0), (783.0, 214.0), (781.0, 204.0), (785.6875, 229.8125), (790.375, 255.625), (795.0625, 281.4375), (799.75, 307.25), (804.4375, 333.0625), (809.125, 358.875), (813.8125, 384.6875), (818.5, 410.5), (823.1875, 436.3125), (827.875, 462.125), (832.5625, 487.9375), (837.25, 513.75), (841.9375, 539.5625), (846.625, 565.375), (851.3125, 591.1875), (856.0, 617.0), (857.0, 617.0), (860.0, 617.0), (855.2727272727273, 580.0), (850.5454545454545, 543.0), (845.8181818181819, 506.0), (841.0909090909091, 469.0), (836.3636363636364, 432.0), (831.6363636363636, 395.0), (826.9090909090909, 358.0), (822.1818181818181, 321.0), (817.4545454545455, 284.0), (812.7272727272727, 247.0), (808.0, 210.0), (814.0, 226.0), (818.0, 239.0), (820.0, 238.0), (824.0, 250.0), (830.0, 260.0), (836.0, 275.0), (839.0, 286.0), (843.3333333333334, 297.6666666666667), (847.6666666666666, 309.3333333333333), (852.0, 321.0), (858.0, 334.0), (860.0, 350.0), (868.0, 366.0), (875.0, 383.0), (875.0, 383.0), (880.0, 402.0), (885.0, 418.0), (891.4285714285714, 428.0), (897.8571428571429, 438.0), (904.2857142857143, 448.0), (910.7142857142857, 458.0), (917.1428571428571, 468.0), (923.5714285714286, 478.0), (930.0, 488.0), (936.4285714285714, 498.0), (942.8571428571429, 508.0), (949.2857142857143, 518.0), (955.7142857142858, 528.0), (962.1428571428571, 538.0), (968.5714285714286, 548.0), (975.0, 558.0), (991.0, 561.0), (991.0, 561.0), (994.0, 570.0), (997.0, 579.0), (1000.3333333333334, 578.6666666666666), (1003.6666666666666, 578.3333333333334), (1007.0, 578.0), (1010.3333333333334, 577.6666666666666), (1013.6666666666666, 577.3333333333334), (1017.0, 577.0), (992.0, 529.0), (967.0, 481.0), (942.0, 433.0), (942.0, 433.0), (943.0, 424.0), (944.0, 420.0), (946.0, 412.0), (949.0, 407.0), (948.0, 401.0), (948.0, 401.0), (948.0, 397.0), (949.0, 391.0), (950.0, 391.0), (952.0, 385.0), (954.0, 381.0), (954.0, 381.0), (954.0, 378.0), (954.0, 375.0), (955.0, 372.0), (956.0, 371.0), (956.0, 368.0), (956.0, 368.0), (956.0, 368.0), (960.0, 365.0), (959.0, 363.0), (960.0, 364.0), (961.0, 364.0), (961.0, 364.0), (963.0, 363.0), (963.0, 364.0), (962.0, 364.0), (965.0, 365.0), (967.0, 367.0), (967.0, 367.0), (967.0, 367.0), (966.0, 370.0), (966.0, 371.0), (968.0, 374.0), (969.0, 377.0), (969.0, 377.0), (969.0, 381.0), (969.0, 384.0), (969.0, 388.0), (970.5, 391.0), (972.0, 394.0), (972.0, 394.0), (971.0, 399.0), (972.0, 404.0), (973.0, 409.0), (972.0, 414.0), (973.0, 418.0), (973.0, 418.0), (973.0, 424.0), (973.0, 430.0), (972.0, 437.0), (972.1, 436.3), (972.2, 435.6), (972.3, 434.9), (972.4, 434.2), (972.5, 433.5), (972.6, 432.8), (972.7, 432.1), (972.8, 431.4), (972.9, 430.7), (973.0, 430.0), (974.0, 423.0), (974.0, 416.0), (974.0, 411.0), (974.0, 407.0), (974.0, 407.0), (973.0, 403.0), (972.0, 396.0), (971.5, 392.5), (971.0, 389.0), (973.0, 385.0), (973.0, 385.0), (972.0, 384.0), (973.0, 379.0), (972.0, 377.0), (971.0, 374.0), (972.0, 373.0), (973.0, 373.0), (972.0, 372.9375), (971.0, 372.875), (970.0, 372.8125), (969.0, 372.75), (968.0, 372.6875), (967.0, 372.625), (966.0, 372.5625), (965.0, 372.5), (964.0, 372.4375), (963.0, 372.375), (962.0, 372.3125), (961.0, 372.25), (960.0, 372.1875), (959.0, 372.125), (958.0, 372.0625), (957.0, 372.0), (956.3529411764706, 374.3529411764706), (955.7058823529412, 376.70588235294116), (955.0588235294117, 379.05882352941177), (954.4117647058823, 381.4117647058824), (953.7647058823529, 383.7647058823529), (953.1176470588235, 386.11764705882354), (952.4705882352941, 388.47058823529414), (951.8235294117648, 390.8235294117647), (951.1764705882352, 393.1764705882353), (950.5294117647059, 395.52941176470586), (949.8823529411765, 397.88235294117646), (949.2352941176471, 400.2352941176471), (948.5882352941177, 402.5882352941176), (947.9411764705883, 404.94117647058823), (947.2941176470588, 407.29411764705884), (946.6470588235294, 409.6470588235294), (946.0, 412.0), (941.0, 413.0), (935.0, 414.0), (936.0, 414.0), (929.0, 414.0), (922.0, 413.0), (914.0, 414.0), (908.0, 416.0), (902.0, 417.0), (902.0, 417.0), (894.0, 418.0), (889.0, 422.0), (882.0, 424.0), (873.0, 425.0), (867.0, 428.0), (867.0, 428.0), (861.0, 436.0), (853.0, 437.0), (846.8888888888889, 442.5), (840.7777777777778, 448.0), (834.6666666666666, 453.5), (828.5555555555555, 459.0), (822.4444444444445, 464.5), (816.3333333333334, 470.0), (810.2222222222222, 475.5), (804.1111111111111, 481.0), (798.0, 486.5), (791.8888888888889, 492.0), (785.7777777777778, 497.5), (779.6666666666666, 503.0), (773.5555555555555, 508.5), (767.4444444444445, 514.0), (761.3333333333334, 519.5), (755.2222222222222, 525.0), (749.1111111111111, 530.5), (743.0, 536.0), (738.0, 543.0), (732.0, 552.0), (732.0, 545.0), (732.0, 545.0), (734.0, 532.0), (723.0, 549.0), (712.0, 566.0), (701.0, 583.0), (711.8333333333334, 556.6666666666666), (722.6666666666666, 530.3333333333334), (733.5, 504.0), (744.3333333333334, 477.6666666666667), (755.1666666666666, 451.33333333333337), (766.0, 425.0), (770.0, 413.0), (769.0, 414.0), (774.0, 405.0), (776.0, 392.0), (780.0, 384.0), (783.0, 374.0), (788.0, 363.0), (788.0, 363.0), (791.0, 354.0), (794.0, 346.0), (799.0, 339.0), (802.0, 331.0), (805.0, 324.0), (805.0, 324.0), (808.0, 319.0), (813.0, 312.0), (814.0, 304.0), (818.0, 299.0), (824.0, 295.0), (824.0, 295.0), (828.0, 288.0), (828.0, 285.0), (832.0, 280.0), (835.0, 276.0), (838.0, 274.0), (838.0, 274.0), (842.0, 269.0), (846.0, 266.0), (848.0, 265.0), (852.0, 262.0), (855.0, 260.0), (855.0, 260.0), (857.0, 259.0), (861.0, 256.0), (864.5, 254.5), (868.0, 253.0), (885.75, 281.4166666666667), (903.5, 309.8333333333333), (921.25, 338.25), (939.0, 366.6666666666667), (956.75, 395.08333333333337), (974.5, 423.5), (992.25, 451.9166666666667), (1010.0, 480.33333333333337), (1027.75, 508.75), (1045.5, 537.1666666666667), (1063.25, 565.5833333333334), (1081.0, 594.0), (1091.0, 586.0), (1091.0, 586.0), (1103.0, 573.0), (1113.0, 564.0), (1126.0, 553.0), (1140.0, 542.0), (1150.0, 533.0), (1150.0, 533.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0), (1163.0, 523.0)]

Using these coordinates I build a DataFrame consisting of 3 columns: x, y, bounce (coordinate where the ball touches the court - found manually)
Sample:

...
x
y
bounce

0
985.0
325.0
0

1
985.0
325.0
0

2
985.0
325.0
0

3
985.0
325.0
0

4
985.0
325.0
0

..
...
...
...

921
1163.0
523.0
0

922
1163.0
523.0
0

923
1163.0
523.0
0

924
1163.0
523.0
0

925
1275.0
572.0
1

[926 rows x 3 columns]

If I plot the x and y coordinates against the frame number and do a scatter plot for the bounce points as well, I get

I can see that there is a certain pattern, the bounce happen 10-30 frames before the peak (local Max/local Min) but the ML model I build using sklearn can't seem to capture it.
import numpy as np
from sklearn.model_selection import train_test_split, GridSearchCV
from sklearn.linear_model import LogisticRegression
from sklearn.preprocessing import StandardScaler
from sklearn.metrics import confusion_matrix

X = df.drop('bounce', 1)
y = df['bounce']

scaler = StandardScaler()
X_scaled = scaler.fit_transform(X)

X_train, X_test, y_train, y_test = train_test_split(X, y, stratify=y)

grid={"C":np.logspace(-3,3,7), "penalty":["l1","l2"]}# l1 lasso l2 ridge
logreg = LogisticRegression(C = 0.001, penalty='l2')
logreg.fit(X_train, y_train)
y_pred = logreg.predict(X_test)

tn, fp, fn, tp = confusion_matrix(y_test, y_pred).ravel()
print(tn, fp, fn, tp)
>>> 381 0 6 0

As far as I know, for sklearn ML models looks for relationship across columns, whereas every row is a new case.
In my case there isn't much across the columns but rather the rows are of higher value, how can I train my model accordingly?

A: Consider the frames as time point and the data as a time series data would help capture the relationship better. Time series models have different methods of training and it would be better to reframe the prediction question accordingly.
This Post seems like a good starting point for this question.


text:
Q: Trigger Style on One Column of GridView My question is similar to WPF Grid - How to apply a style for just one column? but applies to a GridView inside of a ListView
I'm trying to apply a trigger that will change the color of text within a TextBlock only in a given column within the GridView. If I take out the line commented THIS each textblock in the row is affected.
<ListView>
    <ListView.Resources>
        <Style TargetType="{x:Type TextBlock}">
            <Setter Property="Foreground" Value="White" />
        </Style>
    </ListView.Resources>
    <ListView.View>
        <GridView x:Name="MyGridView" ColumnHeaderContainerStyle="{StaticResource GridViewColumnHeaderStyleNew}">
            <GridViewColumn Width="90" Header="Name" DisplayMemberBinding="{Binding Name}"/>
            <GridViewColumn Width="90" Header="Option" DisplayMemberBinding="{Binding Option}"/>
            <GridViewColumn Width="90" Header="Dir" DisplayMemberBinding="{Binding Directory}"/>
            <GridViewColumn Width="90" Header="Size" DisplayMemberBinding="{Binding Size}"/>
            <GridViewColumn Width="90" Header="Status" >
                <GridViewColumn.CellTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding Status}">
                            <TextBlock.Style>
                                <Style TargetType="{x:Type TextBlock}">
                                    <Setter Property="Foreground" Value="White" />
                                    <Style.Triggers>
                                        <DataTrigger Binding="{Binding Status}" Value="Overheating">
                                            <DataTrigger.EnterActions>
                                                <BeginStoryboard>
                                                    <Storyboard>
                                                        <ColorAnimation Storyboard.TargetProperty="Foreground.Color" From="White" To="Red" Duration="0:0:2" AutoReverse="True" RepeatBehavior="Forever" />
                                                    </Storyboard>
                                                </BeginStoryboard>
                                            </DataTrigger.EnterActions>
                                        </DataTrigger>
                                    </Style.Triggers>
                                </Style>
                            </TextBlock.Style>
                        </TextBlock>
                    </DataTemplate>
                </GridViewColumn.CellTemplate>
            </GridViewColumn>
        </GridView>
    </ListView.View>
</ListView>

What changes to that line would make it so that only the 5th column which contains the text block is affected by the multitrigger?
[EDIT 1] Added code for GridView
[EDIT 2] I modified the last GridViewColumn to give it its own style
[EDIT 3] Removed the DisplayMemberBinding and added a Setter property... it works :).
Updated source code to reflect correct answer.

A: The easiest thing to do would be moving the style to the column's template:
<GridViewColumn Width="90" Header="Status">
    <GridViewColumn.CellTemplate>
        <DataTemplate>
            <TextBlock Text="{Binding Status}">
                <TextBlock.Style>
                     <!-- Style here without additional condition -->

A: You will need to use multi-binding and pass GridViewColumn & GridView into the converter, which decides COLUMN number. You can pass those using RelativeSource binding which will work automatically. There is no "Column" property as far I can tell.
In conveter you do GridView.Columns.IndexOf(YourColumn). Alternatively you just change your viewmodel and add new property, "StyleColumn", and use bindable columns WPF MVVM: how to bind GridViewColumn to ViewModel-Collection?

redpajama_set_name: RedPajamaStackExchange


text:
Q: Button setOnClickListener method is not invoked The below is the sample code I'm trying to get the selected value from spinner on setOnClickListener method for the Button validateUser.
    public class MainActivity extends Activity implements  AdapterView.OnItemSelectedListener {
      private Button validateUser;
      private Spinner userTypeSpinner;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        userTypeSpinner=(Spinner)findViewById(R.id.userTypeSpinner);
        validateUser= (Button) findViewById(R.id.userValidate);

        validateUser.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Toast.makeText(getApplicationContext(), "Button is Selected", Toast.LENGTH_SHORT);
            }
        });

        ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(this,
                R.array.userTypeArray, android.R.layout.simple_spinner_item);
        adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        userTypeSpinner.setAdapter(adapter);
        userTypeSpinner.setOnItemSelectedListener(this);
    }

    @Override
    public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
        String item = adapterView.getItemAtPosition(i).toString();

        Toast.makeText(adapterView.getContext(), "Selected: " + item, Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onNothingSelected(AdapterView<?> adapterView) {

    }
}

A: Toast needs to be shown. use .show() at the end.
Toast.makeText(getApplicationContext(), "Button is Selected", Toast.LENGTH_SHORT).show();

A: But you still not going to be able to use that spinner inside your button setOnClickListener.
validateUser.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Toast.makeText(getApplicationContext(), "Button is Selected", Toast.LENGTH_SHORT);
        }
    });


text:
Q: Equation does not start at the begining of the second line \documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
  \label{mutual}
\begin{multlined}
I(Predicted;Actual)=\sum \limits_{a,b} p(Predicted,Actual)\log \frac{p(Predited,Actual}{p(Predicted)p(Actual)}\\
=\log \frac{p(Predicted,Actual)}{p(Predicted)p(Actual)}
\end{multlined}
  \end{equation}
\end{document}

Considering the above code: I would like the =log ... to be at the beginning of the new line but it does not follow my expectation.
How do I fix it?

A: Here is how I would do it, using the align* environment:
\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{align*}
  I(\mathrm{Predicted}; \mathrm{Actual})
  &= \sum_{a,b}p(\mathrm{Predicted}, \mathrm{Actual}) \log\frac{p(\mathrm{Predicted}, \mathrm{Actual})}{p(\mathrm{Predicted}) p(\mathrm{Actual})}\\
  &= \log\frac{p(\mathrm{Predicted}, \mathrm{Actual})}{p(\mathrm{Predicted}) p(\mathrm{Actual})}
\end{align*}

\end{document}

An alternative solution is the following:
\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{align*}
  &I(\mathrm{Predicted}; \mathrm{Actual})\\
  &= \sum_{a,b}p(\mathrm{Predicted}, \mathrm{Actual}) \log\frac{p(\mathrm{Predicted}, \mathrm{Actual})}{p(\mathrm{Predicted}) p(\mathrm{Actual})}\\
  &= \log\frac{p(\mathrm{Predicted}, \mathrm{Actual})}{p(\mathrm{Predicted}) p(\mathrm{Actual})}
\end{align*}

\end{document}

The reason for using the latter is, that the white space below I(\mathrm{Predicted}; \mathrm{Actual}) is removed.
P.S. There is no need for the \limits operator in your case.

A: I have made some changes. Now I think it's fine. If you prefer to have the number of equation, remove \nonumber.

\documentclass[fleqn]{article}
\usepackage{amsmath}
\begin{document}
\label{mutual}
\begin{align}
I(\text{Predicted};\text{Actual}) &=\sum \limits_{a,b} p(\text{Predicted},\text{Actual})\log \frac{p(\text{Predicted},\text{Actual})}{p(\text{Predicted})p(\text{Actual})}= \nonumber &&\\
&= \log \frac{p(\text{Predicted},\text{Actual})}{p(\text{Predicted})p(\text{Actual})}\nonumber
\end{align}
\end{document}

A: Have you considered the split environment?
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{equation}
  \label{mutual}
  \begin{split}
    I(Predicted;Actual)&=\sum \limits_{a,b} p(Predicted,Actual)\log \frac{p(Predited,Actual}{p(Predicted)p(Actual)}\\
                       &=\log \frac{p(Predicted,Actual)}{p(Predicted)p(Actual)}
  \end{split}
\end{equation}
\end{document}

produces:

Note the use of the alignment character & to align the = sign in both lines.


text:
Q: Cheat sheet, sublime text 2 for mac 13 inch keyboard I need full keyboard shortcuts for sublime text2 on macbook retina 13 inch. Searched google but didn't get a full chart that I could print.

A: Here's a Github gist that lists the Mac OS hotkeys for ST2.
You may also want to use Cheatsheet (usable not just for ST2, but for other apps as well).


text:
Q: Installed the reference from NuGet but VS2010 cant find the namespace I am quite new to C# and Visual Studio but I just downloaded the Facebook C# SDK from NuGet but when I try to use it using:
using Facebook;

visual studio says that it cannot find the namespace name. I checked my references list and Facebook is on the project's reference list.
I tried to follow the instructions from this post on code project.
http://www.codeproject.com/Articles/20032/Creating-a-simple-Facebook-Application-using-WPF
All the examples that I found so far online do not suggest for a problem of that nature.
any suggestions?

A: Sometimes some NuGet issues require to re-open the project with the referenced assembly to load it. This problem is not Facebook-specific.


text:
Q: docker image build command fails with "(Client.Timeout exceeded while awaiting headers)" I am new to docker and Ubuntu 16.04 OS as well. My configuration is as follows :
Ubuntu:
$lsb_release -a

No LSB modules are available.

Distributor ID: Ubuntu

Description:    Ubuntu 16.04.5 LTS

Release:    16.04

Codename:   xenial

Docker :
$ docker info

Containers: 2

 Running: 0

 Paused: 0

 Stopped: 2

Images: 5

Server Version: 18.09.0

Storage Driver: overlay2

 Backing Filesystem: extfs

 Supports d_type: true

 Native Overlay Diff: true

Logging Driver: json-file

Cgroup Driver: cgroupfs

Plugins:

 Volume: local

 Network: bridge host macvlan null overlay

 Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk
syslog

Swarm: inactive

Runtimes: runc

Default Runtime: runc

Init Binary: docker-init

containerd version: c4446665cb9c30056f4998ed953e6d4ff22c7c39

runc version: 4fc53a81fb7c994640722ac585fa9ca548971871

init version: fec3683

Security Options:

 apparmor

 seccomp

  Profile: default

Kernel Version: 4.15.0-42-generic

Operating System: Ubuntu 16.04.5 LTS

OSType: linux

Architecture: x86_64

CPUs: 4

Total Memory: 15.4GiB

Name: smarthi-ORADEV

ID: 3OIT:CLN4:HNUU:W4SG:Z6OZ:NRRV:WSSN:E7PO:A2ZZ:XGYI:CXUZ:VBUD

Docker Root Dir: /var/lib/docker

Debug Mode (client): false

Debug Mode (server): false

Username: bluesangig

Registry: https://index.docker.io/v1/

Labels:

Experimental: false

Insecure Registries:

 127.0.0.0/8

Live Restore Enabled: false

Product License: Community Engine

WARNING: No swap limit support

I am connect to office VPN network and all my accesses to office and internet are working fine with my Network proxy configuration done in my laptop.
Even docker container run commands are also working fine.
But when I try to do docker image build using a docker file whose content is:
FROM busybox
RUN echo "building simple docker image"
CMD [echo, "hello container"]
I am getting below error message:
$ docker image build -t testimg .
Sending build context to Docker daemon  2.048kB
Step 1/3 : FROM busybox
Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

I had searched a bit and found that we may need to set the proxy in the ~/.docker/config.json file, and I had added the proxy entries as mentioned in the issue
Even after adding the entries as suggested in the above issue, I still face the same issue.
I am little clueless now on how to solve this issue with docker image build. Any help would be greatly appreciated.

A: After a much trail and error and lot of googling... finally I was able to make docker work behind my office VPN.
And for the benefit of people who might be facing issue similar to mine, below are the steps I performed to resolve the issue:
Three different places where I had modified the proxy value and that got the issue fixed.

*

*/etc/systemd/system/docker.service.d/http-proxy.conf Check if this file exists in your setup, and if it does not create this file and perform below steps:

*

*Open the file and add below statements in it and save:
[Service]
Environment="HTTP_PROXY=http://proxyHost:proxyPort"
Environment="HTTPS_PROXY=http://proxyHost:proxyPort"
Environment="NO_PROXY=localhost,127.0.0.1"

*Flush the above changes by running below command:
sudo systemctl daemon-reload

*Verify that the above changes have been taken affect by running the command below. This should print the Environment variable value:
sudo system ctl show --property Environment docker

*Once you successfully verify that the variable is set, restart the docker service by running below command:
sudo systemctl restart docker

*~/.docker/config.json: Add the json property shown below to the existing properties in the file.
    "proxies": {
      "defaults": {
        "httpProxy":"http://proxyHost:proxyPort",
        "httpsProxy":"http://proxyHost:proxyPort"
      }
    }

*/etc/default/docker : Open or create this file with this content:
export http_proxy='http://proxyHost:proxyPort'
export https_proxy='http://proxyHost:proxyPort'

Once I had all the above changes done, I rebooted my setup and then docker image pull and other docker commands started working without issues.
Note: All the above changes may not be required but for me above changes made sure that docker works after I connect to my VPN.

A: In the file /etc/default/docker, add:
export http_proxy='http://<host>:<port>'
export https_proxy='http://<host>:<port>'

Restart Docker
sudo service docker restart


text:
Q: Tesseract does not recognize single characters How to represent:

*

*Create new image with paint (any size)

*Add letter A to this image

*Try to recognize -> tesseract will not find any letters

*Copy-paste this letter 5-6 times to this image

*Try to recognize -> tesseract will find all the letters

Why?

A: Have you seen this?
https://code.google.com/p/tesseract-ocr/issues/detail?id=581
The bug list shows it as "no longer an issue".

*

*Be sure to have high resolution images.

*If you are resizing the image, be sure to keep a high DPI and don't resize too small

*Be sure to train your tesseract system

*use the baseApi.setVariable("tessedit_char_whitelist", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"); code before the init Tesseract

*Also, you may look into which font to use with OCR

A: You must set the "page segmentation mode" to "single char".
For example, in Android you do the following:
api.setPageSegMode(TessBaseAPI.pageSegMode.PSM_SINGLE_CHAR);

A: python code to do that configuration is like this:
import pytesseract
import cv2
img = cv2.imread("path to some image")
pytesseract.image_to_string(
     img, config=("-c tessedit"
                  "_char_whitelist=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
                  " --psm 10"
                  " -l osd"
                  " "))

the --psm flag defines the page segmentation mode.
according to documentaion of tesseract, 10 means :

Treat the image as a single character.

so to recognize a single character you just need to use : --psm 10 flag.

A: You need to set Tesseract's page segmentation mode to "single character."


text:
Q: Changing CURRENT save/default directory in Delphi 2007 without using Save-As I have a project group that contains a project I'm working on as well as some related component and packages. I prefer to keep the database links active during design-time.
I know how to write the code which would change the database file location, but in this case, I'm just using ".\data" instead, for various design-time reasons. Unfortunately, using a relative folder means that Delphi needs to be "pointing" to the same folder that the project is in.
I'd like to be able to force the folder location to a different root, without using the "Save As" feature. Does anyone happen to know where the Delphi IDE retrieves that info?

A: I have some projects in delphi7, Delphi2009, Delphi2010 and DelphiXE4  and also my project are not stored in my document.
I force the save/default like this:
Tools > Options > Environment Options > Default project
for Delphi 2010  =>  U:\Projects\Rad Studio 2010\Projects

A: I am not sure I completely understand your question.

*

*If you are referring to the folder the IDE has as the current folder, then you can just change the shortcut that launches Delphi to set the current directory where ever you want it to be.

A: You can change the location the project compliers and saves the dcu/unit/exe to in Project/Options under the Directories/Conditionals is that what you are looking for?
I bevile there is also some settings for the DBE in the Tools menu, but I dont have them install at the moment (or i cant find them)

A: I'd say you should just hard-code the full path to the database. Not pretty, but it will always work. There are tools, like GExperts, that will ensure your database components are set to inactive when you save them, and that way you can be sure to set them correctly on the live computer at runtime.
It would be nice to use relative paths, but that would be a function of the component and not the application really.

A: Do NOT use a path relative to .exe path.  That will get you into trouble with Windows XP in limited access mode, as well as with Windows Vista.
Do you need one database for all users?
Use  a path relative to All Users\Application Data directory.
Do you need separate databases per user?
Use a path relative to user's private User\Application Data directory.
Do you need multiple databases per user?
Use a path relative to user's My Documents directory.
Use any of the above as default, but add registry keys that allow you to override the settings.

A: I believe it gets that info from Tools -> Options -> Environment Options -> Environment Variables.
Try to play with those (Add override).

A: Tools -> Options -> Environment Options -> Environment Variables - BDSProjectsDir


text:
Q: iOS for VirtualBox Is there anyway to install Apple iOS in VirtualBox? i have installed Android on VirtualBox with live Android and i have installed Snow leopard on VirtualBox but i don't know whether i could do the same with iOS if there is a way please let me know.(i am using both Ubuntu 10.04 and Windows 7 as hosts)
Thanks !!
UPDATE : here i wanted to know whether there exists a project like Hackintosh for iOS

A: Additional to the above - the QEMU website has good documentation about setting up an ARM based emulator: http://qemu.weilnetz.de/qemu-doc.html#ARM-System-emulator

A: VirtualBox is a virtualizer, not an emulator. (The name kinda gives it away.) I.e. it can only virtualize a CPU that is actually there, not emulate one that isn't. In particular, VirtualBox can only virtualize x86 and AMD64 CPUs. iOS only runs on ARM CPUs.

A: You could try qemu, which is what the Android emulator uses. I believe it actually emulates the ARM hardware.


text:
Q: Filter is causing everything to filter out even though condition is correct I hope this will be easy for the reader. The where clause at the bottom causes nothing to show up on the result. When I comment it, I get all the values for what we need to test but we need to filter US, US, US.
Here is the following data or a subset.

ACCT_DATE
ACCT_CD
STATUS
A
B
C

2021-11-01 19:34:34.000
A20
ACCT
US
US
UK

2021-11-01 19:34:57.000
A20
ACCT
US
US
US

2021-11-01 19:34:57.000
A20
ACCT
US
US
US

2021-11-01 19:34:34.000
A20
ACCT
US
US
UK

2021-11-01 19:34:57.000
A20
ACCT
US
US
UK

2021-11-01 19:34:57.000
A20
ACCT
US
US
US

This is the filter that is not working:
(a.BRANCH_CD != 'US' and b.BRANCH_CD != 'US' and c.BRANCH_CD != 'US')

But you can see that the last record matches these conditions.
I can't put the entire query in this question as this is a proprietary system.
Any help would be appreciated. I have a series of table joins and a GROUP BY.
I believe maybe the group by is causing us the problem.
If someone can PM me, I could show you the code and any help is appreciated.

A: Jeff helped on this and this worked as one would expect
NOT (a.BRANCH_CD = 'US' AND b.BRANCH_CD = 'US' AND c.BRANCH_CD = 'US').
Not sure why the inverse doesn't work. I think SQL Server is malfunctioning :)


text:
Q: what's the gap with this ad lookup code? I'm using ETL to store AD users in a local SQL Server database.  The following AD lookup code populates the Guid, FirstName and LastName of all AD users who belong to a particular group:
var adPrincipalContext = new PrincipalContext(ContextType.Domain, domainName);
var group = GroupPrincipal.FindByIdentity(adPrincipalContext, groupName);
var members = group.GetMembers();
var groupUsers = new List<Tuple<Guid, string, string>>();

var enumerator = members.GetEnumerator();
while (enumerator.MoveNext())
{
    var user = enumerator.Current as UserPrincipal;
    groupUsers.Add(new Tuple <Guid, string, string>(
        (Guid)user.Guid, user.GivenName, user.Surname));
}

The problem is that for about 1/2 of these users, the user guid that gets populated into the groupUsers list above is different than the guid returned by a direct AD query by user DisplayName like this:
    using (var context = new PrincipalContext(ContextType.Domain, domainName))
    {
        // init vars
        var up = new UserPrincipal(context);
        var ps = new PrincipalSearcher(up);
        var allUsers = ps.FindAll().ToList();
        var user2 = allUsers.Where(x =>
            x.DisplayName == groupUser.Item3 + ", " + groupUser.Item2).FirstOrDefault();
    }

Any idea what the problem might be?  I need to return my database representation of each user based on a db lookup of the AD user's Guid.

*

*Both code blocks consistently return the same guid for the same user within the respective code block

*About 1/2 of the user guids returned in the first code block match the user guids returned in the second code block

*About 1/2 of the user guids returned in the first code block don't match the user guids returned in the second code block

Any idea what might be causing this discrepancy?

A: Display names don't have to be unique. You may have multiple accounts with the same display name.
For a quick test, you can modify your second block of code to throw an exception if it finds multiple accounts. If you get an exception, then you know that's the problem:
using (var context = new PrincipalContext(ContextType.Domain, domainName))
{
    // init vars
    var up = new UserPrincipal(context);
    var ps = new PrincipalSearcher(up);
    var allUsers = ps.FindAll().ToList();
    var users = allUsers.Where(x =>
        x.DisplayName == groupUser.Item3 + ", " + groupUser.Item2).ToList();

    if (users.Count > 1) {
        throw new Exception("More than one account found for: " + groupUser.Item3 + ", " + groupUser.Item2)
    }

    var user2 = users.FirstOrDefault();
}


text:
Q: Trouble getting Pypar to work with matplotlib I just started using Pypar for parallel programming in Python.
I can get a simple script to run in parallel which is cool,
and I can get matplotlib to work as well,
but if I try to:
  import matplotlib

and run it through Pypar, I get:
  ImportError: No module named matplotlib

help appreciated..

A: This is probably WAY to late to answer this question. However, my guess is, that you simply did not install matplotlib on all you computational nodes...
So install and configure matplotlib on all the computers you are using for parallel computation and then try again.


text:
Q: Error while "Building wxWidgets" for FileZilla compilation: configure: error: X11 not found, please use --x-includes and/or --x-libraries options I am trying to compile FileZilla3 in my Windows system by exactly following this.
In the MSys2 terminal, everything works fine till "Building SQLite"
In "Building wxWidgets", the steps mentioned are:
cd ~
git clone --branch WX_3_0_BRANCH --single-branch https://github.com/wxWidgets/wxWidgets.git wx3
cd wx3
./configure --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin
make && make install

When I execute the third step, i.e.
./configure --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin

I get the error:
configure: error: X11 not found, please use --x-includes and/or --x-libraries options (see config.log for details)

The complete output of the configure command is:
./configure --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin
configure: loading site script /etc/config.site
checking build system type... x86_64-pc-msys
checking host system type... x86_64-pc-msys
configure: WARNING: *** System type x86_64-pc-msys is unknown, assuming generic Unix and continuing nevertheless.
configure: WARNING: *** Please report the build results to wx-dev@lists.wxwidgets.org.
checking for --disable-gui... no
checking for --enable-monolithic... no
checking for --enable-plugins... no
checking for --without-subdirs... no
checking for --enable-official_build... no
checking for --disable-all-features... no
checking for --enable-universal... no
checking for --enable-nanox... no
checking for --enable-gpe... no
checking for toolkit... x11
checking for --with-libpng... builtin version
checking for --with-libjpeg... no
checking for --with-libtiff... no
checking for --without-libjbig... no
checking for --without-liblzma... no
checking for --with-libxpm... yes
checking for --with-libiconv... yes
checking for --with-libmspack... no
checking for --without-gtkprint... no
checking for --with-gnomevfs... no
checking for --with-libnotify... yes
checking for --with-hildon... no
checking for --with-opengl... auto
checking for --with-dmalloc... no
checking for --with-sdl... no
checking for --with-regex... yes
checking for --with-zlib... yes
checking for --with-expat... builtin version
checking for --with-macosx-sdk...
checking for --with-macosx-version-min...
checking for --enable-debug... default
checking for --disable-debug_flag... no
checking for --enable-debug_info... no
checking for --enable-debug_gdb... no
checking for --enable-debug_cntxt... no
checking for --enable-mem_tracing... no
checking for --disable-shared... no
checking for --enable-stl... no
checking for --enable-std_containers... no
checking for --enable-std_iostreams... yes
checking for --enable-std_string... yes
checking for --enable-std_string_conv_in_wxstring... no
checking for --disable-unicode... no
checking for --enable-mslu... no
checking for --enable-utf8... no
checking for --enable-utf8only... no
checking for --enable-extended_rtti... no
checking for --disable-optimise... no
checking for --enable-profile... no
checking for --enable-no_rtti... no
checking for --enable-no_exceptions... no
checking for --enable-permissive... no
checking for --enable-no_deps... no
checking for --disable-vararg_macros... no
checking for --enable-universal_binary... no
checking for --enable-macosx_arch... no
checking for --enable-compat26... no
checking for --disable-compat28... no
checking for --disable-rpath... no
checking for --enable-objc_uniquifying... no
checking for --disable-visibility... no
checking for --disable-tls... no
checking for --enable-intl... yes
checking for --enable-xlocale... yes
checking for --enable-config... yes
checking for --enable-protocols... yes
checking for --enable-ftp... yes
checking for --enable-http... yes
checking for --enable-fileproto... yes
checking for --enable-sockets... yes
checking for --enable-ipv6... no
checking for --enable-ole... yes
checking for --enable-dataobj... yes
checking for --enable-ipc... yes
checking for --enable-baseevtloop... yes
checking for --enable-epollloop... yes
checking for --enable-selectloop... yes
checking for --enable-any... yes
checking for --enable-apple_ieee... yes
checking for --enable-arcstream... yes
checking for --enable-base64... yes
checking for --enable-backtrace... yes
checking for --enable-catch_segvs... yes
checking for --enable-cmdline... yes
checking for --enable-datetime... yes
checking for --enable-debugreport... yes
checking for --enable-dialupman... yes
checking for --enable-dynlib... yes
checking for --enable-dynamicloader... yes
checking for --enable-exceptions... yes
checking for --enable-ffile... yes
checking for --enable-file... yes
checking for --enable-filehistory... yes
checking for --enable-filesystem... yes
checking for --enable-fontenum... yes
checking for --enable-fontmap... yes
checking for --enable-fs_archive... yes
checking for --enable-fs_inet... yes
checking for --enable-fs_zip... yes
checking for --enable-fsvolume... yes
checking for --enable-fswatcher... yes
checking for --enable-geometry... yes
checking for --enable-log... yes
checking for --enable-longlong... yes
checking for --enable-mimetype... yes
checking for --enable-printfposparam... yes
checking for --enable-snglinst... yes
checking for --enable-sound... yes
checking for --enable-stdpaths... yes
checking for --enable-stopwatch... yes
checking for --enable-streams... yes
checking for --enable-sysoptions... yes
checking for --enable-tarstream... yes
checking for --enable-textbuf... yes
checking for --enable-textfile... yes
checking for --enable-timer... yes
checking for --enable-variant... yes
checking for --enable-zipstream... yes
checking for --enable-url... yes
checking for --enable-protocol... yes
checking for --enable-protocol_http... yes
checking for --enable-protocol_ftp... yes
checking for --enable-protocol_file... yes
checking for --enable-threads... yes
checking for --enable-iniconf... no
checking for --enable-regkey... yes
checking for --enable-docview... yes
checking for --enable-help... yes
checking for --enable-mshtmlhelp... yes
checking for --enable-html... yes
checking for --enable-htmlhelp... yes
checking for --enable-xrc... yes
checking for --enable-aui... yes
checking for --enable-propgrid... yes
checking for --enable-ribbon... yes
checking for --enable-stc... yes
checking for --enable-constraints... yes
checking for --enable-loggui... yes
checking for --enable-logwin... yes
checking for --enable-logdialog... yes
checking for --enable-mdi... yes
checking for --enable-mdidoc... yes
checking for --enable-mediactrl... auto
checking for --enable-gstreamer8... no
checking for --enable-richtext... yes
checking for --enable-postscript... yes
checking for --enable-printarch... yes
checking for --enable-svg... yes
checking for --enable-webkit... yes
checking for --enable-webview... yes
checking for --enable-graphics_ctx... yes
checking for --enable-clipboard... yes
checking for --enable-dnd... yes
checking for --disable-controls... no
checking for --enable-markup... yes
checking for --enable-accel... yes
checking for --enable-animatectrl... yes
checking for --enable-bannerwindow... yes
checking for --enable-artstd... yes
checking for --enable-arttango... auto
checking for --enable-bmpbutton... yes
checking for --enable-bmpcombobox... yes
checking for --enable-button... yes
checking for --enable-calendar... yes
checking for --enable-caret... yes
checking for --enable-checkbox... yes
checking for --enable-checklst... yes
checking for --enable-choice... yes
checking for --enable-choicebook... yes
checking for --enable-collpane... yes
checking for --enable-colourpicker... yes
checking for --enable-combobox... yes
checking for --enable-comboctrl... yes
checking for --enable-commandlinkbutton... yes
checking for --enable-dataviewctrl... yes
checking for --enable-datepick... yes
checking for --enable-detect_sm... yes
checking for --enable-dirpicker... yes
checking for --enable-display... yes
checking for --enable-editablebox... yes
checking for --enable-filectrl... yes
checking for --enable-filepicker... yes
checking for --enable-fontpicker... yes
checking for --enable-gauge... yes
checking for --enable-grid... yes
checking for --enable-headerctrl... yes
checking for --enable-hyperlink... yes
checking for --enable-imaglist... yes
checking for --enable-infobar... yes
checking for --enable-listbook... yes
checking for --enable-listbox... yes
checking for --enable-listctrl... yes
checking for --enable-notebook... yes
checking for --enable-notifmsg... yes
checking for --enable-odcombobox... yes
checking for --enable-popupwin... yes
checking for --enable-prefseditor... yes
checking for --enable-radiobox... yes
checking for --enable-radiobtn... yes
checking for --enable-richmsgdlg... yes
checking for --enable-richtooltip... yes
checking for --enable-rearrangectrl... yes
checking for --enable-sash... yes
checking for --enable-scrollbar... yes
checking for --enable-searchctrl... yes
checking for --enable-slider... yes
checking for --enable-spinbtn... yes
checking for --enable-spinctrl... yes
checking for --enable-splitter... yes
checking for --enable-statbmp... yes
checking for --enable-statbox... yes
checking for --enable-statline... yes
checking for --enable-stattext... yes
checking for --enable-statusbar... yes
checking for --enable-taskbaricon... yes
checking for --enable-tbarnative... yes
checking for --enable-textctrl... yes
checking for --enable-timepick... yes
checking for --enable-tipwindow... yes
checking for --enable-togglebtn... yes
checking for --enable-toolbar... yes
checking for --enable-toolbook... yes
checking for --enable-treebook... yes
checking for --enable-treectrl... yes
checking for --enable-treelist... yes
checking for --enable-commondlg... yes
checking for --enable-aboutdlg... yes
checking for --enable-choicedlg... yes
checking for --enable-coldlg... yes
checking for --enable-filedlg... yes
checking for --enable-finddlg... yes
checking for --enable-fontdlg... yes
checking for --enable-dirdlg... yes
checking for --enable-msgdlg... yes
checking for --enable-numberdlg... yes
checking for --enable-splash... yes
checking for --enable-textdlg... yes
checking for --enable-tipdlg... yes
checking for --enable-progressdlg... yes
checking for --enable-wizarddlg... yes
checking for --enable-menus... yes
checking for --enable-miniframe... yes
checking for --enable-tooltips... yes
checking for --enable-splines... yes
checking for --enable-mousewheel... yes
checking for --enable-validators... yes
checking for --enable-busyinfo... yes
checking for --enable-hotkey... auto
checking for --enable-joystick... yes
checking for --enable-metafile... auto
checking for --enable-dragimage... yes
checking for --enable-accessibility... no
checking for --enable-uiactionsim... yes
checking for --enable-dctransform... yes
checking for --enable-webviewwebkit... yes
checking for --enable-palette... yes
checking for --enable-image... yes
checking for --enable-gif... yes
checking for --enable-pcx... yes
checking for --enable-tga... yes
checking for --enable-iff... yes
checking for --enable-pnm... yes
checking for --enable-xpm... yes
checking for --enable-ico_cur... yes
checking for --enable-dccache... yes
checking for --enable-ps-in-msw... yes
checking for --enable-ownerdrawn... yes
checking for --enable-uxtheme... yes
checking for --enable-wxdib... yes
checking for --enable-webviewie... yes
checking for --enable-autoidman... no
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether we are using the Intel C compiler... no
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking whether gcc needs -traditional... no
checking for g++... g++
checking whether we are using the GNU C++ compiler... yes
checking whether g++ accepts -g... yes
checking whether we are using the Intel C++ compiler... no
checking for ar... ar
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for langinfo.h... no
checking for wchar.h... yes
checking for sys/select.h... no
checking for cxxabi.h... yes
checking for an ANSI C-conforming const... yes
checking for inline... inline
checking size of short... 2
checking size of void *... 8
checking size of int... 4
checking size of long... 4
checking size of size_t... 8
checking size of long long... 8
checking size of wchar_t... 2
checking for va_copy... yes
checking whether the compiler supports variadic macros... yes
checking for _FILE_OFFSET_BITS value needed for large files... 64
checking if large file support is available... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking whether byte ordering is bigendian... no
checking for iostream... yes
checking if C++ compiler supports the explicit keyword... yes
checking for std::wstring in <string>... yes
checking for std::istream... yes
checking for std::ostream... yes
checking how to run the C++ preprocessor... g++ -E
checking type_traits usability... yes
checking type_traits presence... yes
checking for type_traits... yes
checking for __sync_fetch_and_add and __sync_sub_and_fetch builtins... yes
checking for libraries directories... /usr/lib
checking for cos... yes
checking for floor... yes
checking if floating point functions link without -lm... yes
checking for strtoull... yes
checking for pkg-config... /mingw64/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
configure: WARNING: Defaulting to the builtin regex library for Unicode build.
checking for zlib.h >= 1.1.4... yes
checking for zlib.h... (cached) yes
checking for deflate in -lz... yes
checking for X... no
configure: error: X11 not found, please use --x-includes and/or --x-libraries options (see config.log for details)

I get the same error on trying out any of these 2 also:
./configure --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin --x-includes=/mingw64/include/X11

./configure --prefix="$HOME/prefix" --enable-shared --disable-static --enable-unicode --enable-printfposparam --without-libtiff --without-libjpeg --with-expat=builtin --with-libpng=builtin --x-includes=/mingw64/include

Kindly help

A: You seem to be running configure from "msys" subsystem of MSYS2 which is a POSIX-like system not meant to be used for compilation.
You should launch mingw64.exe or mingw32.exe instead to build native MSW software using MinGW and then configure should work just fine there.


text:
Q: Allow user to delete profile information I'm trying to create a form that displays current service information for a user on their profile and then allows them to select a check box for one or more services they provide and then hit a delete button to remove the service(s) related to the check box. Each service has a unique ID and so I'm assuming I need to use this so that the query knows what to delete.
Here is relevant code and the form I am using:
<?php

if (isset($_POST['OddJobName']) && isset($_POST['Description']) && isset($_POST['DaysAvailable']) && empty($errors) === true){//if (empty($_POST) === false && empty($errors) === true) { //if (isset(empty($_POST['OddJobName'])) && isset(empty($_POST['Description'])) && isset(empty($_POST['DaysAvailable'])) === false && empty($errors) === true)
            $daysavailable='';
            foreach ($_POST['DaysAvailable'] as $value)
            {

            $daysavailable .=$value." ";
            }

            $Delete_Oddjob = array (
                'MemberID'      => $MemberID,
                'OddJobID'      => $_POST['OddJobID'],
                'OddJobName'    => $_POST['OddJobName'],
                'Description'   => $_POST['Description'],
                'DaysAvailable' => $daysavailable,

                );
                Delete_Oddjob ($Delete_Oddjob);
                if(success){
                 header('Location: member.php?username='.$username);
                 exit ();
                }
            } else if (empty($errors) === false){
                //otherwise output errors
                echo output_errors($errors);
            }

?>

<?php
                $result = mysql_query("SELECT * FROM `oddjob` WHERE `MemberID` = $MemberID");

                while($row = mysql_fetch_assoc($result))
                {

                echo"

                <form action='' method ='post' enctype='multipart/form-data'>

                        <input type='hidden' name='MemberID' id='MemberID' value= ". $MemberID .">

                        <input type='hidden' name='OddJobID' id='OddJobID' value= ". $row['OddJobID'] .">

Name of OddJob*:

                        <input type='text' name='OddJobID' style='width:180px' value= ". $row['OddJobID'].">

Name of OddJob*:

                        <input type='text' name='OddJobName' style='width:180px' value= ". $row['OddJobName'].">

Description*:

                        <textarea name='Description'>". $row['Description'] ."</textarea>

Days Available(current week)*:

(hold Ctrl to select multiple)

                        <select name='DaysAvailable[]' size='5' multiple='multiple' id='DaysAvailable[]'>
                        <option value='Monday'>Monday</option>
                        <option value='Tuesday'>Tuesday</option>
                        <option value='Wednesday'>Wednesday</option>
                        <option value='Thursday'>Thursday</option>
                        <option value='Friday'>Friday</option>
                        <option value='Saturday'>Saturday</option>
                        <option value='Sunday'>Sunday</option>
                        </select>

                        <input type='checkbox' name='Delete' value= ". $row['OddJobID'] .">

                <input type='submit' name='Delete' value='Delete'>
                </form> ";
                }
?>

Function:
function Delete_Oddjob ($Delete_Oddjob){
            //global $Add_Oddjob;
             array_walk($Delete_Oddjob, 'array_sanitize');
             mysql_query("DELETE FROM `oddjob` WHERE `OddJobID` = '".$_POST['OddJobID']."'") or die (mysql_error());
}

I don't understand how to make this work. At the moment when I select a check box and click the delete button the page seems to refresh but nothing else happens. Also If i try to echo out the query nothing is displayed.
echo "DELETE FROM `oddjob` WHERE `OddJobID` = '".$_POST['OddJobID']."'";

Any help would be great. Thank you.

A: You pretty much have the solution there.
Rename your Delete checkboxes to name="delete[]" that allows multiple checkboxes to be posted under the one name, then on the PHP side of things you can access these by saying:
if (isset($_POST['delete'])) {
    foreach($_POST['delete'] as $oddjob) {
        if (Delete_Oddjob($oddjob)) {
            // success
        } else {
            // failure
        }
    }
}

Whenever the form is submitted and the delete option has been selected this will loop through all the checked checkboxes on the form and delete them using their ID.


text:
Q: Tikz Wheelchart - How do I link a CSV to this graph? I am trying to connect a CSV file to a wheelchart of the tikzpicture package. The image below looks fine, the only issue is that currently the data entries are hard coded. In the code below you can see that I already generated a CSV file. Does somebody knows how to link this CSV to the wheelchart?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{filecontents}
\usepackage{pgfplots}
\usepackage{pgfplotstable}

% This CSV should be added to the /wheelchart command below
\begin{filecontents}{testdata.csv}
 Name,   Quantity
"Blueberries",  16
"Pears",    5
"Bananas",  4
"Grapes",   2
\end{filecontents}

\pgfplotstableread[col sep=comma]{testdata.csv}\datatable

\begin{document}

% Adjusts the size of the wheel:
\def\innerradius{2.8cm}
\def\outerradius{3.2cm}

% The main macro
\newcommand{\wheelchart}[1]{
    % Calculate total
    \pgfmathsetmacro{\totalnum}{0}
    \foreach \value/\colour/\name in {#1} {
        \pgfmathparse{\value+\totalnum}
        \global\let\totalnum=\pgfmathresult
    }
    \begin{center}
        \begin{tikzpicture}

        % Calculate the thickness and the middle line of the wheel
        \pgfmathsetmacro{\wheelwidth}{\outerradius-\innerradius}
        \pgfmathsetmacro{\midradius}{(\outerradius+\innerradius)/2}

        % Rotate so we start from the top
        \begin{scope}[rotate=90]

        % Loop through each value set. \cumnum keeps track of where we are in the wheel
        \pgfmathsetmacro{\cumnum}{0}
        \foreach \value/\colour/\name in {#1} {
            \pgfmathsetmacro{\newcumnum}{\cumnum + \value/\totalnum*360}

            % Calculate the percent value
            \pgfmathsetmacro{\percentage}{\value}
            % Calculate the mid angle of the colour segments to place the labels
            \pgfmathsetmacro{\midangle}{-(\cumnum+\newcumnum)/2}

            % This is necessary for the labels to align nicely
            \pgfmathparse{
                (-\midangle<180?"west":"east")
            } \edef\textanchor{\pgfmathresult}
            \pgfmathsetmacro\labelshiftdir{1-2*(-\midangle>180)}

            % Draw the color segments. Somehow, the \midrow units got lost, so we add 'pt' at the end. Not nice...
            \fill[\colour] (-\cumnum:\outerradius) arc (-\cumnum:-(\newcumnum):\outerradius) --
            (-\newcumnum:\innerradius) arc (-\newcumnum:-(\cumnum):\innerradius) -- cycle;

            % Draw the data labels
            \draw  [*-,thin] node [append after command={(\midangle:\midradius pt) -- (\midangle:\outerradius + 1ex) -- (\tikzlastnode)}] at (\midangle:\outerradius + 1ex) [xshift=\labelshiftdir*0.5cm,inner sep=0pt, outer sep=0pt, ,anchor=\textanchor]{\name: \pgfmathprintnumber{\percentage}};

            % Set the old cumulated angle to the new value
            \global\let\cumnum=\newcumnum
        }

        \end{scope}
        %      \draw[gray] (0,0) circle (\outerradius) circle (\innerradius);
        \end{tikzpicture}
    \end{center}
}

% This is where the CSV should be added instead of hard-coded data entries.
\wheelchart{16/blue/Blueberries,  5/green/Pears, 4/yellow/Bananas, 2/pink/Grapes}

\end{document}

A: Here is a quick rewrite that reads the values from the table, so the argument to \wheelchart is \datatable instead. I made a second table to hold the colors. You have to make sure that there are at least as many colors in the colortable as in the datatable though, I haven't implemented any looping (my initial attempt failed).
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{filecontents}
\usepackage{pgfplotstable}

% This CSV should be added to the /wheelchart command below
\begin{filecontents*}{testdata.csv}
Name,   Quantity
Blueberries,  16
\end{filecontents*}
\begin{filecontents*}{testdata2.csv}
Name,   Quantity
Blueberries,  16
Pears,    5
Bananas,  4
Grapes,   2
\end{filecontents*}

\pgfplotstableread[col sep=comma]{testdata.csv}\datatableA

\pgfplotstableread[col sep=comma]{testdata2.csv}\datatableB

\pgfplotstableread{
clr
blue!70
red
yellow
green
}\MyColors

% Adjusts the size of the wheel:
\def\innerradius{2.8cm}
\def\outerradius{3.2cm}

\newcommand\LabelName{}
\newcommand\LabelValue{}
% The main macro
\newcommand{\wheelchart}[1]{
    % Calculate total
    \pgfmathsetmacro{\totalnum}{0}
    % get number of rows in table
    \pgfplotstablegetrowsof{#1}
    % minus 1 because indexing starts as zero
    \pgfmathsetmacro{\RowsInTable}{\pgfplotsretval-1}
    \foreach \i in {0,...,\RowsInTable} {
        \pgfplotstablegetelem{\i}{Quantity}\of{#1}
        \pgfmathparse{\pgfplotsretval+\totalnum}
        \global\let\totalnum=\pgfmathresult
    }
    \begin{center}
        \begin{tikzpicture}

        % Calculate the thickness and the middle line of the wheel
        \pgfmathsetmacro{\wheelwidth}{\outerradius-\innerradius}
        \pgfmathsetmacro{\midradius}{(\outerradius+\innerradius)/2}

        % Rotate so we start from the top
        \begin{scope}[rotate=90]

        % Loop through each value set. \cumnum keeps track of where we are in the wheel
        \pgfmathsetmacro{\cumnum}{0}

        \foreach \i in {0,...,\RowsInTable} {
            % get values from table
            \pgfplotstablegetelem{\i}{Name}\of{#1}\global\let\LabelName=\pgfplotsretval
            \pgfplotstablegetelem{\i}{Quantity}\of{#1}\renewcommand\LabelValue{\pgfplotsretval}

            \pgfmathsetmacro{\newcumnum}{\cumnum + \LabelValue/\totalnum*360}

            % Calculate the percent value
            \pgfmathsetmacro{\percentage}{\LabelValue}
            % Calculate the mid angle of the colour segments to place the labels
            \pgfmathsetmacro{\midangle}{-(\cumnum+\newcumnum)/2}

            % This is necessary for the labels to align nicely
            \pgfmathparse{
                (-\midangle<180?"west":"east")
            } \edef\textanchor{\pgfmathresult}
            \pgfmathsetmacro\labelshiftdir{ifthenelse(\RowsInTable==0,-1,1)*(1-2*(-\midangle>180))}

            % Draw the color segments. Somehow, the \midrow units got lost, so we add 'pt' at the end. Not nice...
            \pgfplotstablegetelem{\i}{clr}\of{\MyColors}
            \fill[color=\pgfplotsretval] (-\cumnum:\outerradius) arc (-\cumnum:-(\newcumnum):\outerradius) --
            (-\newcumnum:\innerradius) arc (-\newcumnum:-(\cumnum):\innerradius) -- cycle;

            % Draw the data labels
            \draw  [*-,thin] node [append after command={(\midangle:\midradius pt) -- (\midangle:\outerradius + 1ex) -- (\tikzlastnode)}] at (\midangle:\outerradius + 1ex) [xshift=\labelshiftdir*0.5cm,inner sep=0pt, outer sep=0pt, ,anchor=\textanchor]{\LabelName: \pgfmathprintnumber{\percentage}};

            % Set the old cumulated angle to the new value
            \global\let\cumnum=\newcumnum
        }

        \end{scope}
        %      \draw[gray] (0,0) circle (\outerradius) circle (\innerradius);
        \end{tikzpicture}
    \end{center}
}

\begin{document}

\wheelchart{\datatableA}

\wheelchart{\datatableB}

\end{document}


text:
Q: Partition by weeknumber and next weeknumber I would like to count for each customer how many times a specific product was purchased in the past. I want to highlight the purchases for the same product (where the second order date is close to the first order date)  with a rn = 2, so I can only count the rows with rn = 1
I created the following query and also included the current output. Its containing a partition by week number, to filter out purchases for the same product in the same week. It's working quite good,  but the behaviour is not exactly what I was hoping for.
create table  sandbox.hm_orders as
select o.customer_id
,o.product_id
,o.order_date
,ROW_NUMBER() over (partition by o.customer_id, o.product_id,concat(EXTRACT(year FROM order_date),EXTRACT(week FROM order_date)) order by o.order_date asc) as rn
,concat(EXTRACT(year FROM o.order_date),'_',EXTRACT(week FROM o.order_date)) as weeknr
    from datamarts.orders o
    where o.label_id = 1
    and o.order_date > '2020-01-01'
    and o.payment_status = 'PAID'

Current output:

customer_id
product_ID
order_date
rn
weeknr

4708818
128703
2020-05-11 20:19:25
1
2020_20

4708818
128703
2020-05-12 22:13:09
2
2020_20

4708818
128703
2020-06-06 21:45:04
1
2020_23

4708818
274578
2020-07-02 22:02:10
1
2020_27

4753958
137482
2021-03-14 18:13:04
1
2021_10

4753958
137482
2021-03-15 17:29:03
1
2021_11

As you can see in first two rows, the difference between the first the rows is 1 day and it will mark the second row with a rowNumber 2. For the last 2 rows, the difference between the orders is also 1 day. But since the weeknumbers are different, it will not give the second row a rowNumber 2.
Therefore I would like to find a way to also include the next weeknumber for the partition by. In this case, the order that have been done in 2021-11 needs a row number 2, and the week number 10 needs row number 1
desired output

customer_id
product_ID
order_date
rn
weeknr

4708818
128703
2020-05-11 20:19:25
1
2020_20

4708818
128703
2020-05-12 22:13:09
2
2020_20

4708818
128703
2020-06-06 21:45:04
1
2020_23

4708818
274578
2020-07-02 22:02:10
1
2020_27

4753958
137482
2021-03-14 18:13:04
1
2021_10

4753958
137482
2021-03-15 17:29:03
2
2021_11

A: A bit complicated way is to calculate a ranking by summing over a calculated flag.
Then use the rank in the row_number.

SELECT *
, ROW_NUMBER() over (partition by customer_id, product_id, rnk order by order_date asc) as rn
, TO_CHAR(order_date, 'YYYY_WW') as weeknr
FROM
(
SELECT *
, SUM(flag) over (partition by customer_id, product_id order by order_date asc) as rnk
FROM
(
  SELECT
    o.customer_id
  , o.product_id
  , o.order_date
  , CASE WHEN 1 >= DATE_PART('day', o.order_date - LAG(o.order_date) over (partition by o.customer_id, o.product_id order by o.order_date asc))
    THEN 0 ELSE 1 END AS flag
  FROM orders o
  WHERE o.label_id = 1
    AND o.order_date > '2020-01-01'
    AND o.payment_status = 'PAID'
) q1
) q2

customer_id
product_id
order_date
flag
rnk
rn
weeknr

4708818
128703
2020-05-11 20:19:25
1
1
1
2020_19

4708818
128703
2020-05-12 22:13:09
0
1
2
2020_19

4708818
128703
2020-06-06 21:45:04
1
2
1
2020_23

4708818
274578
2020-07-02 22:02:10
1
1
1
2020_27

4753958
137482
2021-03-14 18:13:04
1
1
1
2021_11

4753958
137482
2021-03-15 17:29:03
0
1
2
2021_11

Test on db<>fiddle here


text:
Q: react setstate not rerenering I have the following:
  onTransfer = async () => {
    this.setState({loading: true});
    try {
      const accounts = await web3.eth.getAccounts();
      await this.props.myData.methods.transferBalanceToOwner().send({
        from: accounts[0]
      });

      let contractBalance;
      await web3.eth.getBalance(this.props.address).then(function(result) {
        contractBalance = web3.utils.fromWei(result);
      });
      console.log('contract balance: ', contractBalance);

      this.setState({ contractBalance });
    } catch (error) {
      console.log('Transfer to owner error: ',error)
    }
    this.setState({loading: false});
  }

and I have the following in my render()
if (this.state.isOwner) {
  ownerUI = (
    <Container>
      <Divider/>

Contract balance: {this.state.contractBalance}

      <Button loading={this.state.loading} onClick={this.onTransfer} primary>Transfer Balance</Button>
    </Container>
  )
}

For some reason, the contract balance is not getting update after OnTransfer.  Can someone spot what I might be doing wrong?
Thanks!

A: Its not right way to use async/await.

*

*With async/await there is no thenable

*Put await statement inside try/catch block for  success/error check.

The correct way to do this.
let contractBalance;

try {
   //success check

  contractBalance = await web3.eth.getBalance(this.props.address)
  this.setState({contractBalance});

}
catch (rejectedValue) {
  //error check

  console.log(rejectedValue)
}


text:
Q: Maximum size of csv file that can be processed using Import-Csv I am importing csv file of size 24MB but each time it is truncated to 0KB and shows following error.

Import-Csv : Cannot process argument because the value of argument "name" is invalid. Change the value of the "name" argument and run the operation again.
$data = Import-Csv <<<<  $path
     + CategoryInfo          : InvalidArgument: (:) [Import-Csv], PSArgumentException
     + FullyQualifiedErrorId : Argument,Microsoft.PowerShell.Commands.ImportCsvCommand
Property 'Column4' cannot be found on this object; make sure it exists and is settable.
       $_. <<<< Column4 = $separated[3] + $_.Column2 + $_.Column3

+ CategoryInfo          : InvalidOperation: (Column4:String) [], RuntimeException
   + FullyQualifiedErrorId : PropertyNotFound
Export-Csv : Cannot bind argument to parameter 'InputObject' because it is null.
$data | Export-Csv <<<<  $path -NoTypeInformation
     + CategoryInfo          : InvalidData: (:) [Export-Csv], ParameterBindingValidationException
     + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.ExportCsvCo
    mmand

The powershell script that I am using works fine for small size of file (say 24KB). Is there any upper limit for size of input csv file.

A: I have processed csv files that are gigabytes in size, so size is not the issue.
If you have successfully processed other files with the SAME code then I suspect that there is some corruption somewhere in your file that is causing the error.

A: The error was due to trailing columns in the csv file. While converting an Excel file to csv file, the trailing columns of Excel file got add to the csv file. So, to solve the problem, delete all the trailing columns from the Excel file and then convert it to csv file.


text:
Q: Read a table by indicating a pattern instead of the file name , using R I have a folder with a LANDSAT image, with various files (tif, txt, etc).
I  read the metadata of the image (MTL file) and create a data frame from it, as follow:
setwd("C:/Users/Documents/L5__002072-09MAY-2006")
mtl <- read.delim(file="LT05_L1TP_002072_20060509_20161121_01_T1_MTL.txt",
                  sep = '=',
                  stringsAsFactors = F)
mtl

Is it possible to do the same, but instead of writing the name of the MTL file,  read the file of the folder with this pattern: "*MTL.txt"?

A: This should work ::
read.delim(file=list.files(pattern=".*MTL.txt"), sep="=", stringsAsFactors = FALSE )


text:
Q: How to suppress null with single row I have a oracle table like
Name   Sal   Bonus
ABC    400   null
ABC    null   5

How to make it single row and remove null data
Name   Sal   Bonus
ABC    400    5

Please suggest. Using oracle sql.

A: If you have just two rows, you can use group by clause. And sum values inside select statement.
SELECT T.NAME,SUM(NVL(T.SAL,0))AS Sal,SUM(NVL(T.SAL,0)) AS Bonus
FROM TABLE t
GROUP BY T.NAME

Here the result:
Name   Sal   Bonus
ABC    400    5

A: select name, max(sal), max(bonus)
from Table
group by name


text:
Q: Debug Assertion Failed at deleted allocated memory I'm in a relatively basic programming class and I'm getting an error I've never come across before. It's this:
Debug Assertion Failed!

Program:...sual Studio 2010\Projects\Comp Project\Debug\Comp Project.exe
File: f:\dd\vctools\crt_bld\self_x86\crt\src\dbgdel.cpp
Line: 52

Expression:_BLOCK_TYPE_IS_VALID(pHead->nBlockUse)

Here's my code and the error pops up as the allocated memory is deleted it looks like
    //Shortest Path Version 1.01 IN PROGRESS
/*
    This program reads in node and arc data and interpretes it into a list which it can then use
    to calculate the shortest time or distance, depending on user prefrence, between two chosen
    nodes and send pack the path to the user
*/
#include <conio.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
void main()
{
    //opening the files where the data is contained.
    ifstream arcfile;
    ifstream nodefile;
    arcfile.open("G:\\Programming\\Descrete Structures\\arcs2011.txt");
    nodefile.open("G:\\Programming\\Descrete Structures\\nodes2011.txt");

    //creating a class that will store the data relevent to locating the shortest path
    class Arc
    {
    public:
        unsigned short int FROM;                                //from node
        unsigned short int TO;                                    //to node
        double DISTANCE;                                        //distance in miles
        double TIME;                                            //travel time
    };

    //creating a class that will store the data relavent to the node path
    class Node
    {
    public:
        unsigned long int WIEGHT;                                //either time or distance
        unsigned short int FROM;                                //alternativly "via"
        bool* shortestKnown;

    };

    string s;                                                    //placeholder for irrelavent string data
    unsigned short int StartingNode;                            //user selected starting node
    unsigned short int EndingNode;                                //user selected ending node
    unsigned short int ARCSIZE = 0;                                //number of Arcs in arc file
    unsigned short int NODESIZE = 0;                            //number of Nodes in node file

    //////////////////////Begin reading in of Arc data and Node data/////////////////////

    //count number of registered arcs
    while(getline(arcfile,s))
    {
        ARCSIZE++;
    }
    cout<<ARCSIZE<<" line size of arcfile"<<endl;

    //count number of registered nodes
    while(getline(nodefile,s))
    {
        NODESIZE++;
    }
    NODESIZE++;                                                    //final incrementation for +1 format
    cout<<NODESIZE<<" line size of nodefile"<<endl;

    Arc* Arclist;                                                //array that will store all the arcs
    Arclist = new Arc[ARCSIZE];                                    //based on the size of the file
    string* Nodelist;                                            //array that will store the node names
    Nodelist = new string[NODESIZE];                            //based on the size of the file

    //reset the streams
    arcfile.close();
    nodefile.close();
    arcfile.open("G:\\Programming\\Descrete Structures\\arcs2011.txt");
    nodefile.open("G:\\Programming\\Descrete Structures\\nodes2011.txt");

    //loop through and save the arc data to an array
    for(int i=1;i<ARCSIZE;i++)
    {
        arcfile.ignore(1000,'\n');
        arcfile>>Arclist[i].FROM;
        arcfile>>Arclist[i].TO;
        arcfile>>Arclist[i].TIME;
        arcfile>>Arclist[i].DISTANCE;
    }
    //loop through and store node description. Node counting starts at 1 to link up easier with
    //the arcs. The NODESIZE has been increased by 1 to allow for this format.
    for(int i=1;i<NODESIZE;i++)
    {
        getline(nodefile,Nodelist[i],'\t');                        //store node data
        nodefile.ignore(1000,'\n');                                //ignore coordinates
    }

    //////////////////////Begin user interface portion of program////////////////////////////////

    cout<<"Arcs and Nodes loaded."<<endl;
    cout<<"Please select by node number a starting node and ending node."<<endl;
    cout<<"(Press any key to display the list)"<<endl<<endl;
    getch();

    //print out the node list with numarical values
    for(int i=1;i<NODESIZE;i++)
    {
        cout<<i<<" - "<<Nodelist[i]<<endl;
    }
    cout<<endl;
    cout<<"Please select a starting node: ";
    cin>>StartingNode;
    cout<<endl<<"Please select an ending node: ";
    cin>>EndingNode;

    ////////////////////////SOME KIND OF ERROR OCCURS PAST THIS POINT///////////////////////

    //delete allocated memory
    delete Arclist;
    delete Nodelist;

    getch();
}

A: These:
delete Arclist;
delete Nodelist;

should be:
delete [] Arclist;
delete [] Nodelist;

Or better yet, forget using dynamically allocated arrays, and use std::vector.

A: Arclist = new Arc[ARCSIZE];
Nodelist = new string[NODESIZE];

and
delete Arclist;
delete Nodelist;

do not match, which is an error.
You mean:
delete[] Arclist;
delete[] Nodelist;

Your environment is detecting that something is not matching between the allocation and de-allocation.
This is quite fortunate, actually, because the C++ Standard does not mandate any diagnostics; on yours and other platforms, this mistake could silently "work" and cause all manner of memory corruption issues!
Incidentally, your main() function must return int (though you can leave out the explicit return 0; if you like; it'll be done automatically for main() if you leave it out).

A: The rule is simple. If you use new for initializing an array, you must delete it with the delete[] statement.
So you must say
delete[] Arclist;
delete[] Nodelist;


text:
Q: Is there a database of old hot questions listed on stackexchange.com?
Possible Duplicate:
Browse hottest questions of previous months or previous weeks

I very much enjoy reading the top 20 hottest questions from the continuously compiled list kept here. Perhaps a little too much, as I'm getting very sad whenever I don't log in for a few days , read all the current hot questions, and realize there was an entire half-week of hotness that I may never see. Is there any way to access hot questions lists from the past? Even a list of questions that passed a specific hotness at any point would be fine; I'm just looking for a way to satisfy my SE addiction... :)

A: Sounds like you might benefit from subscribing to The Stack Exchange Weekly Newsletters!
They contain a choice selection of Hot questions from the past week, some greatest hits, and even a few unanswered questions that might be worth a look.
Of course, you do have to pick a site. I wonder if a network-wide newsletter would interest anyone...


text:
Q: Regex - filter websites and IPs What regex can detect the presence of any IP address or URL in a string. It should be able to detect people trying to obviously avoid the filter: Examples:
154.43.45.345
website.com
website . com
website dot com
website?@#[]?.,<>.com
etc
Thanks!

A: The IP Regex is very straightforward, as it's structure is constant
(\d{1,4}\.){3}\d{1,4}
For websites, I would need more detailed info, but the general idea is like
.+((\.|dot).+)*(\.|dot)\s*(com|net|org|gov|uk...)
or, extremely basic
.*(\.|dot).*(com|net|org|gov|uk...)


text:
Q: Convert newline in JSON and print in textarea using PHP I already did my research first, but some topics didn't solve my issue and some quite different from what issue I have. I have a JSON that didn't print out the entire data and as upon checking the culprit is the newline when it was a value (it is my first time knowing it, my bad).
<?php

$jsn = <<<_JSON
{
"name": "Editorial",
"links": "default",
"data": [
    {
        "Status": "Pending",
        "Tags": "Documentation",
        "Info": "all documentation to be ready by Friday"

    },
    {
        "Status": "Published",
        "Tags": "Pros and Cons Limits",
        "Info": "documentations about-Realtime\n-Speed per sec\n-API Limit"

    }
  ]

   }
 _JSON;
 $data = json_decode($jsn, true);
 $output= $data['links'];
 echo $output;

It will not print any output as the \n was there. So I was planning to do in the future, if they tried to use a newline, I will just temporary change the \n to other characters and decode it back. And that's where I'm having a hard time.
As testing it wasn't working for me.. Converting it back and show in textarea.
$txt = "Documentations about%2Realtime%2Speed per sec%2API Limit";
$value = str_replace("%2", '\n', $txt);
$textArea = '<textarea rows="4">'.nl2br($value).'</textarea>';

echo $textarea;
//output
//documentations about\nRealtime\nSpeed per sec\nAPI Limit

If anyone can help me in your spare time, I really appreciate it.. Thanks in advance.


text:
Q: Assign a float value to performance counter I have created a performance counter in C#. However, when assigning a value to it, I would like the value to be a float instead of long, but I cannot seem to figure out how to do so. Can anybody help?
The code I am using is from Counter of type RateOfCountsPerSecond32 always shows 0:
public static void Test()
{
    var ccdc = new CounterCreationDataCollection();

    // Add the counter.
    const string counterName = "RateOfCountsPerSecond64Sample";
    var rateOfCounts64 = new CounterCreationData
    {
        CounterType = PerformanceCounterType.RateOfCountsPerSecond64,
        CounterName = counterName
    };
    ccdc.Add(rateOfCounts64);

    // Create the category.
    const string categoryName = "RateOfCountsPerSecond64SampleCategory";
    if (PerformanceCounterCategory.Exists(categoryName))
        PerformanceCounterCategory.Delete(categoryName);
    PerformanceCounterCategory.Create(categoryName, "",
        PerformanceCounterCategoryType.SingleInstance, ccdc);

    // create the counter
    var pc = new PerformanceCounter(categoryName, counterName, false);
    pc.RawValue = 1000; // <-- want to assign a float value here
}

Can anybody help?

A: Well, you can't; the data type is long. Just scale it by some factor instead (so you get to keep a few decimal places, as low digits) - x1000, for example - and round it:
pc.RawValue = (long)(value * 1000);

However, since you're using RateOfCountsPerSecond32 - you should be recording totals, not the rate. The backend computes the rate.

A: You can't and if you think about it, it wouldn't make any sense. Counters count distinct events and you can't have half an event. Counters can only be incremented as events occur.
A rate counter actually calculates the difference of a base counter between intervals for display purposes. The PerSecond counters use a system-provided interval counter that increments every second. You only have to increment the counter whenever events occur and the OS will calculate the rate.
Other counters that calculate averages allow you to increment the base counter as well, so you can have eg. Bytes per Packet counters


text:
Q: OpenTextFile gives error Automation server can't create Object I created this method to create a text file as log for a page that has different buttons that call functions with parameters from different textfields:
function WriteToFile(data) {
    var currentdate = new Date();
    var datetime = "Time: " + currentdate.getDate() + "/" + (currentdate.getMonth()+1)  + "/" + currentdate.getFullYear() + " @ " + currentdate.getHours() + ":" + currentdate.getMinutes() + ":" + currentdate.getSeconds();
    var fso = new ActiveXObject("Scripting.FileSystemObject");
    var a = fso.OpenTextFile("C:\\logs\\log.txt", 8);
    a.WriteLine(datetime);
    a.WriteLine(data + "\n");
    a.Close();
 }

And it works perfectly fine when I'm using the C: drive. Unfonrtunately, this is to be used in production in a Z: drive so other people can use the page as well. When I copy it to the Z: drive and change this line:
var a = fso.OpenTextFile("C:\\logs\\log.txt", 8);

to the following:
var a = fso.OpenTextFile("Z:\\logs\\log.txt", 8);

it gives me an error saying:

Automation server can't create object

I am using IE8. Any ideas on what I'm doing wrong and how I can fix this?


text:
Q: How do I avoid an EX Hooligan Combination? I recently picked up USF4 and jumped into ranked online to immerse myself in a trial by fire method of learning how to play. I just ran into a Cammy user who liked to use the EX version of the attack where she curls up into a ball and jumps across the screen, then grabs you.
She really liked that move, and it hit me every single time she used it. I tried blocking and jumping, but in either case she had no problem just grabbing me and getting free damage. How do you avoid this attack?

A: EX Hooligan Combination is a very, very risky move to use, as it makes Cammy extremely punishable.  This isn't very easy to spam because it consumes meter (1 bar), and you obviously need a Super meter with some bars to use it.
To punish it, there are several options. One, is crouch.  If you crouch, the EX Hooligan will simply jump over your character on the other side, not even hitting you.  Another option similar to crouching is to forward dash when Cammy begins the inital jump.  This will actually ruin the trajectory and cause her to land behind you. However, DO NOT backdash.  Cammy will grab you even if you backdash, so forward dash to avoid the throw.
Another very easy way to punish is to spam cr.lp (crouching, light punch).   Most characters can easily combo from cr.lp into other moves.
If your character has anti-airs, use them.  During Hooligan Throw, Cammy is considered airborne, so use anti-air moves, including DPs (shoryuken), abel's FS (falling sky), El Fuerte's Guacamole, etc.
One last thing to note. EX Hooligan should be typically used to punish fireballs. This means if you face a player who repeatedly spams the move, don't try to Hadouken them out of it or fireball constantly, or risk getting punished.

A: Caveat: I don't play Street Fighter.
Judging from a bit of Googling, the move seems to be the Hooligan Throw:
"The Hooligan Throw will only grab characters who are standing or jumping; not crouching. Because of this, most players will just duck under your Hooligan Spin and wait.
[...]
EX Version: The EX Hooligan Combination travels through the air MUCH faster than the regular version. It also auto-tracks the opponent and locks onto their position. These two properties make it difficult to react to, but you'll still want to be careful because the Throw and Slide properties are the same."
- http://www.eventhubs.com/guides/2009/jan/18/cammy-street-fighter-4-character-guide/