cytoscape.js with cola seems no longer to work - cytoscape.js

I'm trying the latest cytoscape with the latest cola and I get the following error:
Uncaught TypeError: cola.adaptor is not a function
for the cytoscape.js code snippet:
var adaptor = layout.adaptor = cola.adaptor({
trigger: function( e ){ // on sim event
switch( e.type ){
case 'tick':
if( options.animate ){
Did the API change for Cola?

I still get this error when trying to do as the docs suggest (React/Browserify/ES6/npm):
import cytoscape from 'cytoscape';
import cycola from 'cytoscape-cola';
import cola from 'webcola';
cycola(cytoscape, cola);
However I was able to make it work after seeing this issue and including the cola v3 script in the <head> of my index file.
Finally, I had to do this:
cycola(cytoscape, window.cola); // since cola now lives in window

Cola now has good npm and versioning support, so you can easily try different versions of Cola if you have issues.
I've also made a pull request to Cola so they have a dedicated parent class, generic adapter in Typescript. The PR has since been merged in -- so it should be well supported into the future. (The previous adapter in Cola was a JS one, which apparently didn't fit well with their classical inheritance model in TS.)
--
Old answer:
Cola hasn't had support for semantic versioning, and it's unsupported in package managers. Updates to Cola regularly break API compatibility, and rewriting the Cytoscape.js side of things for an updated version of Cola is not an option until a future major version release.
Use the included version of Cola in the download ZIP for Cytoscape.js, if you want to guarantee compatibility.
You may also want to file an issue with Cola, as the issue in this case is certainly on that side and Cytoscape.js can't operate without a fix: https://github.com/tgdwyer/WebCola/issues

cola import if you use webpack for build app:
import cola from 'exports?cola!webcola/WebCola/cola';
that`s works for me :)

Related

videojs-thumbnails plugin shows thumbnails at incorrect time

I'm trying to use "videojs-thumbnails" plugin from https://github.com/brightcove/videojs-thumbnails and noticed that thumbnail's time, specified in the plugin configuration is not matching the timestamp in the seek bar. Coming across different comments regarding this issue I found suggestion at https://github.com/brightcove/videojs-thumbnails/issues/43 to replace line
mouseTime = Math.floor((left - progressControl.el().offsetLeft) / progressControl.width() * duration);
to
mouseTime = Math.floor((left) / progressControl.width() * duration);
By removing
- progressControl.el().offsetLeft
However, that produces still not exact time match.
Finally I came with redefined value for the
var left
Getting it from the current value of
.vjs-mouse-display
So, my final codes are:
left=parseInt((document.querySelector('.vjs-mouse-display').style.left),10);
mouseTime = Math.floor((left) / progressControl.width() * duration);
Now everything works correctly.
Greatly appreciate for comments/suggestions.
This is NOT an answer to your specific question / issue, but rather, an alternative implentation approach.
I, too, wanted thumbnails for my video(s), so I proto-typed a page
that used videoJS's plugin. I don't recall all the details of the
issues that I ran into trying to use that plugin, but I finally decided
to abandon the plugin, and design an alternative, which has its own
separate 'slider' just above the viewer. [ One 'drags' my slider,
(rather than hover along it, as you do on YouTube's videos), so that it
can work straight-forwardly on touch-screens...i.e. on Android, etc. ]
And, rather than try to extract images from the video in real-time,
(See: How to generate video preview thumbnails for use in VideoJS? ), I chose to prepare the images, ahead of time, using 'ffmpeg' and the cmd-line interface to 'ImageMagick'.
Details of that part are here:
http://weasel.firmfriends.us/GeeksHomePages/subj-video-and-audio.html#implementing-video-thumbnails
My 'proof-of-concept' webpage based on that approach is here:
https://weasel.firmfriends.us/Private3-BB/
I hope this is helpful.

How can I stop renamed items being italic?

Something that is really annoying me about Minecraft 1.13 is the fact that all renamed items are italic, and I cannot seem to try and figure out how to make it 'normal'. It was never like this in any previous versions, is there any way of fixing this? An example of what I mean can be found below.
The ItemStack code:
ItemStack emerald = new ItemStack(Material.SPAWNER);
ItemMeta emeraldMeta = emerald.getItemMeta();
emeraldMeta.setDisplayName(Main.colorCodes("&3&l» &aEmerald Golem Spawner &3&l«"));
emeraldMeta.setLore(emeraldLore);
emerald.setItemMeta(emeraldMeta);
The item inside of a GUI (as you can see, the name is in italic):
According to this thread in Spigot forums, this is a bug within Spigot/Minecraft.
There are a couple of issues referring to this in Mojang's Issue Tracker (1, 2).
Currently, the only way to fix it is to update your Spigot Version, according to user RockinChaos from the thread I quoted above.
You can build the latest Spring following this tutorial from Spring MC
Add &r before &3&l.

yadcf interface change to exFilterColumn confusion

I am upgrading the yadcf version on my site from 0.6.9 to 0.8.8. (I'm also upgrading from datatables 1.9.4 to 1.10.10)
See the 0.6.9 version at my production site and the 0.8.8 version at my sandbox site
I have updated my calls to yadcf.exFilterColumn from two calls to a single call because now the defaults take an array of pairs.
But my filtered dataset is empty when the page loads, and I need to select a gender then click all for all the data to show up.
I'm sure it's something I'm not quite getting for the new interface.
Update: Simplified sandbox version here. See file TestStandings.js
Update 2: Daniel pointed out that "-1" for gender filter won't work. Apparently usegender = "-1" doesn't behave the same way in 0.8.8 as it did in 0.6.9 for some reason. I could try to figure out why it used to work, but that seems unproductive.
I added the following code after the exFilterColumn call (it's necessary for the gender to be filtered in some use cases)
// reset gender column if didn't mean to filter
if (usegender == "-1") {
yadcf.exResetFilters( _rrwebapp_table, [genderCol] )
}
but this gets exception at line 3624 of jquery.dataTable.yadcf.js because settingsDt.aanFeatures.f is undefined
Update 3: while debugging on the datatables side, I changed sDom from '<"H"Clpr>t' to the default 'lfrtip'. The exception mentioned above went away and the table loaded properly.
Here is how you should handle your scenario
Its wrong to ask for filtering for a -1 value because there is no such value in the table, so in order to reset a specific column just before calling exFilterColumn you should use the exResetFilters with noRedraw set to true (grab from 0.8.9.beta.31) you should call this function before your exFilterColumn
Old answer
I might have noticed multiple calls to the exFilterColumn for the same table, while in fact you should call it only once, just set the desired values for each column of the table,
See showcase page (first table)
And notice the relevant code below
yadcf.exFilterColumn(firstTable, [
[1, {
from: 1,
to: 40
}],
[3, "a_value"]
]);
If it still no goodm please provide the your table / yadcf init code and the code for calling the exFilterColumn
Update:
I noticed that your are using the following line of code
yadcf.exFilterColumn(_rrwebapp_table, [[divisionCol, usedivision], [genderCol, usegender]])
Where your usegender is set to "-1" which makes no sense, because its the value of the Select input reset option, so make sure you dont use "-1" as values in your exFilterColumn calls...

Querying for shared nodes in JCR (ModeShape)

I have a JCR content repository implemented in ModeShape (4.0.0.Final). The structure of the repository is quite simple and looks like this:
/ (root)
Content/
Item 1
Item 2
Item 3
...
Tags/
Foo/
Bar/
.../
The content is initially created and stored under /Content as [nt:unstructured] nodes with [mix:shareable] mixin. When a content item is tagged, the tag node is first created under /Tags if it's not already there, and the content node is shared/cloned to the tag node using Workspace.clone(...) as described in the JCR 2.0 spec, section 14.1, Creation of Shared Nodes.
(I don't find this particularly elegant and I did just read this answer, about creating a tag based search system in JCR, so I realize this might not be the best/fastest/most scaleable solution. But I "inherited" this solution from developers before me, so I hope I don't have to rewrite it all...)
Anyway, the sharing itself seems to work (I can verify that the nodes are there using the ModeShape Content Explorer web app or programatically by session.getRootNode().getNode("Tags/Foo").getNodes()). But I am not able to find any shared nodes using a query!
My initial try (using JCR_SQL2 syntax) was:
SELECT * FROM [nt:unstructured] AS content
WHERE PATH(content) LIKE '/Tags/Foo/%' // ISDECENDANTNODE(content, '/Tags/Foo') gives same result
ORDER BY NAME(content)
The result set was to my surprise empty.
I also tried searching in [mix:shareable] like this:
SELECT * FROM [mix:shareable] AS content
WHERE PATH(content) LIKE '/Tags/Foo/%' // ISDECENDANTNODE(content, '/Tags/Foo') gives same result
ORDER BY NAME(content)
This also returned an empty result set.
I can see from the query:
SELECT * FROM [nt:unstructured] AS content
WHERE PATH(content) LIKE '/Content/%' // ISDECENDANTNODE(content, '/Content') works just as well
ORDER BY NAME(content)
...that the query otherwise works, and returns the expected result (all content). It just doesn't work when searching for the shared nodes.
How do I correctly search for shared nodes in JCR using ModeShape?
Update: I upgraded to 4.1.0.Final to see if that helped, but it had no effect on the described behaviour.
Cross-posted from the ModeShape forum:
Shared nodes are really just a single node that appears in multiple places within a workspace, so it's not exactly clear what it semantically means to get multiple query results for that one shareable node. Per Section 14.16 of the JSR-283 (JCR 2.0) specification implementations are free to include shareable nodes in query results at just one or at multiple/all of those locations.
ModeShape 2.x and 3.x always returned in query results only a single location of the shared nodes, as this was the behavior of the reference implementation and this was the feedback we got from users. When we were working on Modeshape 4.0, we tried to make it possible to return multiple results, but we ran into problems with the TCK and uncertainty about what this new expected behavior would be. Therefore, we backed off our goals and implemented query to return only one of the shared locations, as we did with 2.x and 3.x.
I may be wrong, but I'm not exactly sure if any JCR implementation returns multiple rows for a single shared node, but I may be wrong.

Rally print stories with parent feature name in the card generated

I've used Joel Krooswyk's Print All Backlog Story Cards solution for printing all stories in a backlog.
What I'd like to do is to extend this to have each card print the name of the parent feature that the card belongs to so I can print them all up and lay them on a table for a collaborative estimation session.
The issue is, I'm having trouble finding how to do it.
A snippet of his code in question:
queryArray[0] = {
key: CARD_TYPE,
type: 'hierarchicalrequirement',
query: '((Iteration.Name = "") AND (Release.Name = ""))',
fetch: 'Name,Iteration,Owner,FormattedID,PlanEstimate,ObjectID,Description,UserName',
order: 'Rank'
};
I can't seem to find the element to fetch!
Parent was listed on an example queries page(intended for use in the browser query functionality), with Parent.Name containing the actual text but so that hasn't worked - trying to find a reference that is clear about it seems to be eluding me.
I've looked at the type definition located at:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/?fetch=ObjectID&pagesize=100&pretty=true
Going to the hierarchical requirement's type definition from that page indicates it has a Parent field in one form or another.
I'm not even sure that that one will solve what I'm looking at.
A bit stuck, and I'm not sure what I'm trying to do is even possible with the hierarchical requirement object type.
Note: I assume even if I do find it I'll need to add some code to deal parentless stories- not worried about that though, that's easy enough to deal with once I find the actual value.
Many thanks to anyone who can help :)
I modified Joel's app to include PI/Feature's FormattedID to the cards when a story has a parent PI/Feature.
You may see the code in this github repo.
Parent field of a user story references another user story.
If you want to read a parent portfolio item of a user story, which is a Feature object, use Feature attribute or PortfolioItem attribute. Both will work:
if (data[i].PortfolioItem) {
//feature = data[i].PortfolioItem.FormattedID; //also works
//feature = data[i].Feature.Name; //also works
feature = data[i].Feature.FormattedID;
} else {
feature = "";
}
as long as the version of API is set in the code to 1.37 or above (up to 1.43).
PrintStoryCards app is AppSDK1 app.
1.33 is the latest version of AppSDK1.x
1.29, which the app is using is not aware of PortfoilioItems.
PortfolioItem was introduced in Rally in WS API version 1.37.
See API versioning section in the WS API documentation .
If you want to access Portfolio Items, or other features introduced in later versions of WS API up to 1.43 this syntax will allow it.
<script type="text/javascript" src="/apps/1.33/sdk.js?apiVersion=1.43"></script>
This has to be used with caution. One thing that definitely will break is around calculations of timebox start and end dates. That's why many legacy Rally App Catalog apps are still at 1.29.
This is due to changes in API Version 1.30.
Note that this method of setting a more advanced version of WS API for AppSDK1 does not work with v2.0 of WS API.
You should be able to add PortfolioItem to your fetch. Parent is the field used if the parent is a story. PortfolioItem is the field used if the parent is a Feature (or whatever your lowest level PI is).
Then in the results you can just get it like this:
var featureName = (story.PortfolioItem && story.PortfolioItem.Name) || 'None';