Search Results

Search found 4232 results on 170 pages for 'tree traversal'.

Page 22/170 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Problem persisting inheritance tree

    - by alaiseca
    I have a problem trying to map an inheritance tree. A simplified version of my model is like this: @MappedSuperclass @Embeddable public class BaseEmbedded implements Serializable { @Column(name="BE_FIELD") private String beField; // Getters and setters follow } @MappedSuperclass @Embeddable public class DerivedEmbedded extends BaseEmbedded { @Column(name="DE_FIELD") private String deField; // Getters and setters follow } @MappedSuperclass public abstract class BaseClass implements Serializable { @Embedded protected BaseEmbedded embedded; public BaseClass() { this.embedded = new BaseEmbedded(); } // Getters and setters follow } @Entity @Table(name="MYTABLE") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="TYPE", discriminatorType=DiscriminatorType.STRING) public class DerivedClass extends BaseClass { @Id @Column(name="ID", nullable=false) private Long id; @Column(name="TYPE", nullable=false, insertable=false, updatable=false) private String type; public DerivedClass() { this.embedded = new DerivedClass(); } // Getters and setters follow } @Entity @DiscriminatorValue("A") public class DerivedClassA extends DerivedClass { @Embeddable public static NestedClassA extends DerivedEmbedded { @Column(name="FIELD_CLASS_A") private String fieldClassA; } public DerivedClassA() { this.embedded = new NestedClassA(); } // Getters and setters follow } @Entity @DiscriminatorValue("B") public class DerivedClassB extends DerivedClass { @Embeddable public static NestedClassB extends DerivedEmbedded { @Column(name="FIELD_CLASS_B") private String fieldClassB; } public DerivedClassB() { this.embedded = new NestedClassB(); } // Getters and setters follow } At Java level, this model is working fine, and I believe is the appropriate one. My problem comes up when it's time to persist an object. At runtime, I can create an object which could be an instance of DerivedClass, DerivedClassA or DerivedClassB. As you can see, each one of the derived classes introduces a new field which only makes sense for that specific derived class. All the classes share the same physical table in the database. If I persist an object of type DerivedClass, I expect fields BE_FIELD, DE_FIELD, ID and TYPE to be persisted with their values and the remaining fields to be null. If I persist an object of type DerivedClass A, I expect those same fields plus the FIELD_CLASS_A field to be persisted with their values and field FIELD_CLASS_B to be null. Something equivalent for an object of type DerivedClassB. Since the @Embedded annotation is at the BaseClass only, Hibernate is only persisting the fields up to that level in the tree. I don't know how to tell Hibernate that I want to persist up to the appropriate level in the tree, depending on the actual type of the embedded property. I cannot have another @Embedded property in the subclasses since this would duplicate data that is already present in the superclass and would also break the Java model. I cannot declare the embedded property to be of a more specific type either, since it's only at runtime when the actual object is created and I don't have a single branch in the hierarchy. Is it possible to solve my problem? Or should I resignate myself to accept that there is no way to persist the Java model as it is? Any help will be greatly appreciated.

    Read the article

  • Dojo treemodel- adding large number of items

    - by Ashley
    I am trying to add a large number of items (100+) to my tree via ForestStoreModel by calling newItem in a loop. This seems to be quite slow and locks up the browser. Is there any way I can do something similar to grid's beginUpdate & endUpdate? I want to basically 'turn off' my tree, add 100 items in a batch, then 'turn on' my tree. Any ideas? Thanks!

    Read the article

  • Find node level in a tree

    - by Álvaro G. Vicario
    I have a tree (nested categories) stored as follows: CREATE TABLE `category` ( `category_id` int(10) unsigned NOT NULL AUTO_INCREMENT, `category_name` varchar(100) NOT NULL, `parent_id` int(10) unsigned DEFAULT NULL, PRIMARY KEY (`category_id`), UNIQUE KEY `category_name_UNIQUE` (`category_name`,`parent_id`), KEY `fk_category_category1` (`parent_id`,`category_id`), CONSTRAINT `fk_category_category1` FOREIGN KEY (`parent_id`) REFERENCES `category` (`category_id`) ON DELETE SET NULL ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_spanish_ci I need to feed my client-side language (PHP) with node information (child+parent) so it can build the tree in memory. I can tweak my PHP code but I think the operation would be way simpler if I could just retrieve the rows in such an order that all parents come before their children. I could do that if I knew the level for each node: SELECT category_id, category_name, parent_id FROM category ORDER BY level -- No `level` column so far :( Can you think of a way (view, stored routine or whatever...) to calculate the node level? I guess it's okay if it's not real-time and I need to recalculate it on node modification.

    Read the article

  • In B-trees which element gets promoted when the node splits

    - by Phenom
    Let's say there is a B-tree of order 8. This means it can have 8 pointers and 7 elements. Say the letters A through G are stored in this B-tree. So this B-tree is just a single node containing 7 elements. Then you try to insert J into the tree. There's no room, so you have to split the node and create a new root node. Which element gets promoted up into the root node?

    Read the article

  • How can I correctly display my AVL Tree in LaTex? A solo left-child hangs straight down....

    - by cb
    The below code almost works perfectly, however the child of 9, 7, hangs straight down instead of as a left-child. How can I correct this? \usepackage{tikz} \usepackage{xytree} \begin{tikzpicture}[level/.style={sibling distance=60mm/#1}] \node [circle,draw] {4} child { node [circle,draw] {2} child {node [circle,draw] {1} } child { node [circle,draw]{3} } } child {node [circle,draw] {6} child {node [circle,draw] {5} } child {node [circle,draw] {9} child {node [circle, draw] {7}} } }; \end{tikzpicture}} Thanks, CB

    Read the article

  • Linux software to maintain old/backup versions of directory tree

    - by Bittrance
    I am replacing an old Linux file server serving NFS and CIFS. For the new server (still serving CIFS and NFS), I would like to have software that automatically and efficiently maintains old revisions of files in parallel trees, so that they can be accessed by users without special tools. I am looking for software that is akin to Time Machine or Flyback, but works well on a server. The dataset is some 10000 files weighing maybe 60 GB. Changes are relatively few, usually less than 100 files changes daily. Using LVM snapshots will not cut it, as the old revisions must reside on a separate set of disks from the live data. Edit: To clarify: keeping old revisions is non-vital addition to the solution, so any suggestion will have to stay in the range of some hundred euros.

    Read the article

  • Correcting owner/permissions on damaged directory tree in linux

    - by mcs130
    I inadvertently made a backup copy of a directory recursively and forgot the -a (--preserve) switch when doing so. This damaged my backup directory (which contains data we need to access). The directory and all of its child folders and files comprise an installation of an application including postgress DB and solr files. The original copy was used to for a failed re-config attempt. Now I need to use the backup copy to start over, only the ownership of the backup copy is now root across everything and it is no longer usable (processes won't run due to ownership problems I created when I forgot the -a on the cp -r). I've re-installed a clean copy of the application into a 3rd location now (which has the correct owner/perms) and need to copy the owner/perms from this good directory over onto the damaged directory. What is the best way (if even possible) to do this. (I've Googled and seen things from perl scripting to setfacl/getfacl to do this but am unfortunately still confused). Apologies if this seems a dumb question. Thanks.

    Read the article

  • Subversion all or nothing access to repo tree

    - by Glader
    I'm having some problems setting up access to my Subversion repositories on a Linux server. The problem is that I can only seem to get an all-or-nothing structure going. Either everyone gets read access to everything or noone gets read or write access to anything. The setup: SVN repos are located in /www/svn/repoA,repoB,repoC... Repositories are served by Apache, with Locations defined in etc/httpd/conf.d/subversion.conf as: <Location /svn/repoA> DAV svn SVNPath /var/www/svn/repoA AuthType Basic AuthName "svn repo" AuthUserFile /var/www/svn/svn-auth.conf AuthzSVNAccessFile /var/www/svn/svn-access.conf Require valid-user </Location> <Location /svn/repoB> DAV svn SVNPath /var/www/svn/repoB AuthType Basic AuthName "svn repo" AuthUserFile /var/www/svn/svn-auth.conf AuthzSVNAccessFile /var/www/svn/svn-access.conf Require valid-user </Location> ... svn-access.conf is set up as: [/] * = [/repoA] * = userA = rw [/repoB] * = userB = rw But checking out URL/svn/repoA as userA results in Access Forbidded. Changing it to [/] * = userA = r [/repoA] * = userA = rw [/repoB] * = userB = rw gives userA read access to ALL repositories (including repoB) but only read access to repoA! so in order for userA to get read-write access to repoB i need to add [/] userA = rw which is mental. I also tried changing Require valid-user to Require user userA for repoA in subversion.conf, but that only gave me read access to it. I need a way to default deny everyone access to every repository, giving read/write access only when explicitly defined. Can anyone tell me what I'm doing wrong here? I have spent a couple of hours testing and googling but come up empty, so now I'm doing the post of shame.

    Read the article

  • Web-based SVG or JavaScript Org Chart or Tree Graph Plotting Visualization API

    - by asoltys
    Hi, I'm looking to build an interactive web-based org chart for a large organization. I somewhat like the interface at ancestry.com where you can hover over people and pan/zoom around and click on different nodes to make them the root. Ideally, I'd like it if people could belong to multiple organizational entities like committees, working groups, etc. In other words the API should support graphs in general, not just trees. I'd like to be able to visually explode each organizational substructure into substituents by clicking on it, with a nice animation of the employees ballooning or spilling out so you can really interactively drill down through the organization. I found http://code.google.com/apis/visualization/documentation/gallery/orgchart.html but it looks a bit rudimentary. I know there are desktop tools like OrgPlus and Visio that can build static charts but I'm really looking for a free, web-based API with open standards-based output like SVG or HTML5 Canvas elements rather than Flash or some proprietary output. Something I can embed into a custom web application and style myself. Something interactive.

    Read the article

  • Directory tree in a Resource without extraction...

    - by Corelgott
    Hi all, i am looking for a way to store a complete directory including sub directories in an application's resource and not have to extract it to use it. Details: We would like to use GeckoFx (Gecko as C# Component) in one of our applications. GeckoFX needs the XUL-Runner and needs to find it's folder structure We have some other data which I would not prefer to extracted to the customer's pc; At least not onto something persistent like a hdd... Getting the complete directory into the resources is not that kind of a big deal. Compress to one file and done. But not writing it to the disk to use it is something else. I have a strong dislike against temp folders and such things. Would anything like a RAM drive be possible? Some part of the RAM beeing mounted? Does something like this even exist as a lib, or would this only be possible by a device driver? Any thoughts on this? Thanks in advance! Corelgott

    Read the article

  • creating decision tree based troubleshooting documentation?

    - by Joseph
    We troubleshoot a lot of server and network issues and follow a loose set of steps on what to do in different cases. With more and more people and responsibility, the need for standardization is needed so we don't miss something. I know I could accomplish what I want using flowcharts, but I'd like to do something similar to a "Choose Your Own Adventure" style. I think this is pretty much the same as what support call centers seem to do. Are there any tools to make creating such documentation easier? I'm looking for a web based approach if possible.

    Read the article

  • creating decision tree based troubleshooting documentation?

    - by Joseph
    We troubleshoot a lot of server and network issues and follow a loose set of steps on what to do in different cases. With more and more people and responsibility, the need for standardization is needed so we don't miss something. I know I could accomplish what I want using flowcharts, but I'd like to do something similar to a "Choose Your Own Adventure" style. I think this is pretty much the same as what support call centers seem to do. Are there any tools to make creating such documentation easier? I'm looking for a web based approach if possible.

    Read the article

  • Zipping folder with absolute path without keeping tree of folders

    - by Preston
    I am attempting to use the zip -r command to zip a folder which includes two files. I need to pass the absolute path of the folder with two files (/path/to/my/files/), which is causing all of the folders to be zipped with it, where as I only need the last folder (files/) and its contents to be zipped, so that when the file is unzipped, there is only one folder and the two files within it. How can I modify the command to be able to pass the absolute paths in the arguments while keeping only the last folder?

    Read the article

  • Make symlink on Windows of whole tree without modifying the original folder

    - by DarkGhostHunter
    I'm trying to do this: make a symlink of a whole directory "C:/Master", in different folders like "C:\Projects\Alpha\", "C:\Projects\Beta\" an so on. "Master" directory usually changes in files and data. I work on the "Projects/*", where every project folder uses the "Master" files, but every one has new files in them. Let's say, I point to the car engine in every project folder, and inside them I add different kind of wheels. The problem I'm having, as a Windows 8 user, is that symlinks (junction) acts as a window to "Master" - I'm not allowed to add any file inside. I looking a way to reference the entire "Master" directory, and add new files - not edit any of the "Master" ones. It's as described here, but on Windows.

    Read the article

  • How to zip and rename a directory tree

    - by Kev
    I have a lot of music in a lot of directories: ./artist1/album1/*.mp3 ./artist1/album2/*.mp3 ./artist1/album3/*.mp3 ./artist2/album1/*.mp3 ./artist2/album2/*.mp3 ./artist3/album1/*.mp3 ./artist3/album2/*.mp3 ... ... How can I zip them to this: ./artist1/album1/*.mp3 => ./artist1-album1.tar.gz ./artist1/album2/*.mp3 => ./artist1-album2.tar.gz ./artist1/album3/*.mp3 => ./artist1-album3.tar.gz ./artist2/album1/*.mp3 => ./artist2-album1.tar.gz ./artist2/album2/*.mp3 => ./artist2-album2.tar.gz ./artist3/album1/*.mp3 => ./artist3-album1.tar.gz ./artist3/album2/*.mp3 => ./artist3-album2.tar.gz ... ... I'd like one-line-command or a simple script.

    Read the article

  • Fastest security check of file tree on NFS

    - by fungs
    I am currently experiencing very bad performance using the following on an NFS network folder: time find . | while read f; do test -L "$f" && f=$(readlink -m $f); grp="$(stat -c %G $f)"; perm="$(stat -c %A $f)"; done Question 1) Within the loop permissions are checked using the variables grp and perm. Is there a way to lower the amount of disc I/O for these kind of checks over the network (e.g. read all meta data at once using find)? Question 2) It seems like the NFS isn't tuned very well, the same operation on a similar network link via SSHFS take only one third of the time. All parameters are auto-negotiated. Any suggestions?

    Read the article

  • VMware vSwitches and spanning tree

    - by dunxd
    I have two redundant core switches I want to connect to a new vSwitch I am setting up on a VMware ESX host. The switch will have two physical NICs each of which will connect to one of the core switches. The core switches are connected. If this was a physical switch, I would worry about connecting it to both core switches, because this would create a network loop. Do I need to worry about this for a VMware virtual switch? VMware's documentation says it is not possible to connect two vSwitches in a loop, therefore STP is not required. However, I am worried about connecting two physical switches together via a vSwitch.

    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

  • What does the \- mean in the mvn dependency tree output

    - by Calm Storm
    Hi, I tried doing a mvn dependency:tree and I get a tree of dependencies. The output looks like below. I want to know what is the "-" symbol that is shown at times and the "+-" symbol for other dependencies (it doesnt seem to be the scope) My actual question is, My project depends on many modules which internally depends on many spring artifacts. There are a few version clashes. I want to upgrade all spring related libraries to say the latest one (2.6.x or above). What is the preferred way to do this? Should I declare all the deps spring-context, spring-support (and 10 other artifacts) in my pom.xml and point them to 2.6.x ? Is there any other better method ? [INFO] +- com.xxxx:yyy-jar:jar:1.0-SNAPSHOT:compile [INFO] | +- com.xxxx:zzz-commons:jar:1.0-SNAPSHOT:compile [INFO] | | +- org.springframework:spring-dao:jar:2.0.7:compile [INFO] | | +- org.springframework:spring-jdbc:jar:2.0.7:compile [INFO] | | +- org.springframework:spring-web:jar:2.0.7:compile [INFO] | | +- org.springframework:spring-support:jar:2.0.7:compile [INFO] | | +- net.sf.ehcache:ehcache:jar:1.2:compile [INFO] | | +- commons-collections:commons-collections:jar:3.2:compile [INFO] | | +- aspectj:aspectjweaver:jar:1.5.3:compile [INFO] | | +- betex-commons:betex-commons:jar:5.5.1-2:compile [INFO] | | \- javax.servlet:servlet-api:jar:2.4:compile [INFO] | +- org.springframework:spring-beans:jar:2.0.7:compile [INFO] | +- org.springframework:spring-jmx:jar:2.0.7:compile [INFO] | +- org.springframework:spring-remoting:jar:2.0.7:compile [INFO] | +- org.apache.cxf:cxf-rt-core:jar:2.0.2-incubator:compile [INFO] | | +- org.apache.cxf:cxf-api:jar:2.0.2-incubator:compile [INFO] | | | +- org.apache.geronimo.specs:geronimo-activation_1.1_spec:jar:1.0-M1:compile [INFO] | | | +- org.codehaus.woodstox:wstx-asl:jar:3.2.1:compile [INFO] | | | +- org.apache.neethi:neethi:jar:2.0.2:compile [INFO] | | | \- org.apache.cxf:cxf-common-schemas:jar:2.0.2-incubator:compile

    Read the article

  • How to minimize total cost of shortest path tree

    - by Michael
    I have a directed acyclic graph with positive edge-weights. It has a single source and a set of targets (vertices furthest from the source). I find the shortest paths from the source to each target. Some of these paths overlap. What I want is a shortest path tree which minimizes the total sum of weights over all edges. For example, consider two of the targets. Given all edge weights equal, if they share a single shortest path for most of their length, then that is preferable to two mostly non-overlapping shortest paths (fewer edges in the tree equals lower overall cost). Another example: two paths are non-overlapping for a small part of their length, with high cost for the non-overlapping paths, but low cost for the long shared path (low combined cost). On the other hand, two paths are non-overlapping for most of their length, with low costs for the non-overlapping paths, but high cost for the short shared path (also, low combined cost). There are many combinations. I want to find solutions with the lowest overall cost, given all the shortest paths from source to target. Does this ring any bells with anyone? Can anyone point me to relevant algorithms or analogous applications? Cheers!

    Read the article

  • Binary Search Tree - Postorder logic

    - by daveb
    I am looking at implementing code to work out binary search tree. Before I do this I was wanting to verify my input data in postorder and preorder. I am having trouble working out what the following numbers would be in postorder and preorder I have the following numbers 4, 3, 14 ,8 ,1, 15, 9, 5, 13, 10, 2, 7, 6, 12, 11, that I am intending to put into an empty binary tree in that order. The order I arrived at for the numbers in POSTORDER is 2, 1, 6, 3, 7, 11, 12, 10, 9, 8, 13, 15, 14, 4. Have I got this right? I was wondering if anyone here would be able to kindly verify if the postorder sequence I came up with is indeed the correct sequence for my input i.e doing left subtree, right subtree and then root. The order I got for pre order (Visit root, do left subtree, do right subtree) is 4, 3, 1, 2, 5, 6, 14 , 8, 7, 9, 10, 12, 11, 15, 13. I can't be certain I got this right. Very grateful for any verification. Many Thanks

    Read the article

  • ANTLR Tree Grammar and StringTemplate Code Translation

    - by Behrooz Nobakht
    I am working on a code translation project with a sample ANTLR tree grammar as: start: ^(PROGRAM declaration+) -> program_decl_tmpl(); declaration: class_decl | interface_decl; class_decl: ^(CLASS ^(ID CLASS_IDENTIFIER)) -> class_decl_tmpl(cid={$CLASS_IDENTIFIER.text}); The group template file for it looks like: group My; program_decl_tmpl() ::= << *WHAT?* >> class_decl_tmpl(cid) ::= << public class <cid> {} >> Based on this, I have these questions: Everything works fine apart from that what I should express in WHAT? to say that a program is simply a list of class declarations to get the final generated output? Is this approach averagely suitable for not so a high-level language? I have also studied ANTLR Code Translation with String Templates, but it seems that this approach takes much advantage of interleaving code in tree grammar. Is it also possible to do it as much as possible just in String Templates?

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >