Export MongoDB symbol in Package in Meteor 0.6.5 - package

I need to use MongoDB driver in Meteor because I want to use Grid in my application. Before Meteor 0.6.5, I managed to have a mongodb as a package, and it worked fine.
But after the update, with the new Package system, I cannot make it to work. Here is my package.js (in myAppFolder/packages/mongodb/), I also did meteor add mongodb
Package.describe({
summary: "Mongodb driver"
});
Npm.depends({'mongodb': '1.3.18'});
Package.on_use(function(api){
MongoDB = Npm.require("mongodb");
console.log(MongoDB, '--------------');
api.export('MongoDB', 'server');
});
I can see that the console log prints something when I start the server, but then in my application code at runtime, the value of MongoDB is undefined, the same thing for Package.mongodb.MongoDB . It seems to me that these values are assigned to undefined somehow.
If someone knows how to use the already included MongoDB driver in the mongo-livedata package, it would be a better solution.

I don't think it works if you do it in the package.js file; it appears you have to use a separate file. I did something similar to get the csv package, in the following way:
package.js:
Npm.depends({
csv: "0.3.5"
});
Package.on_use(function (api) {
api.add_files('server.js', 'server');
api.export('csv');
});
server.js:
csv = Npm.require('csv');
This is Meteor 0.6.5+ specific. They have a section in the docs about it now: http://docs.meteor.com/#writingpackages
Like you said though, you should be able to Npm.require the same mongodb package that Meteor is already using, and save an additional npm install. For example, the mongo-livedata package exports something called MongoInternals, and you may be able to dig in to it and find out how to pull out the mongo driver:
https://github.com/meteor/meteor/blob/devel/packages/mongo-livedata/package.js

Related

object johnsnowlabs is not a member of package com

I am very new to Zeppelin/spark and couldn't get an accurate description of steps to configure new dependencies like that of NLP libraries.
Found similar issue here.
I was trying to use Johnsnowlabs NLP library in Zeppelin notebook (spark version2.2.1).
Setup included :
In Zeppelin's Interpreters configurations for Spark, include the following artifact:
com.johnsnowlabs.nlp:spark-nlp_2.11:2.5.4
Then, in conf/zeppelin-env.sh, setup SPARK_SUBMIT_OPTIONS.
export SPARK_SUBMIT_OPTIONS=” — packages JohnSnowLabs:spark-nlp:2.2.2". Then restarted Zeppelin.
But the below program gives the error :
%spark
import com.johnsnowlabs.nlp.base._
import com.johnsnowlabs.nlp.annotator._
<console>:26: error: object johnsnowlabs is not a member of package com
import com.johnsnowlabs.nlp.base._
^
<console>:27: error: object johnsnowlabs is not a member of package com
import com.johnsnowlabs.nlp.annotator._
Can someone please share how this can be done? I referred this link .
TIA
you don't need to edit the conf/zeppelin-env.sh (anyway you're using it incorrectly, as you're specifying completely different version), you can make all changes via Zeppelin UI. Go to the Spark interpreter configuration, and put com.johnsnowlabs.nlp:spark-nlp_2.11:2.5.4 into spark.jars.packages configuration property (or add it if it doesn't exist), and into the Dependencies at the end of configuration (for some reason, it isn't automatically pulled into driver classpath).

How do add Quandl package to Julia

I'm trying to add the Quandl package (query finance and economic data) like this:
using Pkg
Pkg.add("Quandl")
which gets me this:
Updating registry at ~/.julia/registries/General
Updating git-repohttps://github.com/JuliaRegistries/General.git`
[1mFetching: [========================================>] 100.0 %[==========> ] 23.3 %] 46.4 % %> ] 90.2 %
The following package names could not be resolved:
* Quandl (not found in project, manifest or registry)
Anyone know what's going on here? Am I doing something wrong or is there a problem with the package?
The error message is telling you that Quandl is not registered in Julia's general registry, and can therefore not be added directly by typing it's name in the package manager.
You can still add it from its URL, are you referring to this package:
https://github.com/milktrader/Quandl.jl?
If so you can do Pkg.add("https://github.com/milktrader/Quandl.jl") to add it from GitHub.
It looks however like the package is unmaintained, as it hasn't been updated for three years, and therefore is unlikely to work with Julia versions post 1.0.
If it turns out it doesn't work but you need the package, you can try installing Julia 0.7, which can give you deprecation warnings to tell you about the syntax changes to get it to work with Julia 1.0+.

CakePHP 3 Audit Log, working with admin routes?

