Kibana 4.0 change default timefilter - elasticsearch

How can I change default time filter duaration in Kibana 4.0?
By default it is 15 minutes from now. It return default each time when I open new session Kibana.

Find index.js in [YourKibanaLocation]\src\public\index.js
and look for Timefilter() function (my Kibana version has it at string 115480).
After finding the function, change default value for timeDefaults to your liking and save index.js.
Mine looked like this:
BEFORE
function Timefilter() {
Timefilter.Super.call(this);
var self = this;
self.enabled = false;
var timeDefaults = {
from: 'now-15m',
to: 'now'
};
AFTER
function Timefilter() {
Timefilter.Super.call(this);
var self = this;
self.enabled = false;
var timeDefaults = {
from: 'now-24h',
to: 'now'
};
You don't have to restart Kibana after that, just refresh your Kibana page.
PS. Sorry for unformatted answer, I'll change later, when not on mobile.

Click on the top right corner[Last 15 minutes]. You will get a dropdown from where you can change the time.

In Kibana 4.6.1, the default time can be changed from 15 minutes to ,for example, 24 hours easily.
Location of file to change:
kibanaDir/optimize/bundles/kibana.bundle.js
search for 'timepicker:timeDefaults', change the time from 15mto 24h, save the file and refresh the browser. You are done.

Related

generateMasterViews in BIM360

I have a problem with revit files loaded into BIM360; Rooms and spaces in Forge viewer are not displayed as in the example reported at the link https://forge.autodesk.com/blog/new-rvt-svf-model-derivative-parameter-generates-additional-content-including-rooms-and-spaces (see ); There is no volume, only one point.
Otherwise, if I load revit model into a bucket, following the procedure above, rooms and spaces are represented as desired in the viewer forge (see ).
Is there a possibility to call Data Management's APIs (as Model Derivative's APIs, https://forge.autodesk.com/en/docs/model-derivative/v2/reference/http/job-POST/) to load revit file in BIM360 folder by setting generateMasterViews parameter to true?
Or is there the possibility in BIM360 to set this option by default for each revit file that is uploaded?
TIA
Alder
BIM360 Docs set generateMasterViews to true by default, so no need to do that with BIM360 via Forge Model Derivative API (Not Data Management API).
The viewer of BIM360 is called BIM360 Viewer which is built on the top of the Forge Viewer, but not all features of Forge Viewer are included in BIM360 Viewer. (See BIM 360 Viewer vs Forge Viewer)
Back to your question,
Could you try to load your models that you cannot see the rooms with this viewer code?
var options = {
env: 'MD20Prod' + (atob(urn.replace('urn:', '').replace('_', '/')).indexOf('emea') > -1 ? 'EU' : 'US'),
api: 'D3S',
getAccessToken: getForgeToken
};
if (LMV_VIEWER_VERSION >= '7.48') {
options.env = 'AutodeskProduction2';
options.api = 'streamingV2' + (atob(urn.replace('urn:', '').replace('_', '/')).indexOf('emea') > -1 ? '_EU' : '');
}
Autodesk.Viewing.Initializer(options, () => {
viewer = new Autodesk.Viewing.GuiViewer3D(document.getElementById('forgeViewer'));
viewer.start();
var documentId = 'urn:' + urn;
Autodesk.Viewing.Document.load(documentId, onDocumentLoadSuccess, onDocumentLoadFailure);
});
function onDocumentLoadSuccess(doc) {
const root = doc.getRoot();
const viewables = root.search({'type':'geometry', 'role': '3d'});
console.log('Viewables:', viewables);
const phaseViews = viewables.filter(v => v.data.name === v.data.phaseNames && v.getViewableRootPath().includes('08f99ae5-b8be-4f8d-881b-128675723c10'));
console.log('Master Views:', phaseViews);
viewer.loadDocumentNode(doc, phaseViews[0], { skipHiddenFragments: false }).then(model => {
// any additional action here?
console.log({
'LMV version': LMV_VIEWER_VERSION
});
});
}
function onDocumentLoadFailure(viewerErrorCode) {
console.error('onDocumentLoadFailure() - errorCode:' + viewerErrorCode);
}
ref: https://github.com/yiskang/forge-viewhubmodels-nodejs-svf2/blob/main/public/js/ForgeViewer.js

request.object.id not returning in afterSave() in Cloud Code

Parse.Cloud.afterSave(function(request) {
var type = request.object.get("type");
switch (type) {
case 'inspiration':
var query = new Parse.Query("Inspiration");
break;
case 'event':
var query = new Parse.Query("Event");
break;
case 'idea':
var query = new Parse.Query("Idea");
break;
case 'comment':
break;
default:
return;
}
if (query) {
query.equalTo("shares", request.object.id);
query.first({
success: function(result) {
result.increment("sharesCount");
result.save();
},
error: function(error) {
throw "Could not save share count: " + error.message;
}
});
}
});
For some reason request.object.id is not returning the object id from the newly created record. I've tested this code out throughly and have isolated it down to the request.object.id variable. I've even successfully ran it with using a pre-existing object ID and it worked fine. Am I using the wrong variable for the object ID?
Thanks in advanced for any help!
Had this exact problem a few weeks ago.
It turned out to be a bug in Parse's newest Javascript SDK. Please have a look at your CloudCode folder - it should contain a global.json file where you can specify the JavaScript SDK version. By default, it states "latest", change it to "1.4.2" and upload your CloudCode folder again.
In case the global.json file is missing in your cloud code folder, please have a look at this thread, where I described how to create it manually.
Thanks for the reply. I found out another work around for this for version 1.6.5. I should probably also mention that my use case for this code is to increment a count column (comments count) when a new relation has been added to a particular record (post).
Instead of implementing an afterSave method on my relation class (comment), I instead implemented a beforeSave method on my class (Post) and used request.object.dirtyKeys() to get my modified columns. From there I check to see if my dirty key was comments and if it is I increment my count column. It works pretty well actually.

Query logging tool for Firefox

I am looking for a way to log my own queries I submit to Google in Firefox. Is there a way so I can store them in a log file?
Cheers.
Do you need write an add-on and you can use many tools for solve this.
You can chose:
HTTP Observers
Listening to events on tabs
Load Events
WebProgressListeners
https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Intercepting_Page_Loads
https://developer.mozilla.org/en/docs/Listening_to_events_on_all_tabs
To log JS msj (error, warnings, logs) to disk, set the environment variable XRE_CONSOLE_LOG to the path to the filename. i.e. export XRE_CONSOLE_LOG=/path/to/logfile or set XRE_CONSOLE_LOG=C:\path\to\logfile.
https://developer.mozilla.org/en-US/docs/Mozilla/Projects/XULRunner/Debugging_XULRunner_applications
Or you can create files
https://developer.mozilla.org/en-US/Add-ons/Code_snippets/File_I_O
Components.utils.import("resource://gre/modules/NetUtil.jsm");
Components.utils.import("resource://gre/modules/FileUtils.jsm");
// get the "data.txt" file in the profile directory
var file = FileUtils.getFile("ProfD", ["GoogleQuery.txt"]);
// You can also optionally pass a flags parameter here. It defaults to
// FileUtils.MODE_WRONLY | FileUtils.MODE_CREATE | FileUtils.MODE_TRUNCATE;
var ostream = FileUtils.openSafeFileOutputStream(file);
var converter = Components.classes["#mozilla.org/intl/scriptableunicodeconverter"].
createInstance(Components.interfaces.nsIScriptableUnicodeConverter);
converter.charset = "UTF-8";
var istream = converter.convertToInputStream(data);
// The last argument (the callback) is optional.
NetUtil.asyncCopy(istream, ostream, function(status) {
if (!Components.isSuccessCode(status)) {
// Handle error!
return;
}
// Data has been written to the file.
//data is your string of your Google queries
});
Here is an add-on for Firefox or IE to log queries
http://www.lemurproject.org/querylogtoolbar/

Filtering a loaded kml file in OpenLayers

I'm trying to create an interactive search engine (for finding event tickets) of which one of its features is a visual map that shows related venues using OpenLayers. I have a plethora of venues (3000+) in a kml file that I would like to selectively show a filtered subsection of. Below is the code I have but when I try to run it has a JavaScript error. Running firebug and chrome developer tools makes me think that it is not getting passed the parameters I give because it says that the variables are null. However, I cannot figure out why they are not getting passed. Any insight is greatly appreciated.
var map, drawControls, selectControl, selectedFeature, select;
$('#kml').load('venuesComplete.kml');
kml=$('#kml').html();
function showVenues(state, city, venue){
filterStrategy = new OpenLayers.Strategy.Filter({});
var kmllayer = new OpenLayers.Layer.Vector("KML", {
strategies: [filterStrategy,
new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "venuesComplete.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
})
});
select = new OpenLayers.Control.SelectFeature(kmllayer);
kmllayer.events.on({
"featureselected": onFeatureSelect,
"featureunselected": onFeatureUnselect
});
map.addControl(select);
select.activate();
filter = new OpenLayers.Filter.Comparison({
type: OpenLayers.Filter.Comparison.LIKE,
property: "",
value: ""
});
function clearFilter(){
filterStrategy.setFilter(null);
}
function setFilter(property, value){
filter.value = value;
filter.property = property;
filterStrategy.setFilter(filter);
}
var vector_style = new OpenLayers.Style();
if(venue!=""){
setFilter('name', venue);
}else if(city!=""){
setFilter('description', city);
}else if(state!=""){
setFilter('description', state);
}
map.addLayer(kmllayer);
function onPopupClose(evt) {
select.unselectAll();
}
function onFeatureSelect(event) {
var feature = event.feature;
var selectedFeature = feature;
var popup = new OpenLayers.Popup.FramedCloud("chicken",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(100,100),
"<h2>"+feature.attributes.name + "</h2>" + feature.attributes.description +'<br>'+feature.attributes,
null,
true,
onPopupClose
);
document.getElementById('venueName').value=feature.attributes.name;
document.getElementById("output").innerHTML=event.feature.id;
feature.popup = popup;
map.addPopup(popup);
}
function onFeatureUnselect(event) {
var feature = event.feature;
if(feature.popup) {
map.removePopup(feature.popup);
feature.popup.destroy();
delete feature.popup;
}
}
}
function init() {
map = new OpenLayers.Map('map');
var google_map_layer = new OpenLayers.Layer.Google(
'Google Map Layer',
{type: google.maps.MapTypeId.HYBRID}
);
map.addLayer(google_map_layer);
state="";
state+=document.getElementById('stateProvDesc').value;
city="";
city+=document.getElementById('cityZip').value;
venue="";
venue+=document.getElementById('venueName').value;
showVenues(state,city,'Michie Stadium');
map.addControl(new OpenLayers.Control.LayerSwitcher({}));
map.zoomToMaxExtent();
}
IF I UNDERSTAND CORRECTLY, your kml does not load properly. if this is not the case, please disconsider my answer.
it is very important to check if your kml layer was properly loaded. i have a map that loads multiple dynamic (from php) kml layers and it is not uncommon to have a large layer simply not load. when that happens, the operation is aborted, but, as far as openlayers is concerned, the layer was properly loaded.
so i do 2 things: i check if the amount of loaded data meets the expected number of features in my orginal php kml parser (i use a jquery or ajax call for that) and then, in case there is a discrepancy, i try reloading (since this is a loop, i limit it to 5 attempts, so as not to loop infinitely).
check out some of my code here

Jquery datetime picker plugin?

I am using this plugin:
http://tedserbinski.com/jcalendar/index.html
The plugin is supposed to accept a user defined startdate, but I cant manage to get it to work.
This is the header of the js file:
var _drawCalendar = function(dateIn, a, day, month, year) {
var today = new Date();
if (dateIn == undefined) {
// start from this month.
d = new Date(today.getFullYear(), today.getMonth(), 1);
year.val(today.getFullYear());
month.val(today.getMonth()+1);
day.val(today.getDate());
}
else {
// start from the passed in date
d = dateIn;
d.setDate(1);
}
And i am calling the calendar plug with the following line, that actually is missing something. I have tried hundreds of diffrent code snippets, but I have gived up :(
$('fieldset.jcalendar').jcalendar();
Best regards, Joakim
Any particular reason you aren't using the DatePicker that comes with jQuery UI? The page you linked even says that the project has been superceded by jQuery UI.

Resources