jstree stuck on loading? - jstree

Using the following code, jstree gets stuck on loading.
<meta charset="UTF-8">
<title>No title</title>
<link rel="stylesheet" type="text/css" href="theme2/jquery-ui-1.8.17.custom/css/ui-lightness/jquery-ui-1.8.17.custom.css" media="screen" />
<link rel="stylesheet" type="text/css" href="layout-default-latest.css" />
<script type="text/javascript" src="jquery-1.6.1.min.js"></script>
<script type="text/javascript" src="jquery.jstree.js"></script>
<script type="text/javascript" src="jquery-ui-1.8.17.custom/js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="jquery.layout-latest.js"></script>
$("#treeFile").jstree({ "themes" : {
"theme" : "default",
"dots" : false,
"icons" : false
},
"plugins" : ["themes", "treeFile"]
});
Interesting, if the change value of false to fales, it works but unable to give the dots and icons names a real false value.

Try this:
$("#treeFile").jstree({ "themes" : {
"theme" : "default",
"dots" : "false",
"icons" : "false"
},
"plugins" : ["themes", "treeFile"]
});

I think your missing the datasource.
"json_data" : {
{
"data" : "Node 1",
"children" :[],
"state" : "open"
},
{
"data" : "Node 2",
"children" :[],
"state" : "open"
},
{
"data" : "Node 3",
"children" :[],
"state" : "open"
}
},
"themes" : {"theme" : "classic"},
"plugins" : ["themes", "json_data"]
}

Related

Vega Vega-lite streaming

