Coder Social home page Coder Social logo

uap-r's Introduction

uaparser

An implementation of tobie's ua-parser in R and C++

Author: Oliver Keyes and Alex Suhan
License: MIT

Installation

Install uaparser through:

devtools::install_github("ua-parser/uap-r")

Then place regexes.yaml from the uap-core repository in the installation directory. In the event that you don't complete this step, the uaparser will attempt to download the YAML file into a temporary directory when called, but this is less efficient and not workable for machines without a direct internet connection.

This package no longer works with the old (pre-0.5) version of the yaml-cpp library. You will need version 0.5 or later.

Dependencies

Contributing upstream

Both the library and the regex definitions welcome patches and reported issues! Just submit through GitHub and we'll do our best to merge or fix them promptly.

uap-r's People

Contributors

atheriel avatar bearloga avatar ironholds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

uap-r's Issues

Fails testing - Library not loaded: libboost_regex.dylib

I'm using OS X 10.11.3 (El Capitan) and calling R from the Terminal. libboost_regex.dylib exists in /usr/local/lib. All other dependencies are installed (I believe). Here's the output.

> devtools::install_github("ua-parser/uap-r")
Downloading GitHub repo ua-parser/uap-r@master
from URL https://api.github.com/repos/ua-parser/uap-r/zipball/master
Installing uaparser
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ  \
  --no-save --no-restore CMD INSTALL  \
  '/private/var/folders/p7/5ylvzpld32x89bnkw42jj7dw0000gr/T/RtmpqhWpde/devtoolscdde29e38543/ua-parser-uap-r-cbfdc17'  \
  --library='/Library/Frameworks/R.framework/Versions/3.2/Resources/library'  \
  --install-tests 

* installing *source* package ‘uaparser’ ...
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -E
checking for R... yes
checking for Rscript... yes
checking whether we are using the GNU C++ compiler... yes
checking whether clang++ -arch x86_64 -ftemplate-depth-256 accepts -g... yes
checking for boostlib >= 1.4... yes
checking whether the Boost::Regex library is available... yes
checking for exit in -lboost_regex... yes
** libs
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include     -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include     -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c internal_UaParser.cpp -o internal_UaParser.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include     -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c internal_ua_parser.cpp -o internal_ua_parser.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include     -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Library/Frameworks/R.framework/Versions/3.2/Resources/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2 -c ua_parse.cpp -o ua_parse.o
clang++ -std=c++11 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o uaparser.so RcppExports.o internal_UaParser.o internal_ua_parser.o ua_parse.o -lboost_regex -lboost_system -lyaml-cpp -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Library/Frameworks/R.framework/Versions/3.2/Resources/library/uaparser/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/Library/Frameworks/R.framework/Versions/3.2/Resources/library/uaparser/libs/uaparser.so':
  dlopen(/Library/Frameworks/R.framework/Versions/3.2/Resources/library/uaparser/libs/uaparser.so, 6): Library not loaded: libboost_regex.dylib
  Referenced from: /Library/Frameworks/R.framework/Versions/3.2/Resources/library/uaparser/libs/uaparser.so
  Reason: image not found
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/Library/Frameworks/R.framework/Versions/3.2/Resources/library/uaparser’
Error: Command failed (1)

parse_agents crashes RStudio

I don't have much information beyond this. No errors get returned. No warnings. RStudio just crashes when I try to parse a vector of 1000 user agents. The CLI, however, works.

Problems installing it on rstudio (windows)

What happen?
I tryed to install ua-parser/uap-r and its being a madness.... my log:

devtools::install_github("ua-parser/uap-r")
Downloading GitHub repo ua-parser/uap-r@master
√ checking for file 'C:\Users\Denis\AppData\Local\Temp\RtmpYtEJCz\remotes1c4c6bc420df\ua-parser-uap-r-b90070e/DESCRIPTION' ...

  • preparing 'uaparser':
    √ checking DESCRIPTION meta-information ...
  • cleaning src
  • checking for LF line-endings in source and make files and shell scripts
  • checking for empty or unneeded directories
  • building 'uaparser_0.2.0.tar.gz'
    Warning: file 'uaparser/configure' did not have execute permissions: corrected

