Title: Convert android vector drawable to SVG

Body:
How to convert this file to SVG?

<?xml version="1.0" encoding="utf-8"?>
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:height="dimension(28161)"
android:width="dimension(28161)"
android:viewportWidth="1121714176.000000"
android:viewportHeight="1121714176.000000">

<group
    android:translateX="1101529088.000000"
    android:translateY="1090519040.000000">

    <path
        android:name="hair1"
        android:fillColor="rgb8(0xff0572cc)"
        android:pathData="M13.6680389 87.8907808C13.6680389 87.8907808 15.555746 93.5954113 17.6983406 93.7540446C19.8409352 93.9126779 21.0469466 91.9482686 21.0469466 91.9482686C21.0469466 91.9482686 23.4880504 94.1488653 25.7751953 93.9919946C28.0640509 93.8342426 28.8073302 90.4068815 28.8073302 90.4068815C28.8073302 90.4068815 29.1896615 91.8416318 31.0277596 91.7323511C32.8658578 91.6230703 33.4945233 89.4118981 33.4945233 89.4118981C33.4945233 89.4118981 33.2011461 87.8907808 36.7362134 87.8907808C40.2712807 87.8907808 38.842492 70.768022 39.5040522 70.3760024C40.8990908 69.5502278 38.8873613 67.9154344 38.2407339 66.6796779C37.5941065 65.4439213 36.364146 65.8530872 37.7933978 64.6968266C39.2226495 63.5405659 38.2407339 60.9275226 38.2407339 60.9275226C38.2407339 60.9275226 38.5614816 59.0935451 37.7839892 57.4472838C37.0064968 55.8010224 34.0812777 53.6374402 34.0812777 53.6374402C34.0812777 53.6374402 36.0605049 50.1140178 36.4505341 46.8223764C36.8414186 43.530735 38.408378 38.5205659 36.2846006 37.2938016C34.1608232 36.0670372 32.6451834 34.7838699 33.6561801 33.2865476C34.6680322 31.788344 35.5926409 29.6476755 35.1855052 28.8879981C34.7783694 28.1274395 36.4761939 24.939791 35.7406125 24.2091964C35.0058864 23.4794832 33.3901734 21.613779 34.2985309 20.3323743C35.2068883 19.0500883 38.6863594 18.2639721 39.5040522 17.142082C40.321745 16.0201919 40.7955962 14.7617008 40.7955962 14.7617008C40.7955962 14.7617008 42.8321303 15.8148498 44.2023645 15.1908921C45.573454 14.5660531 47.1489667 11.3123074 47.1489667 11.3123074C47.1489667 11.3123074 48.3370161 13.1330654 50.9705686 12.7964102C53.6049763 12.4597551 53.7734758 11.0338178 53.7734758 11.0338178C53.7734758 11.0338178 56.7902148 12.6386582 59.4143587 12.0781538C62.0376472 11.5176494 62.625257 9.24126125 62.625257 9.24126125C62.625257 9.24126125 65.3417762 11.1378107 67.2063894 8.78122462C69.0710027 6.42463849 69.780069 3.40355502 67.8726893 3.16384244L65.9653097 2.92412987L66.0730809 4.83742398C66.0730809 4.83742398 65.2331496 0.75790373 63.6148705 0.899792423C61.9965915 1.04168112 61.6903843 2.03930845 61.6903843 2.03930845L62.4516256 3.15855466C62.4516256 3.15855466 61.9102034 1.48585442 59.561475 1.59160996C57.2136018 1.69648422 57.3136751 3.01314078 57.3136751 3.01314078C57.3136751 3.01314078 56.9664122 0.522597636 53.7195902 0.559612078C50.4736235 0.595745224 50.1109647 3.65208055 50.1109647 3.65208055C50.1109647 3.65208055 50.3094007 -0.0925471327 46.6383363 0.00175156402C42.967272 0.0960502607 43.5771203 4.06981497 43.5771203 4.06981497C43.5771203 4.06981497 41.3729421 0.78610521 36.7362134 3.4308752C32.0994846 6.07652648 34.7056666 10.5244286 34.7056666 10.5244286C34.7056666 10.5244286 32.092642 8.86759165 29.7832586 11.0223609C27.4747305 13.1771302 27.1642467 16.7014338 27.1642467 16.7014338C27.1642467 16.7014338 25.8453322 15.9787709 24.1073073 17.8744391C22.3692824 19.7718699 23.5376594 22.6722158 23.5376594 22.6722158C23.5376594 22.6722158 21.4874401 23.5579185 21.2659103 25.4227413C21.0452359 27.2884455 21.3428898 28.4226737 21.3428898 28.4226737C21.3428898 28.4226737 18.2962143 29.5031429 17.8257844 32.5612408C17.3544991 35.62022 18.1183063 36.4706709 18.1183063 36.4706709C18.1183063 36.4706709 15.9902522 38.0094141 15.0493923 39.5613768C14.1093877 41.1133394 14.6337033 43.0671732 14.6337033 43.0671732C14.6337033 43.0671732 12.6484888 43.4082348 11.1183085 45.3726441C9.58812812 47.3361721 10.5537925 50.1298812 10.5537925 50.1298812C10.5537925 50.1298812 8.9175516 50.2585504 7.84668195 52.9068456C6.7758123 55.5560221 7.35657946 57.037481 7.35657946 57.037481C7.35657946 57.037481 5.74172172 56.0724617 4.26115034 57.6226617C2.78057896 59.1728618 4.49636532 63.7256381 4.49636532 63.7256381C4.49636532 63.7256381 2.40680097 63.1281193 1.26836047 65.4344715C0.129919975 67.7408238 1.6087807 68.9385053 1.6087807 68.9385053C1.6087807 68.9385053 -0.334522693 71.0227709 0.0939962327 73.1925222L0.909978379 75.0309062C0.909978379 75.0309062 -1.31130635 79.8348519 1.18710439 82.0759883C3.68637046 84.3171246 5.49111085 83.0295508 5.49111085 83.0295508C5.49111085 83.0295508 3.1090246 85.4152197 4.91376499 87.4175247C6.71850538 89.420711 8.08446291 88.2529935 8.08446291 88.2529935C8.08446291 88.2529935 7.9835343 90.1292732 11.2491735 91.7543835C13.7775207 93.0128745 13.6680389 87.8907808 13.6680389 87.8907808Z"
        android:fillType="1" />

    <path
        android:pathData="M11.2491735 91.7543835C13.7775207 93.0128745 13.6680389 87.8907808 13.6680389 87.8907808C13.6680389 87.8907808 15.555746 93.5954113 17.6983406 93.7540446C19.8409352 93.9126779 21.0469466 91.9482686 21.0469466 91.9482686C21.0469466 91.9482686 23.4880504 94.1488653 25.7751953 93.9919946C28.0640509 93.8342426 28.8073302 90.4068815 28.8073302 90.4068815C28.8073302 90.4068815 29.1896615 91.8416318 31.0277596 91.7323511C32.8658578 91.6230703 33.2772702 89.8851542 34.0812777 87.8907808C34.3521489 87.2188739 37.7731929 88.6849417 38.2407339 86.236289C38.6264912 84.2159624 39.682448 81.9103573 39.5040522 79.1689654C39.256883 75.3707399 38.4604451 71.3828691 38.9977154 71.0644997C40.3927541 70.2387251 40.1506795 68.4816333 39.5040522 67.6482127C38.8574248 66.814792 36.364146 65.8530872 37.7933978 64.6968266C39.2226495 63.5405659 38.2407339 60.9275226 38.2407339 60.9275226C38.2407339 60.9275226 38.5614816 59.0935451 37.7839892 57.4472838C37.0064968 55.8010224 34.0812777 53.6374402 34.0812777 53.6374402C34.0812777 53.6374402 36.0605049 50.1140178 36.4505341 46.8223764C36.8414186 43.530735 38.408378 38.5205659 36.2846006 37.2938016C34.1608232 36.0670372 32.6451834 34.7838699 33.6561801 33.2865476C34.6680322 31.788344 35.5926409 29.6476755 35.1855052 28.8879981C34.7783694 28.1274395 36.4761939 24.939791 35.7406125 24.2091964C35.0058864 23.4794832 33.3901734 21.613779 34.2985309 20.3323743C35.2068883 19.0500883 38.6863594 18.2639721 39.5040522 17.142082C40.321745 16.0201919 40.7955962 14.7617008 40.7955962 14.7617008C40.7955962 14.7617008 42.8321303 15.8148498 44.2023645 15.1908921C45.573454 14.5660531 47.1489667 11.3123074 47.1489667 11.3123074C47.1489667 11.3123074 48.3370161 13.1330654 50.9705686 12.7964102C53.6049763 12.4597551 53.7734758 11.0338178 53.7734758 11.0338178C53.7734758 11.0338178 56.7902148 12.6386582 59.4143587 12.0781538C62.0376472 11.5176494 62.625257 9.24126125 62.625257 9.24126125C62.625257 9.24126125 65.3417762 11.1378107 67.2063894 8.78122462C69.0710027 6.42463849 69.780069 3.40355502 67.8726893 3.16384244L65.9653097 2.92412987L66.0730809 4.83742398C66.0730809 4.83742398 65.2331496 0.75790373 63.6148705 0.899792423C61.9965915 1.04168112 61.6903843 2.03930845 61.6903843 2.03930845L62.4516256 3.15855466C62.4516256 3.15855466 61.9102034 1.48585442 59.561475 1.59160996C57.2136018 1.69648422 57.3136751 3.01314078 57.3136751 3.01314078C57.3136751 3.01314078 56.9664122 0.522597636 53.7195902 0.559612078C50.4736235 0.595745224 50.1109647 3.65208055 50.1109647 3.65208055C50.1109647 3.65208055 50.3094007 -0.0925471327 46.6383363 0.00175156402C42.967272 0.0960502607 43.5771203 4.06981497 43.5771203 4.06981497C43.5771203 4.06981497 41.3729421 0.78610521 36.7362134 3.4308752C32.0994846 6.07652648 34.7056666 10.5244286 34.7056666 10.5244286C34.7056666 10.5244286 32.092642 8.86759165 29.7832586 11.0223609C27.4747305 13.1771302 27.1642467 16.7014338 27.1642467 16.7014338C27.1642467 16.7014338 25.8453322 15.9787709 24.1073073 17.8744391C22.3692824 19.7718699 23.5376594 22.6722158 23.5376594 22.6722158C23.5376594 22.6722158 21.4874401 23.5579185 21.2659103 25.4227413C21.0452359 27.2884455 21.3428898 28.4226737 21.3428898 28.4226737C21.3428898 28.4226737 18.2962143 29.5031429 17.8257844 32.5612408C17.3544991 35.62022 18.1183063 36.4706709 18.1183063 36.4706709C18.1183063 36.4706709 15.9902522 38.0094141 15.0493923 39.5613768C14.1093877 41.1133394 14.6337033 43.0671732 14.6337033 43.0671732C14.6337033 43.0671732 12.6484888 43.4082348 11.1183085 45.3726441C9.58812812 47.3361721 10.5537925 50.1298812 10.5537925 50.1298812C10.5537925 50.1298812 8.9175516 50.2585504 7.84668195 52.9068456C6.7758123 55.5560221 7.35657946 57.037481 7.35657946 57.037481C7.35657946 57.037481 5.74172172 56.0724617 4.26115034 57.6226617C2.78057896 59.1728618 4.49636532 63.7256381 4.49636532 63.7256381C4.49636532 63.7256381 2.40680097 63.1281193 1.26836047 65.4344715C0.129919975 67.7408238 1.6087807 68.9385053 1.6087807 68.9385053C1.6087807 68.9385053 -0.334522693 71.0227709 0.0939962327 73.1925222L0.909978379 75.0309062C0.909978379 75.0309062 -1.31130635 79.8348519 1.18710439 82.0759883C3.68637046 84.3171246 5.49111085 83.0295508 5.49111085 83.0295508C5.49111085 83.0295508 3.1090246 85.4152197 4.91376499 87.4175247C6.71850538 89.420711 8.08446291 88.2529935 8.08446291 88.2529935C8.08446291 88.2529935 7.9835343 90.1292732 11.2491735 91.7543835Z"
        android:strokeColor="rgb8(0xff000000)"
        android:strokeWidth="1065353216.000000" />
</group>
</vector>

I tried to change it manually and whith this tool, but I did not succeed.

