<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Menlo-Regular;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
tt
        {mso-style-priority:99;
        font-family:"Courier New";}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=FR-CA link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Thank you Martin,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>I’ve implemented your preferred solution. 259,000 requests from Chrome instead of… 2. This feels more accurate to me!<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>I agree with Adam, using a library would be a better solution, but this works great for now. <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'>Robin<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><p class=MsoNormal><span lang=EN-CA style='font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D;mso-fareast-language:EN-US'><o:p>&nbsp;</o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=FR style='font-size:11.0pt;font-family:"Calibri",sans-serif'>De&nbsp;:</span></b><span lang=FR style='font-size:11.0pt;font-family:"Calibri",sans-serif'> martin.braendle@id.uzh.ch [mailto:martin.braendle@id.uzh.ch] <br><b>Envoyé&nbsp;:</b> 30 septembre 2015 02:08<br><b>À&nbsp;:</b> eprints-tech@ecs.soton.ac.uk<br><b>Objet&nbsp;:</b> [EP-tech] Antwort: Re: IRStats2. Browsers and Countries<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p>&nbsp;</o:p></p><p><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>My Perl book (Tom Christiansen, brian d foy &amp; Larry Wall, Programming Perl, 4th ed., O'Reilly, 2012) says on p. 887 that keys returned by the keys function are sorted by the values.</span><br><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>There are two options:</span><br><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>- On line 20 of Browsers.pm, you change the value from &quot;Apple Safari&quot; to &quot;Safari&quot;, so Google Chrome matches first.</span><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>- or on line 54, you change the loop to </span><br><br><span style='font-size:10.0pt;font-family:"Menlo-Regular",serif'># &nbsp; &nbsp; &nbsp; foreach( keys %$BROWSERS_SIGNATURES )</span><br><span style='font-size:10.0pt;font-family:"Menlo-Regular",serif'>&nbsp; &nbsp; &nbsp; &nbsp; foreach( sort keys %$BROWSERS_SIGNATURES )</span><br><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>which sorts on the keys, so Chrome matches before Safari.</span><br><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>The second option is a little less performant, since it involves a sort operation on each processed record. However, I prefer it.</span><br><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Have a nice day,</span><br><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Martin</span><br><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>--</span><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Dr. Martin Brändle</span><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Zentrale Informatik</span><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Universität Zürich</span><br><span style='font-size:10.0pt;font-family:"Arial",sans-serif'>Stampfenbachstr. </span><span lang=EN-CA style='font-size:10.0pt;font-family:"Arial",sans-serif'>73</span><span lang=EN-CA><br></span><span lang=EN-CA style='font-size:10.0pt;font-family:"Arial",sans-serif'>CH-8006 Zürich</span><span lang=EN-CA><br><br><br></span><img width=16 height=16 id="_x0000_i1025" src="cid:image001.gif@01D0FB60.2F19DA40" alt="Inactive hide details for &quot;Field A.N.&quot; ---24/09/2015 16:02:28---The code you want is here: https://github.com/eprints/irstats2/"><span lang=EN-CA style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#424282'>&quot;Field A.N.&quot; ---24/09/2015 16:02:28---The code you want is here: </span><span style='font-size:10.0pt;font-family:"Arial",sans-serif;color:#424282'><a href="https://github.com/eprints/irstats2/blob/master/cfg/plugins/EPrints/Plugi"><span lang=EN-CA>https://github.com/eprints/irstats2/blob/master/cfg/plugins/EPrints/Plugi</span></a></span><span lang=EN-CA><br><br></span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif;color:#5F5F5F'>Von: </span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif'>&quot;Field A.N.&quot; &lt;</span><span style='font-size:7.5pt;font-family:"Arial",sans-serif'><a href="mailto:af05v@ecs.soton.ac.uk"><span lang=EN-CA>af05v@ecs.soton.ac.uk</span></a></span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif'>&gt;</span><span lang=EN-CA><br></span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif;color:#5F5F5F'>An: </span><span style='font-size:7.5pt;font-family:"Arial",sans-serif'><a href="mailto:eprints-tech@ecs.soton.ac.uk"><span lang=EN-CA>eprints-tech@ecs.soton.ac.uk</span></a></span><span lang=EN-CA><br></span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif;color:#5F5F5F'>Datum: </span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif'>24/09/2015 16:02</span><span lang=EN-CA><br></span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif;color:#5F5F5F'>Betreff: </span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif'>[EP-tech] Re: IRStats2. Browsers and Countries</span><span lang=EN-CA><br></span><span lang=EN-CA style='font-size:7.5pt;font-family:"Arial",sans-serif;color:#5F5F5F'>Gesendet von: </span><span style='font-size:7.5pt;font-family:"Arial",sans-serif'><a href="mailto:eprints-tech-bounces@ecs.soton.ac.uk"><span lang=EN-CA>eprints-tech-bounces@ecs.soton.ac.uk</span></a></span><span lang=EN-CA><o:p></o:p></span></p><div class=MsoNormal><hr size=2 width="100%" noshade style='color:#8091A5' align=left></div><p class=MsoNormal style='margin-bottom:12.0pt'><br><br><br><tt><span style='font-size:10.0pt'>The code you want is here:</span></tt><span style='font-size:10.0pt;font-family:"Courier New"'><br><br><tt><a href="https://github.com/eprints/irstats2/blob/master/cfg/plugins/EPrints/Plugin/Stats/Processor/Access/Browsers.pm#L12">https://github.com/eprints/irstats2/blob/master/cfg/plugins/EPrints/Plugin/Stats/Processor/Access/Browsers.pm#L12</a></tt><br><br><tt>...which probably should exist in a configuration file for just this reason.</tt><br><br><tt>The problem is that the Chrome line includes the word 'Safari' -- I'm not sure what the best practice to fix this is. &nbsp;It's quite possible that the problem is broader than you suspect, so fixing it would make it wrong in different ways.</tt><br><br><tt>Part of the problem is also that we're iterating through the keys of a hash, and they order they come out in is undefined, so we can't be sure which browser will get the priority.</tt><br><br><tt>We should probably be using a library for this -- something like <a href="http://search.cpan.org/dist/Parse-HTTP-UserAgent/lib/Parse/HTTP/UserAgent.pm">http://search.cpan.org/dist/Parse-HTTP-UserAgent/lib/Parse/HTTP/UserAgent.pm</a></tt><br><br><tt>--</tt><br><tt>Adam Field</tt><br><tt>Business Relationship Manager and Community Lead</tt><br><tt>EPrints Services</tt><br><tt>+44 (0)23 8059 8814</tt><br><br><br><br><br><br><tt>On 22 Sep 2015, at 20:45, Robin Sylvestre wrote:</tt><br><br><tt>&gt; This is pretty old, but I haven't seen any response to this.</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; I noticed that Chrome browser gets identified as Safari in IRStats2. The user agent string from my Chrome browser is :</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.93 Safari/537.36</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; I don’t have Safari on my computer, but from what I gather from Google, Safari’s user agent looks like this:</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/600.3.18 (KHTML, like Gecko) Version/8.0.3Safari/600.3.18</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; Anyone here knows how to modify “Browsers.pm” to distinguish the two browsers?</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; Thanks!</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; </tt><br><tt>&gt; Robin Sylvestre</tt><br><tt>&gt; Technicien en documentation</tt><br><tt>&gt; Bibliothèque - Services techniques et systèmes informatisés</tt><br><tt>&gt; École Polytechnique de Montréal</tt><br><tt>&gt; Tél.: 514-340-4711 poste 3743</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; -----Message d'origine-----</tt><br><tt>&gt; De : Centro de Documentación [<a href="mailto:cendocu@gmail.com">mailto:cendocu@gmail.com</a>] </tt><br><tt>&gt; Envoyé : 3 mars 2015 09:19</tt><br><tt>&gt; À : <a href="mailto:eprints-tech@ecs.soton.ac.uk">eprints-tech@ecs.soton.ac.uk</a></tt><br><tt>&gt; Objet : [EP-tech] IRStats2. Browsers and Countries</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; Hi,</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; I think that the IRStats' browser detection isn't working properly. At the very very top of the ranking, I have &quot;Apple Safari&quot; and &quot;MIExplorer&quot;, ¿Firefox? in the middle and at the end ¿Chrome?. It's weird ....</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; Some days ago, when I looked some items with few downloads, I realized that some of them showed more downloads than countries-downloads. I think IRStats2 can't resolve some IPs as countries or unknown-countries, can be?. (I use country.pm with this patch</tt><br><tt>&gt; <a href="https://github.com/eprints/irstats2/commit/cdeb3281694ff1eee3d4f97660560aa4ef3cd30c">https://github.com/eprints/irstats2/commit/cdeb3281694ff1eee3d4f97660560aa4ef3cd30c</a>)</tt><br><tt>&gt; I running IRStats1 too and it's works fine.</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; Regards,</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; Cristian</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; &nbsp;</tt><br><tt>&gt; *** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a></tt><br><tt>&gt; *** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a></tt><br><tt>&gt; *** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a></tt><br><tt>&gt; *** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a></tt><br><br><br><tt>*** Options: <a href="http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech">http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech</a></tt><br><tt>*** Archive: <a href="http://www.eprints.org/tech.php/">http://www.eprints.org/tech.php/</a></tt><br><tt>*** EPrints community wiki: <a href="http://wiki.eprints.org/">http://wiki.eprints.org/</a></tt><br><tt>*** EPrints developers Forum: <a href="http://forum.eprints.org/">http://forum.eprints.org/</a></tt></span><o:p></o:p></p></div></body></html>