Is there a concept of tailable cursor in Couchbase?
I mean a cursor which remains open after fetching all data, and yields the new data when they become available.
My objective is to create a worker which will transmit all data from particular view to other resource (Disco).
This is not something currently available in Couchbase, so you have to query your view each time
Related
guys! I'm looking for a solution or some ideas on how to solve my task.
There is a video surveillance camera(vendor: Hikvision) with an accessible web-interface.
In the web-interface, there is a field Device Name containing data I need to retrieve by means of the Zabbix server and further to use this data for renaming discovered hosts.
Since Hikvision cameras support SNMP, I've tried the SNMP agent in Zabbix. I turned out that Hikvision MIB doesn't contain data from that field.
Also exploring web-interface through Developer tools in Google Chrome I stumbled upon the string Request URL: http://10.90.187.16/ISAPI/System/deviceInfo which gives such response in XML format:
<DeviceInfo xmlns="http://www.hikvision.com/ver20/XMLSchema" version="2.0">
<deviceName>1.5.1.1</deviceName>
<deviceID>566eec0b-6580-11b3-81a1-1868cb48861f</deviceID>
<deviceDescription>IPCamera</deviceDescription>
<deviceLocation>hangzhou</deviceLocation>
<systemContact>Hikvision.China</systemContact>
<model>DS-2CD2155FWD-IS</model>
<serialNumber>DS-2CD2155FWD-IS20170417AAWR749464587</serialNumber>
<macAddress>18:68:cb:48:86:1f</macAddress>
<firmwareVersion>V5.4.5</firmwareVersion>
<firmwareReleasedDate>build 170124</firmwareReleasedDate>
<encoderVersion>V7.3</encoderVersion>
<encoderReleasedDate>build 170123</encoderReleasedDate>
<bootVersion>V1.3.4</bootVersion>
<bootReleasedDate>100316</bootReleasedDate>
<hardwareVersion>0x0</hardwareVersion>
<deviceType>IPCamera</deviceType>
<telecontrolID>88</telecontrolID>
<supportBeep>false</supportBeep>
<supportVideoLoss>false</supportVideoLoss>
</DeviceInfo>
Where the tag <deviceName>1.5.1.1</deviceName> contains required data and now the question is how to put two and two together by means of Zabbix.
Digging into Zabbix documentation I've found an article about creating an Item based on HTTP agent with XML request . Unfortunately there are not any exmaples how to do it exactly.
Has somebody had such experience? Any clues will be helpful
You can create an HTTP Agent item, set it to TEXT type and point it to http://10.90.187.16/ISAPI/System/deviceInfo (don't forget the authentication, if required!), Zabbix will retrieve the full XML.
To get the desired value you have to create a dependent item, point it to the previous item and set up a preprocessing step.
Create a single XML Xpath preprocessing rule with parameter string(/DeviceInfo/DeviceName) to get the 1.5.1.1 value
If you want to get the firmware version, create another dependent item and set up the XPath to string(/DeviceInfo/FirmwareVersion) and so on for every element you need.
If you want a single value you can use a single item, adding the preprocessing rule to the http agent item. I use my solution for flexibility, maybe one day I'll need another XML element or maybe a firmware update will add some element to the page.
Dependent items are more flexible, but of course the full XML uses more storage in the database for stuff you don't need right now: it's a tradeoff, either way works!
I'm using the app-indexeddb-mirror component for storing offline data in the indexeddb cache. I got it working with the following code.
<app-indexeddb-mirror
key="travels"
data="{{data}}"
persisted-data="{{persistedData}}">
</app-indexeddb-mirror>
<firebase-query
app-name="projectMeta"
path="/travel"
data="{{data}}">
</firebase-query>
This code block successfully get an array of data and then stores it under the travel key in my indexeddb.
Let's say I'm offline and I want to fill in a form which is then stored in indexeddb under the key bto. How can I get the component to persist my data?
I tried the following:
<app-indexeddb-mirror
id="readCache"
key="testKey"
data="{{liveData}}"
persisted-data="{{persistedData}}"
log="true">
</app-indexeddb-mirror>
First attempt to write my data object:
this.$.readCache.setStoredValue(key, data).then(function(res) {
console.log("success")
});
Second attempt to write my data object:
this.set("liveData", newval.data);
in the console i'm getting:
but when I'm looking in the console under the Application tab to view all the stored content under indexeddb, it's still empty?
For what I have seen, you can't really "save" offline data with this component. It will update the versions of the data each time they change, and save them, and on an offline scenario will only serve the stocked value in persisted data, but not save them.
In fact, as soon as you'll be online again, all changes will be erased by the online version of the datas retrieved by the firebase-query
If you want to save offline changes, you'll have to use the component serving the datas, fortunately firebase-document have offlines capabilities so just save your data with it, and it should work fine.
At least that what's I have done on a pet project, and it seems to work.
Cordially :)
I am working on a fairly simple Heat Map application where the longitude and latitude of the points will be stored in a SQL Server database. I have been looking at an example that uses an array of objects as follows (eliminated a lot of data for brevity):
/* Sample data to demonstrate Bing Maps Heatmap */
/* http://alastair.wordpress.com */
var CrimeData = [
new Microsoft.Maps.Location(52.67280, 0.94392),
new Microsoft.Maps.Location(52.62423, 1.29493),
new Microsoft.Maps.Location(52.62187, 1.29080),
new Microsoft.Maps.Location(52.58962, 1.72228),
new Microsoft.Maps.Location(52.69915, 0.24332),
new Microsoft.Maps.Location(52.51161, 0.99350),
new Microsoft.Maps.Location(52.59573, 1.17067),
new Microsoft.Maps.Location(52.94351, 0.49153),
new Microsoft.Maps.Location(52.64585, 1.73145),
new Microsoft.Maps.Location(52.75424, 1.30079),
new Microsoft.Maps.Location(52.63566, 1.27176),
new Microsoft.Maps.Location(52.63882, 1.23121)
];
What I want to do is present the user with a list of some sort that displays all the data sets that exist in the database (they each have a name associated with them) and then allow the user to check all or only a select few. I will then need to generate an array like the above to create the heat map. Any ideas on a good approach to this?
What you trying to achieve is more related to a web developement rather than only related to Bing Maps.
To summarize, you have multiple ways to do this but it really depends on what you are capable to do and what you need in the interface.
What process/technology?
First, you need to determine what process you want to follow to display the data and it will set the technology that you will use. The questions that you need to ask yourself are:
Do you want to be able to change the data sets dynamically without refreshing the whole page?
If yes, it means that you will have to use asynchronous data loading through a dedicated web service in order to avoid loading all the information at the initial load of the page.
Do you have lots of data to load?
If so, it might comfort you with asynchronous loading to avoid loading all data.
If not loading every elements in multiple arrays might be the simplest solution.
Implementation
So now, you want to create a web service to load the data asynchronously, you can take a look at the following websites :
http://www.asp.net/get-started
http://www.stefanprodan.com/2011/04/async-operations-with-jquery-ajax-and-asp-net-mvc/
There might be interesting other website, you will be able to find them. If needed, add comment and I'm sure the community will help you.
If you want to generate the data directly in the script, it could be simple as you can compose the JavaScript directly in your dynamically created HTML page (in your ASP.Net markup code or whatever technology you're using).
I have a Store used to back a List. When I tap on a list item, I show a "details" panel. One of the buttons on the details panel initiates a POST request to initiate a server-side operation. This changes the status on the server side from "idle" to "in-progress". To update the UI on the details panel, I then load the latest data for this instance by calling load() on the Model class, e.g.
MyApp.model.Server.load(serverId,
success: function(record, operation) {
// code that updates the current view
}
});
However, this doesn't seem to update the instance in the underlying Store. So when I go back to the list, there is stale data for the server I tapped on (still says "idle").
Is there a way I can take the updated Server instance and update just that record in the Store? I don't want to have to reload my entire Store just to update the UI for one record.
I tried updating the instance in the Store, to no avail:
Ext.getStore('Server').getById(serverId).data = record.data;
Am I missing something here? Or do I really have to reload the whole Store just to get the updated status for one record?
No, you dont need reload all store and inst good update a record data manualy.
Correct:
var record = Ext.getStore('Server').first();
record.set(form.getData());
record.save();
Im creating an app that needs to track the location of the user (with their knowledge, like a running app) so that I can show them their route later. Should I use HTML5 with some timeout interval to save the coordinates every N seconds and if so, how often should I save the data and how should I save it (locally using local storage or post it to the server?)
Also, what is the easiest way to display the map of where the user has been later?
Has anyone done anything like this before?
The timeout interval for forge.geolocation is up to you and the balance of responsiveness of your application. Also, network traffic is expensive. So maybe you can buffer... say the last 10 geopositions... and then Http post (or whatever... see Parse below) in bulk? And since the geo data sounds like temporary device data why would there be a need to persist using forge.prefs? Unless maybe you need to the app to work "offline"?
For permanent storage I would look at Parse (generous free plan) and their Parse.GeoPoint class via their Javascript or REST Api as one possible solution. They have some nifty methods like (kilometersTo, milesTo, radiansTo) - https://parse.com/docs/js/symbols/Parse.GeoPoint.html