Como fazer imagem SVG se ajustar ao tamanho de um DIV?

Question: Eu tenho uma imagem SVG de mais ou menos 100 linhas e 60 paths e preciso que ela se ajuste a um nó block qualquer, como uma div por exemplo.
Tentei colocar uma class css na tag svg e ajustar o width para 100% mas isso cortou a imagem ao inves de ajustar todos os paths.
Eis o que tentei (direto no html):

    <svg bla bla bla class="classeQueAlteraWidth">
        //resto do svg...
    </svg>

ps: Não domino XML.
Answer: No seu caso em especifico, se olhar o código do svg a altura e largura estão sendo definidas:
 <svg width="678pt" height="1200pt" ...

Basta alterar essa altura ou removê-la (trabalhando somente com o CSS), por exemplo:

.contain-svg {
    width: 200px;
}

    <svg viewBox="0 0 678 1200" version="1.1" xmlns="http://www.w3.org/2000/svg">
<g id="#000000ff">
<path fill="#000000" opacity="1.00" d=" M 319.37 0.00 L 322.63 0.00 C 326.82 1.05 331.22 2.48 334.18 5.82 C 338.39 10.83 339.89 18.17 337.34 24.30 C 335.69 28.97 331.56 32.31 327.05 34.06 C 321.83 36.16 315.70 35.00 311.12 31.90 C 303.20 26.50 301.37 13.99 307.67 6.69 C 310.64 3.14 315.04 1.31 319.37 0.00 Z" />
<path fill="#000000" opacity="1.00" d=" M 358.36 1.34 C 367.81 -1.27 378.03 5.95 379.71 15.36 C 380.74 19.74 379.25 24.25 377.00 27.99 C 373.97 33.13 367.83 35.71 362.08 35.89 C 356.84 35.38 351.35 33.16 348.39 28.60 C 346.40 25.46 344.89 21.82 344.95 18.04 C 345.48 10.45 350.90 3.30 358.36 1.34 Z" />
<path fill="#000000" opacity="1.00" d=" M 274.39 4.40 C 277.20 3.72 280.13 3.78 283.00 3.96 C 287.37 4.17 291.05 7.02 293.76 10.25 C 296.69 13.75 297.37 18.55 297.06 22.97 C 296.66 29.58 291.65 35.43 285.44 37.43 C 280.04 38.87 273.79 38.30 269.36 34.65 C 265.05 31.80 263.09 26.66 262.49 21.74 C 262.37 14.26 267.13 6.71 274.39 4.40 Z" />
<path fill="#000000" opacity="1.00" d=" M 400.41 7.43 C 404.43 6.41 408.83 6.74 412.66 8.33 C 418.62 11.13 422.45 17.52 422.82 24.00 C 422.45 33.04 414.54 42.12 405.00 41.13 C 397.68 41.54 390.46 36.56 388.55 29.45 C 387.35 24.49 387.53 18.85 390.51 14.52 C 392.71 10.96 396.50 8.69 400.41 7.43 Z" />
<path fill="#000000" opacity="1.00" d=" M 238.37 11.29 C 244.16 9.98 250.13 12.78 254.18 16.82 C 258.29 21.82 260.06 29.12 257.14 35.15 C 254.44 43.25 244.73 47.75 236.70 45.34 C 233.27 44.64 230.43 42.40 228.17 39.82 C 223.19 34.66 222.61 26.17 226.02 20.02 C 228.81 15.70 233.23 12.20 238.37 11.29 Z" />
<path fill="#000000" opacity="1.00" d=" M 440.42 19.43 C 445.81 18.03 451.94 19.05 456.20 22.79 C 460.59 26.02 462.63 31.59 462.68 36.91 C 462.20 43.38 457.91 49.31 452.08 52.07 C 448.90 53.40 445.35 53.21 441.99 53.03 C 435.85 52.66 431.05 47.59 428.82 42.19 C 427.11 36.85 427.50 30.53 430.91 25.92 C 433.13 22.67 436.73 20.63 440.42 19.43 Z" />
<path fill="#000000" opacity="1.00" d=" M 195.35 26.36 C 199.60 25.40 204.25 25.70 208.09 27.88 C 217.88 32.43 220.21 47.15 212.83 54.82 C 210.24 57.55 206.88 59.87 203.01 60.03 C 198.95 60.26 194.48 60.44 190.98 58.02 C 186.96 55.26 183.23 51.11 182.97 46.01 C 182.74 41.95 182.57 37.49 184.96 33.98 C 187.41 30.37 191.11 27.48 195.35 26.36 Z" />
<path fill="#000000" opacity="1.00" d=" M 477.39 35.40 C 482.42 34.22 487.97 34.74 492.38 37.59 C 496.46 39.70 498.55 44.12 499.65 48.38 C 500.95 53.52 499.16 58.97 496.21 63.20 C 492.27 67.75 485.91 69.81 480.00 69.05 C 474.88 68.76 470.80 65.01 467.95 61.06 C 464.44 56.19 464.07 49.33 467.17 44.16 C 469.55 40.32 472.99 36.79 477.39 35.40 Z" />
<path fill="#000000" opacity="1.00" d=" M 157.33 47.39 C 162.69 47.02 168.13 49.32 171.73 53.28 C 176.13 58.66 177.69 66.82 173.97 72.98 C 171.32 76.99 167.48 80.64 162.64 81.67 C 157.29 82.82 151.17 81.80 147.19 77.82 C 142.50 73.65 139.68 66.91 141.67 60.72 C 143.30 53.47 149.86 47.75 157.33 47.39 Z" />
<path fill="#000000" opacity="1.00" d=" M 517.40 58.42 C 520.79 57.65 524.37 57.66 527.80 58.21 C 537.63 60.84 543.03 73.32 538.35 82.33 C 535.29 88.22 528.83 92.77 521.99 92.15 C 513.08 92.54 506.13 84.15 505.03 75.89 C 504.92 68.26 509.97 60.65 517.40 58.42 Z" />
<path fill="#000000" opacity="1.00" d=" M 107.37 80.37 C 115.21 79.13 123.78 79.88 130.44 84.56 C 135.06 87.88 139.09 92.20 141.69 97.30 C 144.27 102.46 144.24 108.40 144.05 114.03 C 143.93 119.09 141.46 123.66 138.84 127.84 C 135.05 133.90 128.68 138.03 121.85 139.87 C 106.11 144.73 87.66 133.75 84.29 117.64 C 81.59 109.73 83.94 101.02 88.04 94.04 C 92.57 87.47 99.37 81.88 107.37 80.37 Z" />
<path fill="#000000" opacity="1.00" d=" M 562.34 85.44 C 570.10 85.32 577.93 88.11 583.79 93.21 C 589.35 98.38 593.26 105.49 593.90 113.12 C 595.81 128.03 584.54 143.06 569.91 145.96 C 561.04 148.05 551.21 145.66 544.30 139.71 C 537.74 134.44 533.26 126.49 532.95 118.00 C 531.96 106.03 539.06 94.09 549.71 88.71 C 553.69 86.92 557.99 85.84 562.34 85.44 Z" />
<path fill="#000000" opacity="1.00" d=" M 69.37 142.32 C 74.99 140.93 80.91 143.13 85.17 146.83 C 90.38 151.94 91.38 160.23 88.91 166.90 C 84.77 176.65 70.82 180.10 62.59 173.41 C 59.04 170.26 55.88 165.97 55.88 161.02 C 55.73 157.59 55.91 153.89 57.99 151.00 C 60.76 147.06 64.49 143.33 69.37 142.32 Z" />
<path fill="#000000" opacity="1.00" d=" M 594.39 149.39 C 600.54 147.91 607.64 149.18 612.17 153.83 C 615.83 158.09 618.10 164.02 616.66 169.63 C 615.20 175.29 611.27 180.76 605.44 182.42 C 601.85 183.36 598.00 183.40 594.39 182.61 C 587.49 180.17 582.22 173.40 582.03 166.00 C 582.22 158.61 587.48 151.83 594.39 149.39 Z" />
<path fill="#000000" opacity="1.00" d=" M 53.39 178.31 C 57.16 177.61 61.00 178.91 64.27 180.73 C 69.39 183.59 72.44 189.34 72.90 195.08 C 72.74 200.89 70.05 206.84 65.06 210.07 C 58.59 214.94 48.53 213.90 43.15 207.85 C 37.48 202.80 36.16 193.68 40.25 187.27 C 42.71 182.19 47.97 179.18 53.39 178.31 Z" />
<path fill="#000000" opacity="1.00" d=" M 187.09 180.10 C 197.97 178.39 209.10 178.60 220.00 180.01 C 226.28 180.73 232.62 180.99 238.85 182.11 C 278.89 187.95 317.69 200.01 355.85 213.18 C 366.44 217.30 377.25 220.85 387.71 225.29 C 402.87 231.08 417.58 237.94 432.34 244.65 C 442.01 249.64 451.95 254.12 461.37 259.60 C 472.66 265.41 483.40 272.21 494.32 278.68 C 503.91 284.25 512.93 290.73 522.20 296.81 C 533.03 304.59 544.15 312.02 554.28 320.73 C 558.22 324.12 562.37 327.28 566.24 330.76 C 577.39 341.96 589.54 352.54 597.80 366.20 C 602.57 373.22 605.86 381.21 607.51 389.53 C 609.75 399.64 604.55 410.45 596.19 416.21 C 586.86 422.98 575.27 425.72 564.00 427.04 C 559.03 427.77 554.02 428.20 549.00 428.04 C 542.14 427.79 535.25 428.44 528.42 427.59 C 520.42 426.60 512.34 426.24 504.42 424.66 C 460.52 417.74 418.06 403.75 377.00 387.00 C 361.86 381.14 347.11 374.36 332.33 367.67 C 320.35 361.65 308.31 355.73 296.38 349.61 C 294.97 348.94 293.54 348.26 292.01 347.96 C 290.75 348.21 289.62 348.86 288.51 349.49 C 280.68 354.18 273.42 359.75 265.87 364.86 C 257.48 370.68 250.06 377.72 242.27 384.28 C 238.72 387.42 236.03 391.36 232.82 394.83 C 227.58 400.64 223.67 407.57 220.87 414.86 C 218.17 422.49 217.99 431.28 221.40 438.72 C 228.85 439.63 236.38 438.42 243.85 439.22 C 254.59 440.39 265.33 442.04 275.63 445.37 C 282.99 447.80 290.43 450.12 297.34 453.65 C 304.36 457.25 311.60 460.45 318.18 464.83 C 330.08 473.03 341.90 481.59 351.74 492.26 C 359.27 499.12 365.48 507.21 371.99 515.00 C 388.22 536.51 401.84 560.02 412.07 584.96 C 419.84 602.90 425.44 621.69 430.36 640.60 C 431.79 646.90 433.21 653.22 434.42 659.58 C 435.38 664.72 435.90 669.95 437.17 675.04 C 445.43 667.08 450.52 656.57 455.22 646.27 C 457.51 640.58 460.33 635.02 464.30 630.31 C 466.28 627.91 469.75 627.49 472.62 628.17 C 475.37 630.07 476.13 633.77 475.95 636.93 C 475.34 643.85 473.46 650.60 471.17 657.14 C 468.83 664.34 464.97 670.90 461.64 677.66 C 457.59 684.43 453.30 691.13 448.02 697.01 C 440.73 704.41 432.36 710.66 425.25 718.25 C 416.59 726.92 407.91 735.57 399.26 744.24 C 389.24 755.29 379.35 766.50 370.55 778.55 C 366.47 783.76 363.22 789.59 360.69 795.70 C 357.24 803.68 354.36 811.93 352.47 820.42 C 351.48 826.24 349.88 832.02 349.94 837.98 C 349.93 841.95 349.84 845.92 350.14 849.89 C 350.46 854.08 352.37 857.89 353.65 861.84 C 346.92 863.23 340.07 864.17 333.22 864.61 C 327.48 857.83 325.84 848.59 324.99 840.00 C 325.03 826.14 328.62 812.53 333.68 799.70 C 337.06 791.59 340.33 783.39 344.81 775.81 C 349.36 768.05 353.50 760.03 358.59 752.59 C 370.20 734.88 383.19 718.08 397.26 702.26 C 400.84 698.17 405.38 694.96 408.52 690.51 C 410.46 685.95 410.14 680.82 409.96 675.99 C 409.12 668.22 408.41 660.32 405.80 652.91 C 403.20 655.04 401.61 658.03 399.79 660.80 C 395.99 666.81 391.62 672.54 386.23 677.23 C 382.85 680.15 378.56 682.31 374.00 682.16 C 369.14 682.34 364.81 679.69 360.95 677.05 C 356.91 674.26 356.20 668.59 352.07 665.92 C 348.87 664.68 345.28 665.15 342.08 663.94 C 339.96 662.86 338.11 661.11 337.02 659.00 C 335.90 656.22 335.71 653.18 334.62 650.40 C 330.99 649.52 326.78 649.79 323.81 647.18 C 320.70 643.38 321.10 637.73 317.66 634.12 C 311.88 632.85 307.33 637.56 302.16 639.20 C 298.98 640.62 295.53 639.48 292.35 638.71 C 289.61 637.93 286.76 637.25 284.37 635.64 C 281.29 633.33 279.71 629.60 279.05 625.91 C 276.61 615.96 279.90 605.90 281.01 596.01 C 281.98 582.54 276.82 569.05 268.20 558.80 C 264.05 554.27 259.67 549.88 254.56 546.44 C 249.82 543.26 245.46 539.55 240.98 536.01 C 238.00 533.68 235.28 531.03 232.87 528.12 C 227.41 521.42 221.96 514.58 218.29 506.69 C 211.15 492.94 207.69 477.54 206.81 462.14 C 206.58 459.90 206.38 457.60 205.51 455.51 C 203.28 452.13 199.85 449.78 197.53 446.47 C 192.48 439.66 188.11 431.72 187.96 423.03 C 187.90 417.74 187.61 412.31 189.15 407.17 C 191.94 397.06 196.98 387.66 203.40 379.41 C 207.44 374.16 211.38 368.78 216.23 364.23 C 223.57 357.24 230.22 349.49 238.27 343.27 C 244.57 337.81 251.22 332.76 257.86 327.72 C 255.16 325.45 252.07 323.73 249.06 321.94 C 230.54 310.11 212.56 297.41 195.71 283.29 C 189.72 278.66 184.64 273.03 179.16 267.84 C 174.68 262.98 169.64 258.64 165.63 253.36 C 158.20 243.99 151.11 233.96 147.59 222.38 C 145.67 216.39 145.31 209.86 146.71 203.72 C 147.74 199.12 150.91 195.41 154.19 192.19 C 158.82 187.60 165.03 185.16 171.09 183.08 C 176.26 181.31 181.70 180.78 187.09 180.10 M 233.41 211.38 C 225.66 212.29 217.81 214.02 211.04 218.04 C 204.66 222.14 199.75 229.82 201.31 237.61 C 202.39 245.03 206.04 251.75 209.95 258.04 C 216.11 267.03 223.95 274.69 231.81 282.18 C 238.62 287.71 245.08 293.72 252.37 298.64 C 257.48 302.18 262.42 305.95 267.59 309.41 C 309.68 337.33 355.76 358.82 403.28 375.74 C 411.62 379.09 420.36 381.25 428.88 384.08 C 452.03 391.06 475.83 396.14 499.97 397.97 C 514.15 398.06 528.93 398.92 542.31 393.33 C 547.84 391.48 552.66 387.79 556.10 383.11 C 559.85 377.65 559.84 370.39 557.71 364.32 C 554.35 354.35 547.31 346.26 540.63 338.35 C 535.45 332.19 529.03 327.30 523.09 321.92 C 515.79 316.18 508.51 310.41 500.87 305.11 C 493.74 299.77 485.97 295.39 478.56 290.46 C 460.67 279.61 442.58 268.93 423.36 260.60 C 411.04 254.60 398.32 249.46 385.57 244.45 C 373.20 240.13 361.05 235.12 348.43 231.54 C 317.77 221.60 286.27 213.40 254.02 211.03 C 247.15 211.01 240.25 210.66 233.41 211.38 M 231.34 459.32 C 228.15 460.63 225.26 463.45 225.06 467.06 C 224.61 471.61 224.78 476.31 226.31 480.67 C 228.18 486.25 230.33 491.75 232.96 497.02 C 234.57 500.25 235.93 503.83 238.87 506.13 C 242.48 509.13 246.43 511.97 248.87 516.09 C 250.68 518.91 251.87 522.42 254.96 524.14 C 259.52 520.31 263.63 515.94 268.60 512.59 C 275.22 507.45 283.59 504.69 291.98 504.95 C 299.97 505.17 307.98 504.69 315.96 505.17 C 316.09 508.73 315.61 512.32 314.67 515.76 C 308.57 516.13 302.40 515.92 296.41 517.39 C 284.41 519.12 273.00 525.71 266.18 535.82 C 269.41 538.61 272.99 540.98 276.19 543.81 C 278.85 546.05 281.33 548.68 284.63 549.98 C 285.21 547.71 285.61 545.39 286.33 543.17 C 288.62 542.94 291.27 542.37 293.35 543.61 C 294.18 546.58 294.25 549.74 295.29 552.67 C 296.16 555.02 298.64 556.35 301.00 556.74 C 303.45 556.45 305.92 555.44 307.66 553.66 C 311.75 549.23 314.47 543.79 317.90 538.88 C 319.74 536.68 322.56 534.40 325.62 535.12 C 327.96 536.82 329.07 539.92 328.75 542.76 C 328.24 547.20 327.13 551.55 325.83 555.83 C 325.21 557.94 324.01 559.91 322.22 561.24 C 317.51 564.93 311.34 565.58 306.01 568.02 C 302.94 569.44 299.58 570.70 297.26 573.26 C 297.84 580.99 298.64 588.72 299.56 596.42 C 300.19 601.82 300.35 607.28 301.36 612.63 C 305.63 615.01 310.55 613.65 315.08 613.08 C 320.17 612.37 325.80 613.76 329.31 617.69 C 331.30 619.76 332.44 622.55 334.63 624.44 C 341.17 626.16 348.30 623.53 354.67 626.31 C 358.14 627.67 360.59 630.89 361.54 634.44 C 362.84 639.29 362.98 644.42 364.83 649.14 C 366.48 653.44 368.03 658.23 371.90 661.10 C 373.31 662.08 374.90 663.27 376.74 663.00 C 382.38 657.87 386.33 651.12 392.32 646.32 C 396.13 642.94 401.02 641.10 404.86 637.78 C 403.89 632.91 401.80 628.36 400.38 623.62 C 395.57 610.24 390.97 596.76 385.26 583.73 C 381.13 573.53 375.86 563.85 370.98 554.00 C 361.76 537.57 351.12 521.64 337.24 508.76 C 331.87 503.09 326.21 497.70 319.86 493.14 C 312.74 487.30 304.66 482.86 296.73 478.24 C 287.31 472.81 277.07 469.05 267.01 465.00 C 259.74 462.07 252.13 460.06 244.46 458.53 C 240.12 457.67 235.46 457.51 231.34 459.32 Z" />
<path fill="#000000" opacity="1.00" d=" M 614.38 183.35 C 619.42 182.10 625.07 183.54 628.81 187.18 C 631.64 189.85 634.47 193.05 634.95 197.07 C 635.35 201.09 635.42 205.55 633.02 209.01 C 629.67 213.99 624.19 217.98 618.00 217.97 C 613.57 217.80 609.16 216.11 605.82 213.19 C 602.10 209.51 600.49 204.12 600.84 198.97 C 600.56 191.27 607.11 184.78 614.38 183.35 Z" />
<path fill="#000000" opacity="1.00" d=" M 36.36 217.34 C 40.82 216.32 45.70 216.98 49.63 219.36 C 55.41 222.92 59.13 229.96 57.86 236.77 C 57.01 243.59 51.73 249.49 45.06 251.11 C 39.92 253.06 34.31 250.97 30.07 247.93 C 26.08 245.16 23.78 240.50 23.17 235.77 C 22.65 227.56 28.35 219.42 36.36 217.34 Z" />
<path fill="#000000" opacity="1.00" d=" M 628.39 220.41 C 631.50 219.67 634.76 219.74 637.93 220.07 C 641.46 220.46 644.43 222.69 646.82 225.19 C 653.71 232.06 652.63 245.07 644.63 250.65 C 636.89 257.38 623.39 254.16 618.76 245.23 C 616.51 241.10 616.42 236.04 617.57 231.57 C 619.32 226.57 623.23 222.00 628.39 220.41 Z" />
<path fill="#000000" opacity="1.00" d=" M 29.33 258.41 C 36.11 257.88 43.14 261.74 46.12 267.91 C 50.69 275.81 47.07 286.95 39.03 291.06 C 34.80 293.70 29.43 293.57 24.79 292.22 C 17.70 289.84 13.24 282.35 13.10 275.08 C 13.43 270.72 15.29 266.48 18.30 263.31 C 21.26 260.45 25.32 259.01 29.33 258.41 Z" />
<path fill="#000000" opacity="1.00" d=" M 640.37 261.33 C 644.30 260.31 648.45 261.21 652.05 262.93 C 657.88 265.53 661.42 271.88 661.66 278.11 C 661.69 283.42 659.40 288.87 655.05 292.06 C 651.42 294.73 646.82 296.72 642.24 295.84 C 637.14 294.83 632.31 291.95 629.40 287.60 C 627.02 283.98 626.49 279.41 627.16 275.21 C 628.39 268.57 633.74 262.80 640.37 261.33 Z" />
<path fill="#000000" opacity="1.00" d=" M 21.38 296.28 C 24.94 295.44 28.58 296.64 31.71 298.29 C 36.02 300.54 39.67 304.49 40.66 309.36 C 41.75 314.47 40.92 320.32 37.29 324.29 C 33.70 328.26 28.64 331.62 23.05 331.06 C 17.80 330.52 12.42 328.07 9.38 323.62 C 6.55 319.09 5.01 313.28 7.14 308.16 C 9.11 301.84 14.95 297.33 21.38 296.28 Z" />
<path fill="#000000" opacity="1.00" d=" M 647.41 304.44 C 650.98 303.58 654.84 303.56 658.37 304.64 C 664.92 307.28 669.47 313.99 669.82 321.00 C 669.46 328.01 664.92 334.72 658.37 337.36 C 651.22 339.54 642.20 337.52 638.10 330.88 C 634.59 325.66 633.60 318.49 636.88 312.91 C 638.77 308.55 643.00 305.79 647.41 304.44 Z" />
<path fill="#000000" opacity="1.00" d=" M 16.39 339.29 C 19.91 338.56 23.39 340.04 26.54 341.46 C 32.16 343.99 35.40 350.12 35.90 356.08 C 35.77 362.63 32.20 369.21 26.34 372.34 C 22.42 374.32 17.76 374.56 13.55 373.47 C 9.73 372.47 6.71 369.70 4.26 366.74 C 1.00 362.79 0.28 357.24 1.34 352.35 C 3.17 345.47 9.37 340.25 16.39 339.29 Z" />
<path fill="#000000" opacity="1.00" d=" M 655.40 344.34 C 659.76 343.21 664.25 344.79 668.00 347.00 C 672.12 349.40 674.50 353.90 675.66 358.39 C 676.82 362.74 675.19 367.25 673.00 371.00 C 670.59 375.12 666.10 377.50 661.61 378.67 C 657.26 379.82 652.74 378.21 649.02 375.99 C 643.29 372.63 640.13 365.64 641.02 359.11 C 641.85 351.72 648.18 345.61 655.40 344.34 Z" />
<path fill="#000000" opacity="1.00" d=" M 5.33 384.32 C 9.53 379.98 16.18 378.63 21.95 379.97 C 29.84 381.81 35.75 389.82 35.08 397.91 C 34.85 402.58 32.34 406.87 28.83 409.86 C 22.56 415.74 11.65 415.53 5.64 409.37 C 2.80 406.75 1.24 403.12 0.00 399.53 L 0.00 394.43 C 1.14 390.78 2.61 387.09 5.33 384.32 Z" />
<path fill="#000000" opacity="1.00" d=" M 659.15 383.61 C 663.98 383.40 668.57 385.69 671.84 389.16 C 677.24 393.96 678.54 402.64 674.82 408.84 C 672.45 412.71 668.97 416.30 664.44 417.45 C 659.99 418.55 654.97 418.56 650.97 416.05 C 644.17 412.53 640.32 403.96 642.56 396.57 C 643.47 393.51 644.87 390.46 647.25 388.25 C 650.47 385.30 654.81 383.77 659.15 383.61 Z" />
<path fill="#000000" opacity="1.00" d=" M 18.25 419.48 C 25.59 419.08 32.67 423.90 35.35 430.67 C 36.77 434.71 36.76 439.28 35.28 443.31 C 32.92 448.71 27.90 453.24 21.91 453.96 C 18.39 454.33 14.65 454.19 11.43 452.58 C 4.65 449.42 0.83 441.38 2.05 434.09 C 2.81 426.06 10.35 419.76 18.25 419.48 Z" />
<path fill="#000000" opacity="1.00" d=" M 642.88 441.98 C 642.57 433.57 649.18 425.87 657.26 424.14 C 662.15 423.29 667.21 424.96 671.18 427.79 C 674.99 430.52 676.67 435.11 678.00 439.42 L 678.00 443.60 C 677.02 446.55 675.91 449.53 674.08 452.08 C 671.30 456.07 666.56 458.34 661.83 458.95 C 652.27 459.72 643.21 451.54 642.88 441.98 Z" />
<path fill="#000000" opacity="1.00" d=" M 22.26 459.47 C 29.25 459.43 36.18 463.45 39.07 469.92 C 40.33 472.75 40.21 475.96 40.04 478.99 C 39.55 487.47 31.48 494.62 23.00 494.13 C 15.41 494.56 8.35 488.90 6.22 481.80 C 5.67 478.12 5.57 474.23 6.64 470.63 C 9.19 464.37 15.45 459.71 22.26 459.47 Z" />
<path fill="#000000" opacity="1.00" d=" M 652.35 463.37 C 655.44 462.72 658.68 462.67 661.80 463.20 C 670.21 465.38 676.64 474.65 674.41 483.31 C 673.57 488.25 670.02 492.24 666.02 495.02 C 662.55 497.41 658.09 497.36 654.07 496.94 C 648.25 495.83 643.04 491.57 641.07 485.94 C 637.47 477.11 642.85 465.51 652.35 463.37 Z" />
<path fill="#000000" opacity="1.00" d=" M 27.39 504.28 C 34.10 503.14 40.94 506.83 44.60 512.40 C 47.37 515.93 47.43 520.67 46.94 524.92 C 45.47 533.50 36.79 540.08 28.12 538.97 C 23.23 538.16 18.12 535.90 15.53 531.47 C 13.08 527.51 11.73 522.65 12.93 518.05 C 14.18 510.97 20.31 505.30 27.39 504.28 Z" />
<path fill="#000000" opacity="1.00" d=" M 650.37 505.28 C 654.74 504.27 659.25 505.76 663.00 508.00 C 668.14 511.01 670.68 517.17 670.90 522.92 C 670.35 529.90 665.87 536.87 658.94 538.95 C 652.40 541.75 644.85 538.67 640.17 533.83 C 635.18 528.67 634.61 520.16 638.02 514.01 C 640.81 509.70 645.23 506.21 650.37 505.28 Z" />
<path fill="#000000" opacity="1.00" d=" M 38.37 552.37 C 52.68 549.52 67.75 559.17 72.14 572.86 C 73.95 578.05 74.92 583.82 73.18 589.18 C 71.02 596.11 67.52 603.19 61.27 607.30 C 56.49 610.60 50.92 613.04 45.03 613.10 C 34.63 613.75 23.74 608.79 18.16 599.83 C 11.18 589.96 11.01 575.80 17.76 565.77 C 22.12 558.42 30.09 553.82 38.37 552.37 Z" />
<path fill="#000000" opacity="1.00" d=" M 636.36 552.37 C 645.07 550.60 654.26 553.41 661.17 558.82 C 667.63 564.24 672.21 572.39 672.12 580.96 C 672.26 585.68 671.87 590.53 669.91 594.90 C 665.18 605.66 653.90 613.43 642.01 613.11 C 630.98 613.78 620.92 606.77 615.29 597.71 C 612.16 591.58 609.85 584.43 611.53 577.54 C 612.83 571.93 615.00 566.29 619.18 562.18 C 623.65 557.16 629.80 553.74 636.36 552.37 Z" />
<path fill="#000000" opacity="1.00" d=" M 53.36 616.34 C 59.72 614.75 66.74 617.02 70.82 622.18 C 78.83 630.21 74.71 645.51 64.34 649.34 C 56.97 652.70 47.38 649.74 43.11 642.88 C 40.53 638.80 39.19 633.62 40.88 628.94 C 42.37 622.88 47.40 617.99 53.36 616.34 Z" />
<path fill="#000000" opacity="1.00" d=" M 626.39 618.30 C 631.09 617.64 636.04 619.37 639.74 622.25 C 644.30 626.79 647.67 633.78 645.21 640.20 C 643.07 647.57 635.87 653.58 628.01 653.10 C 617.63 653.22 609.03 642.27 611.20 632.23 C 611.95 629.32 613.41 626.62 615.26 624.26 C 617.94 620.82 622.22 619.12 626.39 618.30 Z" />
<path fill="#000000" opacity="1.00" d=" M 70.40 651.29 C 78.81 650.34 87.53 656.47 89.25 664.85 C 91.39 672.90 86.45 681.73 78.89 684.89 C 72.16 687.69 63.66 685.65 59.09 679.91 C 53.88 674.08 53.33 664.47 58.35 658.36 C 61.11 654.36 65.72 652.13 70.40 651.29 Z" />
<path fill="#000000" opacity="1.00" d=" M 609.39 656.39 C 614.41 655.38 620.10 655.52 624.48 658.51 C 628.28 660.86 630.64 665.00 631.79 669.23 C 633.21 676.23 629.95 684.13 623.66 687.69 C 617.68 691.38 608.97 691.25 603.72 686.28 C 596.73 680.96 594.75 669.51 600.70 662.71 C 603.11 660.06 605.89 657.47 609.39 656.39 Z" />
<path fill="#000000" opacity="1.00" d=" M 82.39 688.39 C 88.34 687.08 95.20 687.85 99.75 692.25 C 105.02 697.53 106.83 706.37 102.99 712.99 C 100.37 718.70 94.31 722.48 88.00 722.14 C 78.42 723.11 70.59 713.97 69.98 704.99 C 70.54 697.78 75.44 690.75 82.39 688.39 Z" />
<path fill="#000000" opacity="1.00" d=" M 598.25 691.48 C 605.02 691.29 612.15 694.58 614.99 701.01 C 619.99 709.34 614.93 720.66 606.66 724.67 C 601.30 726.77 594.48 727.04 589.83 723.18 C 586.63 720.64 583.59 717.50 582.53 713.45 C 579.58 703.43 587.67 691.72 598.25 691.48 Z" />
<path fill="#000000" opacity="1.00" d=" M 100.36 721.35 C 104.59 720.47 109.27 720.57 113.03 722.95 C 119.84 726.46 123.68 735.04 121.43 742.42 C 120.40 745.94 118.68 749.45 115.66 751.67 C 111.11 755.05 104.90 756.37 99.46 754.59 C 92.11 752.33 86.77 744.75 87.05 737.10 C 88.03 730.00 93.06 722.89 100.36 721.35 Z" />
<path fill="#000000" opacity="1.00" d=" M 575.36 725.37 C 578.97 724.72 582.83 724.50 586.37 725.64 C 594.02 728.75 599.51 737.74 597.05 745.96 C 595.37 753.98 587.13 759.90 579.00 759.11 C 570.52 759.12 562.87 751.48 562.89 743.00 C 562.16 735.22 567.55 726.94 575.36 725.37 Z" />
<path fill="#000000" opacity="1.00" d=" M 121.40 754.42 C 129.94 751.90 139.82 756.92 142.62 765.40 C 146.53 774.67 139.48 786.02 129.94 788.04 C 123.51 789.65 116.16 787.14 112.35 781.64 C 109.07 777.66 108.26 772.17 109.20 767.21 C 110.74 761.22 115.51 756.27 121.40 754.42 Z" />
<path fill="#000000" opacity="1.00" d=" M 554.40 758.40 C 557.40 757.59 560.61 757.76 563.64 758.35 C 567.80 759.14 571.13 762.08 573.75 765.25 C 579.09 772.16 577.47 783.28 570.34 788.35 C 563.98 794.00 553.49 793.23 547.32 787.68 C 544.33 784.51 542.27 780.31 541.94 775.95 C 541.40 768.14 547.13 760.80 554.40 758.40 Z" />
<path fill="#000000" opacity="1.00" d=" M 147.38 786.32 C 155.89 784.56 164.82 790.33 167.61 798.39 C 168.81 803.80 168.41 810.13 164.28 814.27 C 160.46 819.43 153.65 821.98 147.38 820.68 C 141.97 819.24 136.72 815.65 134.82 810.18 C 132.81 803.85 133.71 796.32 138.33 791.32 C 140.82 788.88 144.04 787.24 147.38 786.32 Z" />
<path fill="#000000" opacity="1.00" d=" M 535.37 789.31 C 543.39 788.71 552.14 793.89 554.03 802.02 C 556.49 809.73 552.30 818.57 545.34 822.35 C 539.59 825.06 532.26 824.88 527.13 820.89 C 520.35 816.22 517.70 806.13 521.88 798.91 C 524.36 793.67 529.78 790.30 535.37 789.31 Z" />
<path fill="#000000" opacity="1.00" d=" M 174.38 817.36 C 183.27 815.03 192.53 821.65 194.80 830.20 C 195.32 833.79 195.48 837.66 194.07 841.08 C 191.30 846.95 185.30 851.11 178.90 851.94 C 172.25 852.23 165.60 848.38 162.39 842.58 C 160.52 838.43 160.62 833.63 161.21 829.20 C 162.88 823.13 168.28 818.59 174.38 817.36 Z" />
<path fill="#000000" opacity="1.00" d=" M 509.35 819.38 C 514.89 819.15 520.59 821.57 523.86 826.14 C 527.62 830.07 527.33 835.91 526.94 840.94 C 525.70 847.38 519.99 852.27 513.77 853.79 C 508.10 855.00 502.12 852.91 497.83 849.17 C 492.49 843.95 491.44 835.28 494.65 828.66 C 497.53 823.28 503.29 819.78 509.35 819.38 Z" />
<path fill="#000000" opacity="1.00" d=" M 207.32 842.37 C 212.86 842.18 218.86 844.17 222.19 848.82 C 225.01 852.81 226.75 857.87 225.85 862.78 C 225.15 866.23 223.53 869.54 221.09 872.09 C 216.73 876.26 210.23 878.06 204.35 876.66 C 196.95 874.68 191.43 867.59 191.00 860.01 C 191.38 855.88 192.81 851.69 195.43 848.44 C 198.59 845.24 202.76 842.74 207.32 842.37 Z" />
<path fill="#000000" opacity="1.00" d=" M 476.40 843.33 C 482.52 842.25 489.28 845.03 493.06 849.94 C 495.97 854.57 498.37 860.58 495.95 865.94 C 493.36 874.27 483.88 879.84 475.36 877.66 C 470.96 876.78 467.48 873.61 464.83 870.17 C 460.85 864.81 461.17 857.10 464.54 851.53 C 467.09 847.24 471.63 844.49 476.40 843.33 Z" />
<path fill="#000000" opacity="1.00" d=" M 246.34 862.37 C 252.14 862.04 257.78 865.24 261.20 869.82 C 265.61 875.66 265.60 884.34 261.21 890.19 C 258.01 894.16 253.21 897.13 247.99 897.12 C 239.83 897.83 232.16 891.55 230.21 883.79 C 229.18 878.58 230.21 872.85 233.79 868.80 C 236.71 864.83 241.55 862.82 246.34 862.37 Z" />
<path fill="#000000" opacity="1.00" d=" M 443.37 863.34 C 448.72 861.98 454.47 863.92 458.58 867.42 C 463.93 872.46 465.65 880.94 462.66 887.66 C 459.69 893.95 452.97 898.08 446.03 898.04 C 437.01 897.29 429.50 889.13 429.31 880.12 C 429.59 877.21 430.47 874.37 431.79 871.78 C 434.05 867.34 438.71 864.62 443.37 863.34 Z" />
<path fill="#000000" opacity="1.00" d=" M 342.37 871.36 C 355.52 869.13 369.61 876.88 374.95 889.09 C 377.58 894.93 377.89 901.60 376.92 907.87 C 375.93 914.33 371.96 919.90 367.30 924.30 C 356.46 935.08 336.77 934.85 326.19 923.81 C 321.20 919.54 318.04 913.53 316.79 907.14 C 315.36 902.09 316.60 896.85 318.00 891.96 C 321.41 881.20 331.30 873.13 342.37 871.36 Z" />
<path fill="#000000" opacity="1.00" d=" M 283.35 878.34 C 288.25 877.29 293.79 878.00 297.75 881.24 C 302.19 884.72 304.79 890.34 304.90 895.93 C 304.19 900.84 302.17 906.02 297.94 908.94 C 293.68 911.96 288.08 914.05 282.94 912.11 C 274.10 910.07 268.07 900.12 270.36 891.35 C 271.73 885.00 277.10 879.85 283.35 878.34 Z" />
<path fill="#000000" opacity="1.00" d=" M 402.40 880.42 C 405.74 879.58 409.28 879.70 412.64 880.37 C 419.74 881.99 424.44 889.09 425.06 896.05 C 425.66 904.19 419.44 911.68 411.80 913.82 C 406.61 914.67 400.74 913.95 396.71 910.30 C 391.41 905.99 388.26 898.43 390.80 891.80 C 392.45 886.33 397.03 882.13 402.40 880.42 Z" />
<path fill="#000000" opacity="1.00" d=" M 343.37 940.34 C 351.07 939.31 358.42 944.76 361.37 951.63 C 363.31 958.39 361.98 966.66 356.18 971.19 C 351.77 974.36 345.90 976.11 340.56 974.44 C 337.52 973.47 334.61 971.92 332.33 969.68 C 327.94 964.89 326.81 957.74 328.64 951.63 C 331.07 945.60 336.96 941.24 343.37 940.34 Z" />
<path fill="#000000" opacity="1.00" d=" M 341.42 985.42 C 347.00 983.88 353.26 985.59 357.45 989.56 C 363.06 994.39 364.59 1002.97 361.67 1009.66 C 357.62 1018.37 345.80 1022.60 337.40 1017.58 C 332.37 1014.07 328.37 1008.43 328.32 1002.13 C 328.62 998.02 329.84 993.77 332.70 990.70 C 335.10 988.24 338.17 986.49 341.42 985.42 Z" />
<path fill="#000000" opacity="1.00" d=" M 341.41 1029.43 C 347.07 1027.78 353.29 1029.53 357.73 1033.27 C 363.32 1038.56 364.72 1047.47 361.34 1054.34 C 358.36 1059.89 352.26 1063.47 346.02 1063.80 C 336.70 1063.85 328.50 1055.32 328.32 1046.13 C 328.62 1042.02 329.85 1037.78 332.70 1034.70 C 335.09 1032.24 338.15 1030.47 341.41 1029.43 Z" />
<path fill="#000000" opacity="1.00" d=" M 328.23 1072.23 C 334.13 1071.59 340.08 1072.12 346.00 1072.02 C 352.26 1072.14 358.54 1071.57 364.77 1072.23 C 365.63 1084.05 364.37 1095.95 365.23 1107.77 C 376.86 1108.74 388.61 1107.13 400.22 1108.40 C 401.10 1111.49 400.99 1114.75 401.07 1117.94 C 401.03 1123.53 400.99 1129.11 400.88 1134.70 C 400.78 1137.41 400.77 1140.21 399.74 1142.78 C 388.26 1143.65 376.71 1142.35 365.23 1143.23 C 364.97 1145.12 364.92 1147.04 364.92 1148.98 C 365.09 1165.98 364.96 1182.99 365.00 1200.00 L 328.00 1200.00 C 328.00 1185.67 327.99 1171.33 328.01 1157.00 C 327.98 1152.40 328.32 1147.79 327.78 1143.22 C 316.28 1142.34 304.71 1143.69 293.22 1142.73 C 292.14 1139.26 292.78 1135.59 292.89 1132.04 C 293.26 1126.08 293.09 1120.10 292.66 1114.15 C 292.61 1112.16 292.24 1110.02 293.30 1108.22 C 304.76 1107.35 316.31 1108.63 327.78 1107.78 C 328.63 1095.95 327.37 1084.05 328.23 1072.23 Z" />
</g>
</svg>

