Search Results

Search found 4103 results on 165 pages for 'n ary tree'.

Page 34/165 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • How to build, sort and print a tree of a sort?

    - by Tuplanolla
    This is more of an algorithmic dilemma than a language-specific problem, but since I'm currently using Ruby I'll tag this as such. I've already spent over 20 hours on this and I would've never believed it if someone told me writing a LaTeX parser was a walk in the park in comparison. I have a loop to read hierarchies (that are prefixed with \m) from different files art.tex: \m{Art} graphical.tex: \m{Art}{Graphical} me.tex: \m{About}{Me} music.tex: \m{Art}{Music} notes.tex: \m{Art}{Music}{Sheet Music} site.tex: \m{About}{Site} something.tex: \m{Something} whatever.tex: \m{Something}{That}{Does Not}{Matter} and I need to sort them alphabetically and print them out as a tree About Me (me.tex) Site (site.tex) Art (art.tex) Graphical (graphical.tex) Music (music.tex) Sheet Music (notes.tex) Something (something.tex) That Does Not Matter (whatever.tex) in (X)HTML <ul> <li>About</li> <ul> <li><a href="me.tex">Me</a></li> <li><a href="site.tex">Site</a></li> </ul> <li><a href="art.tex">Art</a></li> <ul> <li><a href="graphical.tex">Graphical</a></li> <li><a href="music.tex">Music</a></li> <ul> <li><a href="notes.tex">Sheet Music</a></li> </ul> </ul> <li><a href="something.tex">Something</a></li> <ul> <li>That</li> <ul> <li>Doesn't</li> <ul> <li><a href="whatever.tex">Matter</a></li> </ul> </ul> </ul> </ul> using Ruby without Rails, which means that at least Array.sort and Dir.glob are available. All of my attempts were formed like this (as this part should work just fine). def fss_brace_array(ss_input)#a concise version of another function; converts {1}{2}...{n} into an array [1, 2, ..., n] or returns an empty array ss_output = ss_input[1].scan(%r{\{(.*?)\}}) rescue ss_output = [] ensure return ss_output end #define tree s_handle = File.join(:content.to_s, "*") Dir.glob("#{s_handle}.tex").each do |s_handle| File.open(s_handle, "r") do |f_handle| while s_line = f_handle.gets if s_all = s_line.match(%r{\\m\{(\{.*?\})+\}}) s_all = s_all.to_a #do something with tree, fss_brace_array(s_all) and s_handle break end end end end #do something else with tree

    Read the article

  • how to generate an N level tree using datatable?

    - by Kishore Kumar
    I have a DataTable with column ID, Name, RootID. The tree stucture is implmented using the RootId field. If the RootId is null it is considered as Root Node. How to create an Nlevel tree using the DataTale. eg. 1 Manager null, 2 Project Lead 1, 3 Test Lead 1, 4 Sr Soft Eng 2, 5 Soft eng 2, 6 HR Manager Null, 7 HR exec 6, ......

    Read the article

  • Dell 2950 Perc 6/i "physical disk" and "Enclosure(Backplane)" under Connector 1 in OMSA tree- Troubleshoot help

    - by user66357
    Just looking for someone who might know why this could occur... In OMSA, on my Dell 2950, there usually is only one "Physical Disks" child under "Enclosure (Backplane)" in the tree view. Currently, the tree looks like this: Dell PERC 6/i Integrated Connector 1 (RAID) Enclosure (Backplane) Physical Disks (1:04 good, 1:05 removed) Physical Disks (1:33 Ready but unused) Normally it's like this: Connector 1 (RAID) Enclosure (Backplane) Physical Disks (1:04 good, 1:05 good) From the front, 6 of 6 3.5" SAS drives are connected. The server is showing Slot 5 as bad and the disk as removed. It seems that the drive in Slot 5 is being sensed as external to the Enclosure. Any ideas why this would happen? Think I can get away with rebuilding the virtual disk by replacing 1:05 with 1:33? Thanks. UPDATE: The only options on the Physical Disk 1:33 were Assign as Global Hot Spare and Clear... After clearing, I assigned it as the Global Hot Spare. This allowed the rebuilding of the virtual disk. Hopefully it won't fail. I'm still unsure of the reason for this odd behavior. I'm checking the firmware next.

    Read the article

  • Kill a tree, save your website? Content strategy in action, part III

    - by Roger Hart
    A lot has been written about how driving content strategy from within an organisation is hard. And that's true. Red Gate is pretty receptive to new ideas, so although I've not had a total walk in the park, it's been a hike with charming scenery. But I'm one of the lucky ones. Lots of people are involved in content, and depending on your organisation some of those people might be the kind who'll gleefully call themselves "stakeholders". People holding a stake generally want to stick it through something's heart and bury it at a crossroads. Winning them over is not always easy. (Richard Ingram has made a nice visual summary of how this can feel - Content strategy Snakes & ladders - pdf ) So yes, a lot of content strategy advocates are having a hard time. And sure, we've got a nice opportunity to get together and have a hug and a cry, but in the interim we could use a hand. What to do? My preferred approach is, I'll confess, brutal. I'd like nothing so much as to take a scorched earth approach to our website. Burn it, salt the ground, and build the new one right: focusing on clearly delineated business and user content goals, and instrumented so we can tell if we're doing it right. I'm never getting buy-in for that, but a boy can dream. So how about just getting buy-in for some small, tenable improvements? Easier, but still non-trivial. I sat down for a chat with our marketing and design guys. It seemed like a good place to start, even if they weren't up for my "Ctrl-A + Delete"  solution. We talked through some of this stuff, and we pretty much agreed that our content is a bit more broken than we'd ideally like. But to get everybody on board, the problems needed visibility. Doing a visual content inventory Print out the internet. Make a Wall Of Content. Seriously. If you've already done a content inventory, you know your architecture, and you know the scale of the problem. But it's quite likely that very few other people do. So make it big and visual. I'm going to carbon hell, but it seems to be working. This morning, I printed out a tiny, tiny part of our website: the non-support content pertaining to SQL Compare I made big, visual, A3 blowups of each page, and covered a wall with them. A page per web page, spread over something like 6M x 2M, with metrics, right in front of people. Even if nobody reads it (and they are doing) the sheer scale is shocking. 53 pages, all told. Some are redundant, some outdated, some trivial, a few fantastic, and frighteningly many that are great ideas delivered not-quite-right. You have to stand quite far away to get it all in your field of vision. For a lot of today, a whole bunch of folks have been gawping in amazement, talking each other through it, peering at the details, and generally getting excited about content. Developers, sales guys, our CEO, the marketing folks - they're engaged. Will it last? I make no promises. But this sort of wave of interest is vital to getting a content strategy project kicked off. While the content strategist is a saucer-eyed orphan in the cupboard under the stairs, they're not getting a whole lot done. Of course, just printing the site won't necessarily cut it. You have to know your content, and be able to talk about it. Ideally, you'll also have page view and time-on-page metrics. One of the most powerful things you can do is, when people are staring at your wall of content, ask them what they think half of it is for. Pretty soon, you've made a case for content strategy. We're also going to get folks to mark it up - cover it with notes and post-its, let us know how they feel about our content. I'll be blogging about how that goes, but it's exciting. Different business functions have different needs from content, so the more exposure the content gets, and the more feedback, the more you know about those needs. Fingers crossed for awesome.

    Read the article

  • In this context with views in a tree, which class should perform the task?

    - by Jhonny 8
    Imagine that I have this context: A main view containing a table containing some cells. Each one of them with their own controller and view files. In the main view, I have an object "Person", with 3 different IDs. Depending on certain conditions (let say, time of the day), I have to choose one of them and display it in the cell. My question is, should the main view pass the whole object to the table, and this one to the cell, and the cell will calculate the ID that it will be shown? or, The main view calculates this parameter, and send the result to the table and this to the cell? Is a question focused on OO design, which one of this approaches is more suitable in an OO design and why?

    Read the article

  • How can you tell whether to use Composite Pattern or a Tree Structure, or a third implementation?

    - by Aske B.
    I have two client types, an "Observer"-type and a "Subject"-type. They're both associated with a hierarchy of groups. The Observer will receive (calendar) data from the groups it is associated with throughout the different hierarchies. This data is calculated by combining data from 'parent' groups of the group trying to collect data (each group can have only one parent). The Subject will be able to create the data (that the Observers will receive) in the groups they're associated with. When data is created in a group, all 'children' of the group will have the data as well, and they will be able to make their own version of a specific area of the data, but still linked to the original data created (in my specific implementation, the original data will contain time-period(s) and headline, while the subgroups specify the rest of the data for the receivers directly linked to their respective groups). However, when the Subject creates data, it has to check if all affected Observers have any data that conflicts with this, which means a huge recursive function, as far as I can understand. So I think this can be summed up to the fact that I need to be able to have a hierarchy that you can go up and down in, and some places be able to treat them as a whole (recursion, basically). Also, I'm not just aiming at a solution that works. I'm hoping to find a solution that is relatively easy to understand (architecture-wise at least) and also flexible enough to be able to easily receive additional functionality in the future. Is there a design pattern, or a good practice to go by, to solve this problem or similar hierarchy problems? EDIT: Here's the design I have: The "Phoenix"-class is named that way because I didn't think of an appropriate name yet. But besides this I need to be able to hide specific activities for specific observers, even though they are attached to them through the groups. A little Off-topic: Personally, I feel that I should be able to chop this problem down to smaller problems, but it escapes me how. I think it's because it involves multiple recursive functionalities that aren't associated with each other and different client types that needs to get information in different ways. I can't really wrap my head around it. If anyone can guide me in a direction of how to become better at encapsulating hierarchy problems, I'd be very glad to receive that as well.

    Read the article

  • I need some help creating a non-binary tree (or some other data structure that will better solve my problem)

    - by EDO
    I have about ten lists of numbers and some strings. Each list has about <= 30K lines. Each line on a list has a distinct number. I need to build an efficient way of finding all the lines in each list that has the same 'control' number (or key for dB guys) and comparing what is in their string parts. I am writing this in Java. I have thought about using trees but my brain cells are about burnt now. I need some help.

    Read the article

  • How can I force apt to optimize the dependency tree for minimal download size?

    - by ObsessiveSSO?
    Some background information: As you may know, in a Debian package, there may be alternative dependencies, written in the CONTROL file as Depends: apache2|something-else, for example. How does apt select which dependencies to choose, and how can I override this so I can minimize download size? I'm on a slow connection on some locations and need it to use the smallest total download size. How can I force it to do so?

    Read the article

  • tree view; show lines property is not working properly

    - by Jibu P C
    Hii, I am a bigginer in using tree view control. I am using tree view control to make a simple tree like structure. But when i use show lines property it is not connecting to the root node. The code which i have written is as follows. <asp:TreeView ID="treeSettings" runat="server" ImageSet="Simple2" NodeIndent="15" ShowLines="True"> <ParentNodeStyle Font-Bold="False" /> <HoverNodeStyle BackColor="#CCCCCC" BorderColor="#888888" BorderStyle="None" Font-Underline="True" /> <SelectedNodeStyle BackColor="#FFCCCC" Font-Underline="False" HorizontalPadding="0px" VerticalPadding="1px" Height="0px" /> <Nodes> <asp:TreeNode Text="Settings" Value="Settings"> <asp:TreeNode Text="Edit Task" Value="Edit Task"></asp:TreeNode> <asp:TreeNode Text="Assign" Value="Assign a Resource"></asp:TreeNode> <asp:TreeNode Text="Task Status" Value="Task Status"></asp:TreeNode> </asp:TreeNode> </Nodes> <NodeStyle Font-Names="Verdana" Font-Size="8pt" ForeColor="Black" HorizontalPadding="0px" NodeSpacing="1px" VerticalPadding="0px" Width="100px" ChildNodesPadding="0px" /> <LeafNodeStyle NodeSpacing="0px" /> </asp:TreeView>enter code here`

    Read the article

  • How do I optimize this postfix expression tree for speed?

    - by Peter Stewart
    Thanks to the help I received in this post: I have a nice, concise recursive function to traverse a tree in postfix order: deque <char*> d; void Node::postfix() { if (left != __nullptr) { left->postfix(); } if (right != __nullptr) { right->postfix(); } d.push_front(cargo); return; }; This is an expression tree. The branch nodes are operators randomly selected from an array, and the leaf nodes are values or the variable 'x', also randomly selected from an array. char *values[10]={"1.0","2.0","3.0","4.0","5.0","6.0","7.0","8.0","9.0","x"}; char *ops[4]={"+","-","*","/"}; As this will be called billions of times during a run of the genetic algorithm of which it is a part, I'd like to optimize it for speed. I have a number of questions on this topic which I will ask in separate postings. The first is: how can I get access to each 'cargo' as it is found. That is: instead of pushing 'cargo' onto a deque, and then processing the deque to get the value, I'd like to start processing it right away. I don't yet know about parallel processing in c++, but this would ideally be done concurrently on two different processors. In python, I'd make the function a generator and access succeeding 'cargo's using .next(). But I'm using c++ to speed up the python implementation. I'm thinking that this kind of tree has been around for a long time, and somebody has probably optimized it already. Any Ideas? Thanks

    Read the article

  • Python OOP and lists

    - by Mikk
    Hi, I'm new to Python and it's OOP stuff and can't get it to work. Here's my code: class Tree: root = None; data = []; def __init__(self, equation): self.root = equation; def appendLeft(self, data): self.data.insert(0, data); def appendRight(self, data): self.data.append(data); def calculateLeft(self): result = []; for item in (self.getLeft()): if (type(item) == type(self)): data = item.calculateLeft(); else: data = item; result.append(item); return result; def getLeft(self): return self.data; def getRight(self): data = self.data; data.reverse(); return data; tree2 = Tree("*"); tree2.appendRight(44); tree2.appendLeft(20); tree = Tree("+"); tree.appendRight(4); tree.appendLeft(10); tree.appendLeft(tree2); print(tree.calculateLeft()); It looks like tree2 and tree are sharing list "data"? At the moment I'd like it to output something like [[20,44], 10, 4], but when I tree.appendLeft(tree2) I get RuntimeError: maximum recursion depth exceeded, and when i even won't appendLeft(tree2) it outputs [10, 20, 44, 4] (!!!). What am I missing here? I'm using Portable Python 3.0.1. Thank you

    Read the article

  • Extending existing data structure in Scala.

    - by Lukasz Lew
    I have a normal tree defined in Scala. sealed abstract class Tree case class Node (...) extends Tree case class Leaf (...) extends Tree Now I want to add a member variable to all nodes and leaves in the tree. Is it possible with extend keyword or do I have to modify the tree classes by adding [T]?

    Read the article

  • Tree View WIKI replacement solution for SharePoint like Confluence?

    - by Melih Öztürk
    Hi to all, I keep my Process Documents on SVN and I want to create a Wiki page includes the information about these files. We use SharePoint in the company for basic document sharing and team sites. As it is mentioned in http://stackoverflow.com/questions/256407/what-are-your-biggest-complaints-about-sharepoint SharePoint Wiki lacks of usability. I need an easy to use wiki tool which is capable of showing the content like WikiPedia contents and it would be great if I could have the SharePoint tree view and Active Directory authentication also. I googled it and found Atlassian's Confluence and it seems that this product is capable of the requirements. We use Jira for issue tracking, so we can use it's reporting in dashboards. I need and it has a Wiki part which displays wiki pages in tree view. It should be like Does anyone used Confluence or have an idea for other products which meets my requirements

    Read the article

  • failed to load viewstate. the control tree into which viewstate

    - by Mohan
    Hi Everybody, i have a gridview control . When I change page of gridview control i get this error. Server Error in '/' Application. Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. how to tackle with this problem. It's urgent Any suggestion? Thanks in advance.

    Read the article

  • Create unordered list tree menu from data stored in an table with the adjacency list model...php

    - by Ronedog
    I need to create a tree menu of "nth" subcategories. I settled on using the adjacency list model for my table structure, because I won't be updating this table very much and this seemed the easiest to implement for my use. I want to style the output using "ul" and "li" tags...I already have a css and jquery solution to do the styling. My problem comes from pulling the data out of the database and using a recursive function via PHP to build the list ... the list is a concatenated string that gets parsed to build the tree. I'm really having a hard time getting the closing "ul" and "li" tags to line up just where they need to be. Is this the best way to do this? Are there other better ways using arrays or something like that to do this? Any examples you can point me to of "best practices" for building a list like this will be appreciated. Thanks.

    Read the article

  • How can I traverse the EMF object tree generated by Xtext?

    - by reprogrammer
    I'm using Xtext to define my DSL. Xtext generates a parser that lets me traverse the EMF model of my input DSL. I'd like to translate this EMF model into some other tree. To do this translation, I need to traverse the tree. But, I couldn't find a visitor class for the EMF model generated by Xtext. The closest thing that I've found is a Switch class that visits a single node. I can traverse the EMF model myself and invoke the Switch class on each node that I visit. But, I wonder if there exists a visitor functionality in Xtext that implements the model traversal.

    Read the article

  • How can I debug or set a break statement inside an expression tree?

    - by Abel
    When an external library contains a LINQ provider, and it throws an exception when executing a dynamic expression tree, how can I break when that expression is thrown? For example, I use a third party LINQ2CRM provider, which allows me to call the Max<TSource, TResult>() method of IQueryable, but when it throws an InvalidCastException, I fail to break on the spot when the exception is thrown, making it hard to review the stack-trace because it's already unwinded when the debugger breaks it in my code. I've set "break on throw" for the mentioned exception. My debug settings are: Clarification on where exactly I'd want to break. I do not want to break in side the LINQ Expression, but instead, I want to break when the expression tree is executed, or, put in other words, when the IQueryable extension method Max() calls the override provided by the LINQ provider. The top of the stacktrace looks like this, which is where I would like to break inside (or step through, or whatever): at XrmLinq.QueryProviderBase.Execute[T](Expression expression) at System.Linq.Queryable.Max[TSource,TResult](IQueryable`1 source, Expression`1 selector)

    Read the article

  • Build a decision tree for classification of large amount data,using python?

    - by kaushik
    Hi,i am working for speech synthesis.In this i have a large number of pronunciation for each phone i.e alphabet and need to classify them according to few feature such as segment size(int) and alphabet itself(string) into a smaller set suitable for that particular context. For this purpose,i have decided to use decision tree for classification.the data to be parsed is in the S expression format.eg:((question)(LEFTNODE)(RIGHTNODE)). i hav idea for building decision tree for normal buit in type such as list..looking for suggestion for implementation for S expression.. kindly help.. Thanks in advance.. Note:this question may look similar to my prev post,srry if cant giv multiple post.already edited it many times so though of wirting new question instead of editing again

    Read the article

  • Chess board position numbers in 6-rooted-binary tree?

    - by HH
    The maximum number of adjacent vertices is 6 that corresponds to the number of roots. By the term root, I mean the number of children for each node. If adjacent square is empty, fill it with Z-node. So every square will have 6 nodes. How can you formulate it with binary tree? Is the structure just 6-rooted-binary tree? What is the structure called if nodes change their positions? Suppose partially ordered list where its units store a large randomly expanding board. I want a self-adjusting data structure, where it is easy to calculate distances between nodes. What is its name?

    Read the article

  • Can I ReRender the entire tree of a component?

    - by Ben
    Hi, I have a JSF application with several major components and a component tree under each. On a certain event (Value change) I would like to reRender the entire component tree for one of those components. For example: can I rerender components 1,2 and 3 in one shot here: <h:panelgroup id="1"> <h:panelgroup id="2"> <h:panelgroup id="3"> <h:panelgroup/> <h:panelgroup/> <h:panelgroup/> <h:commandButton rerender="1*"> <--- Made up code. Is that possible? Another Idea - Can I reRender with wildcards? (I.E - ReRender all components who's ID's begin or contain: "UpdateMe") Thanks!

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >