问:
DomCrawler does not bring all the links?
not all links on the target site gives only why 5 links?

div.td.cm4.takimlar the structures are the same

```<code><?php
require("library/vendor/autoload.php");

use Goutte\Client;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\DomCrawler\Crawler;

$client = new Client(HttpClient::create(['timeout' => 60]));
$crawler = $client->request('GET', 'https://www.iddaaorantahmin.com/iddaa-bulteni');

$nodeValues = $crawler->filter('div.td.cm4.takimlar')->each(function (Crawler $node, $i) {
return $node->filter('a')->attr('href');
});

var_dump($nodeValues);
</code>```

答:
I got 376 items in var_dump()  with following code

```<code>$nodeValues = $crawler->filter('div.td.cm4.takimlar > a')->each(function (Crawler $node, $i) {

    // return $node;
    return $node->attr('href');
});

var_dump($nodeValues);
</code>```

some items

```<code>array (size=376)
  0 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/kaiserslautern-zwickau-iddaa-oranlari-105726' (length=91)
  1 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/wurzburger-kickers-eintracht-braunschweig-iddaa-oranlari-105740' (length=110)
  2 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/uerdingen-preussen-munster-iddaa-oranlari-105737' (length=95)
  3 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/hansa-rostock-ingolstadt-iddaa-oranlari-105724' (length=93)
  4 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/carl-zeiss-jena-meppen-iddaa-oranlari-105722' (length=91)
  5 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/msv-duisburg-waldhof-mannheim-iddaa-oranlari-105723' (length=98)
  6 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/red-star-laval-iddaa-oranlari-105731' (length=83)
  7 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/lubeck-holstein-kiel-ii-iddaa-oranlari-105729' (length=92)
  8 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/schalke-04-ii-borussia-m-gladbach-ii-iddaa-oranlari-105734' (length=105)
  9 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/sv-lippstadt-08-bergisch-gladbach-iddaa-oranlari-105728' (length=102)
  10 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/homberg-borussia-dortmund-ii-iddaa-oranlari-105738' (length=97)
  11 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/verl-fortuna-dusseldorf-ii-iddaa-oranlari-105733' (length=95)
  12 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/bonner-sc-fortuna-koln-iddaa-oranlari-105721' (length=91)
  13 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/koln-ii-tus-haltern-iddaa-oranlari-105727' (length=88)
  14 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/fsv-frankfurt-saarbrucken-iddaa-oranlari-105905' (length=94)
  15 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/pirmasens-ulm-iddaa-oranlari-105909' (length=82)
  16 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/elversberg-aalen-iddaa-oranlari-105904' (length=85)
  17 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/tsv-steinbach-fc-giessen-iddaa-oranlari-105910' (length=93)
  18 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/kickers-offenbach-bahlinger-sc-iddaa-oranlari-105908' (length=99)
  19 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/homburg-freiburg-ii-iddaa-oranlari-105906' (length=88)
  20 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/al-taawon-al-raed-iddaa-oranlari-105720' (length=86)
  21 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/fc-zlate-moravce-skf-sered-iddaa-oranlari-105739' (length=95)
  22 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/pohronie-msk-zilina-iddaa-oranlari-105730' (length=88)
  23 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/ruzomberok-dac-iddaa-oranlari-105732' (length=83)
  24 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/zemplin-michalovce-nitra-iddaa-oranlari-105741' (length=93)
  25 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/slovan-bratislava-fk-as-trencin-iddaa-oranlari-105735' (length=100)
  26 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/triglav-rudar-iddaa-oranlari-105915' (length=82)
  27 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/kesl%C9%99-zira-iddaa-oranlari-105943' (length=84)
  28 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/institute-coleraine-iddaa-oranlari-105725' (length=88)
  29 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/havelse-altona-93-iddaa-oranlari-105736' (length=86)
  30 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/mbombela-united-real-kings-iddaa-oranlari-105907' (length=95)
  31 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/highlands-park-kaizer-chiefs-iddaa-oranlari-106025' (length=97)
  32 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/happy-wanderers-ts-sporting-iddaa-oranlari-105953' (length=96)
  33 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/club-africain-chebba-iddaa-oranlari-105945' (length=89)
  34 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/us-ben-guerdane-tataouine-iddaa-oranlari-105950' (length=94)
  35 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/etoile-sahel-metlaoui-iddaa-oranlari-105949' (length=90)
  36 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/akhisarspor-karagumruk-iddaa-oranlari-105742' (length=91)
  37 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/slavia-prag-opava-iddaa-oranlari-105746' (length=86)
  38 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/mlada-boleslav-slovacko-iddaa-oranlari-105744' (length=92)
  39 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/slovan-liberec-bohemians-1905-iddaa-oranlari-105747' (length=98)
  40 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/oskarshamns-aik-orebro-iddaa-oranlari-105745' (length=91)
  41 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/elfsborg-brage-iddaa-oranlari-105743' (length=83)
  42 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/al-ain-al-wasl-iddaa-oranlari-105933' (length=83)
  43 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/umm-salal-al-sadd-iddaa-oranlari-105911' (length=86)
  44 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/arka-gdynia-rakow-czestochowa-iddaa-oranlari-105749' (length=98)
  45 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/goztepe-gaziantep-fk-iddaa-oranlari-105467' (length=89)
  46 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/cittadella-juve-stabia-iddaa-oranlari-105752' (length=91)
  47 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/trapani-spezia-iddaa-oranlari-105757' (length=83)
  48 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/virtus-entella-benevento-iddaa-oranlari-105759' (length=93)
  49 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/ascoli-cremonese-iddaa-oranlari-105750' (length=85)
  50 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/lens-caen-iddaa-oranlari-105756' (length=78)
  51 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/hajduk-split-gorica-iddaa-oranlari-105754' (length=88)
  52 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/bologna-udinese-iddaa-oranlari-105466' (length=84)
  53 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/carrarese-gozzano-iddaa-oranlari-105751' (length=86)
  54 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/renate-pizzighettone-iddaa-oranlari-105748' (length=89)
  55 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/virtus-verona-rimini-iddaa-oranlari-105758' (length=89)
  56 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/modena-sudtirol-iddaa-oranlari-105755' (length=84)
  57 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/fc-rieti-teramo-iddaa-oranlari-105753' (length=84)
  58 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/biskra-belouizdad-iddaa-oranlari-105935' (length=86)
  59 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/nc-magra-es-setif-iddaa-oranlari-105934' (length=86)
  60 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/m-gladbach-hoffenheim-iddaa-oranlari-105470' (length=90)
  61 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/hertha-berlin-koln-iddaa-oranlari-105469' (length=87)
  62 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/werder-bremen-dortmund-iddaa-oranlari-105471' (length=91)
  63 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/freiburg-fortuna-dusseldorf-iddaa-oranlari-105468' (length=96)
  64 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/barry-town-caernarfon-town-iddaa-oranlari-105760' (length=95)
  65 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/newtown-bala-town-iddaa-oranlari-105763' (length=86)
  66 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/carmarthen-town-cefn-druids-iddaa-oranlari-105761' (length=96)
  67 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/uwic-cardiff-airbus-uk-iddaa-oranlari-105779' (length=91)
  68 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/fleetwood-town-portsmouth-iddaa-oranlari-105803' (length=94)
  69 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/southend-united-burton-albion-iddaa-oranlari-105841' (length=98)
  70 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/rochdale-coventry-city-iddaa-oranlari-105837' (length=91)
  71 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/milton-keynes-dons-bolton-iddaa-oranlari-105825' (length=94)
  72 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/lincoln-city-gillingham-iddaa-oranlari-105822' (length=92)
  73 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/accrington-stanley-rotherham-united-iddaa-oranlari-105765' (length=104)
  74 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/shrewsbury-town-doncaster-rovers-iddaa-oranlari-105840' (length=101)
  75 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/wycombe-wanderers-tranmere-rovers-iddaa-oranlari-105857' (length=102)
  76 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/afc-wimbledon-blackpool-iddaa-oranlari-105855' (length=92)
  77 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/ipswich-town-oxford-united-iddaa-oranlari-105816' (length=95)
  78 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/sunderland-bristol-rovers-iddaa-oranlari-105846' (length=94)
  79 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/southampton-aston-villa-iddaa-oranlari-105476' (length=92)
  80 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/burnley-afc-bournemouth-iddaa-oranlari-105473' (length=92)
  81 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/crystal-palace-newcastle-utd-iddaa-oranlari-105474' (length=97)
  82 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/sheffield-united-brighton-hove-albion-iddaa-oranlari-105475' (length=106)
  83 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/barcelona-eibar-iddaa-oranlari-105472' (length=84)
  84 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/almeria-fuenlabrada-iddaa-oranlari-105767' (length=88)
  85 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/ad-alcorcon-las-palmas-iddaa-oranlari-105766' (length=91)
  86 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/barnsley-middlesbrough-iddaa-oranlari-105771' (length=91)
  87 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/not-forest-queens-park-rangers-iddaa-oranlari-105828' (length=99)
  88 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/birmingham-city-sheffield-wednesday-iddaa-oranlari-105773' (length=104)
  89 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/swansea-city-huddersfield-town-iddaa-oranlari-105847' (length=99)
  90 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/stoke-city-cardiff-city-iddaa-oranlari-105845' (length=92)
  91 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/preston-north-end-hull-city-iddaa-oranlari-105834' (length=96)
  92 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/wigan-athletic-millwall-iddaa-oranlari-105854' (length=92)
  93 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/charlton-athletic-luton-town-iddaa-oranlari-105782' (length=97)
  94 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/leeds-united-reading-iddaa-oranlari-105820' (length=89)
  95 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/bristol-city-west-bromwich-iddaa-oranlari-105777' (length=95)
  96 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/arbroath-ayr-united-iddaa-oranlari-105770' (length=88)
  97 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/queen-of-the-south-dundee-fc-iddaa-oranlari-105835' (length=97)
  98 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/partick-thistle-dunfermline-athletic-iddaa-oranlari-105831' (length=105)
  99 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/greenock-morton-alloa-athletic-iddaa-oranlari-105804' (length=99)
  100 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/dynamo-kiev-vorskla-iddaa-oranlari-105795' (length=88)
  101 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/crawley-town-stevenage-iddaa-oranlari-105790' (length=91)
  102 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/swindon-town-grimsby-town-iddaa-oranlari-105848' (length=94)
  103 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/salford-city-colchester-united-iddaa-oranlari-105838' (length=99)
  104 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/newport-county-bradford-city-iddaa-oranlari-105826' (length=97)
  105 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/crewe-alexandra-macclesfield-town-iddaa-oranlari-105791' (length=102)
  106 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/scunthorpe-united-forest-green-rovers-iddaa-oranlari-105839' (length=106)
  107 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/plymouth-argyle-cambridge-united-iddaa-oranlari-105833' (length=101)
  108 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/walsall-port-vale-iddaa-oranlari-105850' (length=86)
  109 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/leyton-orient-oldham-athletic-iddaa-oranlari-105821' (length=98)
  110 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/cheltenham-town-mansfield-town-iddaa-oranlari-105784' (length=99)
  111 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/carlisle-united-morecambe-iddaa-oranlari-105780' (length=94)
  112 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/northampton-town-exeter-city-iddaa-oranlari-105827' (length=97)
  113 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/woking-stockport-county-iddaa-oranlari-105856' (length=92)
  114 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/hartlepool-united-notts-county-iddaa-oranlari-105810' (length=99)
  115 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/dagenham-redbridge-solihull-moors-iddaa-oranlari-105793' (length=102)
  116 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/maidenhead-united-aldershot-town-iddaa-oranlari-105823' (length=101)
  117 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/bromley-wrexham-iddaa-oranlari-105778' (length=84)
  118 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/dover-athletic-afc-fylde-iddaa-oranlari-105796' (length=93)
  119 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/boreham-wood-yeovil-town-iddaa-oranlari-105774' (length=93)
  120 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/torquay-united-halifax-town-iddaa-oranlari-105849' (length=96)
  121 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/chorley-barnet-iddaa-oranlari-105787' (length=83)
  122 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/harrogate-town-eastleigh-iddaa-oranlari-105809' (length=93)
  123 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/chesterfield-ebbsfleet-united-iddaa-oranlari-105786' (length=98)
  124 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/kidderminster-harriers-york-city-iddaa-oranlari-105817' (length=101)
  125 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/spennymoor-town-alfreton-town-iddaa-oranlari-105842' (length=98)
  126 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/curzon-ashton-gloucester-city-iddaa-oranlari-105792' (length=98)
  127 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/altrincham-king-s-lynn-town-iddaa-oranlari-105768' (length=96)
  more elements...
</code>```