código escondido pelo svg ser muito grande.
Outra forma é salvar esse svg como arquivo (ao invés de inseri-lo diretamente no html) e chamá-lo com a tag img:

.contain-svg > img {
    width: 100%
}

.contain-svg:nth-child(1) {
    height: 50px;
    width: 50px
}

.contain-svg:nth-child(2) {
    height: 200px;
    width: 200px
}

.contain-svg {
    float: left;
    margin: 10px
}

Answer: Você pode usar o svg como background e ajustar com background-size para fazer com que o tamanho da imagem se ajuste ao tamanho do elemento.
Exemplo:

#div1 {
    width: 100px;
    height: 150px;
    background-image: url(http://imgh.us/terco003.svg);
    background-size: 100% 100%;
}

#div2 {
    width: 300px;
    height: 400px;
    background-image: url(http://imgh.us/terco003.svg);
    background-size: 100% 100%;
}


Predictive Distribution is an expectation?

Question: The predictive distribution is defined as follows
$ p(\hat{y} | X) = \int p(\hat{y} | X) p(\theta | X) d\theta$
where $\hat{y}$ is unobserved value, $\theta$ represents parameters and $X$ denotes observed values (i.e data set.)
Two questions:

Does the integral need to be computed for every new observation? or should the posterior be interpreted as distribution over all posible new observations?