Installing package into ‘C:/Users/Denis/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)

  • installing source package 'uaparser' ...


    WARNING: this package has a configure script
    It probably needs manual configuration


** libs

*** arch - i386
C:/RBuildTools/3.5/mingw_32/bin/g++ -std=gnu++11 -I"C:/PROGRA1/R/R-351.1/include" -DNDEBUG -I"C:/Users/Denis/Documents/R/win-library/3.5/Rcpp/include" -O2 -Wall -mtune=generic -c RcppExports.cpp -o RcppExports.o
C:/RBuildTools/3.5/mingw_32/bin/g++ -std=gnu++11 -I"C:/PROGRA1/R/R-351.1/include" -DNDEBUG -I"C:/Users/Denis/Documents/R/win-library/3.5/Rcpp/include" -O2 -Wall -mtune=generic -c internal_UaParser.cpp -o internal_UaParser.o
In file included from internal_UaParser.cpp:1:0:
internal_UaParser.h:5:27: fatal error: boost/regex.hpp: No such file or directory
#include <boost/regex.hpp>
^
compilation terminated.
make: *** [C:/PROGRA1/R/R-351.1/etc/i386/Makeconf:215: internal_UaParser.o] Error 1
ERROR: compilation failed for package 'uaparser'

  • removing 'C:/Users/Denis/Documents/R/win-library/3.5/uaparser'
    In R CMD INSTALL
    Error in i.p(...) :
    (converted from warning) installation of package ‘C:/Users/Denis/AppData/Local/Temp/RtmpYtEJCz/file1c4c61462306/uaparser_0.2.0.tar.gz’ had non-zero exit status

uap-r fails to build with new YAML libraries

Greetings, when I go to install this package, I get:

internal_UaParser.cpp:54:23: error: no member named 'GetNextDocument' in 'YAML::Parser'
    CHECK(yaml_parser.GetNextDocument(regexes));
          ~~~~~~~~~~~ ^

Some googling led me to here: http://stackoverflow.com/questions/14365505/complete-example-yaml-program-on-http-code-google-com-p-yaml-cpp-wiki-howtopar which seems to imply that you built this code with the yaml-cpp 0.3.0 branch and the new 0.5.x branch has broken the API.

Thank you!

boost/regex.hpp not found - terminates install in R

I cannot install_github this project as when I try to do so I get the following error:
In file included from internal_UaParser.cpp:1:0: internal_UaParser.h:5:27: fatal error: boost/regex.hpp: No such file or directory compilation terminated.

All the googling I can do about this problem has to do with compiling Boost for C++ projects...not sure what to make of those forums. And I have all the necessary dependencies.

Making a note here re: OS X

fails hard even with the C++ YAML lib installed. Will post logs in a bit.

However…

Why not read the YAML file with R (via the yaml package) and pass an R data structure into Rcpp? It's not like the UA YAML file is huge (so it's not going to really save time) and it would remove something you'd no doubt have to make a download-and-install library as part of the pkg installation process (== ugh).

Also, an alternative to getting C++ regex working is to ask the stringi folks to expose a cpl functions directly (i.e. just use stringi regexes). I'll still keep poking at the example icu code you slack'd tho.

fatal error: 'boost/regex.hpp' file not found

When installing with "devtools::install_github("ua-parser/uap-r")", I get the following error:

In file included from internal_UaParser.cpp:1:
./internal_UaParser.h:5:10: fatal error: 'boost/regex.hpp' file not found
#include <boost/regex.hpp>

How to install?

A lot of github install 'instructions' are anything but. I'm afraid these 'instructions' are no different:

"Install uaparser through the usual install.packages() command..."

> install.packages("ua-parser")
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘ua-parser’ is not available (for R version 3.1.2)
> install.packages("uaparser")
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘uaparser’ is not available (for R version 3.1.2)
> install.packages("uap-r")
(as ‘lib’ is unspecified)
Warning in install.packages :
  package ‘uap-r’ is not available (for R version 3.1.2)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.