Body:
not all links on the target site gives only why 5 links?

div.td.cm4.takimlar the structures are the same

<?php
require("library/vendor/autoload.php");

use Goutte\Client;
use Symfony\Component\HttpClient\HttpClient;
use Symfony\Component\DomCrawler\Crawler;

$client = new Client(HttpClient::create(['timeout' => 60]));
$crawler = $client->request('GET', 'https://www.iddaaorantahmin.com/iddaa-bulteni');

$nodeValues = $crawler->filter('div.td.cm4.takimlar')->each(function (Crawler $node, $i) {
return $node->filter('a')->attr('href');
});

var_dump($nodeValues);

Body:
I got 376 items in var_dump()  with following code

$nodeValues = $crawler->filter('div.td.cm4.takimlar > a')->each(function (Crawler $node, $i) {

    // return $node;
    return $node->attr('href');
});

var_dump($nodeValues);

some items

array (size=376)
  0 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/kaiserslautern-zwickau-iddaa-oranlari-105726' (length=91)
  1 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/wurzburger-kickers-eintracht-braunschweig-iddaa-oranlari-105740' (length=110)
  2 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/uerdingen-preussen-munster-iddaa-oranlari-105737' (length=95)
  3 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/hansa-rostock-ingolstadt-iddaa-oranlari-105724' (length=93)
  4 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/carl-zeiss-jena-meppen-iddaa-oranlari-105722' (length=91)
  5 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/msv-duisburg-waldhof-mannheim-iddaa-oranlari-105723' (length=98)
  6 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/red-star-laval-iddaa-oranlari-105731' (length=83)
  7 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/lubeck-holstein-kiel-ii-iddaa-oranlari-105729' (length=92)
  8 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/schalke-04-ii-borussia-m-gladbach-ii-iddaa-oranlari-105734' (length=105)
  9 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/sv-lippstadt-08-bergisch-gladbach-iddaa-oranlari-105728' (length=102)
  10 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/homberg-borussia-dortmund-ii-iddaa-oranlari-105738' (length=97)
  11 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/verl-fortuna-dusseldorf-ii-iddaa-oranlari-105733' (length=95)
  12 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/bonner-sc-fortuna-koln-iddaa-oranlari-105721' (length=91)
  13 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/koln-ii-tus-haltern-iddaa-oranlari-105727' (length=88)
  14 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/fsv-frankfurt-saarbrucken-iddaa-oranlari-105905' (length=94)
  15 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/pirmasens-ulm-iddaa-oranlari-105909' (length=82)
  16 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/elversberg-aalen-iddaa-oranlari-105904' (length=85)
  17 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/tsv-steinbach-fc-giessen-iddaa-oranlari-105910' (length=93)
  18 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/kickers-offenbach-bahlinger-sc-iddaa-oranlari-105908' (length=99)
  19 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/homburg-freiburg-ii-iddaa-oranlari-105906' (length=88)
  20 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/al-taawon-al-raed-iddaa-oranlari-105720' (length=86)
  21 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/fc-zlate-moravce-skf-sered-iddaa-oranlari-105739' (length=95)
  22 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/pohronie-msk-zilina-iddaa-oranlari-105730' (length=88)
  23 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/ruzomberok-dac-iddaa-oranlari-105732' (length=83)
  24 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/zemplin-michalovce-nitra-iddaa-oranlari-105741' (length=93)
  25 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/slovan-bratislava-fk-as-trencin-iddaa-oranlari-105735' (length=100)
  26 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/triglav-rudar-iddaa-oranlari-105915' (length=82)
  27 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/kesl%C9%99-zira-iddaa-oranlari-105943' (length=84)
  28 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/institute-coleraine-iddaa-oranlari-105725' (length=88)
  29 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/havelse-altona-93-iddaa-oranlari-105736' (length=86)
  30 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/mbombela-united-real-kings-iddaa-oranlari-105907' (length=95)
  31 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/highlands-park-kaizer-chiefs-iddaa-oranlari-106025' (length=97)
  32 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/happy-wanderers-ts-sporting-iddaa-oranlari-105953' (length=96)
  33 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/club-africain-chebba-iddaa-oranlari-105945' (length=89)
  34 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/us-ben-guerdane-tataouine-iddaa-oranlari-105950' (length=94)
  35 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/etoile-sahel-metlaoui-iddaa-oranlari-105949' (length=90)
  36 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/akhisarspor-karagumruk-iddaa-oranlari-105742' (length=91)
  37 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/slavia-prag-opava-iddaa-oranlari-105746' (length=86)
  38 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/mlada-boleslav-slovacko-iddaa-oranlari-105744' (length=92)
  39 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/slovan-liberec-bohemians-1905-iddaa-oranlari-105747' (length=98)
  40 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/oskarshamns-aik-orebro-iddaa-oranlari-105745' (length=91)
  41 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/elfsborg-brage-iddaa-oranlari-105743' (length=83)
  42 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/al-ain-al-wasl-iddaa-oranlari-105933' (length=83)
  43 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/umm-salal-al-sadd-iddaa-oranlari-105911' (length=86)
  44 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/arka-gdynia-rakow-czestochowa-iddaa-oranlari-105749' (length=98)
  45 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/goztepe-gaziantep-fk-iddaa-oranlari-105467' (length=89)
  46 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/cittadella-juve-stabia-iddaa-oranlari-105752' (length=91)
  47 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/trapani-spezia-iddaa-oranlari-105757' (length=83)
  48 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/virtus-entella-benevento-iddaa-oranlari-105759' (length=93)
  49 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/ascoli-cremonese-iddaa-oranlari-105750' (length=85)
  50 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/lens-caen-iddaa-oranlari-105756' (length=78)
  51 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/hajduk-split-gorica-iddaa-oranlari-105754' (length=88)
  52 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/bologna-udinese-iddaa-oranlari-105466' (length=84)
  53 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/carrarese-gozzano-iddaa-oranlari-105751' (length=86)
  54 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/renate-pizzighettone-iddaa-oranlari-105748' (length=89)
  55 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/virtus-verona-rimini-iddaa-oranlari-105758' (length=89)
  56 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/modena-sudtirol-iddaa-oranlari-105755' (length=84)
  57 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/fc-rieti-teramo-iddaa-oranlari-105753' (length=84)
  58 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/biskra-belouizdad-iddaa-oranlari-105935' (length=86)
  59 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/nc-magra-es-setif-iddaa-oranlari-105934' (length=86)
  60 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/m-gladbach-hoffenheim-iddaa-oranlari-105470' (length=90)
  61 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/hertha-berlin-koln-iddaa-oranlari-105469' (length=87)
  62 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/werder-bremen-dortmund-iddaa-oranlari-105471' (length=91)
  63 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/freiburg-fortuna-dusseldorf-iddaa-oranlari-105468' (length=96)
  64 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/barry-town-caernarfon-town-iddaa-oranlari-105760' (length=95)
  65 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/newtown-bala-town-iddaa-oranlari-105763' (length=86)
  66 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/carmarthen-town-cefn-druids-iddaa-oranlari-105761' (length=96)
  67 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/uwic-cardiff-airbus-uk-iddaa-oranlari-105779' (length=91)
  68 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/fleetwood-town-portsmouth-iddaa-oranlari-105803' (length=94)
  69 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/southend-united-burton-albion-iddaa-oranlari-105841' (length=98)
  70 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/rochdale-coventry-city-iddaa-oranlari-105837' (length=91)
  71 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/milton-keynes-dons-bolton-iddaa-oranlari-105825' (length=94)
  72 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/lincoln-city-gillingham-iddaa-oranlari-105822' (length=92)
  73 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/accrington-stanley-rotherham-united-iddaa-oranlari-105765' (length=104)
  74 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/shrewsbury-town-doncaster-rovers-iddaa-oranlari-105840' (length=101)
  75 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/wycombe-wanderers-tranmere-rovers-iddaa-oranlari-105857' (length=102)
  76 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/afc-wimbledon-blackpool-iddaa-oranlari-105855' (length=92)
  77 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/ipswich-town-oxford-united-iddaa-oranlari-105816' (length=95)
  78 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/sunderland-bristol-rovers-iddaa-oranlari-105846' (length=94)
  79 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/southampton-aston-villa-iddaa-oranlari-105476' (length=92)
  80 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/burnley-afc-bournemouth-iddaa-oranlari-105473' (length=92)
  81 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/crystal-palace-newcastle-utd-iddaa-oranlari-105474' (length=97)
  82 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/sheffield-united-brighton-hove-albion-iddaa-oranlari-105475' (length=106)
  83 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/barcelona-eibar-iddaa-oranlari-105472' (length=84)
  84 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/almeria-fuenlabrada-iddaa-oranlari-105767' (length=88)
  85 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/ad-alcorcon-las-palmas-iddaa-oranlari-105766' (length=91)
  86 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/barnsley-middlesbrough-iddaa-oranlari-105771' (length=91)
  87 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/not-forest-queens-park-rangers-iddaa-oranlari-105828' (length=99)
  88 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/birmingham-city-sheffield-wednesday-iddaa-oranlari-105773' (length=104)
  89 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/swansea-city-huddersfield-town-iddaa-oranlari-105847' (length=99)
  90 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/stoke-city-cardiff-city-iddaa-oranlari-105845' (length=92)
  91 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/preston-north-end-hull-city-iddaa-oranlari-105834' (length=96)
  92 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/wigan-athletic-millwall-iddaa-oranlari-105854' (length=92)
  93 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/charlton-athletic-luton-town-iddaa-oranlari-105782' (length=97)
  94 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/leeds-united-reading-iddaa-oranlari-105820' (length=89)
  95 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/bristol-city-west-bromwich-iddaa-oranlari-105777' (length=95)
  96 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/arbroath-ayr-united-iddaa-oranlari-105770' (length=88)
  97 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/queen-of-the-south-dundee-fc-iddaa-oranlari-105835' (length=97)
  98 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/partick-thistle-dunfermline-athletic-iddaa-oranlari-105831' (length=105)
  99 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/greenock-morton-alloa-athletic-iddaa-oranlari-105804' (length=99)
  100 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/dynamo-kiev-vorskla-iddaa-oranlari-105795' (length=88)
  101 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/crawley-town-stevenage-iddaa-oranlari-105790' (length=91)
  102 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/swindon-town-grimsby-town-iddaa-oranlari-105848' (length=94)
  103 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/salford-city-colchester-united-iddaa-oranlari-105838' (length=99)
  104 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/newport-county-bradford-city-iddaa-oranlari-105826' (length=97)
  105 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/crewe-alexandra-macclesfield-town-iddaa-oranlari-105791' (length=102)
  106 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/scunthorpe-united-forest-green-rovers-iddaa-oranlari-105839' (length=106)
  107 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/plymouth-argyle-cambridge-united-iddaa-oranlari-105833' (length=101)
  108 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/walsall-port-vale-iddaa-oranlari-105850' (length=86)
  109 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/leyton-orient-oldham-athletic-iddaa-oranlari-105821' (length=98)
  110 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/cheltenham-town-mansfield-town-iddaa-oranlari-105784' (length=99)
  111 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/carlisle-united-morecambe-iddaa-oranlari-105780' (length=94)
  112 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/northampton-town-exeter-city-iddaa-oranlari-105827' (length=97)
  113 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/woking-stockport-county-iddaa-oranlari-105856' (length=92)
  114 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/hartlepool-united-notts-county-iddaa-oranlari-105810' (length=99)
  115 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/dagenham-redbridge-solihull-moors-iddaa-oranlari-105793' (length=102)
  116 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/maidenhead-united-aldershot-town-iddaa-oranlari-105823' (length=101)
  117 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/bromley-wrexham-iddaa-oranlari-105778' (length=84)
  118 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/dover-athletic-afc-fylde-iddaa-oranlari-105796' (length=93)
  119 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/boreham-wood-yeovil-town-iddaa-oranlari-105774' (length=93)
  120 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/torquay-united-halifax-town-iddaa-oranlari-105849' (length=96)
  121 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/chorley-barnet-iddaa-oranlari-105787' (length=83)
  122 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/harrogate-town-eastleigh-iddaa-oranlari-105809' (length=93)
  123 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/chesterfield-ebbsfleet-united-iddaa-oranlari-105786' (length=98)
  124 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/kidderminster-harriers-york-city-iddaa-oranlari-105817' (length=101)
  125 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/spennymoor-town-alfreton-town-iddaa-oranlari-105842' (length=98)
  126 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/curzon-ashton-gloucester-city-iddaa-oranlari-105792' (length=98)
  127 => string 'https://www.iddaaorantahmin.com/iddaa-oranlari/altrincham-king-s-lynn-town-iddaa-oranlari-105768' (length=96)
  more elements...


来源: stackexchange

问:
How to sort plotly stacked bar graph in r by y value?
I've got this graph and I want it to appear in Sam - Jhon - Paul order because that's going from highest to lowest cost, somebody could tell me how to order it by cost? Tried using code below in layout section but it didn't word.

```<code> layout(yaxis = list(title = 'Cost'),
        xaxis = list(title = 'Parent',
                     categoryorder = "array",
                     categoryarray = ~cost),
                     barmode = 'stack')
</code>```

答:
You are almost there. You just need to use the order of top_3$parent in your categoryarray instead of cost, as follows:

```<code>layout(yaxis = list(title = 'Cost'),
       xaxis = list(title = 'Parent',
               categoryorder = "array",
               categoryarray = top_3$parent),
               barmode = 'stack')
</code>```

So, using the full plotting code:

```<code>plot_ly(sample[sample$parent %in% top_3$parent,],
        x = ~parent, y = ~cost, type = 'bar', color = ~topic) %>%
        layout(yaxis = list(title = 'Cost'),
               xaxis = list(title = 'Parent',
                            categoryorder = "array",
                            categoryarray = top_3$parent),
                            barmode = 'stack') %>%
        config(displayModeBar = FALSE)
</code>```

You should get the following plot:

ContentLicense: CC BY-SA 4.0