Is the integral equivalent to an expection? i.e:

$ p(\hat{y} | X) = E_{\theta | x} [p(\hat{y} | X)]$
If so,  how should  this  expectation  be interpreted ? is it a point estimate for $\hat{y}$ or how does it somehow represent a distribution?
Answer: The definition of the posterior predictive distribution is,
$$
p(\hat y \mid X) = \int p(\hat y \mid \theta) p(\theta \mid X) d\theta  \quad (*)
$$
where $p(\hat y \mid \theta)$ is the likelihood of your model and $p(\theta \mid X)$ is the posterior distribution of $\theta$ after observing $X$.
The quantity $p(\hat y \mid X)$ can indeed be seen as an expectation.
Your model is $p(\hat y \mid \theta)$ and after observing $X$, you knowledge on the model parameter $\theta$ is represented by the posterior distribution $p(\theta \mid X)$.
From the integral above we see that $p(\hat y \mid X)$ is the expectation of $p(\hat y \mid \theta)$ given that the distribution of $\theta$ is $p(\theta \mid X)$, i.e:
$$
p(\hat y \mid X) = \mathbb E_{\theta \mid X} \left [ p(\hat y \mid \theta )\right ].
$$
Another way to see $p(\hat y \mid X)$ is think about it as the sum across $\theta$ of $p(\hat y \mid \theta )$, i.e the probability of $\hat y$ given the model is $\theta$, times your current knowledge of the probability of this model $p(\theta \mid X)$.
So it completely represents a distribution (a distribution marginalized over $\theta$).
If you wanted a point estimate of $\hat y$ you could take for example the expectation of this distribution:
$$
\int \hat y p(\hat y \mid X)d\hat y.
$$
Last, if I understand your first question, in the general case if you want to evaluate $p(\hat y \mid X)$ for different values of $\hat y $ you will need to recompute the integral in $(*)$ each time.
Comment: One thing I am confused about is how can  $p(y∣X)$,   completely represent a distribution?, when it is quantity (i.e. a single value  expressed an expection over a distribution)
Comment: @Joel $p(y \mid X)$ is a function (a density) of the variable $y$. The whole function (and not just one of its value $p(y \mid X)$ for a particular $y$) represents a distribution. But for each value of $y$, $p(y \mid X)$ can be seen as an expectation.


