I want to embed one my specific chart in dahsboard of kibana. For that I need inject my JS into Kibana source. I have followed by instructions https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md to provide test environment, but I have obtained an error after "./kibana --dev"
let _ = require('lodash');
^^^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected strict mode reserved word
at Module._compile (module.js:429:25)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:41)
Can anybody help me with start environment, or advice. Probably, I am moving by wrong way...my general goal (inject my JS code into Kibana) can be reached by another approach.
Thanks
I have reached my general goal, and if it is right - I place here my approach. (also, as an answer for above question)
When I was seeking ways how to implement what I want (my own custom metrics in dashboard....only as training and for personal "sport interest" sake) - I had chosen next way.
First of all - you need pay attention on index.js, not small one but huge file (more than 5MB), it predominantly contains angularJS terms.
My steps was:
I put into HTML empty container for my metrics
<div class="metric_container"></div>.
HTML defines in index.js as
define('text!plugins/dashboard/index.html',[],function () { return '<div dashboard-app class="app-container dashboard-container">\n .....
you can try to search ctrl+F it over the index.js
I found variable with JSON data for charts (esResp)
I found watcher on changing it $scope.$watch('esResp', prereq(function (resp, pre Resp) {....
Put in the body of watcher my_function () call.
finished my_function() call, that contains completing HTML metric sample with renewed figures (from esResp JSON) and putting it into
metric_container
so, I can develop my own metrics, charts, and it will be renew, but ONLY based on information provided in charts.
So, If you need smth - you need firstly create appropriate chart because of data set for you own calculations and further visualization.
Something So.
I am sure, probably there is best way, but my was.
I have created a number of visualizations for Kibana 4.4.1, and once you have the right baseline, it is no big deal.
I encourage you to take a look at any of my sources, in order to know what has to be done (http://github.com/JuanCarniglia).
There are some basic files you need to have, and you have them, you just put them on the src/plugins directory, and restart kibana. If everything is fine, you get a new visualization on the list.
If you encounter any problems or need a more detailed description, send me a message or post it here and I'll try to explain with more detail.
Related
I need to execute a function immediately when someone purchases a course or an order gets completed successfully. The function I am trying to execute is actually called an API. I don't see an appropriate Hook from LearnPress.
It works perfectly when I use "user_register"(when someone registers this hook fire) hook but it doesn't work when I use this "learn_press_confirm_order" hook given by LearnPress.
Do you guys know is there any appropriate way that I can follow and achieve this. Thank You for your time
First off, your Lime API key should be treated as a password - don't share it on the web! Go to your LimeLM Account right now, choose 'Settings', and choose 'Generate New Key'. I'll wait :)
There's nothing obviously wrong with your code, so I would debug it like this:
Put a die('setup'); immediately after the add_action. We want to be sure that this file is actually being called. If it is, remove the die.
Wordpress and LearnPress are fantastic, because you've got the source code. Go to wp-content/plugins/learnpress and type (on Linux or something *nix)
grep -R "learn_press_confirm_order" .
This will show you all the files that reference this action. There is only one:
./templates/order/confirm.php: transaction_method, $order->get_id() ); ?>
So pull up an editor and edit wp-content/plugins/learnpress/templates/order/confirm.php. You need to determine:
Whether the file is being run at all when you order. (Use die right at the top, or error_log if you can see your webserver/php log files.)
I'm fairly certain at this point you will have found the error, but there's a chance for some reason you're getting to this page, but the action isn't being called. So you might need to work out the exact flow of control on this confirm.php page. Again, die or error_log.
You can make live changes to the code of learnpress, to help you debug it. Most people are afraid to dig into other people's code, but that's the great power of open source. You can just reinstall learnpress when you're done.
Looking forward to hearing how it goes :)
I have downloaded the Alexa Skills online tutorial found at:
https://github.com/amzn/alexa-skills-kit-js/blob/master/samples/reindeerGames/src/index.js
and followed (I think) all of the instructions in the tutorial found at:
https://developer.amazon.com/public/community/post/TxDJWS16KUPVKO/New-Alexa-Skills-Kit-Template-Build-a-Trivia-Skill-in-under-an-Hour
This is meant to be a tutorial for first time Alexa Skills developers. My question is, I get this error message once I hit the "Save and Test" button:
errorMessage": "Exception: TypeError: Cannot read property 'application' of undefined"
Does anyone know what the above error means or how to get rid of it?
Thanks v much.
This looks like a javascript error telling you that you are trying to use a property named application on an undefined variable.
JavaScript assigns the value "undefined" to any variable that you use but haven't set yet.
There are a several ways that you can debug problems in your Lambdas. Perhaps the easiest is to review the Logs. To do this:
Go to the Lambda console (where you upload your code to Lambda)
Select the Monitoring tab
Select "View logs in CloudWatch" (in the upper right)
Review the latest log, looking for a reported error in one of your files (typically index.js) and specifically the line number. That should help you find the error.
Note that the time stamps will be GMT, so probably won't match your actual time. This can be confusing if you have multiple entries. But the minutes should match, helping you verify that you're looking at the correct log entry.
A more advanced, and quicker way to debug Lambda problems, is the include a "test" request, and run this each time you upload code to Lambda.
To set this up:
Run one of your defined utterances in the ASK test page under the "Service Simulator" section.
Copy the code displayed below that in the "Lambda Request" section.
Now switch to the Lambda console for your Lambda function
Click the down arrow in the Actions button and select "Configure test event"
Paste the request you copied above into the text field
Click Save and Test.
Now each time you upload new code to Lambda, you can select "Test" and the request that you just saved will be run.
And best of all, the console log will be displayed in the lower right corner, saving you from having to switch to the logs and refresh to view them.
I'm attempting to create a collaborative jukebox as a little project to learn Meteor, so apologies for this very high-level noob question.
I need to be able to call the soundcloud SC.stream (see https://developers.soundcloud.com/docs/api/sdks#streaming) function on multiple clients. The template all clients are looking at is binded to a object that looks something like:
room: {
title: "roomname"
currentlyPlaying: {
trackName: "track name"
trackStreamURL: "http://soundcloud/12345"
}
}
I can't seem figure out a way so that when a client, say the admin, sets a new currentlyPlaying to trigger all client to run SC.stream and start the new song.
I'm just not sure what the right meteor features are to use in this scenario, so i'm not looking for a code solution exactly, just a point in the right direction.
Thanks in advance.
Save the currently playing url in a document in a collection. Then use cursor.observe() or cursor.observeChanges() on the client to watch the document with the url in it. Do this inside a Tracker.autorun in block.
When the url changes, stop playing the previous tune and start playing the new one.
See here for documentation on cursor.observe().
I am a meteor newbie. I am trying out by building a simple app and it does nothing but shows list of items. I first tried out with hard coded model values in my client javascript code and it worked just fine. I then created a folder called 'model' under root of the application and created the model there like the following
Favorites = new Meteor.collection("favorites")
with this change, meteor throws exception pointing to this line of the file on load. If I move this code to client the code works ofcourse that is wrong. The full code is # https://github.com/ksunair/13favs It is a very simple solution has few files and less than 20 or 30 lines altogether. My client code is,
Template.favorites_main.helper({
favorites:Favorites
});
I did the following in order to clear your app of errors:
Favorites = new Meteor.Collection("favorites"); (Collection starts with a capital C)
I moved model/mainmodel.js to lib/mainmodel.js so Favorites would be available as soon as the template rendered. I always put my models under lib (or in a subdirectory) so they will be loaded first. This contradicts what I see in other places including discover meteor, so I'm unclear what the best practice is. In any case, it fixed the problem.
$ meteor add accounts-ui was needed because you referenced Accounts.ui.config.
You need to actually do a find in your favorites_main template. So it should look something like:
Template.favorites_main.helpers({
favorites: Favorites.find();
});
A bit of a followup from a previous question.
As I mentioned in that question, my overall goal is to call a Ruby script after ImageCache does its magic with generating thumbnails and whatnot.
Sebi's suggestion from this question involved using hook_nodeapi.
Sadly, my Drupal knowledge of creating modules and/or hacking into existing modules is pretty limited.
So, for this question:
Should I create my own module or attempt to modify the ImageCache module?
How do I go about getting the generated thumbnail path (from ImageCache) to pass into my Ruby script?
edit
I found this question searching through SO...
Is it possible to do something similar in the _imagecache_cache function that would do what I want?
ie
function _imagecache_cache($presetname, $path) {
...
...
// check if deriv exists... (file was created between apaches request handler and reaching this code)
// otherwise try to create the derivative.
if (file_exists($dst) || imagecache_build_derivative($preset['actions'], $src, $dst)) {
imagecache_transfer($dst);
// call ruby script here
call('MY RUBY SCRIPT');
}
Don't hack into imagecache, remember every time you hack core/contrib modules god kills a kitten ;)
You should create a module that invokes hook_nodeapi, look at the api documentation to find the correct entry point for your script, nodeapi works on various different levels of the node process so you have to pick the correct one for you (it should become clear when you check the link out) http://api.drupal.org/api/function/hook_nodeapi
You won't be able to call the function you've shown because it is private so you'll have to find another route.
You could try and build the path up manually, you should be able to pull out the filename of the uploaded file and then append it to the directory structure, ugly but it should work. e.g.
If the uploaded file is called test123.jpg then it should be in /files/imagecache/thumbnails/test123/jpg (or something similar).
Hope it helps.