Body:
I've got this graph and I want it to appear in Sam - Jhon - Paul order because that's going from highest to lowest cost, somebody could tell me how to order it by cost? Tried using code below in layout section but it didn't word.

 layout(yaxis = list(title = 'Cost'),
        xaxis = list(title = 'Parent',
                     categoryorder = "array",
                     categoryarray = ~cost),
                     barmode = 'stack')

Body:
You are almost there. You just need to use the order of top_3$parent in your categoryarray instead of cost, as follows:

layout(yaxis = list(title = 'Cost'),
       xaxis = list(title = 'Parent',
               categoryorder = "array",
               categoryarray = top_3$parent),
               barmode = 'stack')

So, using the full plotting code:

plot_ly(sample[sample$parent %in% top_3$parent,],
        x = ~parent, y = ~cost, type = 'bar', color = ~topic) %>%
        layout(yaxis = list(title = 'Cost'),
               xaxis = list(title = 'Parent',
                            categoryorder = "array",
                            categoryarray = top_3$parent),
                            barmode = 'stack') %>%
        config(displayModeBar = FALSE)

You should get the following plot:


问:
'cannot open git-upload-pack' error in Eclipse when cloning or pushing git repository
I am not able to clone or push to a git repository at Bitbucket in Eclipse:

It's weird, because a day before I didn't have any problem. I have downloaded the sts 3 times with no luck. This error keeps showing. Also I have installed SourceTree and it says 'This is not a valid source path / URL':

If I use git commands to import the project, it works, but I wan't to use EGit for this task, since I am a newbie with git.

I don't know if this has to do with it, but in the same directory I have the android-adt-bundle. This one works pretty well, but the project lies on GitHub and not Bitbucket. Also, I'm working with another person and he is able to fetch and push data from and to the Bitbucket repository. I have read lots of posts but none of them have helped me out.

I'm using Windows 7 btw.

答:
For the Eclipse running on IBM JDK the following 2 lines are mandatory in eclipse.ini after -vmargs:

-Dhttps.protocols=TLSv1.1,TLSv1.2

-Dcom.ibm.jsse2.overrideDefaultTLS=true

ContentLicense: CC BY-SA 3.0


问:
Instantiate a class with list as useable object
I am new to OOP and thus possibly going about this the wrong way in Python. What I am trying to do is instantiate a class with a list of other objects as an argument. I then want to be able to iterate over that list calling some argument of the first object. The problem is when i instantiate the second class the list argument is reduced to a single object - meaning I cannot iterate over it. This makes sense but I don't know how to get around it.

Here is an example:

```<code>#create a class of Goods with attributes: description and price
class Goods:
    def __init__(self, desc, price):
        self.desc = desc
        self.price = price

#create a class of Shelf, which is a list of Goods
class Shelf:
    def __init__(self, stuff):
        self.stuff = stuff

#write a method for Shelf that prints just the descriptions of everything on the shelf (this is what won't work)
    def print_stuff_descriptions(self):
        return([self[i].desc for i in range(len(self))])

#create two Goods:
icecream = Goods('Icecream', 10)
butter = Goods('Butter', 5)

#now create a Shelf containing those two Goods
isle_1 = Shelf([icecream, butter])

#Now i try to use the method for printing descriptions
print(isle_1.print_stuff_descriptions())
</code>```

This throws the error: TypeError: object of type 'Shelf' has no len(), which makes sense as print(isle_1) gives: <__main__.Shelf object at 0x0124ECB0> i.e. a single object with no length.

I can get around this by doing the following (instead of creating the Shelf object):

```<code>#create a list of the Goods
isle_1 = [icecream, butter]

#create a list of the descriptions
isle_1_stuff_descriptions = [isle_1[i].desc for i in range(len(isle_1))]

#print the result
print(isle_1_stuff_descriptions)
['Icecream', 'Butter']
</code>```

This all makes sense, but I would like to be able to do things like run conditions based on:

if 'Icecream' in isle_1.print_stuff_descriptions:

Instead I have to create the variable and then create the list of descriptions and then run the conditional on that new variable.

if 'Icecream' in isle_1_stuff_descriptions:

This seems extremely cumbersome and is the sort of thing I thought OOP was meant make more elegant. Is this the way to do it, or is there a way to do this in OOP?

答:
You're not using self.stuff in print_stuff_descriptions. It should be:

```<code>    def print_stuff_descriptions(self):
        return([self.stuff[i].desc for i in range(len(self.stuff))])
</code>```

or more simply:

```<code>    def print_stuff_descriptions(self):
        return [x.desc for x in self.stuff]
</code>```

Body:
I am new to OOP and thus possibly going about this the wrong way in Python. What I am trying to do is instantiate a class with a list of other objects as an argument. I then want to be able to iterate over that list calling some argument of the first object. The problem is when i instantiate the second class the list argument is reduced to a single object - meaning I cannot iterate over it. This makes sense but I don't know how to get around it.

Here is an example:

#create a class of Goods with attributes: description and price
class Goods:
    def __init__(self, desc, price):
        self.desc = desc
        self.price = price

#create a class of Shelf, which is a list of Goods
class Shelf:
    def __init__(self, stuff):
        self.stuff = stuff

#write a method for Shelf that prints just the descriptions of everything on the shelf (this is what won't work)
    def print_stuff_descriptions(self):
        return([self[i].desc for i in range(len(self))])

#create two Goods:
icecream = Goods('Icecream', 10)
butter = Goods('Butter', 5)

#now create a Shelf containing those two Goods
isle_1 = Shelf([icecream, butter])

#Now i try to use the method for printing descriptions
print(isle_1.print_stuff_descriptions())

This throws the error: TypeError: object of type 'Shelf' has no len(), which makes sense as print(isle_1) gives: <__main__.Shelf object at 0x0124ECB0> i.e. a single object with no length.

I can get around this by doing the following (instead of creating the Shelf object):

#create a list of the Goods
isle_1 = [icecream, butter]

#create a list of the descriptions
isle_1_stuff_descriptions = [isle_1[i].desc for i in range(len(isle_1))]

#print the result
print(isle_1_stuff_descriptions)
['Icecream', 'Butter']

This all makes sense, but I would like to be able to do things like run conditions based on:

if 'Icecream' in isle_1.print_stuff_descriptions:

Instead I have to create the variable and then create the list of descriptions and then run the conditional on that new variable.

if 'Icecream' in isle_1_stuff_descriptions:

This seems extremely cumbersome and is the sort of thing I thought OOP was meant make more elegant. Is this the way to do it, or is there a way to do this in OOP?

Body:
You're not using self.stuff in print_stuff_descriptions. It should be:

    def print_stuff_descriptions(self):
        return([self.stuff[i].desc for i in range(len(self.stuff))])

or more simply:

    def print_stuff_descriptions(self):
        return [x.desc for x in self.stuff]


问:
Ink is not drawing over the Path using Inkcanvas UWP
I have a Canvas element as Main UIElement, I have placed a Inkcanvas and path over the parent canvas.
When I try to draw ink over the path, its not working properly. It draws properly when it is drawn over the remaining space.

Note: Path is added as topmost child. I don't want to change the Zindex order.

答:
You don't have to change the z-index, maybe you just need to use InkCanvas as the top-level element:

<Canvas>
    <Path Stroke="Black" StrokeThickness="1">
        <Path.Data>

        </Path.Data>
    </Path>
    <InkCanvas />
</Canvas>
```

Body:
You don't have to change the z-index, maybe you just need to use InkCanvas as the top-level element:

<Canvas>
    <Path Stroke="Black" StrokeThickness="1">
        <Path.Data>
            <!--data-->
        </Path.Data>
    </Path>
    <InkCanvas />
</Canvas>


问:
How to catch an ActiveRecord::RecordInvalid error in rails/rspec
I want to catch an ActiveRecord error on Rspec: (I'm also using a factory)

Rspec

```<code>it "should throw an error" do
    animal = create(:animal)
    food_store = -1;
    expect(animal.update!(food_store: food_store)).to raise_error(ActiveRecord::RecordInvalid)
</code>```

Validator:

```<code>class AnimalValidator < ActiveModel::Validator
  def validate(record)
    if record.food_store < 1
      record.errors[:food_store] << "store can't be negative"
    end
  end
end
</code>```

I keep getting this error message:

```<code> Failure/Error: expect(animal.update!(food_store: new_share)).raise_error(ActiveRecord::RecordInvalid)

 ActiveRecord::RecordInvalid:
   Validation failed: store can't be negative
</code>```

How am I suppose to catch this activeRecord error?

答:
So I figured out a potential solution, using brackets instead of brackets

```<code>    expect {animal.update!(food_store: food_store)}.to raise_error
</code>```

Posting it here for not but I'm not sure if this is the best solution

Body:
I want to catch an ActiveRecord error on Rspec: (I'm also using a factory)

Rspec

it "should throw an error" do
    animal = create(:animal)
    food_store = -1;
    expect(animal.update!(food_store: food_store)).to raise_error(ActiveRecord::RecordInvalid)

Validator:

class AnimalValidator < ActiveModel::Validator
  def validate(record)
    if record.food_store < 1
      record.errors[:food_store] << "store can't be negative"
    end
  end
end

I keep getting this error message:

 Failure/Error: expect(animal.update!(food_store: new_share)).raise_error(ActiveRecord::RecordInvalid)

 ActiveRecord::RecordInvalid:
   Validation failed: store can't be negative

How am I suppose to catch this activeRecord error?

Body:
So I figured out a potential solution, using brackets instead of brackets

    expect {animal.update!(food_store: food_store)}.to raise_error

Posting it here for not but I'm not sure if this is the best solution


问:
I have a list, in which one of column data has to formatted in such a way that $ sign and Comma should be removed
```<code>data = Index(['borough', 'neighborhood', 'building_class_category',
       'tax_class_at_present', 'block', 'lot', 'ease_ment',
       'building_class_at_present', 'address', 'apart_ment_number', 'zip_code',
       'residential_units', 'commercial_units', 'total_units',
       'land_square_feet', 'gross_square_feet', 'year_built',
       'tax_class_at_time_of_sale', 'building_class_at_time_of_sale',
       'sale_price', 'sale_date'],
      dtype='object')
</code>```

Convert the field “sale_price” to numeric (it is currently formatted as currency which cannot be
used in calculations.) (Hint, you will need to remove the commas and dollar signs.

I tried

```<code>df=data
df['sale_price']=df['sale_price'].replace('$','')
using

