Coder Social home page Coder Social logo

51degrees.node's People

Contributors

joseph51d avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

51degrees.node's Issues

Build failing with io.js 3.0.0

npm install 51degrees results in an error with the latest io.js 3.0.0:

../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’:
../node_modules/nan/nan.h:772:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’
     return node::Buffer::New(v8::Isolate::GetCurrent(), size);
                                                             ^

The compiling error with node 6.9.1

Hello!

The compiling error was appeared when i try to install the package.
The os version - ubuntu 16.10
The node version - v.6.9.1

In file included from ../src/pattern/api.cc:33:0:
../node_modules/nan/nan.h: At global scope:
../node_modules/nan/nan.h:590:20: error: variable or field ‘AddGCEpilogueCallback’ declared void
v8::Isolate::GCEpilogueCallback callback
^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:590:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCEpilogueCallback callback
^~
../node_modules/nan/nan.h:591:18: error: expected primary-expression before ‘gc_type_filter’
, v8::GCType gc_type_filter = v8::kGCTypeAll) {
^~~~~~~~~~~~~~
../node_modules/nan/nan.h:596:20: error: variable or field ‘RemoveGCEpilogueCallback’ declared void
v8::Isolate::GCEpilogueCallback callback) {
^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:596:7: error: ‘GCEpilogueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCEpilogueCallback callback) {
^~
../node_modules/nan/nan.h:601:20: error: variable or field ‘AddGCPrologueCallback’ declared void
v8::Isolate::GCPrologueCallback callback
^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:601:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCPrologueCallback callback
^~
../node_modules/nan/nan.h:602:18: error: expected primary-expression before ‘gc_type_filter’
, v8::GCType gc_type_filter = v8::kGCTypeAll) {
^~~~~~~~~~~~~~
../node_modules/nan/nan.h:607:20: error: variable or field ‘RemoveGCPrologueCallback’ declared void
v8::Isolate::GCPrologueCallback callback) {
^~~~~~~~~~~~~~~~~~
../node_modules/nan/nan.h:607:7: error: ‘GCPrologueCallback’ is not a member of ‘v8::Isolate’
v8::Isolate::GCPrologueCallback callback) {
^~
../node_modules/nan/nan.h: In function ‘bool Nan::SetAccessor(v8::Localv8::Object, v8::Localv8::String, Nan::GetterCallback, Nan::SetterCallback, v8::Localv8::Value,
v8::AccessControl, v8::PropertyAttribute)’:
../node_modules/nan/nan.h:1933:16: warning: ‘bool v8::Object::SetAccessor(v8::Localv8::Name, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Localv8::Value, v8::AccessControl, v8::PropertyAttribute)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
, attribute);
^
In file included from /home/user/.node-gyp/6.9.1/include/node/v8.h:25:0,
from /home/user/.node-gyp/6.9.1/include/node/node.h:42,
from ../src/pattern/api.cc:31:
/home/user/.node-gyp/6.9.1/include/node/v8.h:2751:22: note: declared here
bool SetAccessor(Local name,
^
/home/user/.node-gyp/6.9.1/include/node/v8config.h:333:3: note: in definition of macro ‘V8_DEPRECATED’
declarator attribute((deprecated(message)))
^~~~~~~~~~
../src/pattern/api.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE PatternParser::Parse(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/pattern/api.cc:108:25: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
if (strlen(*v8_input) > maxInputLength) {
~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
pattern.target.mk:100: recipe for target 'Release/obj.target/pattern/src/pattern/api.o' failed
make: *** [Release/obj.target/pattern/src/pattern/api.o] Error 1

Add support for 3.2 data file version

The TrieV3 data file is now marked as deprecated, but the new TrieV32 is not supported with current NodeJS bindings.

Warning: Device data file is not correct

JSON Parsing error due to quotes in data

We have a severe issue with the module as it breaks on JSON parsing sometimes:

SyntaxError: Unexpected token (
    at Object.parse (native)
    at Parser.parse (/51degrees-test/node_modules/51degrees/index.js:89:18)
    at null.<anonymous> (/51degrees-test/index.js:19:16)

It is very simple to reproduce as you just need to throw this user agent string against (at least) Enterprise-DB and return the HardwareFamily: "Mozilla/5.0 (Linux; U; Android 4.2.2; en-us; KFTHWI Build/JDQ39) AppleWebKit/537.36 (KHTML, like Gecko) Silk/3.30 like Chrome/34.0.1847.137 Safari/537.36"

"HardwareFamily": "Kindle Fire HDX 7" (3rd Gen)"

(https://51degrees.com/Resources/User-Agent-Tester?useragent=Mozilla%2f5.0+(Linux%3b+U%3b+Android+4.2.2%3b+en-us%3b+KFTHWI+Build%2fJDQ39)+AppleWebKit%2f537.36+(KHTML%2c+like+Gecko)+Silk%2f3.30+like+Chrome%2f34.0.1847.137+Safari%2f537.36)

The data needs to be escaped in order to allow the parsing with JSON.parse for these cases.
I'm pretty sure it is quiet easy to fix but as I'm not familiar with C or C++ I can't patch it myself, sorry :(

Load data into memory

Are there anyway to load data to into memory? I can only get 7 req/s from my cloud server.

tweak naming of src

simply renaming api.c and api.h to 51Degrees.c and 51Degrees.h and pattern.cc to api.cc and pattern.h to api.h

complete test cases

it includes:

  • memory leaks
  • empty useragent
  • random useragent
  • super long useragent
  • incorrect database filename or extname

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.