I'm trying to work with this CakePHP 3 plugin which I think does exactly what I need it to do, but am struggling big time! I'm new to CakePHP 3, composer and fiddling with routes etc (previously CakePHP 2.x and manual installation and never played with routes).
The plugin does not appear to be maintained any longer and the package does not exist when trying to install via composer, so I forked it and cloned the files to /plugins/AuditLog/
I've run updated my app composer.json file, loaded the plugin in my bootstrap.php, and run composer install on /plugins/AuditLog/ to load the dependencies from the plugin composer.json file (not sure if this is the right thing to do?)
In plugins/AuditLog/config/routes.php there is the following code
Router::plugin('AuditLog', function ($routes) {
$routes->prefix('admin', function ($routes) {
$routes->fallbacks('DashedRoute');
});
$routes->fallbacks('DashedRoute');
});
So a bit of searching in the CookBook and I read for the first time about 'prefix routing', which from what I can tell means I should be able to reach the pages via /admin/audit-log/audits (for example).
Not surprisingly, I get a missing controller error here
Error: Create the class AdminController below in file: src/Controller/AdminController.php
The instructions for the plugin don't mention anything about creating an admin controller, and there are no controller files anywhere in the plugin at all actually, despite there being views and models.
I'm really out of my depth here, can anyone help me untangle this? Where/how to add which controllers and get them pointing to the right place?

Vespa Tutorial – HTTP API use-case fails to activate with IllegalArgumentException

I'm currently following the Vespa tutorials, and ran into an issue with the HTTP API use-case. Everything works fine from the mvn install package to the vespa-deploy prepare target/application.zip.
The call to vespa-deploy activate returns normally, but the application then never gets available on localhost:8080. Looking at /opt/vespa/logs/vespa/vespa.log (in the VM) one finds the following stack trace:
Container.com.yahoo.jdisc.core.StandaloneMain error Unexpected:
exception=
java.lang.IllegalArgumentException: Could not create a component with id 'com.mydomain.demo.DemoComponent'.
Tried to load class directly, since no bundle was found for spec: sample-app-http-api-searcher.
If a bundle with the same name is installed, there is a either a version mismatch or the installed bundle's version contains a qualifier string.
at com.yahoo.osgi.OsgiImpl.resolveFromClassPath(OsgiImpl.java:48)
...
This occurred using a fresh Docker image with a clean clone of the sample-apps git repository. Preparing and activating the basic sample as well as the other http example did work seamlessly.
I checked the sources and the xml files for obvious problems but don't have any clue about what is failing and where.
target/application.zip contains
application/components/http-api-using-searcher-1.0.1-deploy.jar
application/hosts.xml
application/searchdefinitions/basic.sd
application/services.xml
And the jar itself does contain a com/mydomain/demo/DemoComponent.class file (among other things).
Potentially related issue on the github tracker: https://github.com/vespa-engine/vespa/issues/3479 I'll be posting a link to this question there as well, but I still think it's worth a SO question, at least to get some action behind the vespa tag :)
The bundle id in the application's services.xml file was wrong. Please pull the application from git and try again now. See also PR: https://github.com/vespa-engine/sample-apps/pull/18
Brief explanation: The bundle id given in the bundle="<id>" declaration in services.xml must match the 'Bundle-SymbolicName' in the bundle's manifest. When the bundle has been built with the Vespa bundle-plugin, the symbolic name is by default the same as the project's artifactId. Hence, in most cases you just have to verify that the bundle id matches the artifactId.

PageableManagerInterface error in SonataAdminBundle

I'm trying to configure SonataAdminBundle and SonataUserBundle to use mongodb and am getting the following error:
ClassNotFoundException: Attempted to load interface "PageableManagerInterface" from namespace "Sonata\CoreBundle\Model" in /Users/me/Sites/mynamespace-webtools/vendor/sonata-project/user-bundle/Model/UserManagerInterface.php line 25. Do you need to "use" it from another namespace?
Can anyone shed any light on what might be causing this? I was also getting the symptoms described here and have tried the answers suggested there.
Can anyone confirm if the mongodb functionality is just broken? Am also wondering if this error relates to this commit?
This appears to be a dependency error within the Sonata system itself, and not strictly related to the MongoDB module.
The PageableManagerInterface class is provided by the Sonata Core Bundle. Make sure that you have it in your composer.json file:
"require": {
"sonata-project/core-bundle": "dev-master",
}
After that, make sure your install is up to date and clean your cache, as usual:
php composer.phar self-update ; php composer.phar update

Resources