When to use Blues scales in jazz

Question: I looked it up and found that the key shows you what blues to use during solos. But I find songs with a key of C but using A blues. Does this mean the key doesn't show when to use specific blues scales??
I was also wondering how to know how to figure out what blues scale to use.
Answer: The key gives you some clues, but ultimately it's completely up to you which blues scale you use when, especially in a jazz context, you simply play some variations starting on different roots and decide wether you like the results, that's to a large extent the crux of jazz. The whole idea is you can play want you want, express yourself.
So there are no rules, but zooming in a little bit there are of course conventions.
The blues scale is not a particularly well defined thing, I'm a well seasoned jazz player but I don't really find myself thinking in terms of a blues scale too much. But if you want to start soloing over a blues progression (let's say a major blues in C, all chords dominant 7ths) then using a blues scale starting on the root of C is indeed a good place to start. You have to be aware that if you are playing the C blues scale (taking it here as a minor pentatonic with added b5) then the b3 and b5 are going to be particularly 'clashy', but thats the point, they are the blue notes. It might be useful to play for a while with this scale and listen hard to how all of the notes in that scale sound over each of the chords in the blues progression. Individual notes from the scale will sound different when played over the different chords in the blues progression.
Once you feel you have gotten a handle on the blues scale built on just the tonic of the key for the entire progression you can maybe try using the blues scale based on the tonic of each chord in the progression (ie for bars 5 and 6 in a C blues use the F blues scale). This will give you another sound palette to work with, you can stick to C blues for the first time though, then move around the blues scale for the second time through. These are ways you can help develop a solo and create different melodic ideas as the solo progresses.
Moving further you can, as in your example, play the A blues on a C blues progression. This will work fine as A is the relative minor of C and the blues scale has a minor 3rd (the b3rd of the A blues scale is the tonic of the key you are in) and the A blues scale has a b5th (which is the b3rd to the I chord of the key you are in, which is a blue note, a note present in the C blues scale too)
The A blues sale played over the tonic chord in a C blues will highlight, compared to the C tonic;
A - the 6th
C - the tonic
D - the 9th
Eb - the b3 blue note
E - the 3rd
G - the 5th
I'll leave it up to you as an exercise to determine which intervals an A blues scale will highlight over the IV chord in a C blues, the F!
So you can see the A blues scale (or one of the scales often defined as a blues scale) contains no notes considered dissonant apart from the notes commonly considered 'blue notes' which are desired.
So hopefully you can see you could pick any blues scale, or any other scale for that matter (pentatonics are a common option), work out how they lie over your given piece and learn how they sound, for use in your solos. Hopefully you can also see they are all sounds that require a bit of learning to be able to use satisfactorily, as some notes in the scale will be dissonant and seek resolution, while others will be consonant.
Outside of blues and more into jazz this concept is key to finding sounds you like to use and can call upon in your solos. For example you can play pentatonic scales with various different roots over a given chord and evaluate which notes they highlight, and how many dissonant notes they have to be aware of. Some sounds you may discard, others you may like and use regularly, this is what is colloquially called your jazz 'vocabulary'. Note there is a lot more to a jazz vocabulary than just blues and pentatonics, but they're a part of it.
Lastly, don't get too stuck on 'this' tells you 'this'. It's true sticking to simple forms on clear tonics is good when getting started, but you might hear someone play a Db pentatonic over a C major chord and make it sound fantastic, and there may not be a lot of 'theory' there, just musicality exciting the listener by creating a coherent line outside of the expected before satisfactorily coming back home to the c major chord, this is the fun stuff!
Answer: I like this question.
First, C Major and A minor share the exact same notes.
Why? The A minor scale is the C major scale but starting and ending on the A note, instead of the C note.
The A blues scale is the A minor pentatonic scale, plus the Eb note: The five note version of the scale (Pentatonic) plus the Eb.
The addition of the Eb note allows a tune in the key of C major to have some C minor effects (ie: E is flat in C minor).
Because of this, the A blues allows us to use the Eb note to draw some C minor characteristics into the tune.
Eventually, we want to not think about this in terms of scales, but rather "colors" and "ideas".
Why?
Thinking purely in scale form limits us to a scale box (I think all of us knows what this might mean: we are looking at a scale shape to provide tasteful notes to play: the good buttons to push vs. the bad buttons to push).
Our job as guitarists and artists is to experiment how the Eb note might intermingle with the other chords in the tune: if it sounds bad to you, don't use it.
In time, this will incorporate itself into your vocabulary per key (ie, if the tune is in G Major you would use the E blues scale- or e minor pentatonic with the addition of a Bb).
Remember- jazz is an artists game. Yes, we have theory, but discovery happens through experimentation and experience. It's ok to not have a music theoretical idea at first as to why something sounds good to you: you can always figure that out later.
Comment: Welcome MLunzy!  Excellent first answer.

When to use Blues scales in jazz


Better understanding of the p-values in GAM and the output of summary()

Question: I am trying to model behaviour data using the mgcv package. I am using a beta distribution because the data ranges between $[0,1]$. Here is the GAM output:
Family: Beta regression(4.134)
Link function: logit

Formula:
FA ~ s(contrastGroupForTable, bs = "cs", by = experimentalGroupForTable,
    k = 2) + s(animalGroupForTable, bs = "re") + experimentalGroupForTable +
    rigGroupForTable + sexGroupForTable

Parametric coefficients:
                              Estimate Std. Error z value Pr(>|z|)
(Intercept)                    -0.6834     0.3655  -1.870   0.0615 .
experimentalGroupForTableeYFP   0.5792     0.3659   1.583   0.1135
rigGroupForTableRigB(Right)     0.8689     0.3659   2.375   0.0176 *
sexGroupForTableMale            0.4624     0.3659   1.264   0.2063
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Approximate significance of smooth terms:
                                                           edf Ref.df Chi.sq p-value
s(contrastGroupForTable):experimentalGroupForTableCasp3  1.991      2   1888  <2e-16 ***
s(contrastGroupForTable):experimentalGroupForTableeYFP   1.993      2   2000  <2e-16 ***
s(animalGroupForTable)                                  19.669     20   1401  <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

R-sq.(adj) =  0.765   Deviance explained =   81%
-REML = -1694.5  Scale est. = 1         n = 1681

I believe that I am fitting two splines, one for each experimentalGroupForTable, smoothing across contrastGroupForTable. I also have a random effect s(animalGroupForTable, bs = "re") and a couple of fixed effects.
The question I wanted to answer was: does the two GAM models fitted for each experimentalGroupForTable significantly differ from each other for predicting the value of FA? My interpretation now is since the $p$-value for experimentalGroupForTableeYFP is $> 0.05$, at this confidence interval, that my null hypothesis would be rejected. Rather, it looks like rigGroupForTable as a fixed effect has a significant effect to the model fit of the GAM.
Answer: Without knowing a ton about your data here, here is what I see from your output:

You have rightfully included the grouping factor as both a parametric term and a by-factor smooth. This means you have included mean group differences which can already be directly determined by the intercept. We can see in the parametric coefficients that "Casp 3" is the reference as the intercept and "YFP" is the contrast against that intercept, with a conditional mean increase of about $ 0.5792$, which means that the mean for this group in the response is higher. How high that is in practical terms only you can know given there is a lack of context provided by the question posted.
While here we see that $p = 0.1135$, rating this as statistically
significant or not isn't in and of itself important...there is about an
$11$% chance that you would observe this estimate or a more extreme estimate if
the null hypothesis is true. The null is almost never really true, so whether you think this distinction is important is up to you. Consider neoFisherian reporting if this is for a journal that cares about such things.
Note that $p$-values for smooth terms in GAMs are more approximate than typical $p$-values are concerned (technical discussion about this can be found here). With more "noise" in your data, I imagine $p$-values become less distinct in determining probability. The $\chi^2$ values are quite high, so I would imagine that this is not the case, but some visualization would help determine whether or not your data is fitting correctly.
The "rigGroupForTable" coefficient is indeed statistically significant if your alpha cutoff is $a = .05$.
Just for reference, this is not "two models" but simply one model with both parametric and smooth terms.

If you want more detailed answers, it may be advisable to provide further context in your question.
Comment: It is somewhat analogous to adjusted $R^2$ for a non-Gaussian response such as yours.
Comment: I understand your point about that this is not "two models" but simply one model with a **by** variable smooths - thanks for this point. Since I am here, how do you interpret **deviance explained** on the output? Is the **deviance explained** equivalent to the **$R^2$** for regressions?
Comment: Nice answer Shawn (+1)
Answer:
The question I wanted to answer was: does the two GAM models fitted for each experimentalGroupForTable significantly differ from each other for predicting the value of FA?

You can't actually tell that from this output (beyond the trivial difference that the groups have different mean values of the response, even though this difference is not statistically significant). The first two lines in the smooth terms section of the output are Wald-like tests against the null hypothesis of a flat constant function. As such, this output only tells you that each of the two estimated smooth functions differs from a constant, flat function. It doesn't provide any information whatsoever about the differences in the two smooths.
To answer this you'd need to use the model to estimate the difference between the two smooths (see ?difference_smooths for example in my {gratia} package for a way to do this), or reformulate the model such that it contains a difference smooth, by making experimentalGroupForTable an ordered factor (as one option) and fitting:
# make an ordered factor from your factor by variable
my_df <- my_df |>
  transform(expGrpOrd = ordered(experimentalGroupForTable))

# set the contrasts to be the usual treatment contrasts
contrasts(my_df$expGrpOrd) <_ "contr.treatment"

# fit the model, updated to use the ordered factor and a reference smooth
gam(FA ~ s(contrastGroupForTable, bs = "cs") +                     # !! <-- added
      s(contrastGroupForTable, bs = "cs", by = expGrpOrd, k = 2) + # !! <-- changed
      s(animalGroupForTable, bs = "re") +
      expGrpOrd +                                                  # !! <-- changed
      rigGroupForTable +
      sexGroupForTable,
    data = my_df, ....)

Now the first smooth, the one without the by argument will be for the reference group (level) of the factor, while the smooth generated by the s() term with the factor by will be a smooth difference from the reference smooth.
There are other ways to do this too; another is to fit the "average" smooth effect and then separate difference smooths one per level of the factor, which estimate how each group differs from the average. This is done using the sz basis, and importantly we don't want to include the factor by term as a parametric effect in this model:
gam(FA ~ s(contrastGroupForTable, bs = "cs") +            # !! <-- added
      s(contrastGroupForTable, experimentalGroupForTable,
        xt = list(bs = "cs"), k = 2) +                    # !! <-- changed
      s(animalGroupForTable, bs = "re") +
      rigGroupForTable +
      sexGroupForTable,
    data = my_df, ....)

In both cases I'm not sure what you hope to achieve by setting k so low?

My interpretation now is since the $p$-value for experimentalGroupForTableeYFP is >0.05, at this confidence interval, that my null hypothesis would be rejected.

This is back-to-front; you fail to reject the null hypothesis at the 95%


Infinite probability density

Question: Let's say I have a normally distributed random variable $X$ with mean $t$ and standard deviation $t^2$. That is,
$X \sim N (t,t^2)$
Here, $t$ is a parameter.
If I set $t$ equal to 0, then the probability density at $X=0$, for instance becomes: $ \frac {1} {(0)( \sqrt{2 \pi})} e^{(\frac{0} {0})^2}$, that is, as $X$ tends to 0, the probability density tends to infinity.
Is this a valid probability density function, with $t=0$?
Comment: You have discovered that probability densities are not good mathematical objects to work with when considering limits or extreme cases of families of probability distributions.  If you were to work with, say, the CDF or (even better) the characteristic function, you would encounter no difficulty with the case $t=0.$
Comment: Yes, it's valid. Have a look at the _delta function_ (e.g. https://en.wikipedia.org/wiki/Dirac_delta_function) and the _Heaviside step function_ (e.g. https://en.wikipedia.org/wiki/Heaviside_step_function).
Comment: There is no 'density' when $t=0$ in the sense that the distribution is no longer absolutely continuous.
Comment: Furthermore, $X=0$ is a zero probability event.
Answer: If $t=0$, you have normal distribution with mean 0 and variance 0. The latter means that your "random variable" $X$ is constant, the former means that this constant equals 0.
Comment: Thank you! So if I have a prior distribution for $t$, and I want to find the probability density of $X=0$, can I simple integrate $p(X=0|t=0)p(t=0)$ from - infinity to + infinity to get the value, even though the value at t=0 is infinity?

Infinite probability density


why is this null value not being serialized?

Question: So I've got  an object that we are serializing to gson, the end value is null.  But instead of showing up as null in the json object the whole key value pair for end is just missing from the json object.
Here is the POJO for the object.
public static class History {
   @NonNull
   public final String areaId;
   @NonNull
   public final String userId;
   public final long start;
   @Nullable
   public final Long end;
   public History(@NonNull String areaId, @NonNull String userId, long start, @Nullable Long end) {
        this.areaId = areaId;
        this.userId = userId;
        this.start = start;
        this.end = end;
   }
}

Here is the gson Builder
GsonBuilder()
    .serializeNulls()
    .registerTypeAdapter(Date.class, new DateFormatter())
    .setFieldNamingStrategy(fieldNamingStrategy)
    .create();

This is what the json actually looks like
areaUserHistories": {
         "aff824c6-df4f-49b4-8dea-6c204cb7bb16": {
         "areaId": "ca5f5e6f-77eb-4859-a2ad-c3b249e53493",
         "start": 1524178713,
         "userId": "911705136"
        }
    }