I am starting using Vega and I am now trying to stream my data to nicely refresh my graph. I followed this doc (https://vega.github.io/vega-lite/tutorials/streaming.html) with no success so far. The examples I found have values in arrays and mine are in a JSON file which is refreshed on a regular basis. I ended up with this code which properly shows my graph as I want but it does not refresh my data.
<html>
<head>
<title>A title</title>
<meta charset="utf-8" />
<script src="https://cdn.jsdelivr.net/npm/vega#5.8.1"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-lite#4.0.0-beta.12"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed#6.1.0"></script>
<style media="screen">
/* Add space between Vega-Embed links */
.vega-actions a {
margin-right: 5px;
}
</style>
</head>
<body>
<head>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/vega#5"></script>
<script src="https://cdn.jsdelivr.net/npm/vega-embed#5"></script>
</head>
<body>
<div id="vis"></div>
<script>
var vlSpec = {
data: {"url": "http://localhost:8123/d.json", "name":"table"},
mark: "bar",
"width": 1240,
"encoding": {
"y": {"field": "task", "type": "ordinal", "sort":"x2"},
"x": {"field": "start", "type": "temporal", "aggregate":"sum"},
"x2": {"field": "end", "type": "temporal"},
"color": {"field": "status", "type": "nominal"}
}
};
// Embed visualization and save view as window.view:
vegaEmbed('#vis', vlSpec).then(function(res) {
window.setInterval(function() {
var changeSet = vega
.changeset()
.insert()
res.view.change('table', changeSet).run();
}, 1000);
});
</script>
</body>
</html>
My issue seems to be the insert() where in the example of the doc they insert the result of a function to generate data and I should insert here my JSON file -- I tried different variations with fetch but with no success.
Any help would be appreciated.
Thanks
Let me answer my own question as I figured it out.
First I used jquery:
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
I removed the url tag not to load the JSON file at first:
"data": {"name":'table'},
And the VEGA streaming data from my JSON file:
vegaEmbed('#vis', vlSpec).then(function(res) {
var newdata ;
window.setInterval(function() {
jQuery.getJSON("http://localhost:8123/d.json", function(data) {
newdata = data;
})
var changeSet = vega
.changeset()
.remove(vega.truthy)
.insert(newdata)
console.log (newdata)
res.view.change('table', changeSet).run();
}, 1000);
});
It works like a charm !

how to set Headquarters in schema.org json ld

this is my json ld
<script type="application/ld+json">
{ "#context" : "http://schema.org",
"#type" : "Organization",
"legalName" : "example",
"url" : "https://www.example.com/",
"description" : "Company",
"logo" : "logo.jpg",
"sameAs" : [ " https://www.facebook.com/example"]
}
</script>
for Headquarters what attribute need to be used?
There is no such property like Headquarters. But there are some possibilities to display relations between different offices and organization levels. Look further to following properties:
https://developers.google.com/search/docs/data-types/corporate-contact
https://schema.org/department
https://schema.org/foundingLocation
https://schema.org/parentOrganization
https://schema.org/subOrganization
Related to your screenshot:
Informations from your screenshot are actually coming from Wiki / DBpedia entry for the firm. If you look at this page http://dbpedia.org/page/Google you will see, the Headquarters information from your screenshot is actually a kind of location property, like on my screenshot:

Couldn't connect to node http://localhost:8545

Screenshot of the issues:
Web3.min.js path in my system directory!
Web3.min.js is loaded from folder in my browser
Copy of the web3.min.js in the same folder where index.html file is present.
Code added
info of the node!
I am facing following two issues:
Failed to load resource: web3.min.js:1 net::ERR_CONNECTION_REFUSED
ERROR: Couldn't connect to node http://localhost:8545.
My Index.html file is
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="main.css">
</head>
<body>
<div class="container">
<h1>Coursetro Instructor</h1>
<h2 id="instructor"></h2>
<label for="name" class="col-lg-2 control-label">Instructor Name</label>
<input id="name" type="text">
<label for="name" class="col-lg-2 control-label">Instructor Age</label>
<input id="age" type="text">
<button id="button">Update Instructor</button>
</div>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js"></script>
<script>
if (typeof web3 !== 'undefined') {
web3 = new Web3(web3.currentProvider);
} else {
// set the provider you want from Web3.providers
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
}
web3.eth.defaultAccount = web3.eth.accounts[0];
var CoursetroContract = web3.eth.contract([
{
"constant": false,
"inputs": [
{
"name": "_fName",
"type": "string"
},
{
"name": "_age",
"type": "uint256"
}
],
"name": "setInstructor",
"outputs": [],
"payable": false,
"stateMutability": "nonpayable",
"type": "function"
},
{
"constant": true,
"inputs": [],
"name": "getInstructor",
"outputs": [
{
"name": "",
"type": "string"
},
{
"name": "",
"type": "uint256"
}
],
"payable": false,
"stateMutability": "view",
"type": "function"
}
]);
var Coursetro=CoursetroContract.at('0x95712aa4ff464e56f76af55da6239a368c459ed4');
console.log(Coursetro);
</script>
</body>
</html>
If you are connecting to a local node:
You have included jquery cdn, similarly include a web3 from the link web3_cdn.
You can download one file from the link and connect the file in your webapp by
<script type="text/javascript" src="web3.min.js"></script>
And make sure when you run the app your metamask is disabled. Metamask injects a web3 object right into your application.
For reference check the other answers link
i have this problem and i solve it .
the solution :
you must create index.html and main.css in folder project, not in node_modules folder.

Schema.org TVEpisode entries for multi-source playback page

I'm expanding a static site with playable videos contextualized in a TV Series and I would like to know how to properly fill in the tags url and datePublished.
Currently, with only one embeddable source, the JSON-LD generated is:
<script type="application/ld+json">
{
"#context" : "http://schema.org",
"#type" : "TVEpisode",
"partOfTVSeries" : {
"#type" : "TVSeries",
"name" : "Name of the Show"
},
"keywords": "a,list,of,comma,separated,tags",
"partOfSeason" : {
"#type" : "TVSeason",
"seasonNumber" : "1"
},
"episodeNumber" : "1",
"image" : "absolute/path/to/video/image.jpg",
"url" : "permalink",
"review" : {
"#type" : "Review",
"author" : {
"#type" : "Person",
"name" : "Summary Author Name"
},
"reviewBody" : "Summary"
}
}
</script>
With only one embeddable source it was just a matter of using the template functions to retrieve the Permalink and the Date in which the video has been published.
But I don't know how to do it for multiple sources.
I tried to simply duplicate the whole block, simulating an iteration, changing the mentioned values but when testing with Structured Data Testing Tool, although no errors were reported, the second entry was ignored.
In JSON-LD, if you have multiple values for a property, you have to use an array as value instead of repeating the property.
You could provide multiple VideoObject items for the TVEpisode, by using TVEpisode’s associatedMedia/encoding property:
<script type="application/ld+json">
{
"#context": "http://schema.org",
"#type": "TVEpisode",
"associatedMedia": [
{
"#type": "VideoObject",
"name": "Source 1"
},
{
"#type": "VideoObject",
"name": "Source 2"
}
]
}
</script>
Now you can differentiate between the metadata for the TV episode and for its videos.

Multiple entities in schema.org

How do I nest one or multiple recipes in a NewsArticle or BlogPosting.
I tried this but Google's Structured Data Testing Tool throws an error complaining about recipe1 key. I'm not sure what to change recipe1 key to:
<script type="application/ld+json">
{
"#context" : "http://schema.org",
"#type" : "NewsArticle",
"author" : { "#type" : "Person",
"name" : "hgezim"
},
"dateModified" : "2016-09-21T06:25:35+00:00",
"datePublished" : "2016-09-21T06:25:35+00:00",
"headline" : "Chicken Papriak",
"mainEntityOfPage" : "http://localhost:8080/2016/09/21/chicken-papriak/",
"publisher" : { "#type" : "Organization",
"name" : "Dev Blog"
},
"recipe1": {
"#context": "http://schema.org",
"#type": "Recipe",
"author": "John Smith",
"cookTime": "PT1H",
"datePublished": "2009-05-08",
"description": "This classic banana bread recipe comes from my mom -- the walnuts add a nice texture and flavor to the banana bread.",
"image": "bananabread.jpg",
"recipeIngredient": [
"3 or 4 ripe bananas, smashed",
"1 egg",
"3/4 cup of sugar"
],
"interactionStatistic": {
"#type": "InteractionCounter",
"interactionType": "http://schema.org/Comment",
"userInteractionCount": "140"
},
"name": "Mom's World Famous Banana Bread",
"nutrition": {
"#type": "NutritionInformation",
"calories": "240 calories",
"fatContent": "9 grams fat"
},
"prepTime": "PT15M",
"recipeInstructions": "Preheat the oven to 350 degrees. Mix in the ingredients in a bowl. Add the flour last. Pour the mixture into a loaf pan and bake for one hour.",
"recipeYield": "1 loaf",
"suitableForDiet": "http://schema.org/LowFatDiet"
}
}
</script>
It depends on how the entities are related to each other. You have to use a property that is defined to convey this relation.
To look for a suitable property, check BlogPosting for properties that have Recipe or one of its parent types (CreativeWork, Thing) as expected value.
For example:
about could be used if the blog post is about this specific recipe (e.g., you describe how you liked it)
hasPart could be used if the recipe forms a part of the blog post
mentions could be used if you just reference this recipe in the blog post
…
Thanks #unor. I've used hasPart as follows:
<script type="application/ld+json">
{ "#context" : "http://schema.org",
"#type" : "NewsArticle",
"author" : { "#type" : "Person",
"name" : "hgezim"
},
"dateModified" : "2016-09-21T06:25:35+00:00",
"datePublished" : "2016-09-21T06:25:35+00:00",
"hasPart" : { "#context" : "http://schema.org",
"#type" : "Recipe",
"author" : "John Smith",
"cookTime" : "PT1H",
"datePublished" : "2009-05-08",
"description" : "This classic banana bread recipe comes from my mom -- the walnuts add a nice texture and flavor to the banana bread.",
"image" : "bananabread.jpg",
"interactionStatistic" : { "#type" : "InteractionCounter",
"interactionType" : "http://schema.org/Comment",
"userInteractionCount" : "140"
},
"name" : "Mom's World Famous Banana Bread",
"nutrition" : { "#type" : "NutritionInformation",
"calories" : "240 calories",
"fatContent" : "9 grams fat"
},
"prepTime" : "PT15M",
"recipeIngredient" : [ "3 or 4 ripe bananas, smashed",
"1 egg",
"3/4 cup of sugar"
],
"recipeInstructions" : "Preheat the oven to 350 degrees. Mix in the ingredients in a bowl. Add the flour last. Pour the mixture into a loaf pan and bake for one hour.",
"recipeYield" : "1 loaf",
"suitableForDiet" : "http://schema.org/LowFatDiet"
},
"headline" : "Chicken Papriak",
"mainEntityOfPage" : "http://localhost:8080/2016/09/21/chicken-papriak/",
"publisher" : { "#type" : "Organization",
"name" : "Dev Blog"
}
}
</script>
It validates as validates JSON-LD.