Search Results

Search found 2725 results on 109 pages for 'nodes'.

Page 18/109 | < Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >

  • Post Deploy MAAS cleanup

    - by David Buttrick
    I have a mostly working MAAS cluster. I'm still learning juju, but while I'm doing that, I wanted to take this opportunity to do some clean-up tasks. Here are my goals: Configure ntp on the nodes. Set the video mode on the nodes. Set the timezone on the nodes. Are these juju tasks? Or is this better attacked by mounting the disk image on the MAAS host, and doing the configuration there? If I do it that way, how do I get the nodes to recognize that they have to re-install the image to pickup my changes? Thank you. David

    Read the article

  • How can I find the shortest path between two subgraphs of a larger graph?

    - by Pops
    I'm working with a weighted, undirected multigraph (loops not permitted; most node connections have multiplicity 1; a few node connections have multiplicity 2). I need to find the shortest path between two subgraphs of this graph that do not overlap with each other. There are no other restrictions on which nodes should be used as start/end points. Edges can be selectively removed from the graph at certain times (as explained in my previous question) so it's possible that for two given subgraphs, there might not be any way to connect them. I'm pretty sure I've heard of an algorithm for this before, but I can't remember what it's called, and my Google searches for strings like "shortest path between subgraphs" haven't helped. Can someone suggest a more efficient way to do this than comparing shortest paths between all nodes in one subgraph with all nodes in the other subgraph? Or at least tell me the name of the algorithm so I can look it up myself? For example, if I have the graph below, the nodes circled in red might be one subgraph and the nodes circled in blue might be another. The edges would all have positive integer weights, although they're not shown in the image. I'd want to find whatever path has the shortest total cost as long as it starts at a red node and ends at a blue node. I believe this means the specific node positions and edge weights cannot be ignored. (This is just an example graph I grabbed off Wikimedia and drew on, not my actual problem.)

    Read the article

  • How to find Sub-trees in non-binary tree

    - by kenny
    I have a non-binary tree. I want to find all "sub-trees" that are connected to root. Sub-tree is a a link group of tree nodes. every group is colored in it's own color. What would be be the best approach? Run recursion down and up for every node? The data structure of every treenode is a list of children, list of parents. (the type of children and parents are treenodes) Clarification: Group defined if there is a kind of "closure" between nodes where root itself is not part of the closure. As you can see from the graph you can't travel from pink to other nodes (you CAN NOT use root). From brown node you can travel to it's child so this form another group. Finally you can travel from any cyan node to other cyan nodes so the form another group

    Read the article

  • How do we keep dependent data structures up to date?

    - by Geo
    Suppose you have a parse tree, an abstract syntax tree, and a control flow graph, each one logically derived from the one before. In principle it is easy to construct each graph given the parse tree, but how can we manage the complexity of updating the graphs when the parse tree is modified? We know exactly how the tree has been modified, but how can the change be propagated to the other trees in a way that doesn't become difficult to manage? Naturally the dependent graph can be updated by simply reconstructing it from scratch every time the first graph changes, but then there would be no way of knowing the details of the changes in the dependent graph. I currently have four ways to attempt to solve this problem, but each one has difficulties. Nodes of the dependent tree each observe the relevant nodes of the original tree, updating themselves and the observer lists of original tree nodes as necessary. The conceptual complexity of this can become daunting. Each node of the original tree has a list of the dependent tree nodes that specifically depend upon it, and when the node changes it sets a flag on the dependent nodes to mark them as dirty, including the parents of the dependent nodes all the way down to the root. After each change we run an algorithm that is much like the algorithm for constructing the dependent graph from scratch, but it skips over any clean node and reconstructs each dirty node, keeping track of whether the reconstructed node is actually different from the dirty node. This can also get tricky. We can represent the logical connection between the original graph and the dependent graph as a data structure, like a list of constraints, perhaps designed using a declarative language. When the original graph changes we need only scan the list to discover which constraints are violated and how the dependent tree needs to change to correct the violation, all encoded as data. We can reconstruct the dependent graph from scratch as though there were no existing dependent graph, and then compare the existing graph and the new graph to discover how it has changed. I'm sure this is the easiest way because I know there are algorithms available for detecting differences, but they are all quite computationally expensive and in principle it seems unnecessary so I'm deliberately avoiding this option. What is the right way to deal with these sorts of problems? Surely there must be a design pattern that makes this whole thing almost easy. It would be nice to have a good solution for every problem of this general description. Does this class of problem have a name?

    Read the article

  • Octree subdivision problem

    - by ChaosDev
    Im creating octree manually and want function for effectively divide all nodes and their subnodes - For example - I press button and subnodes divided - press again - all subnodes divided again. Must be like - 1 - 8 - 64. The problem is - i dont understand how organize recursive loops for that. OctreeNode in my unoptimized implementation contain pointers to subnodes(childs),parent,extra vector(contains dublicates of child),generation info and lots of information for drawing. class gOctreeNode { //necessary fields gOctreeNode* FrontBottomLeftNode; gOctreeNode* FrontBottomRightNode; gOctreeNode* FrontTopLeftNode; gOctreeNode* FrontTopRightNode; gOctreeNode* BackBottomLeftNode; gOctreeNode* BackBottomRightNode; gOctreeNode* BackTopLeftNode; gOctreeNode* BackTopRightNode; gOctreeNode* mParentNode; std::vector<gOctreeNode*> m_ChildsVector; UINT mGeneration; bool mSplitted; bool isSplitted(){return m_Splitted;} .... //unnecessary fields }; DivideNode of Octree class fill these fields, set mSplitted to true, and prepare for correctly drawing. Octree contains basic nodes(m_nodes). Basic node can be divided, but now I want recursivly divide already divided basic node with 8 subnodes. So I write this function. void DivideAllChildCells(int ix,int ih,int id) { std::vector<gOctreeNode*> nlist; std::vector<gOctreeNode*> dlist; int index = (ix * m_Height * m_Depth) + (ih * m_Depth) + (id * 1);//get index of specified node gOctreeNode* baseNode = m_nodes[index].get(); nlist.push_back(baseNode->FrontTopLeftNode); nlist.push_back(baseNode->FrontTopRightNode); nlist.push_back(baseNode->FrontBottomLeftNode); nlist.push_back(baseNode->FrontBottomRightNode); nlist.push_back(baseNode->BackBottomLeftNode); nlist.push_back(baseNode->BackBottomRightNode); nlist.push_back(baseNode->BackTopLeftNode); nlist.push_back(baseNode->BackTopRightNode); bool cont = true; UINT d = 0;//additional recursive loop param (?) UINT g = 0;//additional recursive loop param (?) LoopNodes(d,g,nlist,dlist); //Divide resulting nodes for(UINT i = 0; i < dlist.size(); i++) { DivideNode(dlist[i]); } } And now, back to the main question,I present LoopNodes, which must do all work for giving dlist nodes for splitting. void LoopNodes(UINT& od,UINT& og,std::vector<gOctreeNode*>& nlist,std::vector<gOctreeNode*>& dnodes) { //od++;//recursion depth bool f = false; //pass through childs for(UINT i = 0; i < 8; i++) { if(nlist[i]->isSplitted())//if node splitted and have childs { //pass forward through tree for(UINT j = 0; j < 8; j++) { nlist[j] = nlist[j]->m_ChildsVector[j];//set pointers to these childs } LoopNodes(od,og,nlist,dnodes); } else //if no childs { //add to split vector dnodes.push_back(nlist[i]); } } } This version of loop nodes works correctly for 2(or 1?) generations after - this will not divide neightbours nodes, only some corners. I need correct algorithm. Screenshot All I need - is correct version of LoopNodes, which can add all nodes for DivideNode.

    Read the article

  • JGridView (Part 2)

    - by Geertjan
    The second sample in the JGrid download is a picture viewer that needs to be seen to be believed. Here it is, integrated into a NetBeans Platform application (click to enlarge it): When you mouse over the images, they change, showing several different images instantaneously. Here's the explorer view above, mainly making use of code from the sample: public class JGridView extends JScrollPane { @Override public void addNotify() { super.addNotify(); final ExplorerManager em = ExplorerManager.find(this); if (em != null) { final JGrid grid = new JGrid(); Node root = em.getRootContext(); final Node[] nodes = root.getChildren().getNodes(); final PicViewerObject[] pics = new PicViewerObject[nodes.length]; for (int i = 0; i < nodes.length; i++) { Node node = nodes[i]; pics[i] = node.getLookup().lookup(PicViewerObject.class); } grid.getCellRendererManager().setDefaultRenderer(new PicViewerRenderer()); grid.setModel(new DefaultListModel() { @Override public int getSize() { return pics.length; } @Override public Object getElementAt(int i) { return pics[i]; } }); grid.setFixedCellDimension(160); grid.addMouseMotionListener(new MouseAdapter() { int lastIndex = -1; @Override public void mouseMoved(MouseEvent e) { if (lastIndex >= 0) { Object o = grid.getModel().getElementAt(lastIndex); if (o instanceof PicViewerObject) { Rectangle r = grid.getCellBounds(lastIndex); if (r != null && !r.contains(e.getPoint())) { ((PicViewerObject) o).setMarker(false); grid.repaint(r); } } } int index = grid.getCellAt(e.getPoint()); if (index >= 0) { Object o = grid.getModel().getElementAt(index); if (o instanceof PicViewerObject) { Rectangle r = grid.getCellBounds(index); if (r != null) { ((PicViewerObject) o).setFraction(((float) e.getPoint().x - (float) r.x) / (float) r.width); ((PicViewerObject) o).setMarker(true); lastIndex = index; grid.repaint(r); } } } } }); grid.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { //Somehow compare the selected item //with the list of books and find a matching book: int selectedIndex = grid.getSelectedIndex(); for (int i = 0; i < nodes.length; i++) { int picId = pics[i].getId(); if (selectedIndex == picId) { try { em.setSelectedNodes(new Node[]{nodes[i]}); } catch (PropertyVetoException ex) { Exceptions.printStackTrace(ex); } } } } }); setViewportView(grid); } } } The next step is to create a generic JGridView that will handle any kind of object automatically.

    Read the article

  • converting node inheritance to hiera

    - by quickshiftin
    I'm working on moving over a node inheritance tree to hiera. Presently working on the hierarchy. Prior to hiera, my nodes had a hierarchy as such base pre-prod qa nodes staging nodes development nodes prod nodes Now I'm trying to get the same tier with hiera. Starting out I have this :hierarchy: - base - "%{environment}" - "%{clientcert}" but I need another level to capture pre-prod and prod. My thought would be to add an entry to puppet.conf, something like [agent] realm = pre-prod then :hierarchy: - base - "%{realm}" - "%{environment}" - "%{clientcert}" A couple of questions Are you allowed to place arbitrary properties into puppet.conf? Will hiera see the realm property?

    Read the article

  • Erlang node acts like it connects, but doesn't [migrated]

    - by Malfist
    I'm trying to setup a distributed network of nodes across a few firewalls and it's not going so well. My application is structured like this: there is a central server that always running a node ([email protected]) and my co-worker's laptops connect to it on startup. This works if we're all in the office, but if someone is at home, they can connect to the masternode, but they fail to connect to the other nodes in the swarm. I.E., erlang fails to gossip correctly. To correct this, I've change epmd's port number and changed the inet_dist_listen ports to a known open port (1755 and 7070 respectively). However, something fishy is going on. I can run net_adm:world() and it reports that it connects to master node, but when I run nodes() I get an empty array. Same with net_adm:ping('[email protected]'). See: Eshell V5.9 (abort with ^G) ([email protected])1> net_adm:world(). ['[email protected]'] ([email protected])2> nodes(). [] ([email protected])3> net_adm:ping('[email protected]'). pong ([email protected])4> nodes(). [] ([email protected])5> What's going on, and how can I fix it?

    Read the article

  • Assignment of roles in communication when sides could try to cheat

    - by 9000
    Assume two nodes in a peer-to-peer network initiating a communication. In this communication, one node has to serve as a "sender", another as a "receiver" (role names are arbitrary here). I'd like the nodes to assert either role with approximately equal probability. That is, in N communications with various other nodes a given node would assume the "sender" role roughly N/2 times. Since there's no third-party arbiter available, nodes should agree on their roles by exchanging messages. The catch is that we can encounter a rogue node which would try to become the "receiver" in most or all cases, and coax the other side to always serve as a "sender". I'm looking for an algorithm to assign roles to sides of communication so that no side could get a predetermined role with high probability. It's OK for the side which is trying to cheat to fail to communicate.

    Read the article

  • Running Mixed Physical and Virtual Exalogic Elastic Cloud Software Versions in an Exalogic Rack is now Supported

    - by csoto
    Although it was not supported on older versions, now as of EECS 2.0.6, an Exalogic rack can be configured in a mixed-mode: half virtual and half physical Linux: Flexibility to have physical and virtual environments on same rack. For example, production on physical and test/dev on virtual. Exalogic Control manages the virtual compute nodes on the rack. Physical compute nodes are managed manually (including PKeys). Option to change full physical to hybrid and hybrid to full virtual rack. User has an option to choose either the top or bottom nodes for physical or virtual deployment. For further information about how the compute nodes can be split up on the rack (into bottom or top half) to run either Oracle Virtual Server (OVS "hypervisor") or Oracle Linux, please take a look at MOS Note 1536945.1. Note: Solaris is not yet supported in the mixed configuration.

    Read the article

  • populate a tree view with an xml file

    - by syedsaleemss
    Im using .net windows form application. I have an xml file.I want to populate a tree view with data from a xml file. I am doing this using the following code. private void button1_Click(object sender, EventArgs e) { try { this.Cursor = System.Windows.Forms.Cursors.WaitCursor; //string strXPath = "languages"; string strRootNode = "Treeview Sample"; OpenFileDialog Dlg = new OpenFileDialog(); Dlg.Filter = "All files(*.*)|*.*|xml file (*.xml)|*.txt"; Dlg.CheckFileExists = true; string xmlfilename = ""; if (Dlg.ShowDialog() == DialogResult.OK) { xmlfilename = Dlg.FileName; } // Load the XML file. //XmlDocument dom = new XmlDocument(); //dom.Load(xmlfilename); XmlDocument doc = new XmlDocument(); doc.Load(xmlfilename); string rootName = doc.SelectSingleNode("/*").Name; textBox4.Text = rootName.ToString(); //XmlNode root = dom.LastChild; //textBox4.Text = root.Name.ToString(); // Load the XML into the TreeView. this.treeView1.Nodes.Clear(); this.treeView1.Nodes.Add(new TreeNode(strRootNode)); TreeNode tNode = new TreeNode(); tNode = this.treeView1.Nodes[0]; XmlNodeList oNodes = doc.SelectNodes(textBox4.Text); XmlNode xNode = oNodes.Item(0).ParentNode; AddNode(ref xNode, ref tNode); this.treeView1.CollapseAll(); this.treeView1.Nodes[0].Expand(); this.Cursor = System.Windows.Forms.Cursors.Default; } catch (Exception ex) { this.Cursor = System.Windows.Forms.Cursors.Default; MessageBox.Show(ex.Message, "Error"); } } private void AddNode(ref XmlNode inXmlNode, ref TreeNode inTreeNode) { // Recursive routine to walk the XML DOM and add its nodes to a TreeView. XmlNode xNode; TreeNode tNode; XmlNodeList nodeList; int i; // Loop through the XML nodes until the leaf is reached. // Add the nodes to the TreeView during the looping process. if (inXmlNode.HasChildNodes) { nodeList = inXmlNode.ChildNodes; for (i = 0; i <= nodeList.Count - 1; i++) { xNode = inXmlNode.ChildNodes[i]; inTreeNode.Nodes.Add(new TreeNode(xNode.Name)); tNode = inTreeNode.Nodes[i]; AddNode(ref xNode, ref tNode); } } else { inTreeNode.Text = inXmlNode.OuterXml.Trim(); } } My xml file is this:"hello.xml" - - abc hello how ru - def i m fine - ghi how abt u Now after using the above code I am able to populate the tree view. But I dont like to populate the complete xml file. I should get only till languages language key value I don't want abc how are you etc..... I mean to say the leaf nodes. Please help me

    Read the article

  • Most efficient way of creating tree from adjacency list

    - by Jeff Meatball Yang
    I have an adjacency list of objects (rows loaded from SQL database with the key and it's parent key) that I need to use to build an unordered tree. It's guaranteed to not have cycles. This is taking wayyy too long (processed only ~3K out of 870K nodes in about 5 minutes). Running on my workstation Core 2 Duo with plenty of RAM. Any ideas on how to make this faster? public class StampHierarchy { private StampNode _root; private SortedList<int, StampNode> _keyNodeIndex; // takes a list of nodes and builds a tree // starting at _root private void BuildHierarchy(List<StampNode> nodes) { Stack<StampNode> processor = new Stack<StampNode>(); _keyNodeIndex = new SortedList<int, StampNode>(nodes.Count); // find the root _root = nodes.Find(n => n.Parent == 0); // find children... processor.Push(_root); while (processor.Count != 0) { StampNode current = processor.Pop(); // keep a direct link to the node via the key _keyNodeIndex.Add(current.Key, current); // add children current.Children.AddRange(nodes.Where(n => n.Parent == current.Key)); // queue the children foreach (StampNode child in current.Children) { processor.Push(child); nodes.Remove(child); // thought this might help the Where above } } } } public class StampNode { // properties: int Key, int Parent, string Name, List<StampNode> Children }

    Read the article

  • Silverlight performance with a large number of Objects Org Chart.

    - by KC
    Hello, I’m working on a org chart project(SL 3) and I’m seeing the UI thread hang when the chart is building around 2,000 nodes and when it renders it takes about a min and then FPS drop to a crawl. Here is the code flow. Page.xaml.cs calls a wcf service that returns a list of AD users. Then we use Linq to build a collection of nodes to bind to the Orgchart.cs OrgChart.cs is a canvas and displays a collection of nodes and connecting lines. Node.cs is a canvas and has user data can contain children nodes. NodeContent.xaml is a user control that has borders so I can set the background, textblocks to display user's data, Events that handle the selected and expaned nodes, and storyboards that resize the nodes when they are selected or expanded.I noticed during hours of debugging , here in the InitializeComponent(); section where it loads the xaml it seems to be where the preformance hit is happening. System.Windows.Application.LoadComponent(this, new System.Uri("/Silverlight.Custom;component/NodeContent.xaml", System.UriKind.Relative)); So I guess I have two questions. Can threading help in any way with the UI thread hanging while drawing the nodes? How can I avoid the hit when calling this user control? Any advice or direction anyone can lend would be greatly appreciated. Thanks, KC

    Read the article

  • Dojo DnD: how to access newly copied node on onDndDrop event?

    - by toshinao
    Hi. I am working on code like the following. 01: var c1 = new dojo.dnd.Source('container1', {copyOnly:true}); // container1 is a div 02: var c2 = new dojo.dnd.Source('container2'); // container2 is a div 03: var list = []; 04: for (var i = 0; i < 3; i++) { list.push( dojo.create('div') ); } 05: c1.insertNodes(false, list); 06: 07: function checkDndCopy(nodes, target){ 08: dojo.forEach(nodes, function(node){ alert(node.id); } ); 09: } 10: dojo.subscribe("/dnd/drop", function(){ 11: var mgr = dojo.dnd.manager(); 12: checkDndCopy(mgr.nodes, mgr.target); 13: }); The nodes inserted to the c1 at line 05 have id of "dojoUnique1, donoUnique2, dojoUnique3". On a event of drag and drop a node from c1 to c2, a onDndDrop event is fired and the subscribe method defined in line10-13 is invoked. I expected that newly copied node appears in the nodes (for example) at line 08. But this is not true. When dojoUnique1 is target of drag and drop, nodes at line 08 contains only dojoUnique1. I want to modify some attributes of newly copied nodes on the event of onDndDrop. Please let me know how such a thing is realized.

    Read the article

  • XSLT: Using a different way of processing within the current way of processing.

    - by krisvandenbergh
    Below I'm trying to match certain nodes. <xsl:template match="nodes"> <element> <xsl:apply-templates select="nodes" mode="different" /> </element> </xsl:template> Now, there are multiple ways of processing for the same nodes. I want to use this different way of processing within the current way of processing. That's why I perform apply-templates on the same selection, which is nodes, however the mode is different now. Here's how the different mode could look like: <xsl:template match="nodes" mode="different"> <!-- another way of processing these nodes --> </xsl:template> Now, this does not work. Only the first type of processing is processed and the apply-templates call is simply not applied. What am I doing wrong, how can I get what I want using XSLT? What could be another approach to solve this problem?

    Read the article

  • T-SQL XML Query, how to seperate matching nodes into individual rows?

    - by FlySwat
    I have a table that has a column full of XML like: <parent> <child> <name>Sally</name> </child> <child> <name>Bobby</name> </child> </parent> I'm trying to extract all of the names of the children into seperate rows. My desired resultset would look like: Sally Bobby However, if I do something like: SELECT data.query('data(//parents/child/name)') FROM stuff I get back a single row that looks like Sally Bobby What am I doing wrong with the XPath?

    Read the article

  • Axapta: Is it possible to move AOT nodes programatically?

    - by axapter
    Is it possbile to move aotnode in axapta through code(I want to achive the same movement as done via alt-up, alt-down) Dynamics AX 2009 has AOTmove method, but when I try #AOT ProjectNode root; //SysContextMenuAOT ctx = new SysContextMenuAOT(); ProjectGroupNode firstChild; ProjectGroupNode secondChild; ; //root=ctx.first(); root = infolog.projectRootNode().AOTfindChild("Private").AOTfindChild("TestProject"); root = root.getRunNode(); firstChild = root.AOTfirstChild(); secondChild = firstChild.AOTnextSibling(); secondChild = firstChild.AOTnextSibling(); secondChild.AOTMove(secondChild.AOTparent()); and then call it on whole project it successfully moves secondChildNode, BUT it deletes every subnode inside of secondChild.

    Read the article

  • How do find the longest path in a cyclic Graph between two nodes?

    - by Nazgulled
    Hi, I already solved most the questions posted here, all but the longest path one. I've read the Wikipedia article about longest paths and it seems any easy problem if the graph was acyclic, which mine is not. How do I solve the problem then? Brute force, by checking all possible paths? How do I even begin to do that? I know it's going to take A LOT on a Graph with ~18000. But I just want to develop it anyway, cause it's required for the project and I'll just test it and show it to the instructor on a smaller scale graph where the execution time is just a second or two. At least I did all tasks required and I have a running proof of concept that it works but there's no better way on cyclic graphs. But I don't have clue where to start checking all these paths...

    Read the article

  • How to copy child nodes to another xml document?

    - by Alex
    Below is my xml XML1 <?xml version="1.0" encoding="ISO-8859-1" ?> <CATALOG> <CD> <TITLE>1</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>2</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> </CATALOG> XML2 <?xml version="1.0" encoding="ISO-8859-1" ?> <CATALOG> <CD> <TITLE>3</TITLE> <ARTIST>Dolly Parton</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>RCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1982</YEAR> </CD> </CATALOG> i need output like this <?xml version="1.0" encoding="ISO-8859-1" ?> <CATALOG> <CD> <TITLE>1</TITLE> <ARTIST>Bob Dylan</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>Columbia</COMPANY> <PRICE>10.90</PRICE> <YEAR>1985</YEAR> </CD> <CD> <TITLE>2</TITLE> <ARTIST>Bonnie Tyler</ARTIST> <COUNTRY>UK</COUNTRY> <COMPANY>CBS Records</COMPANY> <PRICE>9.90</PRICE> <YEAR>1988</YEAR> </CD> <CD> <TITLE>3</TITLE> <ARTIST>Dolly Parton</ARTIST> <COUNTRY>USA</COUNTRY> <COMPANY>RCA</COMPANY> <PRICE>9.90</PRICE> <YEAR>1982</YEAR> </CD> </CATALOG> How i write this in classic asp ?

    Read the article

  • Count all lists of adjacent nodes stored in an array.

    - by Ben Brodie
    There are many naive approaches to this problem, but I'm looking for a good solution. Here is the problem (will be implemented in Java): You have a function foo(int a, int b) that returns true if 'a' is "adjacent" to 'b' and false if 'a' is not adjacent to 'b'. You have an array such as this [1,4,5,9,3,2,6,15,89,11,24], but in reality has a very long length, like 120, and will be repeated over and over (its a genetic algorithm fitness function) which is why efficiency is important. I want a function that returns the length of each possible 'list' of adjacencies in the array, but not including the 'lists' which simply subsets of a larger list. For example, if foo(1,4) - true, foo(4,5) - true, foo(5,9)- false, foo(9,3) & foo(3,2) & foo(2,6), foo(6,15) - true, then there are 'lists' (1,4,5) and (9,3,2,6), so length 3 and 4. I don't want it to return (3,2,6), though, because this is simply a subset of 9,3,2,6. Thanks.

    Read the article

  • How to add and relate a node within the parent nodes add form in Drupal.

    - by Espen Christensen
    Hi, I want to accomplish the following scenario in Drupal: You have 2 content-types. Lets say, an application-form for a lisence, and a content-type for persons. Then when you go to add a lisence in the "node/add" submission form in Drupal, i would like to add a relative number of persons that would be related to this lisence, and only this lisence. Say you would like to apply for a lisence, and relate 4 persons to this lisence, then insted of creating the lisence and then create the 4 persons and relate them to the lisence, i would like to do this "inline". So when i add a lisence, there would be a way to add 1 or more persons that would relate to the lisence node. Is this possible, and if so how? I have been looking at the node reference module, and that manages to reference a node to another, but not to add them inline with the other. With the web-development framework Django, there is a way to this with something called "inline-editing", where you get the content-type fields inside another content-type creation form. There you bind them togheter with a ForeignKey. Anybody know of something simular in Drupal, if not, is it another way to achive something simular, that would be as user-friendly?

    Read the article

< Previous Page | 14 15 16 17 18 19 20 21 22 23 24 25  | Next Page >