This is what it should look like,
areaUserHistories": {
         "aff824c6-df4f-49b4-8dea-6c204cb7bb16": {
         "areaId": "ca5f5e6f-77eb-4859-a2ad-c3b249e53493",
         "start": 1524178713,
         "end": null
         "userId": "911705136"
        }
    },

EIDT 1
So I was experimenting and I added this line of code to the GsonBuilder,  .setLongSerializationPolicy(LongSerializationPolicy.STRING)
so that the Gson Builder now turns Long values into a String.  This resulted in the end=null value being added correctly. Unfortunately the value needs to be a Long.
Comment: What key value pair? Please provide a [mcve].
Comment: Please show us some input and output
Comment: I've edited the question the "end" variable is the one that is null.   I've added actual json and expected json.
Comment: Show the code that uses the Gson instance. I can't reprodcue this behavior in a minimum sample when using GsonBuilder.serializeNulls.
Comment: @EricCochran  the GsonModule is being used in the Retrofit library and I have been unable to find the class that actually uses the GsonModule.
Comment: I've added an edit (edit 1) based on some experimentation.
Answer: GsonBuilder gsonBuilder = new GsonBuilder();

gsonBuilder.serializeNulls();

Gson gson = gsonBuilder.create();

String jsonString = gson.toJson(object);