df['sale_price'] = df['sale_price'].str.replace(',', '').str.replace('$', '').astype(int)
</code>```

答:
You can check this one, replace int with any type you need:

```<code>df['sale_price'] = df['sale_price'].str.replace(r'[$,]','').astype(int)
</code>```

Or this also works:

```<code>df['sale_price'] = pd.to_numeric(df.sale_price)
</code>```

Body:
data = Index(['borough', 'neighborhood', 'building_class_category',
       'tax_class_at_present', 'block', 'lot', 'ease_ment',
       'building_class_at_present', 'address', 'apart_ment_number', 'zip_code',
       'residential_units', 'commercial_units', 'total_units',
       'land_square_feet', 'gross_square_feet', 'year_built',
       'tax_class_at_time_of_sale', 'building_class_at_time_of_sale',
       'sale_price', 'sale_date'],
      dtype='object')

Convert the field “sale_price” to numeric (it is currently formatted as currency which cannot be
used in calculations.) (Hint, you will need to remove the commas and dollar signs.

I tried

df=data
df['sale_price']=df['sale_price'].replace('$','')
using

df['sale_price'] = df['sale_price'].str.replace(',', '').str.replace('$', '').astype(int)

Body:
You can check this one, replace int with any type you need:

df['sale_price'] = df['sale_price'].str.replace(r'[$,]','').astype(int)

Or this also works:

df['sale_price'] = pd.to_numeric(df.sale_price)


问:
Get Instance count and memory details from AWS EMR Cluster-id
Hi I would like to get Instance count and Total available memory and Memory for each instance in the cluster.

When I submit aws emr describe-cluster --cluster-id 'cluster-id' --region us-east-1 then I get a json output, which has all the information, but is there any way to filter just below 3 details.

Instance count,

Instance memory and

Total memory in the cluster.

答:
The AWS CLI has a --query parameter which can be used to specify the output fields desired.

See: Controlling Command Output from the AWS CLI - AWS Command Line Interface

Therefore, you could use:

```<code>aws emr describe-cluster --cluster-id 'cluster-id' --query Cluster[]. InstanceGroups[].[InstanceType,RunningInstanceCount]
</code>```

I couldn't see any output values listed for memory, but the above should get you started.

Body:
The AWS CLI has a --query parameter which can be used to specify the output fields desired.

See: Controlling Command Output from the AWS CLI - AWS Command Line Interface

Therefore, you could use:

aws emr describe-cluster --cluster-id 'cluster-id' --query Cluster[]. InstanceGroups[].[InstanceType,RunningInstanceCount]

I couldn't see any output values listed for memory, but the above should get you started.


问:
Used Enum in Class Constructor, Method Within Class Won't Recognize Reference Variable
I'm taking a CSIS 1410 Class, and as part of an assignment, I needed to create an enum, Voltage. Then, I had to create a class that uses the enum as a parameter, but when attempting to use the reference variable voltage (lowercase v), it gives me error "voltage cannot be resolve to variable".
Here is the enum:

```<code>public enum Voltage
{
    V110, V220, DUAL;
}
</code>```

and here is the class using said enum

```<code>public class DeskPhone extends Phone
{
    public boolean connected;

    protected DeskPhone(String modelArg, Dimensions dimenstion, Voltage voltage) //enum as parameter
    {
        super(modelArg, dimenstion);
    }

    public void plugIn()
    {
        connected = true;
    }

    public void unPlug()
    {
        connected = false;
    }

    public boolean isConnected()
    {
        return connected;
    }

    @Override
    public String toString()
    {
        if(connected == false)
        {
            return super.toString() + " " + voltage + " not connected"; //results in error
        }

        return super.toString() + " " + voltage + " connected";

    }
</code>```

Why can't I store whatever the constructor is passed within the "voltage" variable and use it in my toString statement?

答:
because constructor arguments are only visible inside a constructor
you need to bind them to a class field to be able to use them in functions:

consider also using Lombok for less boilerplate

public boolean connected;
private Voltage voltage;

 protected DeskPhone(String modelArg, Dimensions dimenstion, Voltage voltage)
 {
  super(modelArg, dimenstion);
  this.voltage = voltage;
 }

```

Body:
I'm taking a CSIS 1410 Class, and as part of an assignment, I needed to create an enum, Voltage. Then, I had to create a class that uses the enum as a parameter, but when attempting to use the reference variable voltage (lowercase v), it gives me error "voltage cannot be resolve to variable".
Here is the enum:

public enum Voltage
{
    V110, V220, DUAL;
}

and here is the class using said enum

public class DeskPhone extends Phone
{
    public boolean connected;

    protected DeskPhone(String modelArg, Dimensions dimenstion, Voltage voltage) //enum as parameter
    {
        super(modelArg, dimenstion);
    }

    public void plugIn()
    {
        connected = true;
    }

    public void unPlug()
    {
        connected = false;
    }

    public boolean isConnected()
    {
        return connected;
    }

    @Override
    public String toString()
    {
        if(connected == false)
        {
            return super.toString() + " " + voltage + " not connected"; //results in error
        }

        return super.toString() + " " + voltage + " connected";

    }

Why can't I store whatever the constructor is passed within the "voltage" variable and use it in my toString statement?


问:
Jest detects open handle with Express app
I've been trying to figure this out for a while now, but with no luck.  I initially had the issue when performing simple integration tests with a MongoDB database, but I've stripped the code right down and made it as simple as I can.  The only thing I have running is a single test file:

```<code>// blah.test.js
const express = require('express');
const app = express();

describe('test block', () => {
    let server = null;

    beforeEach(() => {
        server = app.listen(3000, () => console.log('Listening on port 3000'));
    });

    afterEach(async () => {
        await server.close();
    });

    it('should pass the test', () => {
        expect(1).toBe(1);
    });
});
</code>```

The test passes, but Jest informs me of an open handle which could prevent it from exiting:

On this occasion, it did exit, but still notices an open handle.  I would like to know how to safely close this, without forcing exit.  With previous tests, I would get the same open handle warning, but also with an error stating that Jest didn't exit one second after completing the tests.

I also tried using beforeAll() and afterAll(), instead of beforeEach() and afterEach(), but still get the same problem.  I know the test doesn't require the server on this occasion, but I was trying to make it as simple as possible to try to find the issue with opening and closing the server.

UPDATE: I noticed that it seems to work fine as soon as I add a second test file:

```<code>// blah2.test.js
const express = require('express');
const app = express();

describe('test block', () => {
    let server = null;

    beforeEach(() => {
        server = app.listen(3000, () => console.log('Listening on port 3000'));
    });

    afterEach(async () => {
        await server.close();
    });

    it('should pass the test', () => {
        expect(2).toBe(2);
    });
});
</code>```

No open handles with two tests running

If anyone can share any ideas as to why this happens, it would be much appreciated.

I am using:

Express: 4.16.3

Jest: 23.5.0

NPM: 6.3.0

答:
So I solved the issue by abstracting all the app logic to an app.js file:

```<code>const express = require('express');
const routes = require('./routes');
const app = express();

app.use('/api', routes);

module.exports = app
</code>```

Then creating a server.js file with all my server logic:

```<code>const app = require('./app.js')
const PORT = process.env.PORT || 3000
app.listen(PORT, () => console.log(`Listening on port: ${PORT}`))
</code>```

Then just import app.js into your test file like this:

```<code>const app = require('../app.js')
</code>```

Works like a charm!

Body:
I've been trying to figure this out for a while now, but with no luck.  I initially had the issue when performing simple integration tests with a MongoDB database, but I've stripped the code right down and made it as simple as I can.  The only thing I have running is a single test file:

// blah.test.js
const express = require('express');
const app = express();

describe('test block', () => {
    let server = null;

    beforeEach(() => {
        server = app.listen(3000, () => console.log('Listening on port 3000'));
    });

    afterEach(async () => {
        await server.close();
    });

    it('should pass the test', () => {
        expect(1).toBe(1);
    });
});

The test passes, but Jest informs me of an open handle which could prevent it from exiting:

On this occasion, it did exit, but still notices an open handle.  I would like to know how to safely close this, without forcing exit.  With previous tests, I would get the same open handle warning, but also with an error stating that Jest didn't exit one second after completing the tests.

I also tried using beforeAll() and afterAll(), instead of beforeEach() and afterEach(), but still get the same problem.  I know the test doesn't require the server on this occasion, but I was trying to make it as simple as possible to try to find the issue with opening and closing the server.

UPDATE: I noticed that it seems to work fine as soon as I add a second test file:

// blah2.test.js
const express = require('express');
const app = express();

describe('test block', () => {
    let server = null;

    beforeEach(() => {
        server = app.listen(3000, () => console.log('Listening on port 3000'));
    });

    afterEach(async () => {
        await server.close();
    });

    it('should pass the test', () => {
        expect(2).toBe(2);
    });
});

No open handles with two tests running

If anyone can share any ideas as to why this happens, it would be much appreciated.

I am using:

Express: 4.16.3

Jest: 23.5.0

NPM: 6.3.0

Body:
So I solved the issue by abstracting all the app logic to an app.js file:

const express = require('express');
const routes = require('./routes');
const app = express();

app.use('/api', routes);

module.exports = app

Then creating a server.js file with all my server logic:

const app = require('./app.js')
const PORT = process.env.PORT || 3000
app.listen(PORT, () => console.log(`Listening on port: ${PORT}`))

Then just import app.js into your test file like this:

const app = require('../app.js')

Works like a charm!


问:
Commit merge conflict fixes to the branch with changes
I have a master and a branch A.

I'm trying to get changes to go from A to master.

However, there are merge conflicts.

Currently, when I use git merge or similar things (for example, IntelliJ's built-in merge conflict resolver or SourceTree + KDiff3), when there are conflicts, I can fix them.

However, the fixes I make are done on the master branch.

This means with a protected remote master (i.e. via GitHub) where you can't push directly to master, I can't actually commit the merge conflict fixes.

Is there a way to make edits committed to A and then merge them altogether into master?

I can get this behavior using GitHub's merge conflict editor - when you use it, it commits the changes into branch A and then you still have to do code review, etc. to commit into master. But  I would like to be able to do the merge conflict resolution in my IDE, ideally.

Edit: further searching has suggested that I can actually merge master into A, resolving conflicts in the process, and then merge A back into master. Can anyone confirm if that sounds right?

答: If your fixes are made on master branch then your current HEAD is master. I guess you have to checkout to branch A first and then make the conflict changes and then do a merge to master.</p>


答:
Problem is that you have never declared voltage field, you only pass it as argument to constructor.</p>

```<code>public class DeskPhone extends Phone
{
    public boolean connected;
    // Here we declade voltage as field
    public Voltage voltage;

    protected DeskPhone(String modelArg, Dimensions dimenstion, Voltage voltage) //enum as parameter
    {
        super(modelArg, dimenstion);
        // Here we set field value
        this.voltate = voltage;
    }
  ...
</code>```

Title: Used Enum in Class Constructor, Method Within Class Won't Recognize Reference Variable

Body:
Problem is that you have never declared voltage field, you only pass it as argument to constructor.

public class DeskPhone extends Phone
{
    public boolean connected;
    // Here we declade voltage as field
    public Voltage voltage;

    protected DeskPhone(String modelArg, Dimensions dimenstion, Voltage voltage) //enum as parameter
    {
        super(modelArg, dimenstion);
        // Here we set field value
        this.voltate = voltage;
    }
  ...


问:
C# Windows Forms subclass of generic parameter Form
I have a windows Form called "Selektor" with a data grid view element and some menu bar controls. The class header is

```<code>Selektor<T> : Form where T : Table
</code>```

For different Table-subclasses I need different buttons on the menu bar. I thought about creating a sub-class of Selektor, where I can add different menu bars for different sub classes of Table. For some reason my sub class with header

```<code>public partial class Form1<T> : Selektor<T>
</code>```

The compiler tells me: "Type T cannot be used as type parameter T in generic type or method "Selector ".

What am I doing wrong?

答:
You have a constraint on the T type for the Selektor class:

```<code>Selektor<T> : Form where T : Table
</code>```

but then you are not using the same constraint in this declaration:

```<code>public partial class Form1<T> : Selektor<T>
</code>```

as if every generic type T is good for Form1, but hey, Selektor can't have a T not derived from Table. With this definition it's possible to write something like:

```<code>new Form1<Other>()
</code>```

feeding the base class Selektor a type it can't accept.

You should use:

```<code>public partial class Form1<T> : Selektor<T> where T : Table
</code>```

Body:
I have a windows Form called "Selektor" with a data grid view element and some menu bar controls. The class header is

Selektor<T> : Form where T : Table

For different Table-subclasses I need different buttons on the menu bar. I thought about creating a sub-class of Selektor, where I can add different menu bars for different sub classes of Table. For some reason my sub class with header

public partial class Form1<T> : Selektor<T>

The compiler tells me: "Type T cannot be used as type parameter T in generic type or method "Selector ".

What am I doing wrong?

Body:
You have a constraint on the T type for the Selektor class:

Selektor<T> : Form where T : Table

but then you are not using the same constraint in this declaration:

public partial class Form1<T> : Selektor<T>

as if every generic type T is good for Form1, but hey, Selektor can't have a T not derived from Table. With this definition it's possible to write something like:

new Form1<Other>()

feeding the base class Selektor a type it can't accept.

You should use:

public partial class Form1<T> : Selektor<T> where T : Table


问:
How to apply CSS correctly to iFrame?
Folks, i have the following problem.
My website uses an iframe to select an element aso...
The important thing is that FF (and Chrome) renders the css correctly while IE seems to not apply it or at least parts of it.

I placed a simplified example of my site here:  http://thariama.th.ohost.de/ie2.html
Please have a look using FF and IE. You need to click on "Click me!" and the iframe opens up.

To be honest, it does not look very nice, but thats because i stripped out as much as possible out of the more complex website.
There is a lense image right of the input field X2.
In FF it gets displayed and it gets replaced with another image if the user types in three letters. In IE nothing happens, also other css-settings have not been applied as you can see.

What i can do to make IE apply the css too?

答:
I solved this problem by adding a doctype definition to ie2.html. Seems like IE uses an own one if none is defined what leads to a different css.

```<code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
</code>```

Title: How to apply CSS correctly to iFrame?

Body:
I solved this problem by adding a doctype definition to ie2.html. Seems like IE uses an own one if none is defined what leads to a different css.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


问:
Why is my google API key breaking after 100 requests
I'm validating addresses to make sure they exist. I'm using the google API to do this. I have a google API key and it works great.... until I go over 100. At request 110 I get this

```<code>{
  candidates: [],
  error_message: 'You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account',
  status: 'REQUEST_DENIED'
}
</code>```

All I'm doing is looping through a list of addresses. It works perfectly up until then. And it's always at the exact same point.

I've tried slowing it down (thinking i'm making too many requests too quickly) by wrapping it in a while loop and only doing 50 at a time, but all that does it slow it down but still crashes at exactly 110.

Any ideas why or how or how to fix it? It is an unpaid API key if that helps (wondering if they have a request limit, I can't find anything saying they do)

答:
Turned out to be one of the parameters I was sending to it had a special character that was breaking it. I printed out the URL before sending it to see what was going on.

TLDR had to use encodeURIComponent on the addresses I was sending, before sending them

Body:
I'm validating addresses to make sure they exist. I'm using the google API to do this. I have a google API key and it works great.... until I go over 100. At request 110 I get this

{
  candidates: [],
  error_message: 'You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to http://g.co/dev/maps-no-account',
  status: 'REQUEST_DENIED'
}

All I'm doing is looping through a list of addresses. It works perfectly up until then. And it's always at the exact same point.

I've tried slowing it down (thinking i'm making too many requests too quickly) by wrapping it in a while loop and only doing 50 at a time, but all that does it slow it down but still crashes at exactly 110.

Any ideas why or how or how to fix it? It is an unpaid API key if that helps (wondering if they have a request limit, I can't find anything saying they do)


问:
Adding wrapper for graphQL queries - HOC or Render props
I am trying to do a wrapper for the graphQL queries, I tried this

```<code>const GQLWrapper = ({ query, children}) => (
  <Query query={query}>
    {({ loading, error, data }) => {
      if (loading) {
        return null
      }
      if (error) {
        <QueryError />
      }
      const { gqlData } = data.page
      return (
        <div>
          {children}
        </div>
      )
    }}
  </Query>
)
</code>```

but i don't understand how to use render props to pass the data to the child component.

Also if it is a better solution to use HOC, please let me know (when should one be used or the other). Thank you

答:
You just make your children a function and pass the data there

return
{children(gqlData)}
;
```

<p>When you use your wrapper you do:</p>

<pre class="lang-js prettyprint-override"><code><GQLWrapper query={myquery}>
  {(gqlData) => <SomeComponent data={gqlData} />}
</GQLWrapper>
</code>```

Body:
I am trying to do a wrapper for the graphQL queries, I tried this

const GQLWrapper = ({ query, children}) => (
  <Query query={query}>
    {({ loading, error, data }) => {
      if (loading) {
        return null
      }
      if (error) {
        <QueryError />
      }
      const { gqlData } = data.page
      return (

          {children}

      )
    }}
  </Query>
)

but i don't understand how to use render props to pass the data to the child component.

Also if it is a better solution to use HOC, please let me know (when should one be used or the other). Thank you

Body:
You just make your children a function and pass the data there

return <div>{children(gqlData)}</div>;

When you use your wrapper you do:

<GQLWrapper query={myquery}>
  {(gqlData) => <SomeComponent data={gqlData} />}
</GQLWrapper>


问:
React Native responsive margin and padding
I would like to know if setting paddings and margins to a responsive value is the right way to do things in React Native.

For instance, let's say that I have a Button component. My button component has a padding and the text inside should be responsive. I'm already handling text as responsive with my custom function (code below), and works just fine, the problem here is that if a person tries the app in a very small devide, the text inside the button will look cool, but the padding will be way too much compared to the text size, since I'm setting a fixed value. So, is it right to use the same function that calculates the text size to calculate my padding too?

My responsive size calculate function:

```<code>const scale = width / 375

export const normalize = (size: number): number => {
    const newSize = size * scale

    if (Platform.OS === 'ios') {
        return Math.round(PixelRatio.roundToNearestPixel(newSize))
    } else {
        return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2
    }
}
</code>```

答:
react-native-responsive-fontsize is for resizing font but basically it's for anything with pixels I use for auto margin padding font anything I basically want to dynamically resize that uses pixel (px)

eg

```<code>    import { RFValue } from "react-native-responsive-fontsize";

    {
       fontSize: RFValue(14),
       padding: RFValue(10)
    }
</code>```

but if you want to manually control it you can use Dimensions

eg

```<code>import { Dimensions } from "react-native";

const width = Math.round(Dimensions.get('window').width);
</code>```

then you can do your stuff

```<code>const scale = width / 375

export const normalize = (size: number): number => {
    const newSize = size * scale

    if (Platform.OS === 'ios') {
        return Math.round(PixelRatio.roundToNearestPixel(newSize))
    } else {
        return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2
    }
}
</code>```

Body:
I would like to know if setting paddings and margins to a responsive value is the right way to do things in React Native.

For instance, let's say that I have a Button component. My button component has a padding and the text inside should be responsive. I'm already handling text as responsive with my custom function (code below), and works just fine, the problem here is that if a person tries the app in a very small devide, the text inside the button will look cool, but the padding will be way too much compared to the text size, since I'm setting a fixed value. So, is it right to use the same function that calculates the text size to calculate my padding too?

My responsive size calculate function:

const scale = width / 375

export const normalize = (size: number): number => {
    const newSize = size * scale

    if (Platform.OS === 'ios') {
        return Math.round(PixelRatio.roundToNearestPixel(newSize))
    } else {
        return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2
    }
}

Body:
react-native-responsive-fontsize is for resizing font but basically it's for anything with pixels I use for auto margin padding font anything I basically want to dynamically resize that uses pixel (px)

eg

    import { RFValue } from "react-native-responsive-fontsize";

    {
       fontSize: RFValue(14),
       padding: RFValue(10)
    }

but if you want to manually control it you can use Dimensions

eg

import { Dimensions } from "react-native";

const width = Math.round(Dimensions.get('window').width);

then you can do your stuff

const scale = width / 375

export const normalize = (size: number): number => {
    const newSize = size * scale

    if (Platform.OS === 'ios') {
        return Math.round(PixelRatio.roundToNearestPixel(newSize))
    } else {
        return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2
    }
}


问:
Get 5 random instances from a queryset in Django
I have this view function that renders the first 5 articles in my Articles model

```<code>def home_page(request):
    qs = Article.objects.all()[:5]
    context = {'article_list': qs}
    return render(request, "home.html", context)
</code>```

How do i edit it to output any random 5?

I've tried this solution, but it didn't work. I don't know what I'm doing wrong.

Any help will be greatly appreciated.

Thanks

答:
this is what worked for me</p>

```<code>from random import sample

def home_page(request):
    id_list = Article.objects.all().values_list('id', flat=True)
    random_profiles_id_list = sample(list(id_list), 5)
    qs = Article.objects.filter(id__in=random_profiles_id_list)
    context = {'article_list': qs}
    return render(request, "home.html", context)
</code>```

Body:
I have this view function that renders the first 5 articles in my Articles model

def home_page(request):
    qs = Article.objects.all()[:5]
    context = {'article_list': qs}
    return render(request, "home.html", context)

How do i edit it to output any random 5?

I've tried this solution, but it didn't work. I don't know what I'm doing wrong.

Any help will be greatly appreciated.

Thanks

Body:
this is what worked for me

from random import sample

def home_page(request):
    id_list = Article.objects.all().values_list('id', flat=True)
    random_profiles_id_list = sample(list(id_list), 5)
    qs = Article.objects.filter(id__in=random_profiles_id_list)
    context = {'article_list': qs}
    return render(request, "home.html", context)


问:
Efficiently removing shared elements from grouped data
I have the following data.table:

```<code>dt
#    unique_id group_id primary_id  ph1  ph2  ph3
# 1:         1        1       TRUE   07   03 <NA>
# 2:         2        1      FALSE   07   03   84
# 3:         3        2      FALSE   10 <NA> <NA>
# 4:         4        2       TRUE <NA>   10 <NA>
# 5:         5        2      FALSE <NA> <NA>   10
# 6:         6        3      FALSE   22   03 <NA>
# 7:         7        3       TRUE <NA>   13   03
</code>```

unique_ids are grouped by common phone numbers (ph1, ph2, ph3) which are common across rows (e.g. in the first group "07", "03" are common across the group and in the third group, "03" is shared, but not in the same column, as per group 2).

Each group has 1 primary_id.

Within each group I want to remove the common phone number element(s) in the non primary_id's and retain it for the primary id, so they are no longer linked.

I can achieve this easily in a for loop, however, it's across millions of groups and it's extremely slow.

Looking for a quicker method.

Data:

```<code>library(data.table)

dt <- data.table(structure(list(unique_id = c(1, 2, 3, 4, 5, 6, 7), group_id = c(1,
    1, 2, 2, 2, 3, 3), primary_id = c(TRUE, FALSE, FALSE, TRUE, FALSE,
    FALSE, TRUE), ph1 = c("07", "07", "10", NA, NA, "22", NA), ph2 = c("03",
    "03", NA, "10", NA, "03", "13"), ph3 = c(NA, "84", NA, NA, "10",
    NA, "03")), class = "data.frame", row.names = c(NA, -7L))
)
</code>```

Desired output is:

```<code>output <- data.table(structure(list(unique_id = c(1, 2, 3, 4, 5, 6, 7), group_id = c(1,
1, 2, 2, 2, 3, 3), primary_id = c(TRUE, FALSE, FALSE, TRUE, FALSE,
FALSE, TRUE), ph1 = c("07", NA, NA, NA, NA, "22", NA), ph2 = c("03",
NA, NA, "10", NA, NA, "13"), ph3 = c(NA, "84", NA, NA, NA, NA,
"03")), class = "data.frame", row.names = c(NA, -7L)))

output
#    unique_id group_id primary_id  ph1  ph2  ph3
# 1:         1        1       TRUE   07   03 <NA>
# 2:         2        1      FALSE <NA> <NA>   84
# 3:         3        2      FALSE <NA> <NA> <NA>
# 4:         4        2       TRUE <NA>   10 <NA>
# 5:         5        2      FALSE <NA> <NA> <NA>
# 6:         6        3      FALSE   22 <NA> <NA>
# 7:         7        3       TRUE <NA>   13   03
</code>```

If still unclear, it may be easier to visualize it like this:

答:
Using data.table syntax the following reproduces your expected output

dcast(
    setorder(
        melt(dt, id.vars = 1:3, measure.vars = 4:6),
        group_id, -primary_id)[
            which(duplicated(value)), value := NA, by = "group_id"],
    unique_id + group_id + primary_id ~ variable, value.var = "value")
#   unique_id group_id primary_id  ph1  ph2  ph3
#1:         1        1       TRUE   07   03 <NA>
#2:         2        1      FALSE <NA> <NA>   84
#3:         3        2      FALSE <NA> <NA> <NA>
#4:         4        2       TRUE <NA>   10 <NA>
#5:         5        2      FALSE <NA> <NA> <NA>
#6:         6        3      FALSE   22 <NA> <NA>
#7:         7        3       TRUE <NA>   13 <NA>
```

Explanation: The idea is to reshape data from wide to long, order entries by group_id and primary_id (such that primary_id == TRUE comes first); then we use duplicated (by group_id) to flag duplicate rows and set duplicated entries to NA before reshaping again from wide to long.

Body:
I have the following data.table:

dt
#    unique_id group_id primary_id  ph1  ph2  ph3
# 1:         1        1       TRUE   07   03 <NA>
# 2:         2        1      FALSE   07   03   84
# 3:         3        2      FALSE   10 <NA> <NA>
# 4:         4        2       TRUE <NA>   10 <NA>
# 5:         5        2      FALSE <NA> <NA>   10
# 6:         6        3      FALSE   22   03 <NA>
# 7:         7        3       TRUE <NA>   13   03

unique_ids are grouped by common phone numbers (ph1, ph2, ph3) which are common across rows (e.g. in the first group "07", "03" are common across the group and in the third group, "03" is shared, but not in the same column, as per group 2).

Each group has 1 primary_id.

Within each group I want to remove the common phone number element(s) in the non primary_id's and retain it for the primary id, so they are no longer linked.

I can achieve this easily in a for loop, however, it's across millions of groups and it's extremely slow.

Looking for a quicker method.

Data:

library(data.table)

dt <- data.table(structure(list(unique_id = c(1, 2, 3, 4, 5, 6, 7), group_id = c(1,
    1, 2, 2, 2, 3, 3), primary_id = c(TRUE, FALSE, FALSE, TRUE, FALSE,
    FALSE, TRUE), ph1 = c("07", "07", "10", NA, NA, "22", NA), ph2 = c("03",
    "03", NA, "10", NA, "03", "13"), ph3 = c(NA, "84", NA, NA, "10",
    NA, "03")), class = "data.frame", row.names = c(NA, -7L))
)

Desired output is:

output <- data.table(structure(list(unique_id = c(1, 2, 3, 4, 5, 6, 7), group_id = c(1,
1, 2, 2, 2, 3, 3), primary_id = c(TRUE, FALSE, FALSE, TRUE, FALSE,
FALSE, TRUE), ph1 = c("07", NA, NA, NA, NA, "22", NA), ph2 = c("03",
NA, NA, "10", NA, NA, "13"), ph3 = c(NA, "84", NA, NA, NA, NA,
"03")), class = "data.frame", row.names = c(NA, -7L)))

output
#    unique_id group_id primary_id  ph1  ph2  ph3
# 1:         1        1       TRUE   07   03 <NA>
# 2:         2        1      FALSE <NA> <NA>   84
# 3:         3        2      FALSE <NA> <NA> <NA>
# 4:         4        2       TRUE <NA>   10 <NA>
# 5:         5        2      FALSE <NA> <NA> <NA>
# 6:         6        3      FALSE   22 <NA> <NA>
# 7:         7        3       TRUE <NA>   13   03

If still unclear, it may be easier to visualize it like this:

Body:
Using data.table syntax the following reproduces your expected output

dcast(
    setorder(
        melt(dt, id.vars = 1:3, measure.vars = 4:6),
        group_id, -primary_id)[
            which(duplicated(value)), value := NA, by = "group_id"],
    unique_id + group_id + primary_id ~ variable, value.var = "value")
#   unique_id group_id primary_id  ph1  ph2  ph3
#1:         1        1       TRUE   07   03 <NA>
#2:         2        1      FALSE <NA> <NA>   84
#3:         3        2      FALSE <NA> <NA> <NA>
#4:         4        2       TRUE <NA>   10 <NA>
#5:         5        2      FALSE <NA> <NA> <NA>
#6:         6        3      FALSE   22 <NA> <NA>
#7:         7        3       TRUE <NA>   13 <NA>

Explanation: The idea is to reshape data from wide to long, order entries by group_id and primary_id (such that primary_id == TRUE comes first); then we use duplicated (by group_id) to flag duplicate rows and set duplicated entries to NA before reshaping again from wide to long.


问:
ajax script works only for the first row when page is refreshed
I have a problem my script. It purpose is to display some values in fields depending on value from dropdown select.
When I fire other scripts that are adding or removing new rows into the form with the same fields, but different row id it stops working for the newly added rows.

```<code><script>
<?php echo 'var lista = '.form_dropdown('produkt[]',$lista).';'?>
$(document).ready(function() {
    $('select[name="produkt[]"]').change(function() {
        var id = $('select[name="produkt[]"] option:selected').val();
        var par = $(this).closest('tr').attr('id');
        $.getJSON(
            '<?php echo $head['site_link'];?>index.php/faktura/pobierzProdukt/'+id,
            function(data){
                var id = $('#'+par);
                $('input[name="pkwiu[]"]',id).val(data.product_pkwiu);
                $('input[name="netto[]"]',id).val(data.product_netto);
                $('input[name="vat[]"]',id).val(data.product_vat);
                $('input[name="brutto[]"]',id).val(data.product_brutto);
                $('input[name="jedn[]"]',id).val(data.product_jedn);
            },
            'json'
        );
    });

    $('#dodajWiersz').click(function() {
        var liczba = $('#produkty tr').length;
        var inputArray = [
            '1',
            lista,
            '<input type="text" name="pkwiu[]" class="short" readonly="readonly"/>',
            '<input type="text" name="netto[]" class="short" readonly="readonly"/>',
            '<input type="text" name="vat[]" class="mini" readonly="readonly"/>',
            '<input type="text" name="brutto[]" class="short" readonly="readonly"/>',
            '<input type="text" name="jedn[]" class="mini" readonly="readonly"/>',
            '<input type="text" name="ilosc[]" class="short"/>',
            '<input type="text" name="knetto[]" class="short" readonly="readonly"/>',
            '<input type="text" name="kvat[]" class="short" readonly="readonly"/>',
            '<input type="text" name="kbrutto[]" class="short" readonly="readonly"/>'
        ];
        var tdString = '<td>'+inputArray.join('</td><td>')+'</td>';
        if($('#produkty tbody tr').length>0) {
            var row = '<tr id="wiersz-'+liczba+'">'+tdString+'</tr>';
            $('#produkty').find('tbody').append(row);
            $('#produkty tr:last td:first-child').text(liczba);
        }
        else {
            var row = '<tr id="wiersz-1">'+tdString+'</tr>';
            $('#produkty').find('tbody').append(row);
        }
    });

    $('#usunWiersz').click(function() {
       $('#produkty').find('tbody tr:last').remove();
    });
});
</script>
</code>```

I think the problem is with $(document).ready() function. But I can't solve it.

UPDATE:
It seems that DOM is not updated. I can see the new HTML structure in Firebug but in the source view is the old structure. I think it matters.

答:
$(this).closest('tr').attr('id') you might always have the same id

and

var row = ''+tdString+'';

you are always appending the same id.

Body:
I have a problem my script. It purpose is to display some values in fields depending on value from dropdown select.
When I fire other scripts that are adding or removing new rows into the form with the same fields, but different row id it stops working for the newly added rows.

I think the problem is with $(document).ready() function. But I can't solve it.

UPDATE:
It seems that DOM is not updated. I can see the new HTML structure in Firebug but in the source view is the old structure. I think it matters.