var dataPoints = [
new H.clustering.DataPoint(52, 1),
new H.clustering.DataPoint(52.1, 1)
];
var clusteringProvider = new H.clustering.Provider(dataPoints, {
clusteringOptions: {
minWeight: 1,
eps: 32
}
});
// clustering should be used with ObjectLayer
var clusteringLayer = new H.map.layer.ObjectLayer(clusteringProvider);
map.addLayer(clusteringLayer);
This is the code from the example from https://developer.here.com/documentation/maps/topics_api/h-clustering-provider.html
I am referencing provided Here Maps JS libraries (version 3.0).
The error I am getting from today is "TypeError: f.pb is not a function" at the initialization of H.clustering.Provider object. The same code worked on Friday. Not sure what is going on?
I stumbled over the same error. Apparently the old example had a link to the clustering code under
https://js.api.here.com/v3/3.0/mapsjs-clustering.js
The current example loads that code from
https://js.cit.api.here.com/v3/3.0/mapsjs-clustering.js
- the same sub-domain as the other scripts.
I guess the two sub-domains are no longer in sync and mixing the minified scripts fails due to different field names.
Related
Sometimes test fail because of random things such as network condition, some services occassionally chug, and many other things.
In this situation ,we hope the failed cases could rerun for specific times, and we can config the value of specific times.
I have add afterScenario in karate-config.js.
The "afterScenario===" is print as log,
but the java code doesn't executed.
What is the correct way to call java code in karate-config.js?
var afterScenario = function(){
karate.log('afterScenario===>', karate.info);
var retryClass = Java.type('utils.CheckUtils');
var retryInstance = new retryClass();
return retryInstance.reRunCases(karate.info.featureFileName, karate.info.scenarioName)
}
karate.configure("afterScenario", afterScenario)
TLDR
I like to really focus on keeping business logic away from the view model / controller. I find this sometimes rather hard in Meteor. Maybe I'm missing the point but I am after one of two things really:
1) A really good document explaining at a really low level how reactive values are being used.
2) A package that somehow manages an object so that if any of the setters are altered, they notify all of the get functions that would change as a result.
Unfortunately I've not seen either.
My Example
I have a fair bit ob business logic sitting behind a dialog used to document a consultation. I might have an event that sets a change of state.
I'd like to do something like this in the event:
const cc = new ConsultationEditor();
cc.setChiefComplaint(event.target.value);
console.log(cc.data());
ConsultationDict.set("consEdit", cc.data() );
When the user has updated this value, I'd then like to show a number of fields, based on the change. For this I have a helper with the following:
fields: function(){
console.log("trying to get fields");
const obj = ConsultationDict.get('consEdit');
cc = new ConsultationEditor(obj);
return cc.getFields();
}
But unfortunately this does not work for me.
What is your ConsultationDict?
The way you describe it, you want it to be a ReactiveDict as in the official ReactiveDict package.
https://atmospherejs.com/meteor/reactive-dict
Check this tutorial for examples:
https://themeteorchef.com/snippets/reactive-dict-reactive-vars-and-session-variables/
If you really need more fine tuning in your reactivity, you can also set a dependency tracker tracker = new Tracker.Dependency, and then refer to it wherever you change a variable with tracker.changed() and where the data needs to be notified with tracker.depend() like this:
var favoriteFood = "apples";
var favoriteFoodDep = new Tracker.Dependency;
var getFavoriteFood = function () {
favoriteFoodDep.depend();
return favoriteFood;
};
var setFavoriteFood = function (newValue) {
favoriteFood = newValue;
favoriteFoodDep.changed();
};
getFavoriteFood();
See the full Tracker doc here:
https://github.com/meteor/meteor/wiki/Tracker-Manual
I also found this gist to be useful to build reactive objects:
https://gist.github.com/richsilv/7d66269aab3552449a4c
and for a ViewModel type of behavior, check out
https://viewmodel.meteor.com/
I hope this helps.
I am following a calculator tutorial from here: http://thecodeplayer.com/walkthrough/javascript-css3-calculator
However I am using nitrous as the IDE and Meteor. In this part of the code in the js file:
// Get all the keys from document
var keys = **document.querySelectorAll**("#calculator span");
var operators = ['+', '-', 'x', '÷'];
var decimalAdded = false;
The 'document.querySelector All' part comes up with a not defined error. I have tried replacing it with the more Meteor friendly 'template. find' however then it just says that template is not defined. Any help would be very much appreciated. :)
I am trying to override the javascript controller node-header.js of components\node-details with the extension module of alfresco share
This is my node-header.get.js
<import resource="classpath:/alfresco/templates/org/alfresco/import/alfresco-util.js">
for (var i=0; i<model.widgets.length; i++)
{
if (model.widgets[i].id == "NodeHeader")
{
if(model.widgets[i].options.nodeRef!=null)
{
var jsNode = new Alfresco.util.Node(model.widgets[i].options.nodeRef);
if(jsNode.hasAspect("custom:intranetFile")){
model.widgets[i].options.showFavourite = false;
model.widgets[i].options.showLikes = false;
}
}
}
}
I am getting this error
Error Message: 05270002 Failed to execute script
'classpath*:webscripts/custom/nodeheader/hidelikesync/node-header.get.js':
05270001 ReferenceError: "Alfresco" is not defined.
(jar:file:/C:/Alfresco/Alfresco42/tomcat/webapps/share/WEB-INF/lib/customshare.jar!/webscripts/custom/nodeheader/hidelikesync/node-header.get.js#1555)
Error lies in this line
var jsNode = new Alfresco.util.Node(model.widgets[i].options.nodeRef);
as Alfresco object is not available how can I get it?
Based on my answer yesterday on the share-extras-devel list:
Your issue is that you are mixing up your web script JS with client-side JavaScript. Alfresco.util.Node is a client-side helper class and is therefore available to client-side JS running in the web browser, but not to your web script code which runs on the server.
If you look at the source of alfresco-util.js, which you are including, you will see that there is a helper class there but it is called AlfrescoUtil.
To get some information on this given node I would suggest that you want to use the static method AlfrescoUtil.getNodeDetails() from that class, e.g.
var jsNode = AlfrescoUtil.getNodeDetails(model.widgets[i].options.nodeRef);
The structure of the jsNode object will be as per the JSON returned by the doclist-v2 webscripts, so you should be able to check for the presence of your custom aspect in the aspects array property.
If you check the source of alfresco-util.js you will see that additional parameters are also supported by getNodeDetails(). It seems to me you can also pass in an optional site name, plus some options if you wish.
I am trying the phpunit in the Zf2 album module by following the online ZF2 tutorial. Below is the debug information.
Album\Model\AlbumTableTest::testFetchAllReturnsAllAlbums
Argument 1 passed to Album\Model\AlbumTable::__construct() must be an instance of Zend\Db\Adapter\Adapter, instance of Mock_TableGateway_fb3537df given, called in D:\www\zend2\tests\module\Album\src\Album\Model\AlbumTableTest.php on line 26 and defined
And the function used is
public function testFetchAllReturnsAllAlbums()
{
$resultSet = new ResultSet();
$mockTableGateway = $this->getMock('Zend\Db\TableGateway\TableGateway',
array('select'), array(), '', false);
$mockTableGateway->expects($this->once())
->method('select')
->with()
->will($this->returnValue($resultSet));
$albumTable = new AlbumTable($mockTableGateway);
$this->assertSame($resultSet, $albumTable->fetchAll());
}
And the 26th line mentioned in the debug information is
$albumTable = new AlbumTable($mockTableGateway);
Which calls to the following functon in Album\Model\AlbumTable::__construct()
public function __construct(Adapter $adapter)
{
$this->adapter = $adapter;
$this->resultSetPrototype = new ResultSet();
$this->resultSetPrototype->setArrayObjectPrototype(new Album());
$this->initialize();
}
Any help to over come this failed test is much appreciated.
Got it solved. I happened to see that the Album module given in the Zend Framework2 tutorial has been changed. I followed it once again to correct the changed codes. Now the mentioned issue has been sorted out.