Comment: The OP already has this exact code.  How does this answer the question?
Comment: No it isn't. Look closer
Comment: If you explain what makes this a relevant answer, he's not have to look at all.
Comment: While this code snippet may be the solution, [including an explanation](http://meta.stackexchange.com/questions/114762/explaining-entirely-code-based-answers) really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, and those people might not know the reasons for your code suggestion.


XML/XSL nub: Is it possible to create a COMPOSITE XML/XSLT document?

Question: I have just recently (like 2 days) started using XSLT documents with XML. I understand the basics and am able to generate a formatted document using an .XML document that references a separate .XSLT document.
My question, as in the subject, is "Is it possible to create a SINGLE, composite document that contains both the XML data and XSLT processing/formatting/styling and displays as formatted HTML?"
I am writing a desktop application in which I need to generate a formatted document on the fly from XML stored in the database.  I want to do this without creating or referencing any actual physical files.  I will generate a text string containing the XML/XSLT document and feed this to a WebBrowser component for formatted display.
Answer: What you are describing is called embedded stylesheets:
http://www.w3.org/TR/xslt#section-Embedding-Stylesheets
To answer your question, yes it is possible, but you have to check your processor's documentation to see if it's supported.
Comment: Hi Max.  Thank you so much for your reply and, indeed, for answering my question.

Unfortunately, as I believe you alluded to, it appears that IE does not support embedded stylesheets.  I found the following workaround:

  http://www.biglist.com/lists/lists.mulberrytech.com/xsl-list/archives/201002/msg00301.html

However, it requires reference to ApplyEmbeddedStylesheet.xsl; which defeats my intent of having a single, self-sufficient file--if I have to reference an external file, I might as well deploy and reference my own .xsl.

Thank you again!!

Jonathan Weekes
Comment: @user356740 If you need to associate it with an xml file so that it will work with xml, you can associate with the xml-stylesheet processing instruction.  See [here](http://www.edankert.com/transforms/xslt.associate.html).  IE will follow that instruction.  If you open an xml file with IE that uses that processing instruction and it can find the referenced stylesheet, it will apply the transform.  It isn't embedded in the single file, but I believe that is, as well as the solution you found, the best you can do with IE.


How do I import text file without column names into SAS format SAS Viya?

Question: I have a text file uploaded in workbench in SAS Viya without column headers. I need covert the file into SAS format and assign the column name myself which I have in word document. I get this code when I use the automated import function in SAS Viya but I don't know how to assign column names. Any help would be great!
proc sql;
%if %sysfunc(exist(WORK.NEWDATA)) %then %do;
    drop table WORK.NEWDATA;
%end;
%if %sysfunc(exist(WORK.NEWDATA,VIEW)) %then %do;
    drop view WORK.NEWDATA;
%end;
quit;

FILENAME LOC DISK '/workspace/workbench/myorg/data/home/olddatatoimport.txt';

PROC IMPORT DATAFILE=LOC
    DBMS=DLM
    OUT=WORK.NEWDATA;
    GETNAMES=YES;
RUN;

Comment: Show the structure of the data in the Word document.   Are you able to read the document with SAS ?  Does the Word document change often or is this a one-time affair ?
Comment: the data file is in text file format, the header names are in separate word document. I have the word document in different location. When I just use the import function in SAS viya (the code I provided) it just assings Var1 Var2 etc. But I would need the names to be Var1=State, Var2=City
Comment: Does the WORD document also describe what is in the variables (character strings, numbers, dates, times, datetimes)?  If so then skip forcing SAS to guess how to define the variables by using PROC IMPORT and instead just write a data step to read the file directly.
Answer: A RENAME statement can be used to change the default column names assigned by PROC IMPORT when GETNAMES=NO.
Example:
Presume the column names in the Word document were copy and pasted into SAS datalines
filename onlydata temp;

* create some sample data;

data _null_;
  file onlydata dlm=',';
  set sashelp.class(obs=3);
  put name age sex height weight;
run;

* log the sample data just to get a look-see;

data _null_;
  infile onlydata;
  input;
  put _infile_;
run;

* IMPORT the data only datafile, no names to get!;
* default column names are VAR1 to VAR<n>;

proc import file=onlydata replace out=onlydata dbms=csv;
  GETNAMES=NO;
run;

* presume the column names in the Word document are in the correct order
* (matching the data file) and were copy & pasted into the datalines;

data column_names(label="From WORD document");
  length name $32;
  input name;
datalines;
name
age
sex
height
weight
run;

* Construct the oldname=newname source code pairs for a RENAME statement;
data _null_;
  set column_names end=last_column;

  length pairs $32000;
  retain pairs;

  pairs = catx(' ', pairs, catx('=', cats('var',_n_), name));

  if last_column then
    call symput ('pairs', trim(pairs));
run;

* use Proc DATASET to modify the header portion of the datas set;
* will not rewrite the entire data set;

proc datasets nolist lib=work;
  modify onlydata;
  rename &pairs;
run;
quit;

%let syslast = onlydata;

log image of the look-see

data set with default PROC IMPORT column names

data set after RENAME statement applied via PROC DATASETS
Comment: Note that to make a CSV file you will want to use DSD option and not just change the delimiter. It won't make any difference in your example because the values in SASHELP.CLASS do not contain any commas.


Moving a DOM element between Bootstrap Tabs with AngularJS

Question: I'm working on a project that manages different times of media. The main page is organized into 3 tabs, Images, Videos, and Slideshows. The Image and Video tabs have each have a table that uses ng-repeat to create rows based on database information. The slideshow tab has an option to create a slideshow by selecting images or videos.
Since constructing the same large table multiple times is expensive, I wanted to move the contents of the image and video tabs into the slideshow tab when it's active. I also thought it would be nice if users could pick up from where they left off, so that's another reason why moving it is appealing. I'm fairly new to Angular, and I can't seem to figure out how to do this the Angular way. If I were just using jQuery, I could select the content wrapper, detach it, and append it to the slideshow tab, but that isn't an option in this case.
Right now, I have everything stored in one large HTML file. My first thought was to break the tab contents into partials and use ng-include in multiple places, but I don't think that would allow me to use the same elements. I've also tried using jqLite to append the elements, but I'm not sure how to select the html of the selected object, rather than the angular object itself.
What's the best way for me to go about reusing these existing DOM elements?
Edit: This is an internal project, so I can't link to a page right now or include all of the code, but I can write out the general structure.
<tabset>
    <tab heading="Images" id="image-tab">

 [HEADERS ARE HERE]

 [ROW INFO]

    </tab>
    <tab heading="Slideshows">

Add pictures using tables below

            <tabset>
                <tab heading="Second Image Tab">
                    [MOVE image-tab-content HERE]
                </tab>
            </tabset>

    </tab>
</tabset>

Hopefully that clarifies a little bit. I'm just trying to move the content of the image tab to the second image tab when you click on the slideshow tab.
Comment: Can you include some of your code or a link to the page?
Comment: I can't add full fledged code right now, but I've added a skeleton that should clear things up.
Answer: Not sure if this had been solved, but I am also facing similar situation. I needed to move DOM element outside of the angular tab into the content.
I didn't want to modify the DOM manually, but I couldn't find other way around it, so this is what I did (which should work for you as well.
$scope.tabs = [];
$scope.addTab = function(el) {
    var tab = { title: el.data("title")};
    $scope.tabs.push(tab);
    $scope.$apply();

    var index = $scope.tabs.length - 1;
    angular.element($element.find(".tab-pane").get(index)).find("span").append(el);
};

So as you can see, after adding a tab, I manually retrieve the new tab, and just move the element inside. In your case, you just need to do something similar.
I know this is against the AngularJS to manipulate the DOM, but until they have a way to accept element as content or have an example of it, this is how I got it working.
Hope this help.


Putting an ID on  in ASP.NET MVC

Question: I would like my views to be able to specify a class for the  tag, which lies in my master page.
My first take was to do something like this:
<asp:Content ContentPlaceHolderID="BodyClassContent" runat="server">
    view-item</asp:Content>

However, that would require this in the master page, which doesn't work:
<body class="<asp:ContentPlaceHolder ID="BodyClassContent" runat="server" />">

Any solutions to this?
Comment: JavaScript in your view can do if you don't want ViewModel to hold this ;-)
Comment: Another crazy idea is to have custom ViewPage class with your BodyCss property; not sure if you can set it early enough, but that's just an idea. Honestly, just use ViewData/ViewModel and you're set ;-) Or custom view engine like Spark.
Answer: In the layout you can do this on the body tag:

and then in your view you can do this:
@section BodyAttributes {
    id="login" class="login"
}

Edit: I also had to do this working with VB.NET and WebForms today and found a handy link for achieving the equivalent
Answer: I would suggest a different approach.
You create an hierachy of view models, starting with the MasterModel. When you instantiate a view object, you pass a body class to it.
public class MasterModel
{
    string BodyCss { get; set; }

    public MasterModel (string bodyCss)
    {
        BodyCss = bodyCss;
    }
}

public class MyView1Model : MasterModel
    : base ("body-view1")
{
}

Then in your master view which should be strongly typed to MasterView:
<%@ Master Language="C#" Inherits="System.Web.Mvc.ViewMasterPage<MasterModel>" %>

you just write:
<body class="<%= Model.BodyCss %>">

Comment: Good idea, but I would rather not have the class in my model – I want the view to solely responsible for layout, and thereby CSS.
Answer: You could also specify the body id attribute in the View which wishes to set it:
@{
ViewBag.Title = "Test";
ViewData["BodyID"] = "test";
Layout = "~/Views/Shared/_Layout.cshtml";}

This helps to decouple the view from the controller, the controller (and/or view model) does not need to know about the id attribute of the body tag.
Set the id of the body tag in the master page like so:

Comment: Good answer. The question was asked when MVC only came bundled with WebForms views - Razor makes this much nicer.
Answer: Why don't you do in your masterpage:
<body class="<%=ViewData["bodyClass"].toString()%>">

and then set ViewData["bodyClass"] in your Controller actions? That should be equivalent...

Putting an ID on  in ASP.NET MVC


Android Studio 2.3 AVD Manager Greyed out?

Question: I just recently installed Android Studio (Version 2.3) so I could use the SDK / AVD GUI manager built in now that the standalone is deprecated. I'm on Windows 10 and this is a fresh install. My goal is to be able to setup a virtual device as well as setup my own android device to run a NativeScript app. After install the SDK button is available, but the AVD button is disabled (below).

I have the Android 7.1.1 (Nougat) SDK Platform installed and the Intel x86 Emulator Acc. installed (below). This is all default installs so far.

I've tried installing / reinstalling as admin as well as opening as admin per this post to no avail.
The Android SDK home path, build target, and Java SDK are setup in the project structure by default correctly as well.
Any thoughts on what I'm missing here?
As a side note the android help page for creating AVD's lists a menu option (tools -> android ) which doesn't exist.
Comment: I also run into exact same problem.I tried all the possible things which you already have tried But nothing works
So i did workaround by Manually installing the from SDK Manager from platform-tools
Comment: Did you have, at least, one SDK Platform downloaded? If not, that's the reason of the grayed icon. I ask this because the tab screen you shared doesn't reveal that you have a 7.1.1 API SDK Platform.
Comment: Yeah Android studio comes with the 7.1.1 SDK platform installed (first tab). Really weird they don't just have everything working out of the box for a standard install.
Answer: My issue was Android Studio does not understand where to load the nativescript android project even after adding android as a platform (If someone knows a way around this, feel free to post). In my particular case I'm testing the angular-seed-advanced. To at least get the command line working (AVD manager is still greyed out):

Create a new blank android "test" project in android studio
The AVD Manager becomes available
Setup an virtual devices as necessary
Reopen nativescript project
use command npm run start.android
prepare, build, run and livesync will work as expected now.

Hope this helps someone else get started.


Input box key Up Check (Validation)

Question: my array
var foo = {};
    foo['xarr'] = [ "23" ];
    foo['yarr'] = [ "21","21","22","23","24"];
    foo['zarr']= [ "70","71","72","73","74","75" ];

Input box takes maximum 4 character and i have a array object
i want when a user enter first tow character and it matches from the array i want to add a class on a div.
if it matches from foo['xarr'] add some diffrent class,when it matches from foo['yarr'] add some diffrent class and so on.
my html markup:

        <input type="text" name="cnumber1" class="inputBx" style="width:58px;" maxlength="4" size="4"/>

Java Script
I was trying through this way but didnt get any success
$('.inputBx').keydown(function() {
         var inputVal = $(this).val(),
             iLen = inputVal.length;
             if( iLen >= 2){
                for(var key in foo) {
                  if( foo[key].indexOf(inputVal) >= 0){
                      if(foo[key] == 'xarr' )
                          $('.Images .test ').addClass('fullOpactiy');
                      if(foo[key] == 'yarr' )
                          $('.cardImages .test ').addClass('fullOpactiy');
                      if(foo[key] == 'zarr' )
                          $('.Images .test ').addClass('fullOpactiy');
                  }
                }
             }
      });

Answer: Something I don't understand in your code :
for(var key in foo) {
    if( foo[key].indexOf(inputVal) >= 0){
       if(foo[key] == 'xarr' ){
            //...
       }
    }
}

key is in foo object, so it's either xarr, yarr or zarr. Then foo[key] is a number array (which makes correct your sentence foo[key].indexOf(inputVal) >= 0). Why foo[key] would ever be equals to the string 'xarr', or 'yarr'?
I suggest this correction before continuing your research :
for(var key in foo) {
    var idx = foo[key].indexOf(inputVal); //search in the array
    if(  idx >= 0){
       if(key == 'yarr'){
            $('.cardImages .test ').addClass('fullOpactiy');
       }
       else{
          $('.Images .test ').addClass('fullOpacity');
       }
       return true;//ends your search now, no need to continue
    }
}

I think this matching algorithm is suboptimal, but it should work
cheers
Grooveek
Answer: this works for me here is aworking demo
var foo = [];
foo['xarr'] = ["23"];
foo['yarr'] = ["21", "21", "22", "23", "24"];
foo['zarr'] = ["70", "71", "72", "73", "74", "75"];

$('.inputBx').keyup(function() {
    var inputVal = this.value;
    iLen = inputVal.length;
    if (iLen >= 2) {
        if ($.inArray(inputVal, foo['xarr']) >= 0) {
            $('.Images, .test').addClass('fullOpactiy')
        }
        if ($.inArray(inputVal, foo['yarr']) >= 0) {
            $('.cardImages, .test').addClass('fullOpactiy')
        }
        if ($.inArray(inputVal, foo['zarr']) >=0) {
            $('.Images, .test').addClass('fullOpactiy')
        }
    }
});

Input box key Up Check (Validation)


Related Rates Answer correct?

Question: https://www.chegg.com/homework-help/questions-and-answers/car-traveling-north-toward-intersection-rate-60-kilometers-per-hour-truck-traveling-east-a-q26728328
I was given this solution.But i have two questions..
1.Do the units not matter while we calculate related rates? If it does, is the answer provided correct?
2.How did he/she end up with the 5mi there?
Thanks alot for your time..
Comment: I would always recommend converting all the units to SI units, especially in this case where there are mixed units.
Answer: First, let's convert the units to SI units:

4 mi = 6437 m
3 mi = 4828 m
5 mi = 8047 m
60 km/h = 16.67 m/s
50 km/h = 13.89 m/s

Let's denote the car's distance (towards south) from the intersection by $s(t)$ and the truck's distance (towards east) by $r(t)$. Their distance from each other is
$$
u^2(t) = s^2(t) + r^2(t)
$$
Differentiating both sides, we get
$$
2u u^{'} = 2s s^{'} + 2 r r^{'}
$$
where the prime denotes differentiation. Now, the rate of change of the distance between the two cars can be solved easily:
$$
u^{'} = \frac{s s^{'} +  r r^{'}}{u}
$$
Now we just have to plug in the values, remembering that the car is heading north, so that $s^{'}<0$:
 $$
u^{'} = \frac{\left(6437~\text{m}\right)\left(-16.67~\frac{\text{m}}{\text{s}}\right) +  \left( 4828~\text{}\right) \left( 13.89~\frac{\text{m}}{\text{s}}\right)}{8047~\text{m}} \approx -5~\frac{\text{m}}{\text{s}}
$$
Comment: how did you get the 5miles?
Comment: Pythagoras: $\sqrt{3^2 + 4^2} = 5$.

Related Rates Answer correct?


sharp ii dim 7th: How to use?

Question: Still here and working on part-writing. I have used a sharp ii dim7th chord, straight after  iihalfdim7- leading to V. Is this actually the right place to put it in terms of chord sequence/harmonic progression? Obviously, as we are in minor, the ii chord is also dissonant, so the progression has to be treated very carefully.
I have voiced the two chords as follows. The key is E minor:

Potential issues:
1.As you can see, in the ii half dim7, I have an augmented 4th between the tenors and alto. This dissonance does not resolve in the next chord, and instead becomes another augmented 4th interval , just half a step up (C-Fsharp, Csharp-F double sharp). Is this acceptable/unavoidable?

I have leapt into a dissonance from A to F sharp in the tenor (F sharp being the augmented 4th of the dissonance). Is this also unavoidable? (perhaps a remedy here is to double the E [5th] of the previous chord, allowing a move by step into the dissonance? although this would be unorthodox doubling).

Any help gratefully received!
Thanks
Ed
Comment: #ii in key Em is a simple G note - which means it's diatonic, so why use Fx?
Comment: @Tim ii in Em is F#, so #ii is Fx. G is iii in Em. The larger problem is that in standard theory there's no such thing as a #ii chord. It would be some kind of applied or common-tone chord. The progression here doesn't make harmonic sense -- at least not without additional context.
Comment: I agree. Knowing where the progression would/should go (and where it's coming from) would also be much more useful.
Comment: Maybe more to the point - why does OP want/need #ii?
Comment: @Tim, I'm guessing it's homework. :D
Answer: ♯ii°7 is really only used for one of two reasons, and in both cases it will be labeled differently:

As a vii°7/iii to tonicize iii. Notice that this really only works in major keys, because in minor the root of ♯ii is enharmonically equivalent to the root of III.

As a common-tone diminished seventh (often labeled CT°7) expanding tonic.

Since you're in minor, the second option is really the only viable use of this chord, in which case you will typically go from i to this "♯ii°7" back to i. And since the purpose of the CT°7 is often to keep the common tone in the same voice, this "♯ii°7" will typically be in third inversion so that the bass E stays constant throughout.
For more on the common-tone diminished seventh, see the first half of this answer.
Comment: @EdB123 Oh, interesting. In this case, that chord is best spelled with the raised fourth scale degree as root (a type of ♯iv°7 as opposed to ♯ii°7). This is enharmonic to ♯ii°7, but it's important to spell it with ♯iv as the root to show its function as a leading-tone chord resolving to V. That definitely happens, but I would say it comes after IV far more often than after ii.
Comment: Well, in minor, it wouldn't be enharmonically equivalent to the root of the target chord as long as the Fxdim7 chord then tonicizes some kind of G# chord instead of G. Pretty unlikely, of course.
Comment: thanks for such a great answer Richard. I remember reading somewhere that sharp ii dim 7 can be used as a leading note dim 7th to V. This is actually how i was planning on using it here. (sharp ii dim 7-V). Do you have any knowledge of this function?
Answer: You've discovered one of the tricks that Romantic piano music is based on-- throw layers and layers of dim7 chords one after the other, especially during your flashy crashy-bangy solo sections, and you'll get a dramatic sound that can end up on any key you want.
A fundamental rule in music is that raised tones rise.  An augmented F wants to resolve a half-step up: to G#.  I'd recommend g# minor, since it's going to be pretty easy to get to B7 and back to e.
One comment as a music teacher: write more NEATLY.  Get a thick mechanical pencil (0.5mm is good) with a soft lead.  And frame your page properly, because not doing so shows disrespect to the people whom you would like help from.
Comment: This comment sets a pretty high bar, so maybe it should not end with a preposition.
Comment: You think that was the kind of comment up with which the OP should not put? :D
Comment: Qui docet discit?
Comment: That's my main reason for being here.  There are quite a lot of smart cookies, here!

sharp ii dim 7th: How to use?


Existence of continuous path connecting points on a plane

Question: I've been thinking over this problem this weekend and although my investigations on it has led to other interesting theorems I am still nowhere close to solving it.

For any set of disjoint unordered pair of points (in $\mathbb{R}^2$), call it $S$, there is a set of simple continuous curves satisfying the following properties:

The set of end points for each curve is a member of $S$ and vice-versa
If two curves can intersect, then the intersection must be an end-point of one of the curves

I feel like I was able to give a proof for this when $S$ was countable using mathematical induction. Basically used that fact the plane remains connected when $|S|=1$ and if the plane is connected after adding a number of curves, it is possible to create an extra curve keeps it connected. So by induction if $S$ is countable then the constructed curves satisfy the given properties. I've never used mathematical induction in this manner so I'm not sure if this is a valid proof.
Anyway, I can not think of a way to go about proving or giving a counterexample for an uncountable $S$. I'm stuck even when I let $S$ be the closed unit square (with interior) which I suspect fails the conjecture. What if $S$ is nowhere dense? Will that always satisfy the conjecture?
Comment: Not sure what you are asking. Do you require one curve for each unordered pair of points $\in S$. If yes, the statement is false. Counter examples are the [complete graph](http://en.wikipedia.org/wiki/Complete_graph) $K_5$ and the [complete bipartite graph](http://en.wikipedia.org/wiki/Complete_bipartite_graph) $K_{3,3}$. They are non-planar graphs (i.e graph that cannot be embedded in the plane). In fact, Kuratowski has proved a [theorem](http://en.wikipedia.org/wiki/Kuratowski%27s_theorem) which assert a graph is planar iff it does not contains $K_5$ or $K_{3,3}$ as sub-graph.
Comment: I just realized I left out the $S$ forms a partition of the plane. For some reason, I wrote "distinct unordered pairs" when I meant "disjoint unordered pairs".
Answer: By the Brouwer fixed-point theorem, "every continuous function $f$ from a convex compact subset $K$ of a Euclidean space to $K$ itself has a fixed point". Because $[0,1]$ is a compact, convex subspace of $\mathbb R$, your bijection is impossible.
Indeed, if you are generalising up to $K=[0,1]\times[0,1]$, it's still impossible.
Comment: I guess I didn't think about your general investigation as much as the second part of your question. Where'd you come up with that map $f$ from your initial investigation?
Comment: Actually, sorry but the fixed-point theorem doesn't apply since $f$ need not be continuous. The thinking behind it was if there happened to be set of curves that work for $S$=unit square. Then I could define $f$ as the set of ordered end-points. Since the end-points share the same curve $f(f(x))=x$. So if I could show there's a fixed-point even when $f$ is discontinuous, then I would have a contradiction because end-points are distinct.
Comment: So if $S$ is defined as ordered pairs, then I guess what we want is two spaces $S_1$ and $S_2$ such that every path goes from $S_1$ to $S_2$.  Are we assuming those spaces are the same, e.g. paths from one copy of the unit interval to the other?
Comment: Yes, the two spaces are the same.
Comment: So I got an $f$ such an $x$ that doesn't have a fixed point. The second part of the question isn't any help to the first after all. Back to square one.
Answer: Let $S=\{c_n=\{x_n,y_n\} \mid n \geq 1\}$ be a set of disjoint pairs of points in $\mathbb{R}^2$. For convenience, let $C_0= \bigcup\limits_{n \geq 1}c_n$.
Notice that $\mathbb{R}^2 \backslash C_0$ is path connected, because between any points $x,y \in \mathbb{R}^2 \backslash C_0$ there are uncountably many disjoint linear piecewise paths whereas $C_0$ is countable. Let $X_1$ be the range of a path between $x_0$ and $y_0$ in $\mathbb{R}^2 \backslash C_0$.
By induction, suppose we have built $X_n$ such that $X_n$ is the union of paths connecting the pairs $c_k$, for $1 \leq k \leq n$ as required. Again, $\mathbb{R}^2 \backslash (X_n \cup C_0)$ is path connected, so you can introduce $X_{n+1}$ as the union of $X_n$ and the range of a path connecting $x_{n+1}$ and $y_{n+1}$ in $\mathbb{R}^2 \backslash (X_n \cup C_0)$.
Finally, set $X= \bigcup\limits_{n \geq 1} X_n$. By construction, $X$ is a countable disjoint union of ranges of paths connecting the pairs $c_n$. Moreover, the union is increasing, so two curves don't intersect (otherwise, they would interset in some $X_n$, impossible by construction).
Added: For a counterexample when $S$ is uncountable, take $S= ...$ (under edition).
Comment: I found a possible solution to the counterexample, so I finally tried to prove the property is true.
Comment: There is a problem only when you don't assume the axiom of choice: Asaf Karagila said that you need the principle of dependent choice to define $\cup f_n$.
Comment: This one is promising. One thing: I'm thinking of making $S_4 = \{\{(q,0),(q,1/2) | q \in \mathbb{Q}\cap (1,2) \}\}$. To avoid pairing $(1,0)$ with two points: $(1,1)$ in $S_1$ and $(1,1/2)$. Since $S$ is countable, I suspect there is a way to use the uncountable irrational "gaps" to construct the paths. I'll let you know what I find out.
Comment: I guess I could write my paper on this for my senior project next year :)
Comment: This is similar to my argument but I can't justify using induction on a countably infinite case. To the best of my knowledge, induction is applicable only to finite sets. Are you sure this is a valid proof?
Comment: $X$ is not built by induction: the $X_n$'s are. Here, $X$ is a kind of limit, possible because the sequence $(X_n)$ is increasing.
Comment: See Asaf's answer here on Finite Choice: http://math.stackexchange.com/a/64239/50955 He constructs $f_n$ just like you did but says he cannot set $f = \cup f_n$ to give a proof of the axiom of countable choice. I hope you see where my confusion lies.
Comment: I was hoping there may be a proof that doesn't require the axiom of choice since I'm not very familiar with it. But the more I think of it, the more this problem seems like the sort that must require some principle of choice.
Comment: Do you think we can prove the $S$ is uncountable case by using the Well-Ordering Theorem and transfinite induction?
Comment: The result is no longer true when $S$ is uncountable; I added a counterexample.
Comment: The problem is that whenever I think of an $S$ that could be a counterexample, I can't prove that it is. Which leads me to believe it has a solution that requires axiom of choice. E.g. $S = \{\{ (x,0), (x-1,0)\} | x \in (0,1) \}$.
Comment: (Using complex plane for the sake of brevity.) The $S$ I just proposed also has an easy solution:
$$f_x(\theta) = \begin{cases} xe^{i\theta}-1 & \theta \in [0, \pi] \\
(x+.5)e^{i\theta}-.5 & \theta \in [\pi, 2\pi] \end{cases}$$
But I can't prove if $S=\{\{e^{i\theta},e^{i(\theta+\pi)}\} | \theta \in [0,\pi) \}$ has a solution or not.
Comment: I proved a counterexample and I posted it as an answer. What do you think?
Answer: Proof of a counterexample when $S$ is uncountable. Using the complex plane, let $S=\{\{e^{i\theta}, e^{i(\theta+\pi)}\}~|~\theta \in [0,\pi) \}$.
Suppose $\mathcal{F}$ is a set of simple curves that satisfy the hypothesis.

By hypothesis, if two curves intersect, then the point of intersection is an endpoint for one of the curves.
There are at most two curves which only intersect the circle at endpoints. All other curves must cross the circle at least once. This has been modelled in following image:

I'll assume this model but it can also be proven when there are only $0$ or $1$ which don't cross the circle. Without loss of generality, there are uncountably many curves $\mathcal{F}_1$ that join "red points" and cross $B_1$. Similarly, for these points of intersections, $I \subset B_1$, let $\mathcal{F}_2$ be set of uncountable curves that join them to $B_2$ and crossing $R_2$ (without loss of generality again).
$\mathcal{F}' = \mathcal{F}_1 \cup \mathcal{F}_2$.
By intermediate value theorem, the curves in $\mathcal{F}'$ cross the $x$-axis. For each point $p \in I$, there are two distinct point, $x_1$ and $x_2$, corresponding points on the $x$-axis (one for a curve in $\mathcal{F}_1$ and another for $\mathcal{F}_2$). Since the curves don't cross, there is no other intersection point between $x_1$ and $x_2$. Let $x_p$ be the midpoint of $x_1$ and $x_2$. This forms a bijection between $x_p$ and $p$. Each $x_p$ is isolated and any set of isolated points is countable.$^1$ This is a contradiction as there is also bijection from each function in $\mathcal{F}_1$ to a given $p$.
Therefore, no such $\mathcal{F}$ exists for the given $S$.
$^1$ One of the interesting theorems I proved in my earlier investigations. Glad I could finally use it somewhere.


Writing IIS Redirect Rule

Question: Sorry, really struggling after Googling so hopefully somebody can help...
If I have a URL in the format {domain}/webinars/Product1, I would like to redirect to {domain}/webinars/Product2. Here is what I have (nb: the second rule to for the PHP controller):
<code><rewrite>
    <rules>
        <rule name="v2-r1">
            <match url="^/webinars/Product1" />
            <action type="Redirect" url="/webinars/Product2" appendQueryString="true" />
        </rule>

        <rule name="Hide-Controller" stopProcessing="true">
            <match url="^(.*)$" ignoreCase="false" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
            </conditions>
            <action type="Rewrite" url="index.php" appendQueryString="true" />
        </rule>
    </rules>
</rewrite>
</code>
If anybody can point me towards what I need to change I'd be very grateful - thanks.
Answer: Try this, I have tested, request localhost/webinars/Product1 will redirect to localhost/webinars/Product2.
<code>            <rules>
                <rule name="redirect" stopProcessing="true">
                    <match url="webinars/Product1" />
                    <action type="Redirect" url="webinars/Product2" />
                </rule>
            </rules>
</code>

Writing IIS Redirect Rule


calculate distance between two coordinates for car

Question:
Possible Duplicate:
Get the distance between two geo points

distanceTo(Location dest) or distanceBetween(double startLatitude, double startLongitude, double endLatitude, double endLongitude, float[] results)
is calculate distance for people walk or driving car?
How calculate distance between two coordinates for car?
Answer: A quick google leads me to a whole lot of formula working on coordinates, which includes what you are working on:
http://www.movable-type.co.uk/scripts/latlong.html
Answer: According to the docs the distance between two points is the straight way between them. If you want the distance between two cars and taking streets etc. into account you need more waypoints:

Computes the approximate distance in meters between two locations, and
  optionally the initial and final bearings of the shortest path between
  them. Distance and bearing are defined using the WGS84 ellipsoid.
Answer: you can get distance for 2 address by:
http://maps.googleapis.com/maps/api/distancematrix/xml?origins="+a+"&destinations="+b+"&mode=driving&language=en-EN&sensor=false
good luck.
Comment: what is a and b ?, but have only coordinates then ?
Comment: a,b is lat long or address


What's the best strategy to create initial data in production?

Question: I am creating a spring boot based user management service. I would need the service to be up with a few production ready users when the server is up. What is the best way to have the initial data such as user information etc ready when the service is launched?
I have referred https://docs.spring.io/spring-boot/docs/current/reference/html/howto.html#howto.data-initialization
Use of data.sql, ddl auto etc are mentioned here, but read in multiple articles that use of such configs are not recommened.
Also, planning to use the property: spring.datasource.url=jdbc:mysql://localhost:3306/users?createDatabaseIfNotExist=true to automatically create the database. Is it recommended to use this in production?
Help is needed with a few sample configurations that are used in production to automatically create the database, tables, and some initial data to launch the application.
Answer: I recommend to use database migration tools like Liquibase or Flyway
They are also very well integrated with Spring Boot:
https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#howto.data-initialization.migration-tool


How to insert a new line in a UILabel that uses NSString StringWithFormat

Question: I am using a UILabel in my storyboard to show a string of text. Then I am using dispatch_get_main_queue to change the text in the UILabel. The text is being cut off on-screen after dispatch_get_main_queue is being called. I have also tried \n which deletes the rest of the text completely.
/*slide*/
double delayInSecond8 = 5.0;
dispatch_time_t popTime8 = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSecond8 * NSEC_PER_SEC));
dispatch_after(popTime8, dispatch_get_main_queue(), ^(void){
    hello.text = [NSString stringWithFormat:@"You can also share\n your email address here"];

});

How can I add a new line to this method?
Answer: If you want your label to display multiple lines you need to specify that in its numberOfLines property:

This property controls the maximum number of lines to use in order to fit the label's text into its bounding rectangle. The default value for this property is 1. To remove any maximum limit, and use as many lines as needed, set the value of this property to 0.

You could set it either in code or in Attributes inspector in the storyoard:

Also make sure that the constraints of the label allows it to expand accordingly to its content.
Comment: @programcode check if the [lineBreakMode](https://developer.apple.com/documentation/uikit/uilabel/1620525-linebreakmode) property of the label is set to `byWordWrapping`. If this doesn't help then I'd check the constraints again - you can test it directly in the interface builder by adding long text to the label's text and see how it's handling it.
Comment: After making an auto layout adjustment allowing for further width of the UILabel and changing `Lines` to 2 in the storyboard, it still gets cut off. I'm not sure why.


Add item to dictionary which has same value in list of dictionary

Question: I am trying to add a key id with the same uuid.uuid4() into the inner dictionary when 'node' values are equal and a new uuid.uuid4() when a distinct uuid is found.
Let's say 2 keys ('node' in this case) have same value like-> node: 'Bangalore', so I want to generate the same ID for it and a fresh ID for every other distinct node.
This is the code I'm working on now:
import uuid
import json

node_list = [
  {
    "nodes": [
      {
         "node": "Kunal",
         "label": "PERSON"
      },
      {
         "node": "Bangalore",
         "label": "LOC"
      }
    ]
  },
  {
    "nodes": [
      {
         "node": "John",
         "label": "PERSON"
      },
      {
         "node": "Bangalore",
         "label": "LOC"
      }
    ]
  }
]

for outer_node_dict in node_list:
      for inner_dict in outer_node_dict["nodes"]:
            inner_dict['id'] = str(uuid.uuid4()) # Remember the key's value here and apply this statement somehow?

print(json.dumps(node_list, indent = True))

This is the response I want:
"[
  {
    "nodes": [
      {
         "node": "Kunal",
         "label": "PERSON",
         "id": "fbf094eb-8670-4c31-a641-4cf16c3596d1"
      },
      {
         "node": "Bangalore",
         "label": "LOC",
         "id": "24867c2a-f66a-4370-8c5d-8af5b9a25675"
      }
    ]
  },
  {
    "nodes": [
      {
         "node": "John",
         "label": "PERSON",
         "id": "5eddc375-ed3e-4f6a-81dc-3966590e8f35"
      },
      {
         "node": "Bangalore",
         "label": "LOC",
         "id": "24867c2a-f66a-4370-8c5d-8af5b9a25675"
      }
    ]
  }
]"

But currently its generating like this:
"[
 {
  "nodes": [
   {
    "node": "Kunal",
    "label": "PERSON",
    "id": "3cce6e36-9d1c-4058-a11b-2bcd0da96c83"
   },
   {
    "node": "Bangalore",
    "label": "LOC",
    "id": "4d860d3b-1835-4816-a372-050c1cc88fbb"
   }
  ]
 },
 {
  "nodes": [
   {
    "node": "John",
    "label": "PERSON",
    "id": "67fc9ba9-b591-44d4-a0ae-70503cda9dfe"
   },
   {
    "node": "Bangalore",
    "label": "LOC",
    "id": "f83025a0-7d8e-4ec8-b4a0-0bced982825f"
   }
  ]
 }
]"

How to remember key's value and apply the same ID for it in the dictionary?
Answer: Looks like you want the uuid to be the same for the same "node" value. So, instead of generating it, store it to a dict
node_uuids = defaultdict(lambda: uuid.uuid4())

and then, in your inner loop, instead of
inner_dict['id'] = str(uuid.uuid4())

you write
inner_dict['id'] = node_uuids[inner_dict['node']]

A complete working example is as follows:
from collections import defaultdict

import uuid
import json

node_list = [
  {
    "nodes": [
      {
         "node": "Kunal",
         "label": "PERSON"
      },
      {
         "node": "Bangalore",
         "label": "LOC"
      }
    ]
  },
  {
    "nodes": [
      {
         "node": "John",
         "label": "PERSON"
      },
      {
         "node": "Bangalore",
         "label": "LOC"
      }
    ]
  }
]

node_uuids = defaultdict(lambda: uuid.uuid4())

for outer_node_dict in node_list:
      for inner_dict in outer_node_dict["nodes"]:
            inner_dict['id'] = str(node_uuids[inner_dict['node']])

print(json.dumps(node_list, indent = True))

Comment: `node_uuids = defaultdict(lambda: uuid.uuid4())` where does this fit in?
Comment: @KunalMukherjee - check out [how does defaultdict work?](https://stackoverflow.com/questions/5900578/how-does-collections-defaultdict-work) which should clear it up for you.
Comment: @KunalMukherjee: the `defaultdict` generates a new uuid if one is not already stored in it


Operações com Data Frame

Question: Preciso fazer como a imagem abaixo. Como seria? Já consegui isolar as linhas que são somente zeros em todas as colunas com uso do subset(Base, VALOR1==0&VALOR2==0&VALOR3==0&VALOR4==0), porém não consigo fazer um tratamento entre o data frame que contém apenas zeros do data frame completo.

structure(list(CADASTRO = structure(c(8L, 1L, 6L, 9L, 7L, 3L,
5L, 4L, 2L), .Label = c("ANTONIA", "ANTONIO", "FABIO", "FILOMENA",
"MARCUS", "MARIA", "MONICA", "TEREZA", "THIAGO"), class = "factor"),
    VALOR1 = c(0L, 10L, 0L, 0L, 0L, 20L, 45L, 0L, 0L), VALOR2 = c(0L,
    0L, 0L, 0L, 0L, 30L, 32L, 0L, 23L), VALOR3 = c(0L, 20L, 0L,
    0L, 0L, 45L, 12L, 0L, 21L), VALOR4 = c(0L, 45L, 0L, 0L, 0L,
    90L, 22L, 0L, 100L), VALOR5 = structure(1:9, .Label = c("A",
    "B", "C", "D", "E", "F", "G", "H", "I"), class = "factor"),
    VALOR6 = structure(c(8L, 7L, 8L, 1L, 3L, 6L, 4L, 5L, 2L), .Label = c("",
    "*", "1", "2.2", "3", "D", "NOK", "OK"), class = "factor")), class = "data.frame", row.names = c(NA,
-9L))

> base
  CADASTRO VALOR1 VALOR2 VALOR3 VALOR4 VALOR5 VALOR6
1   TEREZA      0      0      0      0      A     OK
2  ANTONIA     10      0     20     45      B    NOK
3    MARIA      0      0      0      0      C     OK
4   THIAGO      0      0      0      0      D
5   MONICA      0      0      0      0      E      1
6    FABIO     20     30     45     90      F      D
7   MARCUS     45     32     12     22      G    2.2
8 FILOMENA      0      0      0      0      H      3
9  ANTONIO      0     23     21    100      I      *

> library(dplyr)
> dados = base %>% select('CADASTRO','VALOR1','VALOR2','VALOR3','VALOR4')
> dados
  CADASTRO VALOR1 VALOR2 VALOR3 VALOR4
1   TEREZA      0      0      0      0
2  ANTONIA     10      0     20     45
3    MARIA      0      0      0      0
4   THIAGO      0      0      0      0
5   MONICA      0      0      0      0
6    FABIO     20     30     45     90
7   MARCUS     45     32     12     22
8 FILOMENA      0      0      0      0
9  ANTONIO      0     23     21    100

> base_0 = subset(dados, VALOR1==0&VALOR2==0&VALOR3==0&VALOR4==0)
> base_0
  CADASTRO VALOR1 VALOR2 VALOR3 VALOR4
1   TEREZA      0      0      0      0
3    MARIA      0      0      0      0
4   THIAGO      0      0      0      0
5   MONICA      0      0      0      0
8 FILOMENA      0      0      0      0

Comment: Olá Fabio, mostre como seu código está até o momento para que possamos te ajudar de uma maneira melhor.
Comment: forneça os dados na pergunta pfv: https://pt.meta.stackoverflow.com/questions/6700/como-fazer-uma-pergunta-reproduz%C3%ADvel-em-r
Comment: Duvida melhor apresentada!
Answer: Você pode usar a mesma função subset() com o operador ! que significa uma negação. Mais informações aqui.
dados = subset(dados, !(VALOR1==0&VALOR2==0&VALOR3==0&VALOR4==0))

Answer: So para complementar a resposta acima. Podemos fazer isso de forma dinâmica (sem precisar nomear as colunas). Isso pode ser útil se você tiver um número grande de colunas ou se não tiver certeza da natureza das colunas. No seu exemplo, você está interessado somente nas colunas que têm como classe integer. Portanto, podemos primeiro filtrar quais colunas satisfazem essa condição:
cols <- sapply(dados, function(x) is.numeric(x))

cols <- names(which(cols==TRUE))

Inspecionando o objeto cols:
> cols
[1] "VALOR1" "VALOR2" "VALOR3" "VALOR4"

Agora vamos usar lapply() e Reduce(). lapply() por que precisamos de um objeto de tipo list em Reduce(). Reduce() irá combinar os objetos desta list um por um sucessivamente através da função especificada no seu primeiro argument .f. Portanto:
dados[!Reduce(`&`, lapply(cols, function(x) dados[[x]] == 0)), ]

Retorna:
  CADASTRO VALOR1 VALOR2 VALOR3 VALOR4 VALOR5 VALOR6
2  ANTONIA     10      0     20     45      B    NOK
6    FABIO     20     30     45     90      F      D
7   MARCUS     45     32     12     22      G    2.2
9  ANTONIO      0     23     21    100      I      *

Como explicado antes, a grande vantagem desse método é que ele generaliza para qualquer data.frame na qual você deseja aplicar a condição (no seu caso, retorne as linhas que não tenham todas as suas colunas de tipo integer preenchidas com 0).

Operações com Data Frame


Difference between fetch, ajax, and xhr

Question: What is the difference between these 3 calling methods? I'm using fetch in my current project and don't see any real difference between them. Why does there need to be 30 different ways to do things in javascript XD.
Thanks.
Comment: Possible duplicate of [What is the difference between fetch and jquery ajax?](https://stackoverflow.com/questions/43017576/what-is-the-difference-between-fetch-and-jquery-ajax)
Comment: ajax is just a term, unless you mean jQuery's ajax method which just uses xhr internally
Answer: Ajax is a buzzword meaning "Making an HTTP request from JavaScript without leaving the page".
XMLHttpRequest and fetch are APIs, provided by browsers, which allow HTTP requests to be made from JavaScript.

XMLHttpRequest has been around since the 90s and is event-driven, requiring that you bind event listeners to detect when data has arrived.
fetch is newer and built around Promises, which are now the prefered way to do asynchronous operations in JavaScript. It is sufficiently well established to be supported everywhere significant except in Internet Explorer. It does, however, lack certain features (such as progress monitoring) that XMLHttpRequest provides.

So in short, there are two (not 30) purpose-built ways to do Ajax, and one of them is modern.

For practical introductions on how to use either of them, MDN has you covered:

Using XMLHttpRequest
Using Fetch

There are also various libraries which wrap around fetch or XMLHttpRequest to provide APIs which are situationally more convenient (e.g. a consistent API between Node.js and browsers or integration with a framework like Angular).

Difference between fetch, ajax, and xhr


404 Page wont show / no .htaccess Wordpress

Question: I want to show my 404 error page when ever someone gets on a non working / non created page. After a long time of searching on the web I couldnt find any solution so I post one myself. I dont have any .htaccess file either i created it filled it in but in my FTP it kept saying nothing was safed in there and it didnt show any bytes so thats something im also worried of.
So how can i get my .htaccess file to work and show my 404 Error page template? I followed all the steps to make a 404.php file but i dont mind it to be redirected to the same template I made for it but then as a page any of those solutions is fine.
Comment: Have you tried `ErrorDocument 404 /path/to/404.html` in the .htaccess file; assuming your server is allowing you to upload one... which seems problematic from what you've said? An .htaccess file is simply a text file, called *.htaccess* - nothing more really, you shouldn't have any problems making one... http://httpd.apache.org/docs/2.2/mod/core.html#errordocument
Comment: not exactly with that many slashes but yes i did that and didnt do anything plus i dont think i can get my .htaccess file to work at all
Comment: Got some progress in it but got an error 500 now
Comment: Sounds like a syntax error in the .htaccess doc - that'll trigger an internal server error...
Comment: `# BEGIN WordPress

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
ErrorDocument 404 /httpdocs/wp-content/themes/avian/404.php

# END WordPress` is my .htaccess
Comment: and this is what it shows: http://www.viscongroup.eu/index.php/fdsaf
Comment: Ah - that set of Rewrites (`RewriteCond %{REQUEST_FILENAME} !-f` ... etc) redirects to the homepage if the requested resource is neither a file (`-f`) nor a directory (`-d`) - that's preventing your `ErrorDocument` from ever getting called... technically there can never *really* be a 404 error with that setup.
Comment: well how do i have to do my .htacces then just picked the basic wp one and the index.php in all my url's also annoys me how to fix both of them pretty clueless at the moment :S
Answer: You've got some rewrite rules in your .htaccess file that are preventing a 404 error from every truly happening...
<code>RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</code>
That basically states that if the requested resource is neither a file nor a directory (basically a 404 error), redirect to /index.php
Try this in your .htaccess:
<code># BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# delete the line below to have /index.php/anything trigger a 404
RewriteRule ^index\.php$ - [L]

</IfModule>
# END WordPress

#404 redirect
ErrorDocument 404 /httpdocs/wp-content/themes/avian/404.php
</code>
Note
This may make Wordpress quite unhappy however, I'm not sure how it uses internal routing, it may rely on breaking 404s to determine which pages to load by using fake (RESTful) URLs - reinstating 404 errors make cause Wordpress to stop working properly ... I am, however, no expert on it having barely ever touched it.
Comment: Are you still getting a `500` error ... if so it's possible the path to the 404 doc is wrong (which would cause a 404 error ... which would cause a 404 error ... ad inifinitum) so it goes to a `500` error.
Comment: There's still a rewrite in there so that `/index.php` will redirect and not 404 irrespective of what's after the `/index.php/...` - if you want to switch that off as well - delete the line `RewriteRule ^index\.php$ - [L]` from the .htaccess file. URLs like `viscongroup.eu/badgerbagdgerbadger` should 404 at the moment.