nodes

D3.js force directed graph, each group different color?

谁说胖子不能爱 提交于 2019-12-01 06:05:56
I've made a force directed graph with d3.js plugin, and I wanna color the nodes and the labels with the different color according to group which they belong. I've added scale for color: var color = d3.scale.category20(); and to node variable I've added: .style("fill", function(d) { return color(d.group); }) but all nodes are in the same color.. Here is my current situation: http://jsfiddle.net/WBkw9/ full script: var links = [ {source: "John", target: "Mike", group: "5"}, {source: "John", target: "Janice", group: "5"}, {source: "John", target: "Caleb", group: "5"}, {source: "John", target:

Is there a way to take away focus in javafx?

左心房为你撑大大i 提交于 2019-12-01 05:19:11
I know that your can give focus to a node in javafx by doing node.requestFocus(); but is there a way to take away focus from a node in javafx or prevent focus on an object? I don't think there's any guarantee this will always work, but you can try setting focus to something that inherently doesn't accept keyboard input (such as a layout pane): import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; import javafx.stage.Stage; public class NoFocusTest extends Application { @Override public void start(Stage

Is there a way to take away focus in javafx?

旧街凉风 提交于 2019-12-01 02:16:13
问题 I know that your can give focus to a node in javafx by doing node.requestFocus(); but is there a way to take away focus from a node in javafx or prevent focus on an object? 回答1: I don't think there's any guarantee this will always work, but you can try setting focus to something that inherently doesn't accept keyboard input (such as a layout pane): import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.TextField; import javafx.scene.layout.VBox; import

D3.js force directed graph, each group different color?

时光怂恿深爱的人放手 提交于 2019-12-01 02:13:34
问题 I've made a force directed graph with d3.js plugin, and I wanna color the nodes and the labels with the different color according to group which they belong. I've added scale for color: var color = d3.scale.category20(); and to node variable I've added: .style("fill", function(d) { return color(d.group); }) but all nodes are in the same color.. Here is my current situation: http://jsfiddle.net/WBkw9/ full script: var links = [ {source: "John", target: "Mike", group: "5"}, {source: "John",

PHP: Using simplexml to loop through all levels of an XML file

五迷三道 提交于 2019-11-30 15:38:59
I have a function which uses simplexml to return the first level of nodes in an XML file and write it into an unordered list: function printAssetMap() { $xml = simplexml_load_file(X_ASSETS); $assets = $xml->asset; $html = '<ul>'."\n"; foreach ($assets as $asset) { $html .= '<li id="asset'.$asset->asset_assetid.'"><ins> </ins><a href="#">'.$asset->asset_name.' ['.$asset->asset_assetid.']</a></li>'."\n"; }//end foreach $html .= '</ul>'."\n"; return $html; }// printAssetMap() XML I am using, that has nested nodes: <?xml version="1.0"?> <assets> <asset> <asset_name>Home</asset_name> <asset_url>

Adjusting the node size in igraph using a matrix

对着背影说爱祢 提交于 2019-11-30 15:12:47
I have the following network diagram: set.seed(1410) df<-data.frame( "site.x"=c(rep("a",4),rep("b",4),rep("c",4),rep("d",4)), "site.y"=c(rep(c("e","f","g","h"),4)), "bond.strength"=sample(1:100,16, replace=TRUE)) library(igraph) df<-graph.data.frame(df) V(df)$names <- c("a","b","c","d","e","f","g","h") layOUT<-data.frame(x=c(rep(1,4),rep(2,4)),y=c(4:1,4:1)) E(df)[ bond.strength < 101 ]$color <- "red" E(df)[ bond.strength < 67 ]$color <- "yellow" E(df)[ bond.strength < 34 ]$color <- "green" V(df)$color <- "white" l<-as.matrix(layOUT) plot(df,layout=l,vertex.size=10,vertex.label=V(df)$names,

NPM module installation error

故事扮演 提交于 2019-11-30 15:09:55
问题 I am getting Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND while trying to install a module in node.js. It seems some proxy error.I checked in browser setting ,proxy is disabled. But when i am checking in command prompt npm config get proxy, getting 192.168.98.5:8080. How to disable this? 回答1: First, try to execute npm config delete proxy . If you get something like Error: ENOENT, unlink '/Users/drlazor/.npmrc' is OK; that means you don't have a npm config file

Model.findOne not returning docs but returning a wrapper object

久未见 提交于 2019-11-30 13:38:38
问题 I have defined a Model with mongoose like this: var mongoose = require("mongoose") var Schema = mongoose.Schema var userObject = Object.create({ alias: String, email: String, password: String, updated: { type: Date, default: Date.now } }) var userSchema = new Schema(userObject, {strict: false}) var User = mongoose.model('User', userSchema) module.exports = User Then I created a user that I can perfectly find through mongo console like this: db.users.findOne({ email: "coco@coco.com" }); { "_id

NPM module installation error

[亡魂溺海] 提交于 2019-11-30 13:23:25
I am getting Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND while trying to install a module in node.js. It seems some proxy error.I checked in browser setting ,proxy is disabled. But when i am checking in command prompt npm config get proxy, getting 192.168.98.5:8080. How to disable this? First, try to execute npm config delete proxy . If you get something like Error: ENOENT, unlink '/Users/drlazor/.npmrc' is OK; that means you don't have a npm config file and, therefore, no proxy settings. Second, verify you have no proxy settings with npm config get proxy .

How can I find a specific node in my XML?

血红的双手。 提交于 2019-11-30 12:17:17
I have to read the xml node "name" from the following XML, but I don't know how to do it. Here is the XML: <?xml version="1.0" standalone="yes" ?> <games> <game> <name>Google Pacman</name> <url>http:\\www.google.de</url> </game> </games> Code: using System.Xml; namespace SRCDSGUI { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { XmlDocument doc = new XmlDocument(); doc.Load(Application.StartupPath + @"\games.xml"); XmlElement root = doc.DocumentElement; XmlNodeList nodes = root.SelectNodes("//games"); foreach