I have created a jupyterlab extension and trying to execute a code in the kernel using requestExecute method. Registering the IOPub callback gives back the kernel output which i wanted it log to the JupyterLab web console extension.
execute code from kernel
let future = kernel.requestExecute({ code: 'a = 1' });
future.onIOPub = msg => {
console.log(msg.content); // how to print it to Jupyter Lab console ?
};
Related
I am just trying to open a db through:
let LevelUP = require('levelup');
let LevelDown = require('leveldown');
let path = require('os').homedir() + '/keys.db';
let db = LevelUP(LevelDown(path));
... and getting an error. The Error object traces as...
message: "IO error: /Users/myname/db/base.db/LOCK: No such file or directory"
OS: MacOS Sierra
As per discussion at GitHub, leveldown library doesn't recursively create the folders down the DB file, so you need to create them by your self before running the code. Also, make sure the user which is running the script has the permissions to do so.
I'm having an issue with Selenium standalone webdriver used with webdriver-manager npm module. I'm using the Firefox Gecko driver. I need to select a file from an HTML file input component. When I try this on my local machine or on BrowserStack I get the error:
"WebDriverError: File not found: /Users/christophergrigg/a.pdf"
const requestFile = By.id('requestFile');
driver.wait(until.elementLocated(requestFile));
const requestFileEl = driver.findElement(requestFile);
driver.wait(until.elementIsVisible(requestFileEl), TIMEOUT).click();
requestFileEl.sendKeys('/Users/christophergrigg/a.pdf');
requestFileEl.sendKeys(webdriver.Key.ENTER);
On Browser stack I'm using this path:
requestFileEl.sendKeys('C:\\Desktop\\documents\\pdf-sample2.pdf'); // Windows 7 / 8 / 8.1
You need to provide the full path of the file. And if the file is not present on the machine running the remote instance, you'll also have to set the file detector to automatically upload the file.
On mac OS X:
var remote = require('selenium-webdriver/remote');
driver.setFileDetector(new remote.FileDetector);
driver.sendKeys('/Users/christophergrigg/Desktop/a.pdf');
, or Windows:
var remote = require('selenium-webdriver/remote');
driver.setFileDetector(new remote.FileDetector);
driver.sendKeys('C:\\Users\\christophergrigg\\Desktop\\a.pdf');
I've just learned the basics on how to make modulefiles for loading software on my cluster. Other environment modules (created by admins) print a message upon loading:
$ module load Name
Welcome to Name/version.1.2.3
How do I add this to the modulefile? I like the quick confirmation that I've indeed loaded the module I intended. I've tried a few things from the man page (ex module-info name) but no luck (or I'm doing it wrong).
Thanks
If you "only" want the message to print when running module load (but not when running module unload or other commands), then you can use a statement like this:
if [ module-info mode load ] {
puts stderr "your text here"
}
Reference: https://sourceforge.net/p/modules/mailman/message/34597600/
You can add puts stderr statements to modulefile, for printing messages to terminal.
puts stderr "** INFO: 'Welcome, Module loaded'"
I am following the ArangoDB documentation, and I'm currently following the section ArangoDB Shell Configuration; here, they describe an .arangosh.rc file that is sourced from your home directory, placing custom code into the arango shell's global scope. Following the documentation to a T, I've made an .arangosh.rc file in my home directory ~/.arangosh.rc and added the example function
timed = function (cb) {
var internal = require("internal");
var start = internal.time();
cb();
internal.print("execution took: ", internal.time() - start);
};
I've tried exiting and restarting the arango shell as well as completely restarting my terminal session but I can't get arangosh to source the rc file. When I try invoking timed() I get a
ReferenceError: timed is not defined
Blockquote
As far as I can see the condition for sourcing ~/.arangosh.rc changed somewhere in 2.6, but this looks like an error to me. I have reverted that change in the 2.7, 2.8 and devel branches, so the file will get sourced there now. The fix will be contained in the next official releases.
If you want to apply it before that, the commit id for 2.7 is 8e85a2fbb67c8c50c75cf93aefb7365e1e9fd7d1
It also looks like that in 2.7 any "globals" in the rc file need to be attached to the global object. For example,
timed = function (cb) { ... };
should become
global.timed = function (cb) { ... };
I have also updated the docs to reflect this change.
I have the following setup to test a directive:
beforeEach(inject(function($compile, $rootScope, $injector) {
$httpBackend = $injector.get('$httpBackend');
var html = '<password-strength-bar password-to-check="password"></password-strength-bar>';
scope = $rootScope.$new();
elm = angular.element(html);
$compile(elm)(scope);
$httpBackend.expectGET('l10n/en.js').respond({});
$httpBackend.expectGET('tpl/page_signin.html').respond({});
}));
This works fine on a Mac. However, when I run the same code on Linux, it fails with the following error. It is a headless Linux box, but I'm using PhantomJS as my "browsers" in karma.conf.js.
Error: Unsatisfied requests: GET tpl/page_signin.html
I verified that both operating systems are using the same version of Node.
On a similar note, I've installed Chrome and Xfvb (via Jenkins) to run my e2e tests driven by Protractor. The following works fine when running on my Mac locally, but fails on Linux.
it('should render signup when user clicks on "Create one" link', function () {
var signupLink = element(by.linkText('Create one'));
expect(signupLink.isDisplayed()).toBe(true);
signupLink.click();
expect(element.all(by.css('.wrapper')).first().getText()).
toMatch(/Hi there, we're so glad you're here./);
In Jenkins (on Linux), the error is:
Failures:
1) account signup should render signup when user clicks on "Create one" link
Message:
[31m Expected '' to match /Hi there, we're so glad you're here./.[0m
Stack:
Error: Failed expectation
at Object.<anonymous> (/var/lib/jenkins/jobs/myapp/workspace/tests/e2e/account.js:27:17)
at runMicrotasksCallback (node.js:337:7)
Any idea why tests would run fine on Mac, but not on Linux?
This turned out to be caused by using by.linkText('Create one') for my Protractor test. Once I added an id to the link and used by.id('create-account'), it worked.
I also found that using $('.alert') or by.css('alert') doesn't work nearly as well as by.id. Particularly when you click on a button and wait for something to appear on the next screen. For example:
var alert = element(by.id('success'));
browser.driver.wait(protractor.until.elementIsVisible(alert));