[EP-tech] Re: Antwort: Re: IRStats2. Browsers and Countries

Robin Sylvestre robin.sylvestre at polymtl.ca
Wed Sep 30 14:39:46 BST 2015

Thank you Martin,

I’ve implemented your preferred solution. 259,000 requests from Chrome 
instead of… 2. This feels more accurate to me!

I agree with Adam, using a library would be a better solution, but this 
works great for now.


De : martin.braendle at id.uzh.ch [mailto:martin.braendle at id.uzh.ch]
Envoyé : 30 septembre 2015 02:08
À : eprints-tech at ecs.soton.ac.uk
Objet : [EP-tech] Antwort: Re: IRStats2. Browsers and Countries

My Perl book (Tom Christiansen, brian d foy & 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.

There are two options:

- On line 20 of Browsers.pm, you change the value from "Apple Safari" to 
"Safari", so Google Chrome matches first.
- or on line 54, you change the loop to

#       foreach( keys %$BROWSERS_SIGNATURES )
        foreach( sort keys %$BROWSERS_SIGNATURES )

which sorts on the keys, so Chrome matches before Safari.

The second option is a little less performant, since it involves a sort 
operation on each processed record. However, I prefer it.

Have a nice day,


Dr. Martin Brändle
Zentrale Informatik
Universität Zürich
Stampfenbachstr. 73
CH-8006 Zürich

"Field A.N." ---24/09/2015 16:02:28---The code you want is here: 

Von: "Field A.N." < <mailto:af05v at ecs.soton.ac.uk> af05v at ecs.soton.ac.uk>
An:  <mailto:eprints-tech at ecs.soton.ac.uk> eprints-tech at ecs.soton.ac.uk
Datum: 24/09/2015 16:02
Betreff: [EP-tech] Re: IRStats2. Browsers and Countries
Gesendet von:  <mailto:eprints-tech-bounces at ecs.soton.ac.uk> 
eprints-tech-bounces at ecs.soton.ac.uk


The code you want is here:


...which probably should exist in a configuration file for just this reason.

The problem is that the Chrome line includes the word 'Safari' -- I'm not 
sure what the best practice to fix this is.  It's quite possible that the 
problem is broader than you suspect, so fixing it would make it wrong in 
different ways.

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.

We should probably be using a library for this -- something like 

Adam Field
Business Relationship Manager and Community Lead
EPrints Services
+44 (0)23 8059 8814

On 22 Sep 2015, at 20:45, Robin Sylvestre wrote:

> This is pretty old, but I haven't seen any response to this.
> I noticed that Chrome browser gets identified as Safari in IRStats2. The 
> user agent string from my Chrome browser is :
> Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) 
> Chrome/45.0.2454.93 Safari/537.36
> I don’t have Safari on my computer, but from what I gather from Google, 
> Safari’s user agent looks like this:
> 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
> Anyone here knows how to modify “Browsers.pm” to distinguish the two 
> browsers?
> Thanks!
> Robin Sylvestre
> Technicien en documentation
> Bibliothèque - Services techniques et systèmes informatisés
> École Polytechnique de Montréal
> Tél.: 514-340-4711 poste 3743
> -----Message d'origine-----
> De : Centro de Documentación [mailto:cendocu at gmail.com]
> Envoyé : 3 mars 2015 09:19
> À : eprints-tech at ecs.soton.ac.uk <mailto:eprints-tech at ecs.soton.ac.uk>
> Objet : [EP-tech] IRStats2. Browsers and Countries
> Hi,
> I think that the IRStats' browser detection isn't working properly. At the 
> very very top of the ranking, I have "Apple Safari" and "MIExplorer", 
> ¿Firefox? in the middle and at the end ¿Chrome?. It's weird ....
> 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
> https://github.com/eprints/irstats2/commit/cdeb3281694ff1eee3d4f97660560aa4ef3cd30c)
> I running IRStats1 too and it's works fine.
> Regards,
> Cristian
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: http://www.eprints.org/tech.php/
> *** EPrints community wiki: http://wiki.eprints.org/
> *** EPrints developers Forum: http://forum.eprints.org/

*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20150930/26ea48d8/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 105 bytes
Desc: not available
Url : http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20150930/26ea48d8/attachment.gif 

More information about the Eprints-tech mailing list