Here is my attempt to convert manually. It doesn't throw any errors, but it doesn't display anything.

<svg xmlns="http://www.w3.org/2000/svg"
height="28161"
width="28161"
viewBox="0 0 1121714176.000000 1121714176.000000">

<g transform="translate(1101529088.000000 1101529088.000000)">
    <path
        name="hair1"
        fill="rgb8(0xff0572cc)"
        d="M13.6680389 87.8907808C13.6680389 87.8907808 15.555746 93.5954113 17.6983406 93.7540446C19.8409352 93.9126779 21.0469466 91.9482686 21.0469466 91.9482686C21.0469466 91.9482686 23.4880504 94.1488653 25.7751953 93.9919946C28.0640509 93.8342426 28.8073302 90.4068815 28.8073302 90.4068815C28.8073302 90.4068815 29.1896615 91.8416318 31.0277596 91.7323511C32.8658578 91.6230703 33.4945233 89.4118981 33.4945233 89.4118981C33.4945233 89.4118981 33.2011461 87.8907808 36.7362134 87.8907808C40.2712807 87.8907808 38.842492 70.768022 39.5040522 70.3760024C40.8990908 69.5502278 38.8873613 67.9154344 38.2407339 66.6796779C37.5941065 65.4439213 36.364146 65.8530872 37.7933978 64.6968266C39.2226495 63.5405659 38.2407339 60.9275226 38.2407339 60.9275226C38.2407339 60.9275226 38.5614816 59.0935451 37.7839892 57.4472838C37.0064968 55.8010224 34.0812777 53.6374402 34.0812777 53.6374402C34.0812777 53.6374402 36.0605049 50.1140178 36.4505341 46.8223764C36.8414186 43.530735 38.408378 38.5205659 36.2846006 37.2938016C34.1608232 36.0670372 32.6451834 34.7838699 33.6561801 33.2865476C34.6680322 31.788344 35.5926409 29.6476755 35.1855052 28.8879981C34.7783694 28.1274395 36.4761939 24.939791 35.7406125 24.2091964C35.0058864 23.4794832 33.3901734 21.613779 34.2985309 20.3323743C35.2068883 19.0500883 38.6863594 18.2639721 39.5040522 17.142082C40.321745 16.0201919 40.7955962 14.7617008 40.7955962 14.7617008C40.7955962 14.7617008 42.8321303 15.8148498 44.2023645 15.1908921C45.573454 14.5660531 47.1489667 11.3123074 47.1489667 11.3123074C47.1489667 11.3123074 48.3370161 13.1330654 50.9705686 12.7964102C53.6049763 12.4597551 53.7734758 11.0338178 53.7734758 11.0338178C53.7734758 11.0338178 56.7902148 12.6386582 59.4143587 12.0781538C62.0376472 11.5176494 62.625257 9.24126125 62.625257 9.24126125C62.625257 9.24126125 65.3417762 11.1378107 67.2063894 8.78122462C69.0710027 6.42463849 69.780069 3.40355502 67.8726893 3.16384244L65.9653097 2.92412987L66.0730809 4.83742398C66.0730809 4.83742398 65.2331496 0.75790373 63.6148705 0.899792423C61.9965915 1.04168112 61.6903843 2.03930845 61.6903843 2.03930845L62.4516256 3.15855466C62.4516256 3.15855466 61.9102034 1.48585442 59.561475 1.59160996C57.2136018 1.69648422 57.3136751 3.01314078 57.3136751 3.01314078C57.3136751 3.01314078 56.9664122 0.522597636 53.7195902 0.559612078C50.4736235 0.595745224 50.1109647 3.65208055 50.1109647 3.65208055C50.1109647 3.65208055 50.3094007 -0.0925471327 46.6383363 0.00175156402C42.967272 0.0960502607 43.5771203 4.06981497 43.5771203 4.06981497C43.5771203 4.06981497 41.3729421 0.78610521 36.7362134 3.4308752C32.0994846 6.07652648 34.7056666 10.5244286 34.7056666 10.5244286C34.7056666 10.5244286 32.092642 8.86759165 29.7832586 11.0223609C27.4747305 13.1771302 27.1642467 16.7014338 27.1642467 16.7014338C27.1642467 16.7014338 25.8453322 15.9787709 24.1073073 17.8744391C22.3692824 19.7718699 23.5376594 22.6722158 23.5376594 22.6722158C23.5376594 22.6722158 21.4874401 23.5579185 21.2659103 25.4227413C21.0452359 27.2884455 21.3428898 28.4226737 21.3428898 28.4226737C21.3428898 28.4226737 18.2962143 29.5031429 17.8257844 32.5612408C17.3544991 35.62022 18.1183063 36.4706709 18.1183063 36.4706709C18.1183063 36.4706709 15.9902522 38.0094141 15.0493923 39.5613768C14.1093877 41.1133394 14.6337033 43.0671732 14.6337033 43.0671732C14.6337033 43.0671732 12.6484888 43.4082348 11.1183085 45.3726441C9.58812812 47.3361721 10.5537925 50.1298812 10.5537925 50.1298812C10.5537925 50.1298812 8.9175516 50.2585504 7.84668195 52.9068456C6.7758123 55.5560221 7.35657946 57.037481 7.35657946 57.037481C7.35657946 57.037481 5.74172172 56.0724617 4.26115034 57.6226617C2.78057896 59.1728618 4.49636532 63.7256381 4.49636532 63.7256381C4.49636532 63.7256381 2.40680097 63.1281193 1.26836047 65.4344715C0.129919975 67.7408238 1.6087807 68.9385053 1.6087807 68.9385053C1.6087807 68.9385053 -0.334522693 71.0227709 0.0939962327 73.1925222L0.909978379 75.0309062C0.909978379 75.0309062 -1.31130635 79.8348519 1.18710439 82.0759883C3.68637046 84.3171246 5.49111085 83.0295508 5.49111085 83.0295508C5.49111085 83.0295508 3.1090246 85.4152197 4.91376499 87.4175247C6.71850538 89.420711 8.08446291 88.2529935 8.08446291 88.2529935C8.08446291 88.2529935 7.9835343 90.1292732 11.2491735 91.7543835C13.7775207 93.0128745 13.6680389 87.8907808 13.6680389 87.8907808Z"
        fill-rule="1" />

    <path
        d="M11.2491735 91.7543835C13.7775207 93.0128745 13.6680389 87.8907808 13.6680389 87.8907808C13.6680389 87.8907808 15.555746 93.5954113 17.6983406 93.7540446C19.8409352 93.9126779 21.0469466 91.9482686 21.0469466 91.9482686C21.0469466 91.9482686 23.4880504 94.1488653 25.7751953 93.9919946C28.0640509 93.8342426 28.8073302 90.4068815 28.8073302 90.4068815C28.8073302 90.4068815 29.1896615 91.8416318 31.0277596 91.7323511C32.8658578 91.6230703 33.2772702 89.8851542 34.0812777 87.8907808C34.3521489 87.2188739 37.7731929 88.6849417 38.2407339 86.236289C38.6264912 84.2159624 39.682448 81.9103573 39.5040522 79.1689654C39.256883 75.3707399 38.4604451 71.3828691 38.9977154 71.0644997C40.3927541 70.2387251 40.1506795 68.4816333 39.5040522 67.6482127C38.8574248 66.814792 36.364146 65.8530872 37.7933978 64.6968266C39.2226495 63.5405659 38.2407339 60.9275226 38.2407339 60.9275226C38.2407339 60.9275226 38.5614816 59.0935451 37.7839892 57.4472838C37.0064968 55.8010224 34.0812777 53.6374402 34.0812777 53.6374402C34.0812777 53.6374402 36.0605049 50.1140178 36.4505341 46.8223764C36.8414186 43.530735 38.408378 38.5205659 36.2846006 37.2938016C34.1608232 36.0670372 32.6451834 34.7838699 33.6561801 33.2865476C34.6680322 31.788344 35.5926409 29.6476755 35.1855052 28.8879981C34.7783694 28.1274395 36.4761939 24.939791 35.7406125 24.2091964C35.0058864 23.4794832 33.3901734 21.613779 34.2985309 20.3323743C35.2068883 19.0500883 38.6863594 18.2639721 39.5040522 17.142082C40.321745 16.0201919 40.7955962 14.7617008 40.7955962 14.7617008C40.7955962 14.7617008 42.8321303 15.8148498 44.2023645 15.1908921C45.573454 14.5660531 47.1489667 11.3123074 47.1489667 11.3123074C47.1489667 11.3123074 48.3370161 13.1330654 50.9705686 12.7964102C53.6049763 12.4597551 53.7734758 11.0338178 53.7734758 11.0338178C53.7734758 11.0338178 56.7902148 12.6386582 59.4143587 12.0781538C62.0376472 11.5176494 62.625257 9.24126125 62.625257 9.24126125C62.625257 9.24126125 65.3417762 11.1378107 67.2063894 8.78122462C69.0710027 6.42463849 69.780069 3.40355502 67.8726893 3.16384244L65.9653097 2.92412987L66.0730809 4.83742398C66.0730809 4.83742398 65.2331496 0.75790373 63.6148705 0.899792423C61.9965915 1.04168112 61.6903843 2.03930845 61.6903843 2.03930845L62.4516256 3.15855466C62.4516256 3.15855466 61.9102034 1.48585442 59.561475 1.59160996C57.2136018 1.69648422 57.3136751 3.01314078 57.3136751 3.01314078C57.3136751 3.01314078 56.9664122 0.522597636 53.7195902 0.559612078C50.4736235 0.595745224 50.1109647 3.65208055 50.1109647 3.65208055C50.1109647 3.65208055 50.3094007 -0.0925471327 46.6383363 0.00175156402C42.967272 0.0960502607 43.5771203 4.06981497 43.5771203 4.06981497C43.5771203 4.06981497 41.3729421 0.78610521 36.7362134 3.4308752C32.0994846 6.07652648 34.7056666 10.5244286 34.7056666 10.5244286C34.7056666 10.5244286 32.092642 8.86759165 29.7832586 11.0223609C27.4747305 13.1771302 27.1642467 16.7014338 27.1642467 16.7014338C27.1642467 16.7014338 25.8453322 15.9787709 24.1073073 17.8744391C22.3692824 19.7718699 23.5376594 22.6722158 23.5376594 22.6722158C23.5376594 22.6722158 21.4874401 23.5579185 21.2659103 25.4227413C21.0452359 27.2884455 21.3428898 28.4226737 21.3428898 28.4226737C21.3428898 28.4226737 18.2962143 29.5031429 17.8257844 32.5612408C17.3544991 35.62022 18.1183063 36.4706709 18.1183063 36.4706709C18.1183063 36.4706709 15.9902522 38.0094141 15.0493923 39.5613768C14.1093877 41.1133394 14.6337033 43.0671732 14.6337033 43.0671732C14.6337033 43.0671732 12.6484888 43.4082348 11.1183085 45.3726441C9.58812812 47.3361721 10.5537925 50.1298812 10.5537925 50.1298812C10.5537925 50.1298812 8.9175516 50.2585504 7.84668195 52.9068456C6.7758123 55.5560221 7.35657946 57.037481 7.35657946 57.037481C7.35657946 57.037481 5.74172172 56.0724617 4.26115034 57.6226617C2.78057896 59.1728618 4.49636532 63.7256381 4.49636532 63.7256381C4.49636532 63.7256381 2.40680097 63.1281193 1.26836047 65.4344715C0.129919975 67.7408238 1.6087807 68.9385053 1.6087807 68.9385053C1.6087807 68.9385053 -0.334522693 71.0227709 0.0939962327 73.1925222L0.909978379 75.0309062C0.909978379 75.0309062 -1.31130635 79.8348519 1.18710439 82.0759883C3.68637046 84.3171246 5.49111085 83.0295508 5.49111085 83.0295508C5.49111085 83.0295508 3.1090246 85.4152197 4.91376499 87.4175247C6.71850538 89.420711 8.08446291 88.2529935 8.08446291 88.2529935C8.08446291 88.2529935 7.9835343 90.1292732 11.2491735 91.7543835Z"
        stroke="rgb8(0xff000000)"
        stroke-width="1065353216.000000" />
</g>
</svg>

Body:
Actually the aforementioned converter works pretty fine.

But the huge transform and viewBox values are rather odd.

Removing them will result in a visible svg:

let svg = document.querySelector('svg')
console.log(svg.getBBox())

svg{
  display:inline-block;
  width:10em;
  border: 1px solid #ccc
}

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 69 94" id="vector">
  <g id="group">
    <path fill="rgba(255, 5, 114, 0.8)" id="hair1" d="M 13.668 87.891 C 13.668 87.891 15.556 93.595 17.698 93.754 C 19.841 93.913 21.047 91.948 21.047 91.948 C 21.047 91.948 23.488 94.149 25.775 93.992 C 28.064 93.834 28.807 90.407 28.807 90.407 C 28.807 90.407 29.19 91.842 31.028 91.732 C 32.866 91.623 33.495 89.412 33.495 89.412 C 33.495 89.412 33.201 87.891 36.736 87.891 C 40.271 87.891 38.842 70.768 39.504 70.376 C 40.899 69.55 38.887 67.915 38.241 66.68 C 37.594 65.444 36.364 65.853 37.793 64.697 C 39.223 63.541 38.241 60.928 38.241 60.928 C 38.241 60.928 38.561 59.094 37.784 57.447 C 37.006 55.801 34.081 53.637 34.081 53.637 C 34.081 53.637 36.061 50.114 36.451 46.822 C 36.841 43.531 38.408 38.521 36.285 37.294 C 34.161 36.067 32.645 34.784 33.656 33.287 C 34.668 31.788 35.593 29.648 35.186 28.888 C 34.778 28.127 36.476 24.94 35.741 24.209 C 35.006 23.479 33.39 21.614 34.299 20.332 C 35.207 19.05 38.686 18.264 39.504 17.142 C 40.322 16.02 40.796 14.762 40.796 14.762 C 40.796 14.762 42.832 15.815 44.202 15.191 C 45.573 14.566 47.149 11.312 47.149 11.312 C 47.149 11.312 48.337 13.133 50.971 12.796 C 53.605 12.46 53.773 11.034 53.773 11.034 C 53.773 11.034 56.79 12.639 59.414 12.078 C 62.038 11.518 62.625 9.241 62.625 9.241 C 62.625 9.241 65.342 11.138 67.206 8.781 C 69.071 6.425 69.78 3.404 67.873 3.164 L 65.965 2.924 L 66.073 4.837 C 66.073 4.837 65.233 0.758 63.615 0.9 C 61.997 1.042 61.69 2.039 61.69 2.039 L 62.452 3.159 C 62.452 3.159 61.91 1.486 59.561 1.592 C 57.214 1.696 57.314 3.013 57.314 3.013 C 57.314 3.013 56.966 0.523 53.72 0.56 C 50.474 0.596 50.111 3.652 50.111 3.652 C 50.111 3.652 50.309 -0.093 46.638 0.002 C 42.967 0.096 43.577 4.07 43.577 4.07 C 43.577 4.07 41.373 0.786 36.736 3.431 C 32.099 6.077 34.706 10.524 34.706 10.524 C 34.706 10.524 32.093 8.868 29.783 11.022 C 27.475 13.177 27.164 16.701 27.164 16.701 C 27.164 16.701 25.845 15.979 24.107 17.874 C 22.369 19.772 23.538 22.672 23.538 22.672 C 23.538 22.672 21.487 23.558 21.266 25.423 C 21.045 27.288 21.343 28.423 21.343 28.423 C 21.343 28.423 18.296 29.503 17.826 32.561 C 17.354 35.62 18.118 36.471 18.118 36.471 C 18.118 36.471 15.99 38.009 15.049 39.561 C 14.109 41.113 14.634 43.067 14.634 43.067 C 14.634 43.067 12.648 43.408 11.118 45.373 C 9.588 47.336 10.554 50.13 10.554 50.13 C 10.554 50.13 8.918 50.259 7.847 52.907 C 6.776 55.556 7.357 57.037 7.357 57.037 C 7.357 57.037 5.742 56.072 4.261 57.623 C 2.781 59.173 4.496 63.726 4.496 63.726 C 4.496 63.726 2.407 63.128 1.268 65.434 C 0.13 67.741 1.609 68.939 1.609 68.939 C 1.609 68.939 -0.335 71.023 0.094 73.193 L 0.91 75.031 C 0.91 75.031 -1.311 79.835 1.187 82.076 C 3.686 84.317 5.491 83.03 5.491 83.03 C 5.491 83.03 3.109 85.415 4.914 87.418 C 6.719 89.421 8.084 88.253 8.084 88.253 C 8.084 88.253 7.984 90.129 11.249 91.754 C 13.778 93.013 13.668 87.891 13.668 87.891 Z" fill-rule="evenodd" />
    <path id="path" d="M 11.249 91.754 C 13.778 93.013 13.668 87.891 13.668 87.891 C 13.668 87.891 15.556 93.595 17.698 93.754 C 19.841 93.913 21.047 91.948 21.047 91.948 C 21.047 91.948 23.488 94.149 25.775 93.992 C 28.064 93.834 28.807 90.407 28.807 90.407 C 28.807 90.407 29.19 91.842 31.028 91.732 C 32.866 91.623 33.277 89.885 34.081 87.891 C 34.352 87.219 37.773 88.685 38.241 86.236 C 38.626 84.216 39.682 81.91 39.504 79.169 C 39.257 75.371 38.46 71.383 38.998 71.064 C 40.393 70.239 40.151 68.482 39.504 67.648 C 38.857 66.815 36.364 65.853 37.793 64.697 C 39.223 63.541 38.241 60.928 38.241 60.928 C 38.241 60.928 38.561 59.094 37.784 57.447 C 37.006 55.801 34.081 53.637 34.081 53.637 C 34.081 53.637 36.061 50.114 36.451 46.822 C 36.841 43.531 38.408 38.521 36.285 37.294 C 34.161 36.067 32.645 34.784 33.656 33.287 C 34.668 31.788 35.593 29.648 35.186 28.888 C 34.778 28.127 36.476 24.94 35.741 24.209 C 35.006 23.479 33.39 21.614 34.299 20.332 C 35.207 19.05 38.686 18.264 39.504 17.142 C 40.322 16.02 40.796 14.762 40.796 14.762 C 40.796 14.762 42.832 15.815 44.202 15.191 C 45.573 14.566 47.149 11.312 47.149 11.312 C 47.149 11.312 48.337 13.133 50.971 12.796 C 53.605 12.46 53.773 11.034 53.773 11.034 C 53.773 11.034 56.79 12.639 59.414 12.078 C 62.038 11.518 62.625 9.241 62.625 9.241 C 62.625 9.241 65.342 11.138 67.206 8.781 C 69.071 6.425 69.78 3.404 67.873 3.164 L 65.965 2.924 L 66.073 4.837 C 66.073 4.837 65.233 0.758 63.615 0.9 C 61.997 1.042 61.69 2.039 61.69 2.039 L 62.452 3.159 C 62.452 3.159 61.91 1.486 59.561 1.592 C 57.214 1.696 57.314 3.013 57.314 3.013 C 57.314 3.013 56.966 0.523 53.72 0.56 C 50.474 0.596 50.111 3.652 50.111 3.652 C 50.111 3.652 50.309 -0.093 46.638 0.002 C 42.967 0.096 43.577 4.07 43.577 4.07 C 43.577 4.07 41.373 0.786 36.736 3.431 C 32.099 6.077 34.706 10.524 34.706 10.524 C 34.706 10.524 32.093 8.868 29.783 11.022 C 27.475 13.177 27.164 16.701 27.164 16.701 C 27.164 16.701 25.845 15.979 24.107 17.874 C 22.369 19.772 23.538 22.672 23.538 22.672 C 23.538 22.672 21.487 23.558 21.266 25.423 C 21.045 27.288 21.343 28.423 21.343 28.423 C 21.343 28.423 18.296 29.503 17.826 32.561 C 17.354 35.62 18.118 36.471 18.118 36.471 C 18.118 36.471 15.99 38.009 15.049 39.561 C 14.109 41.113 14.634 43.067 14.634 43.067 C 14.634 43.067 12.648 43.408 11.118 45.373 C 9.588 47.336 10.554 50.13 10.554 50.13 C 10.554 50.13 8.918 50.259 7.847 52.907 C 6.776 55.556 7.357 57.037 7.357 57.037 C 7.357 57.037 5.742 56.072 4.261 57.623 C 2.781 59.173 4.496 63.726 4.496 63.726 C 4.496 63.726 2.407 63.128 1.268 65.434 C 0.13 67.741 1.609 68.939 1.609 68.939 C 1.609 68.939 -0.335 71.023 0.094 73.193 L 0.91 75.031 C 0.91 75.031 -1.311 79.835 1.187 82.076 C 3.686 84.317 5.491 83.03 5.491 83.03 C 5.491 83.03 3.109 85.415 4.914 87.418 C 6.719 89.421 8.084 88.253 8.084 88.253 C 8.084 88.253 7.984 90.129 11.249 91.754 Z" stroke-width="1" stroke="red" stroke-width="1" fill="none" />
  </g>
</svg>

You can get the proper viewBox dimension via getBBox() in js.

Besides, the tool can't convert hex rgba color values.

But you can easily convert them to rgba by a color converter.


来源: stackexchange

问:
Adding dictionaries in lists using heappush
I've been trying to add dictionaries to a list using the heappush function. The first heappush statement works fine, and the print statement after that is executed.

```<code>#random tests
node1 = {'a':1, 'b':2, 'c':3}
node2 = {'c':4, 'd':5, 'e':6}
lists = []
heappush(lists, node1)
print(lists)
heappush(lists, node2)
</code>```

However, when I try to execute the second heappush statement, it gives me the following error.

```<code>[{'a': 1, 'b': 2, 'c': 3}]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-24-c680e53f9699> in <module>()
      5 heappush(lists, node1)
      6 print(lists)
----> 7 heappush(lists, node2)

TypeError: '<' not supported between instances of 'dict' and 'dict'
</code>```

Why is that? I know I can use append function to append dictionaries to the list, but I want to use heappush instead

答:
The heap data structure stores the elements in the list in a specific format, so that the pop() and push() functions are both O(log n). When putting a new element in the heap, we need to compare it with the other objects in the heap to determine position of the new item in the list, which is done using the comparison operators <.

Python dicts don't have comparison operators defined to decide which dict is smaller/larger than the other. What is your use case for putting dicts into a heap? If you want to have some kind of sorted order with dicts you will need to define the comparator methods for the dict on your own.

ContentLicense: CC BY-SA 4.0

Body:
I've been trying to add dictionaries to a list using the heappush function. The first heappush statement works fine, and the print statement after that is executed.

#random tests
node1 = {'a':1, 'b':2, 'c':3}
node2 = {'c':4, 'd':5, 'e':6}
lists = []
heappush(lists, node1)
print(lists)
heappush(lists, node2)

However, when I try to execute the second heappush statement, it gives me the following error.

[{'a': 1, 'b': 2, 'c': 3}]
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-24-c680e53f9699> in <module>()
      5 heappush(lists, node1)
      6 print(lists)
----> 7 heappush(lists, node2)

TypeError: '<' not supported between instances of 'dict' and 'dict'

Why is that? I know I can use append function to append dictionaries to the list, but I want to use heappush instead


问:
Web-based XML to Text File
I have an XML file that lives on an internal IP address and is regularly updated:

```<code><DATA>
<HEADLINE>
<TEXT>Headline 1</TEXT>
</HEADLINE>
<HEADLINE>
<TEXT>Headline 2</TEXT>
</HEADLINE>
<HEADLINE>
<TEXT>Headline 3</TEXT>
</HEADLINE>
</DATA>
</code>```

etc for anywhere from 5-15 headlines. I would like to spit this out to a .txt file formatted

```<code>Headline 1
Headline 2
Headline 3
</code>```

etc.

It seems like XSLT would work, but I'm having difficulty telling a script to pull it from the web address (which is static: http://10.2.1.11/cgi-bin/ExportHeadlines.pl). Is there a better way to create this .txt file?

答:
For the .txt file output you can specify the target format in your XSL stylesheet

```<code><xsl:output method="text" media-type="text/plain" omit-xml-declaration="yes" indent="no"/>
</code>```

To load the XML document over HTTP you can use the document function

```<code><xsl:template match="/">
    <xsl:value-of select="document('http://10.2.1.11/cgi-bin/ExportHeadlines.pl')/DATA"/>
</xsl:template>
</code>```

Since the source file is regularly updated, you need some kind of scheduler that executes the XSL transformation on a regular base.

Probably you also must provide an input XML file (that you don't use because you load your data inside the XSL stylesheet). Just use a pseudo file to make it happy.

```<code><?xml version="1.0" encoding="UTF-8"?>
<test/>
</code>```

Alternative: Download first

You can of course also pull the XML data with curl or a similar tool in a first step and then do a plain vanilla XSL transformation with the downloaded XML data file.

Title: Web-based XML to Text File

Body:
I have an XML file that lives on an internal IP address and is regularly updated:

<DATA>
<HEADLINE>
<TEXT>Headline 1</TEXT>
</HEADLINE>
<HEADLINE>
<TEXT>Headline 2</TEXT>
</HEADLINE>
<HEADLINE>
<TEXT>Headline 3</TEXT>
</HEADLINE>
</DATA>

etc for anywhere from 5-15 headlines. I would like to spit this out to a .txt file formatted

Headline 1
Headline 2
Headline 3

etc.

It seems like XSLT would work, but I'm having difficulty telling a script to pull it from the web address (which is static: http://10.2.1.11/cgi-bin/ExportHeadlines.pl). Is there a better way to create this .txt file?

Body:
For the .txt file output you can specify the target format in your XSL stylesheet

<xsl:output method="text" media-type="text/plain" omit-xml-declaration="yes" indent="no"/>

To load the XML document over HTTP you can use the document function

<xsl:template match="/">
    <xsl:value-of select="document('http://10.2.1.11/cgi-bin/ExportHeadlines.pl')/DATA"/>
</xsl:template>

Since the source file is regularly updated, you need some kind of scheduler that executes the XSL transformation on a regular base.

Probably you also must provide an input XML file (that you don't use because you load your data inside the XSL stylesheet). Just use a pseudo file to make it happy.

<?xml version="1.0" encoding="UTF-8"?>
<test/>

Alternative: Download first

You can of course also pull the XML data with curl or a similar tool in a first step and then do a plain vanilla XSL transformation with the downloaded XML data file.


问:
jQuery slick slider with multiple rows not working
I would like to have two rows of images for a basic slider. I am using Slick Slider, but it doesnt seem to be working even though I am following their instructions. What am I doing wrong?

This is the link to Slick Slider JS website:
http://kenwheeler.github.io/slick/

My HTML:

```<code><div class="carousel">
  <img src="https://cdn2.hubspot.net/hub/482618/hubfs/demo-logo.png">
  <img src="https://cdn2.hubspot.net/hub/482618/hubfs/demo-logo.png">
  <img src="https://cdn2.hubspot.net/hub/482618/hubfs/demo-logo.png">
  <img src="https://cdn2.hubspot.net/hub/482618/hubfs/demo-logo.png">
  <img src="https://cdn2.hubspot.net/hub/482618/hubfs/demo-logo.png">
  <img src="https://cdn2.hubspot.net/hub/482618/hubfs/demo-logo.png">
</div>
</code>```

My JS:

```<code>$(document).ready(function(){
      $('.carousel').slick({
          dots: true,
          slidesPerRow: 3,
          rows: 2,
          responsive: [
          {
            breakpoint: 1024,
            settings: {
              slidesPerRow: 2,
              rows: 1,
            }
          },
          {
            breakpoint: 640,
            settings: {
              slidesPerRow: 1,
              rows: 1,
            }
          }
        ]
      });
    });
</code>```

I have created a fiddle:
https://jsfiddle.net/zts1nok8/

答:
If you are using slick slider version 1.8.1 and using slick.min.js file then replace the file with slick.js file only because slick.min.js has some broken code.

This works for me

Body:
I would like to have two rows of images for a basic slider. I am using Slick Slider, but it doesnt seem to be working even though I am following their instructions. What am I doing wrong?

This is the link to Slick Slider JS website:
http://kenwheeler.github.io/slick/

My HTML:

My JS:

$(document).ready(function(){
      $('.carousel').slick({
          dots: true,
          slidesPerRow: 3,
          rows: 2,
          responsive: [
          {
            breakpoint: 1024,
            settings: {
              slidesPerRow: 2,
              rows: 1,
            }
          },
          {
            breakpoint: 640,
            settings: {
              slidesPerRow: 1,
              rows: 1,
            }
          }
        ]
      });
    });

I have created a fiddle:
https://jsfiddle.net/zts1nok8/


问:
Can't import SVG into Next.js
When I try to import SVG Image then the following error shows. Which loader I have to use for importing SVG images?</p>

```<code>./static/Rolling-1s-200px.svg 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000"><filter id="b"><feGaussianBlur stdDeviation="12" /></filter><path fill="#817c70" d="M0 0h2000v2000H0z"/><g filter="url(#b)" transform="translate(4 4) scale(7.8125)" fill-opacity=".5"><ellipse fill="#000210" rx="1" ry="1" transform="matrix(50.41098 -3.7951 11.14787 148.07886 107 194.6)"/><ellipse fill="#eee3bb" rx="1" ry="1" transform="matrix(-56.38179 17.684 -24.48514 -78.06584 205 110.1)"/><ellipse fill="#fff4bd" rx="1" ry="1" transform="matrix(35.40604 -5.49219 14.85017 95.73337 16.4 123.6)"/><ellipse fill="#79c7db" cx="21" cy="39" rx="65" ry="65"/><ellipse fill="#0c1320" cx="117" cy="38" rx="34" ry="47"/><ellipse fill="#5cb0cd" rx="1" ry="1" transform="matrix(-39.46201 77.24476 -54.56092 -27.87353 219.2 7.9)"/><path fill="#e57339" d="M271 159l-123-16 43 128z"/><ellipse fill="#47332f" cx="214" cy="237" rx="242" ry="19"/></g></svg>
</code>```

答:
If you want to use SVG files in your code WITHOUT ANY CONFIG OR INSTALLING A DEPENDENCY and have complete control on the tag's attributes, the best solution is to convert the SVG file to JSX or TSX components.

JSX solution:

```<code>export const YourSVg = ({color, width, height}) => (
   <svg fill={color} height={height} width={width}>
    ..rest of the svg tags...
   </svg>
)
</code>```

TSX solution:

```<code>   export const YourSVg:React.FC<{color:string, width:string, height:string}> =
       ({color, width, height}) => (
          <svg color={color} height={height} width={width}>
            ..rest of the svg tags...
          </svg>
    )
</code>```

How to use it?

can import it like a normal component and use it same as before

for instance:

```<code>import YourSVg from '../from the path/path

<YourSVg color='red' width='10px' height='10px/>
</code>```

Title: Can't import SVG into Next.js

Body:
When I try to import SVG Image then the following error shows. Which loader I have to use for importing SVG images?

./static/Rolling-1s-200px.svg 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2000 2000"><filter id="b"><feGaussianBlur stdDeviation="12" /></filter><path fill="#817c70" d="M0 0h2000v2000H0z"/><g filter="url(#b)" transform="translate(4 4) scale(7.8125)" fill-opacity=".5"><ellipse fill="#000210" rx="1" ry="1" transform="matrix(50.41098 -3.7951 11.14787 148.07886 107 194.6)"/><ellipse fill="#eee3bb" rx="1" ry="1" transform="matrix(-56.38179 17.684 -24.48514 -78.06584 205 110.1)"/><ellipse fill="#fff4bd" rx="1" ry="1" transform="matrix(35.40604 -5.49219 14.85017 95.73337 16.4 123.6)"/><ellipse fill="#79c7db" cx="21" cy="39" rx="65" ry="65"/><ellipse fill="#0c1320" cx="117" cy="38" rx="34" ry="47"/><ellipse fill="#5cb0cd" rx="1" ry="1" transform="matrix(-39.46201 77.24476 -54.56092 -27.87353 219.2 7.9)"/><path fill="#e57339" d="M271 159l-123-16 43 128z"/><ellipse fill="#47332f" cx="214" cy="237" rx="242" ry="19"/></g></svg>

Body:
If you want to use SVG files in your code WITHOUT ANY CONFIG OR INSTALLING A DEPENDENCY and have complete control on the tag's attributes, the best solution is to convert the SVG file to JSX or TSX components.

JSX solution:

export const YourSVg = ({color, width, height}) => (
   <svg fill={color} height={height} width={width}>
    ..rest of the svg tags...
   </svg>
)

TSX solution:

   export const YourSVg:React.FC<{color:string, width:string, height:string}> =
       ({color, width, height}) => (
          <svg color={color} height={height} width={width}>
            ..rest of the svg tags...
          </svg>
    )

How to use it?

can import it like a normal component and use it same as before

for instance:

import YourSVg from '../from the path/path

<YourSVg color='red' width='10px' height='10px/>


问:
Download a file from server using HTPPS Protocol
I want to download a file from server using https protocol I am using NSUrlConnection but that would not work.any sample code is appreciated </p>

答:
I'd recommend using ASIHTTPRequest which is a great library for handling web services. You can of course roll your own with NSURLConnection, but the advantage of the library is that it handles all the authentication and certificate issues that can arise and generally gives you a more robust and generic solution.

Post some code if you'd rather not use the library, I suspect it might be you are accessing a site that doesn't have a fully valid certificate as IIRC the default behaviour of the iOS is to reject the certificates unless you explicitly allow them as this is the more secure option.

ContentLicense: CC BY-SA 3.0


问:
Can I use Live Server inside Vscode editor?
I know live server opens with a browser.
But is it possible to open it inside editor?
Like I split the editor window with two .js files.</p>

答:
you Open the pallet (Ctrl + Shift + P)

Select "Simple Browser: Show" and then enter the web address


问:
react-native-ssl-pinning - The certificate for this server is invalid
Help me please

I am trying to make a request with react-native-ssl-pinning but get error (IOS 14.2):

The certificate for this server is invalid. You might be connecting to
a server that is pretending to be “https://...” which could put your
confidential information at risk.

I copied the .cer certificate into xcode and do this:

```<code>const response = await fetch(url, {
        method: 'POST',
        body: body,
        pkPinning: true,
        disableAllSecurity: false,
        // your certificates array (needed only in android) ios will pick it automatically
        sslPinning: {
          certs: ['my_cer_file_without_extension'], // your certificates name (without extension)
        },
        headers: {
          Accept: 'application/json; charset=utf-8',
          'Access-Control-Allow-Origin': '*',
          e_platform: 'mobile',
        },
      });
</code>```

Does anyone know what the problem might be? Any ideas?

答: in iOS, make sure that you add the certificate to the bundle resources. Go to Build Phases > Copy bundle resources > Add the certificate.</p>

Body:
Help me please

I am trying to make a request with react-native-ssl-pinning but get error (IOS 14.2):

The certificate for this server is invalid. You might be connecting to
a server that is pretending to be “https://...” which could put your
confidential information at risk.

I copied the .cer certificate into xcode and do this:

const response = await fetch(url, {
        method: 'POST',
        body: body,
        pkPinning: true,
        disableAllSecurity: false,
        // your certificates array (needed only in android) ios will pick it automatically
        sslPinning: {
          certs: ['my_cer_file_without_extension'], // your certificates name (without extension)
        },
        headers: {
          Accept: 'application/json; charset=utf-8',
          'Access-Control-Allow-Origin': '*',
          e_platform: 'mobile',
        },
      });

Does anyone know what the problem might be? Any ideas?


问:
imageantialias() doesn't seem to do anything on circles
I create an image with:

```<code>$image   = @imagecreatetruecolor(320, 45) or die("Cannot Initialize new GD image stream.");
imageantialias($image, true);
imagefill($image, 0, 0, imagecolorallocate($image, 255, 255, 255);
</code>```

Later, I add some text and on top of that, a shape:

```<code>imagearc($image, $x + 5, $y - 7, $size, $size, 0, 360, $color);

</code>```

But the the circle is still very jaggy:

I'm running php 8 with gd installed. I'm getting no errors.

答:
Ok, this guy has a whole web page devoted to algorithms to work around this limitation:  https://create.stephan-brumme.com/antialiased-circle/

Awesome work.

I went with "Wu's Algorithm" which provides the best quality. Works well.

Here's my version modified to use my global $image variable. It creates a perfect circle. The $my_x and $my_y are the x and y coordinates on the canvas.

```<code>function create_circle($my_x, $my_y, $size, $color) {
    global $image;
    $width = $size;
    $height = $size;

    $centerX = $my_x; $radiusX = ($width -20) / 2;
    $centerY = $my_y; $radiusY = ($height-20) / 2;
    static $maxTransparency = 0x7F; // 127
    $radiusX2 = $radiusX * $radiusX;
    $radiusY2 = $radiusY * $radiusY;
    // upper and lower halves
    $quarter = round($radiusX2 / sqrt($radiusX2 + $radiusY2));
    for ($x = 0; $x <= $quarter; $x++) {
        $y = $radiusY * sqrt(1-$x*$x/$radiusX2);
        $error = $y - floor($y);
        $transparency = round($error * $maxTransparency);
        $alpha  = $color | ($transparency << 24);
        $alpha2 = $color | (($maxTransparency - $transparency) << 24);
        setpixel4($centerX, $centerY, $x, floor($y),   $alpha);
        setpixel4($centerX, $centerY, $x, floor($y)+1, $alpha2);
    }

    // right and left halves
    $quarter = round($radiusY2 / sqrt($radiusX2 + $radiusY2));
    for ($y = 0; $y <= $quarter; $y++) {
        $x = $radiusX * sqrt(1-$y*$y/$radiusY2);
        $error = $x - floor($x);
        $transparency = round($error * $maxTransparency);
        $alpha  = $color | ($transparency << 24);
        $alpha2 = $color | (($maxTransparency - $transparency) << 24);
        setpixel4($centerX, $centerY, floor($x),   $y, $alpha);
        setpixel4($centerX, $centerY, floor($x)+1, $y, $alpha2);
    }
}

// helper function, draws pixel and mirrors it
function setpixel4($centerX, $centerY, $deltaX, $deltaY, $alpha) {
    global $image;
    imagesetpixel($image, $centerX + $deltaX, $centerY + $deltaY, $alpha);
    imagesetpixel($image, $centerX - $deltaX, $centerY + $deltaY, $alpha);
    imagesetpixel($image, $centerX + $deltaX, $centerY - $deltaY, $alpha);
    imagesetpixel($image, $centerX - $deltaX, $centerY - $deltaY, $alpha);
}
</code>```

Body:
I create an image with:

$image   = @imagecreatetruecolor(320, 45) or die("Cannot Initialize new GD image stream.");
imageantialias($image, true);
imagefill($image, 0, 0, imagecolorallocate($image, 255, 255, 255);

Later, I add some text and on top of that, a shape:

imagearc($image, $x + 5, $y - 7, $size, $size, 0, 360, $color);

But the the circle is still very jaggy:

I'm running php 8 with gd installed. I'm getting no errors.

Body:
Ok, this guy has a whole web page devoted to algorithms to work around this limitation:  https://create.stephan-brumme.com/antialiased-circle/

Awesome work.

I went with "Wu's Algorithm" which provides the best quality. Works well.

Here's my version modified to use my global $image variable. It creates a perfect circle. The $my_x and $my_y are the x and y coordinates on the canvas.

function create_circle($my_x, $my_y, $size, $color) {
    global $image;
    $width = $size;
    $height = $size;

    $centerX = $my_x; $radiusX = ($width -20) / 2;
    $centerY = $my_y; $radiusY = ($height-20) / 2;
    static $maxTransparency = 0x7F; // 127
    $radiusX2 = $radiusX * $radiusX;
    $radiusY2 = $radiusY * $radiusY;
    // upper and lower halves
    $quarter = round($radiusX2 / sqrt($radiusX2 + $radiusY2));
    for ($x = 0; $x <= $quarter; $x++) {
        $y = $radiusY * sqrt(1-$x*$x/$radiusX2);
        $error = $y - floor($y);
        $transparency = round($error * $maxTransparency);
        $alpha  = $color | ($transparency << 24);
        $alpha2 = $color | (($maxTransparency - $transparency) << 24);
        setpixel4($centerX, $centerY, $x, floor($y),   $alpha);
        setpixel4($centerX, $centerY, $x, floor($y)+1, $alpha2);
    }

    // right and left halves
    $quarter = round($radiusY2 / sqrt($radiusX2 + $radiusY2));
    for ($y = 0; $y <= $quarter; $y++) {
        $x = $radiusX * sqrt(1-$y*$y/$radiusY2);
        $error = $x - floor($x);
        $transparency = round($error * $maxTransparency);
        $alpha  = $color | ($transparency << 24);
        $alpha2 = $color | (($maxTransparency - $transparency) << 24);
        setpixel4($centerX, $centerY, floor($x),   $y, $alpha);
        setpixel4($centerX, $centerY, floor($x)+1, $y, $alpha2);
    }
}

// helper function, draws pixel and mirrors it
function setpixel4($centerX, $centerY, $deltaX, $deltaY, $alpha) {
    global $image;
    imagesetpixel($image, $centerX + $deltaX, $centerY + $deltaY, $alpha);
    imagesetpixel($image, $centerX - $deltaX, $centerY + $deltaY, $alpha);
    imagesetpixel($image, $centerX + $deltaX, $centerY - $deltaY, $alpha);
    imagesetpixel($image, $centerX - $deltaX, $centerY - $deltaY, $alpha);
}


问:
Update column year based on another column year
I need to update year and month from a datetime column reflecting year and month of another DateTime column from a different table. see example below.

update table1
set datepart(year(Month(date1)) = datepart(year(Month(date2)) -- inaccurate method just for example
from table1
inner join table2 on table1.id = table2.id
where year(date1) <> year(date2)
```
<p>Current data</p>
<pre class="lang-none prettyprint-override"><code>table1
ID    |  Date1
User1  1/26/2021
User2   2/27/2018
User3   3/26/2023

table2
ID    |  Date1
User1   2/2/2022
User2   3/1/2021
User3   6/3/2022

Result

table1
ID    |  Date1
User1   2/26/2022
User2   3/27/2021
User3   6/26/2022
</code>```

There are different years and months in date1 and the plan is to update all years and months to match the date2 column from table2.

答:
I have changed your date column to varchar since  the data '2018/02/30' does not exist.

```<code> declare @a TABLE (
   ID    VARCHAR(10) NOT NULL PRIMARY KEY
  ,Date1 varchar(30)  NOT NULL
);
INSERT INTO @a(ID,Date1) VALUES ('User1','1/31/2021');
INSERT INTO @a(ID,Date1) VALUES ('User2','2/30/2018');
INSERT INTO @a(ID,Date1) VALUES ('User3','3/31/2023');
declare @b TABLE (
   ID    VARCHAR(10) NOT NULL PRIMARY KEY
  ,Date1 varchar(30)  NOT NULL
);
INSERT INTO @b(ID,Date1) VALUES ('User1','2/2/2022');
INSERT INTO @b(ID,Date1) VALUES ('User2','3/1/2021');
INSERT INTO @b(ID,Date1) VALUES ('User3','6/3/2022');
</code>```

update statement

```<code>update @a  set
date1=cast(concat(
PARSENAME(REPLACE(b.Date1,'/','.'),3),'/',
PARSENAME(REPLACE(a.Date1,'/','.'),2),'/',
PARSENAME(REPLACE(b.Date1,'/','.'),1)) as date)
FROM @a a join @b b
on a.ID=b.ID
</code>```

you can use the following query if your data was correct

```<code>update @a
set Date1=
cast(concat(Year(b.Date1),'/',Day(a.Date1),'/',Month(b.Date1)) as date)
FROM @a a join @b b
on a.ID=b.ID
</code>```

Body:
I need to update year and month from a datetime column reflecting year and month of another DateTime column from a different table. see example below.

update table1
set datepart(year(Month(date1)) = datepart(year(Month(date2)) -- inaccurate method just for example
from table1
inner join table2 on table1.id = table2.id
where year(date1) <> year(date2)

Current data

table1
ID    |  Date1
User1  1/26/2021
User2   2/27/2018
User3   3/26/2023

table2
ID    |  Date1
User1   2/2/2022
User2   3/1/2021
User3   6/3/2022

Result

table1
ID    |  Date1
User1   2/26/2022
User2   3/27/2021
User3   6/26/2022

There are different years and months in date1 and the plan is to update all years and months to match the date2 column from table2.

Body:
I have changed your date column to varchar since  the data '2018/02/30' does not exist.

 declare @a TABLE (
   ID    VARCHAR(10) NOT NULL PRIMARY KEY
  ,Date1 varchar(30)  NOT NULL
);
INSERT INTO @a(ID,Date1) VALUES ('User1','1/31/2021');
INSERT INTO @a(ID,Date1) VALUES ('User2','2/30/2018');
INSERT INTO @a(ID,Date1) VALUES ('User3','3/31/2023');
declare @b TABLE (
   ID    VARCHAR(10) NOT NULL PRIMARY KEY
  ,Date1 varchar(30)  NOT NULL
);
INSERT INTO @b(ID,Date1) VALUES ('User1','2/2/2022');
INSERT INTO @b(ID,Date1) VALUES ('User2','3/1/2021');
INSERT INTO @b(ID,Date1) VALUES ('User3','6/3/2022');

update statement

update @a  set
date1=cast(concat(
PARSENAME(REPLACE(b.Date1,'/','.'),3),'/',
PARSENAME(REPLACE(a.Date1,'/','.'),2),'/',
PARSENAME(REPLACE(b.Date1,'/','.'),1)) as date)
FROM @a a join @b b
on a.ID=b.ID

you can use the following query if your data was correct

update @a
set Date1=
cast(concat(Year(b.Date1),'/',Day(a.Date1),'/',Month(b.Date1)) as date)
FROM @a a join @b b
on a.ID=b.ID


问:
How to fetch a git remote but only change files that have not been altered in the local repository?
Say I have two repositories: Project A and Project B. Project B has a remote of Project A. I've been working on both projects simultaneously. Now I want the changes from A to go into B, but I don't want files that have been changed from A to be over written. In B I have projects A's files, some files from A originally that have been changed since being in B, and new files that only B has. The files that have not been changed in B from A I want to have updated with the new changes from A. How should I do this?

edit

Maybe what I want is

# from B on master
git remote update a
git rebase --onto a/master
```

The only problem is that if B has a lot of changes which conflict with a/master how do I order git to always take the current branch's version of the file over the remote's?

答:
Short answer

Nohow

Longer answer

Re-think your "workflow". Chaotic changes and jumping between (related be code) projects are a direct way to unmaintained disorder. The Right Way (tm) is (somehow):

Do something in repo A

Commit & push work

Switch to repo B

Pull

Merge pulled (maybe with special merge-driver)

Body:
Say I have two repositories: Project A and Project B. Project B has a remote of Project A. I've been working on both projects simultaneously. Now I want the changes from A to go into B, but I don't want files that have been changed from A to be over written. In B I have projects A's files, some files from A originally that have been changed since being in B, and new files that only B has. The files that have not been changed in B from A I want to have updated with the new changes from A. How should I do this?

edit

Maybe what I want is

# from B on master
git remote update a
git rebase --onto a/master

The only problem is that if B has a lot of changes which conflict with a/master how do I order git to always take the current branch's version of the file over the remote's?


问:
R plotly - sankey chart not returned
I am running below code in RStudio, and want to create sankey chart with plotly. code runs without error. but the sankey chart is not displayed.  what's wrong here?

library("plotly")
a = read.csv('cleanSankey.csv', header=TRUE, sep=',')
node_names <- unique(c(as.character(a$source), as.character(a$target)))
nodes <- data.frame(name = node_names)
links <- data.frame(source = match(a$source, node_names) - 1,
                    target = match(a$target, node_names) - 1,
                    value = a$value)

nodes_with_position <- data.frame(
  "id" = names,
  "label" = node_names,
  "x" = c(0, 0.1, 0.2, 0.3,0.4,0.5,0.6,0.7),
  "y" = c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7)
)

#Plot
plot_ly(type='sankey',
        orientation = "h",

        node = list(
          label = node_names,
          x = nodes_with_position$x,
          y = nodes_with_position$y,
          color = "grey",
          pad = 15,
          thinkness = 20,
          line = list(color = "grey", width = 0.5)),

         link = list(
           source = links$source,
           target = links$target,
           value = links$value))
```

sankey is plotted , but and nodes for second layer goes to last layer. How to fix the node position?

答:
You'll need to define the node position by setting the arrangement argument to stop plotly from automatically justifying the position.

This requires some finessing as you need to specify the coordinates of the nodes. You can find more details here: https://plotly.com/python/sankey-diagram/#define-node-position

Code

```<code>library(plotly)

a <- read.csv("~/cleanSankey.csv")

node_names <- unique(c(as.character(a$source), as.character(a$target)))

# added id column for clarity, but it's likely not needed
nodes <- data.frame(
  id = 0:(length(node_names)-1),
  name = node_names
)

links <- data.frame(
  source = match(a$source, node_names) - 1,
  target = match(a$target, node_names) - 1,
  value = a$value
)

# set the coordinates of the nodes
nodes$x <- c(0, 1, 0.5)
nodes$y <- c(0, 0.5, 1)

# plot - note the `arrangement="snap"` argument
plot_ly(
  type='sankey',
  orientation = "h",
  arrangement="snap", # can also change this to 'fixed'
  node = list(
    label = nodes$name,
    x = nodes$x,
    y = nodes$y,
    color = "grey",
    pad = 15,
    thinkness = 20,
    line = list(color = "grey", width = 0.5)
  ),
  link = list(
    source = links$source,
    target = links$target,
    value = links$value
  )
)
</code>```

Plot output with arrangement="snap":

Title: R plotly - sankey chart not returned

Body:
I am running below code in RStudio, and want to create sankey chart with plotly. code runs without error. but the sankey chart is not displayed.  what's wrong here?

library("plotly")
a = read.csv('cleanSankey.csv', header=TRUE, sep=',')
node_names <- unique(c(as.character(a$source), as.character(a$target)))
nodes <- data.frame(name = node_names)
links <- data.frame(source = match(a$source, node_names) - 1,
                    target = match(a$target, node_names) - 1,
                    value = a$value)

nodes_with_position <- data.frame(
  "id" = names,
  "label" = node_names,
  "x" = c(0, 0.1, 0.2, 0.3,0.4,0.5,0.6,0.7),
  "y" = c(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7)
)

#Plot
plot_ly(type='sankey',
        orientation = "h",

        node = list(
          label = node_names,
          x = nodes_with_position$x,
          y = nodes_with_position$y,
          color = "grey",
          pad = 15,
          thinkness = 20,
          line = list(color = "grey", width = 0.5)),

         link = list(
           source = links$source,
           target = links$target,
           value = links$value))

sankey is plotted , but and nodes for second layer goes to last layer. How to fix the node position?

Body:
You'll need to define the node position by setting the arrangement argument to stop plotly from automatically justifying the position.

This requires some finessing as you need to specify the coordinates of the nodes. You can find more details here: https://plotly.com/python/sankey-diagram/#define-node-position

Code

library(plotly)

a <- read.csv("~/cleanSankey.csv")

node_names <- unique(c(as.character(a$source), as.character(a$target)))

# added id column for clarity, but it's likely not needed
nodes <- data.frame(
  id = 0:(length(node_names)-1),
  name = node_names
)

links <- data.frame(
  source = match(a$source, node_names) - 1,
  target = match(a$target, node_names) - 1,
  value = a$value
)

# set the coordinates of the nodes
nodes$x <- c(0, 1, 0.5)
nodes$y <- c(0, 0.5, 1)

# plot - note the `arrangement="snap"` argument
plot_ly(
  type='sankey',
  orientation = "h",
  arrangement="snap", # can also change this to 'fixed'
  node = list(
    label = nodes$name,
    x = nodes$x,
    y = nodes$y,
    color = "grey",
    pad = 15,
    thinkness = 20,
    line = list(color = "grey", width = 0.5)
  ),
  link = list(
    source = links$source,
    target = links$target,
    value = links$value
  )
)

Plot output with arrangement="snap":


问:
Gerrit will not push. Error: No common ancestry
Trying to push to gerrit. Brings up no common ancestry. </p>

```<code>nolan@nolan-pc:~/pac-man$ git push ssh://1KX2@review.pac-rom.com:29418/android_vendor_pac HEAD:refs/for/pac-6.0
Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 6.63 KiB | 0 bytes/s, done.
Total 8 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done
To ssh://1KX2@review.pac-rom.com:29418/android_vendor_pac
 ! [remote rejected] HEAD -> refs/for/pac-6.0 (no common ancestry)
error: failed to push some refs to 'ssh://1KX2@review.pac-rom.com:29418/android_vendor_pac'
</code>```

答: Looks you are pushing on incorrect branch . Use correct branch it will work</p>

Body:
Trying to push to gerrit. Brings up no common ancestry.

nolan@nolan-pc:~/pac-man$ git push ssh://1KX2@review.pac-rom.com:29418/android_vendor_pac HEAD:refs/for/pac-6.0
Counting objects: 8, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 6.63 KiB | 0 bytes/s, done.
Total 8 (delta 0), reused 0 (delta 0)
remote: Processing changes: refs: 1, done
To ssh://1KX2@review.pac-rom.com:29418/android_vendor_pac
 ! [remote rejected] HEAD -> refs/for/pac-6.0 (no common ancestry)
error: failed to push some refs to 'ssh://1KX2@review.pac-rom.com:29418/android_vendor_pac'


问:
Linked list recursive delete operation: How do I change the head?
```<code>class Node:
    def __init__(self, val, next=None):
        self.val = val
        self.next = next

def rec_delete(head, val, prev=None):
    if(head == None):
        return False
    if(head.val == val):
        if(prev == None):
            head = head.next
        else:
            prev.next = head.next
        return True

    return rec_delete(head.next, val, head)

head = Node(1, Node(2, Node(3, Node(4))))
rec_delete(head, 1)
rec_delete(head, 2)
rec_delete(head, 3)
rec_delete(head, 4)
</code>```

Given a linked list 1 -> 2 -> 3 -> 4 I want to remove all the elements one by one but unsure how to assign a new head in python. The issue with my current code is since head goes through a function I cannot reassign the head. I want head to be None after all the operations.

答:
Your delete function needs to return the head of the list after val has been deleted.  This not only makes the implementation of the delete much simpler (the base case is the one where the head is itself being deleted), it is necessary for the caller to be able to handle the case where the head is deleted.

```<code>class Node:
    def __init__(self, val, next=None):
        self.val = val
        self.next = next

    def __repr__(self):
        """val1 -> val2 -> val3 ..."""
        return f"{self.val}" + (f" -> {self.next}" if self.next else "")

def delete(head, val):
    """Delete val from list with given head, returning head of the modified list."""
    if head.val == val:
        # Deleting head, so the new head is head.next.
        return head.next
    # Head remains head, but we still need to delete val from head.next.
    head.next = delete(head.next, val)
    return head

head = Node(1, Node(2, Node(3, Node(4))))
print(head)  # 1 -> 2 -> 3 -> 4
head = delete(head, 1)
head = delete(head, 2)
print(head)  # 3 -> 4
head = delete(head, 3)
head = delete(head, 4)
print(head)  # None
</code>```

Body:
class Node:
    def __init__(self, val, next=None):
        self.val = val
        self.next = next

def rec_delete(head, val, prev=None):
    if(head == None):
        return False
    if(head.val == val):
        if(prev == None):
            head = head.next
        else:
            prev.next = head.next
        return True

    return rec_delete(head.next, val, head)

head = Node(1, Node(2, Node(3, Node(4))))
rec_delete(head, 1)
rec_delete(head, 2)
rec_delete(head, 3)
rec_delete(head, 4)

Given a linked list 1 -> 2 -> 3 -> 4 I want to remove all the elements one by one but unsure how to assign a new head in python. The issue with my current code is since head goes through a function I cannot reassign the head. I want head to be None after all the operations.

Body:
Your delete function needs to return the head of the list after val has been deleted.  This not only makes the implementation of the delete much simpler (the base case is the one where the head is itself being deleted), it is necessary for the caller to be able to handle the case where the head is deleted.

class Node:
    def __init__(self, val, next=None):
        self.val = val
        self.next = next

    def __repr__(self):
        """val1 -> val2 -> val3 ..."""
        return f"{self.val}" + (f" -> {self.next}" if self.next else "")

def delete(head, val):
    """Delete val from list with given head, returning head of the modified list."""
    if head.val == val:
        # Deleting head, so the new head is head.next.
        return head.next
    # Head remains head, but we still need to delete val from head.next.
    head.next = delete(head.next, val)
    return head

head = Node(1, Node(2, Node(3, Node(4))))
print(head)  # 1 -> 2 -> 3 -> 4
head = delete(head, 1)
head = delete(head, 2)
print(head)  # 3 -> 4
head = delete(head, 3)
head = delete(head, 4)
print(head)  # None


问:
Data redundancy on csv file
Hi Good day everyone I'm sorry I'm new to python programming sorry if I'm asking this even this is basic or not. Someone can help me with this?  My problem is I want to write the data that capture's on my open cv Like for example "Name" "Reputation" or something else. And write it to my csv file. It writes But I has a redundancy like per capture it records The same name. I just want one Name that don't redundant Someone can Help me with this Please???

Here's the code to record data to csv:

def markattend(name, years, pos, tempe):
    with open('attendances.csv', 'r+') as f:
        datalist = f.readlines()
        nameList = []

        for line in datalist:
            entry = line.split(',')
            nameList.append(entry[0])

        if name and years and pos and tempe not in nameList:
            now = datetime.now()
            dtString = now.strftime('%I:%M:%a:%d:%b:%Y')
            f.writelines(f'\n{name},{years},{pos},{tempe},{dtString}')
        return datalist
```
<p>And here I call the function and assigning its Data: like "Name" "Position"</p>
<pre class="lang-py prettyprint-override"><code>if confidence>70:
    cv2.putText(img, datas, (x,y+205), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2, cv2.LINE_AA)
    cv2.putText(img, datas1, (x,y+230), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2, cv2.LINE_AA)
    cv2.putText(img, datas2, (x,y+250), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2, cv2.LINE_AA)
    cv2.putText(img, get_temp(ser), (x,y+280), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2, cv2.LINE_AA)
    markattend(datas,datas1,datas2,get_temp(ser))  # <== This temp is from my sensor data and datas, datas1, datas2   it correspond the "Name" "position" "Student"
</code>```

Someone can help me   plsss

Here's my csv file photo:here's the Image

答:
do not parse CSV manually:

```<code>import csv

data = []

with open('attendances.csv', newline='') as csvfile:
  reader = csv.reader(csvfile)
  for row in reader:
    data.append(row)
</code>```

↓

if name and years and pos and tempe not in nameList:
```
<p>is the same as</p>
<pre class="lang-py prettyprint-override"><code>if name is True and years is True and pos is True and tempe not in nameList:
</code>```

correct code is:

import csv

def markattend(name,years,pos,tempe):
    with open('attendances.csv','r+') as f:

        reader = csv.reader(f)

        for line in reader:

            if name == line[0] and years == line[1] and pos == line[2] and tempe == line[3]:
                ... do some stuff ...
```

Title: Data redundancy on csv file

Body:
Hi Good day everyone I'm sorry I'm new to python programming sorry if I'm asking this even this is basic or not. Someone can help me with this?  My problem is I want to write the data that capture's on my open cv Like for example "Name" "Reputation" or something else. And write it to my csv file. It writes But I has a redundancy like per capture it records The same name. I just want one Name that don't redundant Someone can Help me with this Please???

Here's the code to record data to csv:

def markattend(name, years, pos, tempe):
    with open('attendances.csv', 'r+') as f:
        datalist = f.readlines()
        nameList = []

        for line in datalist:
            entry = line.split(',')
            nameList.append(entry[0])

        if name and years and pos and tempe not in nameList:
            now = datetime.now()
            dtString = now.strftime('%I:%M:%a:%d:%b:%Y')
            f.writelines(f'\n{name},{years},{pos},{tempe},{dtString}')
        return datalist

And here I call the function and assigning its Data: like "Name" "Position"

if confidence>70:
    cv2.putText(img, datas, (x,y+205), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2, cv2.LINE_AA)
    cv2.putText(img, datas1, (x,y+230), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2, cv2.LINE_AA)
    cv2.putText(img, datas2, (x,y+250), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2, cv2.LINE_AA)
    cv2.putText(img, get_temp(ser), (x,y+280), cv2.FONT_HERSHEY_SIMPLEX, 0.8, color, 2, cv2.LINE_AA)
    markattend(datas,datas1,datas2,get_temp(ser))  # <== This temp is from my sensor data and datas, datas1, datas2   it correspond the "Name" "position" "Student"

Someone can help me   plsss

Here's my csv file photo:here's the Image

Body:
do not parse CSV manually:

import csv

data = []

with open('attendances.csv', newline='') as csvfile:
  reader = csv.reader(csvfile)
  for row in reader:
    data.append(row)

↓

if name and years and pos and tempe not in nameList:

is the same as

if name is True and years is True and pos is True and tempe not in nameList:

correct code is:

import csv

def markattend(name,years,pos,tempe):
    with open('attendances.csv','r+') as f:

        reader = csv.reader(f)

        for line in reader:

            if name == line[0] and years == line[1] and pos == line[2] and tempe == line[3]:
                ... do some stuff ...


问:
LINQ Aggregate algorithm explained
This might sound lame, but  I have not been able to find a really good explanation of Aggregate.

Good means short, descriptive, comprehensive with a small and clear example.

答:
Super short
Aggregate works like fold in Haskell/ML/F#.

Slightly longer
.Max(), .Min(), .Sum(), .Average() all iterates over the elements in a sequence and aggregates them using the respective aggregate function. .Aggregate () is generalized aggregator in that it allows the developer to specify the start state (aka seed) and the aggregate function.

I know you asked for a short explaination but I figured as others gave a couple of short answers I figured you would perhaps be interested in a slightly longer one

Long version with code
One way to illustrate what does it could be show how you implement Sample Standard Deviation once using foreach and once using .Aggregate. Note: I haven't prioritized performance here so I iterate several times over the colleciton unnecessarily

First a helper function used to create a sum of quadratic distances:

```<code>static double SumOfQuadraticDistance (double average, int value, double state)
{
    var diff = (value - average);
    return state + diff * diff;
}
</code>```

Then Sample Standard Deviation using ForEach:

```<code>static double SampleStandardDeviation_ForEach (
    this IEnumerable<int> ints)
{
    var length = ints.Count ();
    if (length < 2)
    {
        return 0.0;
    }

    const double seed = 0.0;
    var average = ints.Average ();

    var state = seed;
    foreach (var value in ints)
    {
        state = SumOfQuadraticDistance (average, value, state);
    }
    var sumOfQuadraticDistance = state;

    return Math.Sqrt (sumOfQuadraticDistance / (length - 1));
}
</code>```

Then once using .Aggregate:

```<code>static double SampleStandardDeviation_Aggregate (
    this IEnumerable<int> ints)
{
    var length = ints.Count ();
    if (length < 2)
    {
        return 0.0;
    }

    const double seed = 0.0;
    var average = ints.Average ();

    var sumOfQuadraticDistance = ints
        .Aggregate (
            seed,
            (state, value) => SumOfQuadraticDistance (average, value, state)
            );

    return Math.Sqrt (sumOfQuadraticDistance / (length - 1));
}
</code>```

Note that these functions are identical except for how sumOfQuadraticDistance is calculated:

```<code>var state = seed;
foreach (var value in ints)
{
    state = SumOfQuadraticDistance (average, value, state);
}
var sumOfQuadraticDistance = state;
</code>```

Versus:

```<code>var sumOfQuadraticDistance = ints
    .Aggregate (
        seed,
        (state, value) => SumOfQuadraticDistance (average, value, state)
        );
</code>```

So what .Aggregate does is that it encapsulates this aggregator pattern and I expect that the implementation of .Aggregate would look something like this:

```<code>public static TAggregate Aggregate<TAggregate, TValue> (
    this IEnumerable<TValue> values,
    TAggregate seed,
    Func<TAggregate, TValue, TAggregate> aggregator
    )
{
    var state = seed;

    foreach (var value in values)
    {
        state = aggregator (state, value);
    }

    return state;
}
</code>```

Using the Standard deviation functions would look something like this:

```<code>var ints = new[] {3, 1, 4, 1, 5, 9, 2, 6, 5, 4};
var average = ints.Average ();
var sampleStandardDeviation = ints.SampleStandardDeviation_Aggregate ();
var sampleStandardDeviation2 = ints.SampleStandardDeviation_ForEach ();

Console.WriteLine (average);
Console.WriteLine (sampleStandardDeviation);
Console.WriteLine (sampleStandardDeviation2);
</code>```

IMHO

So does .Aggregate help readability? In general I love LINQ because I think .Where, .Select, .OrderBy and so on greatly helps readability (if you avoid inlined hierarhical .Selects). Aggregate has to be in Linq for completeness reasons but personally I am not so convinced that .Aggregate adds readability compared to a well written foreach.

Title: LINQ Aggregate algorithm explained

Body:
Super short
Aggregate works like fold in Haskell/ML/F#.

Slightly longer
.Max(), .Min(), .Sum(), .Average() all iterates over the elements in a sequence and aggregates them using the respective aggregate function. .Aggregate () is generalized aggregator in that it allows the developer to specify the start state (aka seed) and the aggregate function.

I know you asked for a short explaination but I figured as others gave a couple of short answers I figured you would perhaps be interested in a slightly longer one

Long version with code
One way to illustrate what does it could be show how you implement Sample Standard Deviation once using foreach and once using .Aggregate. Note: I haven't prioritized performance here so I iterate several times over the colleciton unnecessarily

First a helper function used to create a sum of quadratic distances:

static double SumOfQuadraticDistance (double average, int value, double state)
{
    var diff = (value - average);
    return state + diff * diff;
}

Then Sample Standard Deviation using ForEach:

static double SampleStandardDeviation_ForEach (
    this IEnumerable<int> ints)
{
    var length = ints.Count ();
    if (length < 2)
    {
        return 0.0;
    }

    const double seed = 0.0;
    var average = ints.Average ();

    var state = seed;
    foreach (var value in ints)
    {
        state = SumOfQuadraticDistance (average, value, state);
    }
    var sumOfQuadraticDistance = state;

    return Math.Sqrt (sumOfQuadraticDistance / (length - 1));
}

Then once using .Aggregate:

static double SampleStandardDeviation_Aggregate (
    this IEnumerable<int> ints)
{
    var length = ints.Count ();
    if (length < 2)
    {
        return 0.0;
    }

    const double seed = 0.0;
    var average = ints.Average ();

    var sumOfQuadraticDistance = ints
        .Aggregate (
            seed,
            (state, value) => SumOfQuadraticDistance (average, value, state)
            );

    return Math.Sqrt (sumOfQuadraticDistance / (length - 1));
}

Note that these functions are identical except for how sumOfQuadraticDistance is calculated:

var state = seed;
foreach (var value in ints)
{
    state = SumOfQuadraticDistance (average, value, state);
}
var sumOfQuadraticDistance = state;

Versus:

var sumOfQuadraticDistance = ints
    .Aggregate (
        seed,
        (state, value) => SumOfQuadraticDistance (average, value, state)
        );

So what .Aggregate does is that it encapsulates this aggregator pattern and I expect that the implementation of .Aggregate would look something like this:

public static TAggregate Aggregate<TAggregate, TValue> (
    this IEnumerable<TValue> values,
    TAggregate seed,
    Func<TAggregate, TValue, TAggregate> aggregator
    )
{
    var state = seed;

    foreach (var value in values)
    {
        state = aggregator (state, value);
    }

    return state;
}

Using the Standard deviation functions would look something like this:

var ints = new[] {3, 1, 4, 1, 5, 9, 2, 6, 5, 4};
var average = ints.Average ();
var sampleStandardDeviation = ints.SampleStandardDeviation_Aggregate ();
var sampleStandardDeviation2 = ints.SampleStandardDeviation_ForEach ();

Console.WriteLine (average);
Console.WriteLine (sampleStandardDeviation);
Console.WriteLine (sampleStandardDeviation2);

IMHO

So does .Aggregate help readability? In general I love LINQ because I think .Where, .Select, .OrderBy and so on greatly helps readability (if you avoid inlined hierarhical .Selects). Aggregate has to be in Linq for completeness reasons but personally I am not so convinced that .Aggregate adds readability compared to a well written foreach.


问:
ModuleNotFoundError: No module named 'dj_rest_auth'
I don't get why I am getting this problem I followed most the steps to the guide in installing: https://dj-rest-auth.readthedocs.io/en/latest/installation.html

Except that I used pipenv install.

However, python manage.py migrate gave me this error:

```<code>    main()
  File "/home/ryan/Documents/is4103/is4103-capstone-id01/Backend/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
    utility.execute()
  File "/home/ryan/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute
    django.setup()
  File "/home/ryan/.local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/apps/config.py", line 223, in create
    import_module(entry)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'dj_rest_auth'
</code>```

settings.py

```<code>    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'BackendApp',
    'rest_framework',
    'rest_framework.authtoken',
    'dj_rest_auth',
]
</code>```

Pipfile

```<code>[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
django = "*"
psycopg2-binary = "*"
django-polymorphic = "*"
pillow = "*"
djangorestframework = "*"
markdown = "*"
django-filter = "*"
dj-rest-auth = "*"

[dev-packages]

[requires]
python_version = "3.9"

</code>```

Edit: this repo is on github so I reclone it and tried, but same error.

答:
Edit: I am wrong about this, it is because I am not in pipenv shell environement when I am installing dj_auth_rest

Old Wrong answer:

My Anaconda is causing this issue somehow.

i used conda deactivate to resolve this.

Body:
I don't get why I am getting this problem I followed most the steps to the guide in installing: https://dj-rest-auth.readthedocs.io/en/latest/installation.html

Except that I used pipenv install.

However, python manage.py migrate gave me this error:

    main()
  File "/home/ryan/Documents/is4103/is4103-capstone-id01/Backend/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 425, in execute_from_command_line
    utility.execute()
  File "/home/ryan/.local/lib/python3.9/site-packages/django/core/management/__init__.py", line 401, in execute
    django.setup()
  File "/home/ryan/.local/lib/python3.9/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
  File "/home/ryan/.local/lib/python3.9/site-packages/django/apps/config.py", line 223, in create
    import_module(entry)
  File "/usr/local/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'dj_rest_auth'

settings.py

    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'BackendApp',
    'rest_framework',
    'rest_framework.authtoken',
    'dj_rest_auth',
]

Pipfile

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
requests = "*"
django = "*"
psycopg2-binary = "*"
django-polymorphic = "*"
pillow = "*"
djangorestframework = "*"
markdown = "*"
django-filter = "*"
dj-rest-auth = "*"

[dev-packages]

[requires]
python_version = "3.9"

Edit: this repo is on github so I reclone it and tried, but same error.


问:
Purposeful random memory allocations
For an experiment, I want to measure time it takes to find a given record with random memory access. The record is a simple class:

template<class TKey, class TData>
class Record {
  TKey key;
  TData data;
public:
  Record(TKey key, TData data) {
    this->key = key;
    this->data = data;
  }
};
```
<p>Now I simply allocate memory and insert some records. (Please ignore some syntax mistakes...)</p>
<pre class="lang-cpp prettyprint-override"><code>const int size = 1_000_000;
Record<int, int> ** data = new Record<int, int>*[size];

for (int i = 0; i < size; ++i) {
  // allocates sizeof(Record<int, int>) on heap
  data[i] = new Record<int, int>(i, i);
}

</code>```

The issue is, when allocating these new Record objects, the are actually stored sequentially in memory. I want these memory locations to be random.
Does C++ have any ways to accomplish this?

答:
The best answers are commented under the question by UnholySheep and
Fabian. See their comments for the correct answer.</p>

Title: Purposeful random memory allocations

Body:
For an experiment, I want to measure time it takes to find a given record with random memory access. The record is a simple class:

template<class TKey, class TData>
class Record {
  TKey key;
  TData data;
public:
  Record(TKey key, TData data) {
    this->key = key;
    this->data = data;
  }
};

Now I simply allocate memory and insert some records. (Please ignore some syntax mistakes...)

const int size = 1_000_000;
Record<int, int> ** data = new Record<int, int>*[size];

for (int i = 0; i < size; ++i) {
  // allocates sizeof(Record<int, int>) on heap
  data[i] = new Record<int, int>(i, i);
}

The issue is, when allocating these new Record objects, the are actually stored sequentially in memory. I want these memory locations to be random.
Does C++ have any ways to accomplish this?


问:
Get the last day of the month
Is there a way using Python's standard library to easily determine (i.e. one function call) the last day of a given month?

If the standard library doesn't support that, does the dateutil package support this?

答:
Using dateutil.relativedelta

```<code>dt + dateutil.relativedelta.relativedelta(months=1, day=1, days=-1)
</code>```

months=1 and day=1 would shift dt to the first date of next month, then days=-1 would shift the new date to previous date which is exactly the last date of current month.

OwnerDisplayName: Cristian

Title: Get the last day of the month

Body:
Using dateutil.relativedelta

dt + dateutil.relativedelta.relativedelta(months=1, day=1, days=-1)

months=1 and day=1 would shift dt to the first date of next month, then days=-1 would shift the new date to previous date which is exactly the last date of current month.


问:
Get record real value after overriding it
I've overridden a a record value like the following :

```<code>public function getWeightAttribute($weight)
 {
        if($weight)
        {
          return $weight;
        }

        return 70;
}
</code>```

Now I have a collection of that model and I want to know if the original value was null or not.
I want to do it without connecting to DB again, Actually I want to make sure the user has filled the weight and some other fields while registering.
Some sections are working based on the above override and I don't want to mess them up neither use extra connections to db.
Thanks In Advance,

答:
In order to get the original value, you can use:-</p>
```<code>$fetchData->getAttributes()['weight'];
</code>```

Body:
I've overridden a a record value like the following :

public function getWeightAttribute($weight)
 {
        if($weight)
        {
          return $weight;
        }

        return 70;
}

Now I have a collection of that model and I want to know if the original value was null or not.
I want to do it without connecting to DB again, Actually I want to make sure the user has filled the weight and some other fields while registering.
Some sections are working based on the above override and I don't want to mess them up neither use extra connections to db.
Thanks In Advance,

Body:
In order to get the original value, you can use:-

$fetchData->getAttributes()['weight'];


问:
For loop in JJB templates
Is there a way to use for loops in YAML templates for Jenkins Job Builder?

Like it Ansible with jinja2

Something like

```<code>jobs: job1, job2, job3

- trigger-builds:
    - project:
        {% for j in jobs %}
          project_{{ j }}
        {% endfor %}
</code>```

So it will be like

```<code>- trigger-builds:
    - project: project_job1 project_job2 project_job3
</code>```

答:
You can use jinja2 template for achieving this purpose.

Something like this:

```<code>- builder:
    name: test-builder
    builders:
      - shell:
          !j2: |
            {{ var }}
            {% for item in test_list -%}
            {{ item }}
            {% endfor %}
- job:
    name: test-job
    builders:
       - test-builder:
          var: "test variable"
          test_list:
             - a
             - b
             - c
</code>```

Title: For loop in JJB templates

Body:
Is there a way to use for loops in YAML templates for Jenkins Job Builder?

Like it Ansible with jinja2

Something like

jobs: job1, job2, job3

- trigger-builds:
    - project:
        {% for j in jobs %}
          project_{{ j }}
        {% endfor %}

So it will be like

- trigger-builds:
    - project: project_job1 project_job2 project_job3

Body:
You can use jinja2 template for achieving this purpose.

Something like this:

- builder:
    name: test-builder
    builders:
      - shell:
          !j2: |
            {{ var }}
            {% for item in test_list -%}
            {{ item }}
            {% endfor %}
- job:
    name: test-job
    builders:
       - test-builder:
          var: "test variable"
          test_list:
             - a
             - b
             - c


问:
'attr_accessible' effects
I am using Ruby on Rails 3.0.9 and I would like to know in which cases (that is, for which methods) the attr_accessible method has effect. For example, if I use

```<code>attr_accessible :name, :surname
</code>```

it will care to not assign those attribute values when you use the new(...) method for the User.new(params[:user]) statement.

But what other methods it will take care? Can I run correctly, for example, methods as where(...) and exists?(...) without that the attr_accessible will take effect?

答:
If you use attr_accessible, the model will prevent mass assignment of those columns which are not included in the attr_accessible list. The methods affected are those of mass assignment like new, create, update_attributes, attributes= etc. All other functions will work, even single assignment like this:

```<code>@model_object.column_not_listed_in_attr_accessible_list = "Saved"
@model_object.column_not_listed_in_attr_accessible_list
=> "Saved"
</code>```

So, there should not be any problem for using them in where, exists? etc.

Title: 'attr_accessible' effects

Body:
I am using Ruby on Rails 3.0.9 and I would like to know in which cases (that is, for which methods) the attr_accessible method has effect. For example, if I use

attr_accessible :name, :surname

it will care to not assign those attribute values when you use the new(...) method for the User.new(params[:user]) statement.

But what other methods it will take care? Can I run correctly, for example, methods as where(...) and exists?(...) without that the attr_accessible will take effect?

Body:
If you use attr_accessible, the model will prevent mass assignment of those columns which are not included in the attr_accessible list. The methods affected are those of mass assignment like new, create, update_attributes, attributes= etc. All other functions will work, even single assignment like this:

@model_object.column_not_listed_in_attr_accessible_list = "Saved"
@model_object.column_not_listed_in_attr_accessible_list
=> "Saved"

So, there should not be any problem for using them in where, exists? etc.


问:
How can distribute one table data to another table
I have two tables Orderapproval and stock:

Table 1:  Orderapproval

itemcode
approvalqty

1
25

2
10

Table 2: stock

itemcode
stockqty
batch
date

1
5
aa
2021-02-01

1
10
bb
2021-02-10

1
15
cc
2021-02-02

2
5
dd
2021-02-01

2
20
aa
2021-02-05

we have stock batch-wise.
when we get an order request for an item
we are trying to pick up items from the old batch first & so on
How can I get a result set like this:

itemcode
qty
batch
date

1
5
aa
2021-02-01

1
15
cc
2021-02-02

1
5
bb
2021-02-10

2
5
dd
2021-02-01

I am trying as......

Declare @StockTable table
(ItemCode int,BranchCode int,Qty int)
Insert Into @StockTable values
(1,       101,          5),
(1,       102,           10),
(1,       101,          15),
(2,       102,           5),
(2,       103,           20)

Declare @Orderapproval table (ItemCode int,Qty int)
Insert Into @Orderapproval values
(1,25),
(2,10)

;with T1 as (
Select A.*
,ToDist  = cast(D.Qty as int),
running_total = SUM(D.Qty) OVER (PARTITION BY  A.ItemCode,BranchCode  ORDER BY  BranchCode  DESC
ROWS BETWEEN UNBOUNDED PRECEDING
AND CURRENT ROW)

```<code>     From  @StockTable A

     Join  @Orderapproval D on A.ItemCode=D.ItemCode    )
</code>```

, T2 as (
Select *,   prev_running_total = LAG(Qty,1,0) OVER (PARTITION BY  ItemCode ORDER BY  BranchCode  DESC) From T1

)

select *,
CASE WHEN prev_running_total >= ToDist THEN 0

WHEN running_total > ToDist THEN ToDist - prev_running_total

ELSE qty
END 'qty'
from T2;

I didn't get the right output.
Please suggest  a better way

答:
Try this:

```<code>SELECT s.itemcode
     , s.stockqty AS qty
     , s.batch
     , s.date
  FROM stock AS s
 INNER JOIN Orderapproval AS oa
    ON s.stockqty <= oa.approvalqty
</code>```

If required, insert resultset into new table

Body:
I have two tables Orderapproval and stock:

Table 1:  Orderapproval

itemcode
approvalqty

1
25

2
10

Table 2: stock

itemcode
stockqty
batch
date

1
5
aa
2021-02-01

1
10
bb
2021-02-10

1
15
cc
2021-02-02

2
5
dd
2021-02-01

2
20
aa
2021-02-05

we have stock batch-wise.
when we get an order request for an item
we are trying to pick up items from the old batch first & so on
How can I get a result set like this:

itemcode
qty
batch
date

1
5
aa
2021-02-01

1
15
cc
2021-02-02

1
5
bb
2021-02-10

2
5
dd
2021-02-01

I am trying as......

Declare @StockTable table
(ItemCode int,BranchCode int,Qty int)
Insert Into @StockTable values
(1,       101,          5),
(1,       102,           10),
(1,       101,          15),
(2,       102,           5),
(2,       103,           20)

Declare @Orderapproval table (ItemCode int,Qty int)
Insert Into @Orderapproval values
(1,25),
(2,10)

;with T1 as (
Select A.*
,ToDist  = cast(D.Qty as int),
running_total = SUM(D.Qty) OVER (PARTITION BY  A.ItemCode,BranchCode  ORDER BY  BranchCode  DESC
ROWS BETWEEN UNBOUNDED PRECEDING
AND CURRENT ROW)

     From  @StockTable A

     Join  @Orderapproval D on A.ItemCode=D.ItemCode    )

, T2 as (
Select *,   prev_running_total = LAG(Qty,1,0) OVER (PARTITION BY  ItemCode ORDER BY  BranchCode  DESC) From T1

)

select *,
CASE WHEN prev_running_total >= ToDist THEN 0

WHEN running_total > ToDist THEN ToDist - prev_running_total

ELSE qty
END 'qty'
from T2;

I didn't get the right output.
Please suggest  a better way

Body:
Try this:

SELECT s.itemcode
     , s.stockqty AS qty
     , s.batch
     , s.date
  FROM stock AS s
 INNER JOIN Orderapproval AS oa
    ON s.stockqty <= oa.approvalqty

If required, insert resultset into new table


问:
How to pass parameters to URL from Laravel Blade file
I want to pass parameters from my blade file to the URL when the user presses the next or previous button. I want to achieve that when the user presses the button next, the parameters page will be equal to 1, and the value will keep increasing by one every time the user presses the following button. I know I have to do something in ref, but I do not know what code to put in. So the example URL after the user presses the next button will be www.example.com?page=1.

```<code><div>
    <ul class="pagination">
        <li class="">
            <a href=""><i class="fa fa-angle-left"></i> Previous</a>
        </li>
        <li class="">
            <a href="">Next <i class="fa fa-angle-right"></i></a>
        </li>
    </ul>
</div>
</code>```

答:
If you only need to display simple "Next" and "Previous" links in your application's UI, you may use the simplePaginate method to perform a single, efficient query:

```<code>$users = DB::table('users')->simplePaginate(15);
</code>```

By default, the views rendered to display the pagination links are compatible with the Tailwind CSS framework.

However, the easiest way to customize the pagination views is by exporting them to your resources/views/vendor directory using the vendor:publish command:

```<code>php artisan vendor:publish --tag=laravel-pagination
</code>```

Body:
I want to pass parameters from my blade file to the URL when the user presses the next or previous button. I want to achieve that when the user presses the button next, the parameters page will be equal to 1, and the value will keep increasing by one every time the user presses the following button. I know I have to do something in ref, but I do not know what code to put in. So the example URL after the user presses the next button will be www.example.com?page=1.

             Previous

            Next

Body:
If you only need to display simple "Next" and "Previous" links in your application's UI, you may use the simplePaginate method to perform a single, efficient query:

$users = DB::table('users')->simplePaginate(15);

By default, the views rendered to display the pagination links are compatible with the Tailwind CSS framework.

However, the easiest way to customize the pagination views is by exporting them to your resources/views/vendor directory using the vendor:publish command:

php artisan vendor:publish --tag=laravel-pagination


问:
Superscript, Subscript text with Core Text iPhone
Can anyone explain me, How to draw superscript and subscript alphabets with Core Text?

Thanks.

答:
I noticed that this question is a bit old, I hope you still require assistance in this matter and that this post will help you.

you can use NSAttributedString (or its mutable counterpart NSMutableAttributedString) to assign different attributes (such as font, both name and size) to specific ranges of a single string.

Superscript and subscript are not natively supported by core text and to make them look good you might need to do quite a lot of work. Fortunately there is an open source project developed by Oliver Drobnik from cocoa genetics that allows you to easily convert HTML into NSAttributedString (or NSMutableAttributedString), feed it into a custom textview and show superscripts and subscripts (along with many other HTML and CSS) as they would appear in a UIWebview, but without the need to use a UIWebview. You can download the project from here.

While a lot of effort has been put into this project, there are two caveats:

The computations can be at times very performance intensive.

Not all HTML tags and CSS features are supported yet.


问:
Update column to add a default and disallow null
I want to update a column with a default value. I do that like so:

```<code>ALTER TABLE  `db`.`tbl` ALTER COLUMN `some_timestamp` SET DEFAULT current_timestamp();
</code>```

that works fine. I also want to add NOT NULL. How do I do that?

答:
you can add multiple constrains by following way also
ALTER TABLE MEMBER
ADD CONSTRAINT U_MEMBERID UNIQUE(MEMBER_ID), primary key (MEMBER_ID),
CONSTRAINT Sys_date DEFAULT GETDATE() FOR Sys_date;</p>

Body:
I want to update a column with a default value. I do that like so:

ALTER TABLE  `db`.`tbl` ALTER COLUMN `some_timestamp` SET DEFAULT current_timestamp();

that works fine. I also want to add NOT NULL. How do I do that?