Search Results

Search found 25747 results on 1030 pages for 'tree view'.

Page 5/1030 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Materialized View vs POJO View based on Objects representing Oracle tables

    - by Zack Macomber
    I have about 12 Oracle tables that represent data that's being integrated from an external system into my web application. This data is going to be used in an informational and comparative manner for the clients using my web application. On one particular page of my web application, I need to combine data from 3 - 5 Oracle tables for display as an HTML table on the page. We are NOT currently using a framework (Apache Struts for instance) and we're not in a position to move this Java web application into one at this moment (I'm trying to get us there...). I am certainly not an architect, but I see one of two ways that I can effectively build this page (I know there are other ways, but these seem like they would be good ones...): 1. Create an Oracle Materialized View that represents what the HTML table should look like and then create a POJO based on the View that I can then integrate into my JSP. 2. Create POJOs that represent the Oracle tables themselves and then create another POJO that is the View used for the HTML table and then integrate that POJO into my JSP. To me, it seems the Materialized View would possibly offer quicker results which is always what we strive for in web applications. But, if I just create 12 POJOs that represent the Oracle tables and then build POJO Views off of those, I have the advantage of keeping all the code in one place for this and possibility for creating any number of different views and reusable components in my web application. Any thoughts on which one might be the better route? Or, maybe you know of an even better one?

    Read the article

  • check if a tree is a binary search tree

    - by TimeToCodeTheRoad
    I have written the following code to check if a tree is a Binary search tree. Please help me check the code: Pair p{ boolean isTrue; int min; int max; } public boo lean isBst(BNode v){ return isBST1(v).isTrue; } public Pair isBST1(BNode v){ if(v==null) return new Pair(true, INTEGER.MIN,INTEGER.MAX); if(v.left==null && v.right==null) return new Pair(true, v.data, v.data); Pair pLeft=isBST1(v.left); Pair pRight=isBST1(v.right); boolean check=pLeft.max<v.data && v.data<= pRight.min; Pair p=new Pair(); p.isTrue=check&&pLeft.isTrue&&pRight.isTrue; p.min=pLeft.min; p.max=pRight.max; return p; } Note: This function checks if a tree is a binary search tree

    Read the article

  • Android, simply view question about view reset

    - by javano
    I have a button in my activity, when you click the button an if statement is ran against its text label; if(BTN_1.getText()=="firsttext"){ //do some stuff, then... BTN_1.setText("secondtext"); }else if(BTN_1.getText()=="secondtext"){ //do other stuff, then... BTN_1.setText("firsttext"); } Firstly, if I hit the home button and go back to the desktop and then click back onto my app the view has reset its self; if I press the button and leave it in a state where the text of the button is "secondtext", when I return to my app it says "firsttext", how can I stop the view of my app refreshing its self like this? Secondly, under my XML layout I have defined the buttons text; android:text="firsttext" But this won't actually match my if statement above, under onCreate of this app I have: BTN_CONNECT.setText("Connect"); But visually the text of the button is exactly the same, why won't it match? Thanks for reading :)

    Read the article

  • How can we view 3d objects from top down view in TD game

    - by Syed
    I am making a tower defense game. I am working in x and y axis only. I have made a grid, snapped towers and made a pathfinding algo to run enemy. Initially I have worked with cubes and spheres in place of towers and enemies. Now I am going to place real towers (3D). Note that I haven't used z axis up till now. The user will analyze the game from top down view. I want the user to see towers placement with a little bit of 3d view but I have made my all code in 2d thing. Is there any solution to my problem that somewhat tower placement would view a 3D touch or you can say 2.5D ?? (like fieldrunners) or should I have to involve z axis and ignoring y axis ?

    Read the article

  • how does NTFS actually work with B-tree ?

    - by bakra
    To improve performance, NTFS directories use a special data management structure called a B-tree. "B-tree" concept here refers to a "tree of storage units" that hold the contents of an individual directory. What I don't understand is where on the disk is this tree stored? Its surely not created every-time we reboot...that would take lots of time. and since its a tree(dynamic Data structure) unlike arrays it will grow. so space needs to be allocated every-time it grows. so how is this "dynamic meta-data" stored ?

    Read the article

  • Accessing selected node of richfaces tree from Javascript

    - by kazanaki
    Hello This should be a very simple question. I have a richfaces tree that is rendered using JSF. When the user clicks on a node I want a javascript function to run. Nothing more nothing less. No redirects, no re-submit, no-rerender, no Ajax. Just plain old Javascript. I have seen the onselected attribute of the tree and it indeed fires a Javascript method. But of course I want to know which node was clicked. Here is what I have so far <head> <script type="text/javascript"> function documentClicked(nodeRef) { alert("Node is "+nodeRef); } </script> </head> <rich:tree switchType="client" value="#{ajaxDocumentTree.rootNode}" var="document" onselected="documentClicked()" > <rich:treeNode iconLeaf="../images/tree/doc.gif" icon="../images/tree/doc.gif"> <h:outputText value="#{doc.friendlyName}" /> </rich:treeNode> But this does not work because nodeRef is undefined. I expected that the first argument of the callback would be the selected node but this is not the case. So the question is this: How do I fire a Javascript function with the selected node from a richfaces tree?

    Read the article

  • JQGrid tree - passing additional parameters when tree is expanded

    - by PHP thinker
    I have a JQGRid tree. It loads data click by click, not all at once. Typically, JQGRid passes 4 standard tree parameters with each call - row (level, parent, is leaf, is expanded). How can I pass more parameters that I will take from the row being expanded? E.g. data from Name column should be passed in AJAX call too. There doesn't seem to be OnExpand event or similar.

    Read the article

  • When is my View too smart?

    - by Kyle Burns
    In this posting, I will discuss the motivation behind keeping View code as thin as possible when using patterns such as MVC, MVVM, and MVP.  Once the motivation is identified, I will examine some ways to determine whether a View contains logic that belongs in another part of the application.  While the concepts that I will discuss are applicable to most any pattern which favors a thin View, any concrete examples that I present will center on ASP.NET MVC. Design patterns that include a Model, a View, and other components such as a Controller, ViewModel, or Presenter are not new to application development.  These patterns have, in fact, been around since the early days of building applications with graphical interfaces.  The reason that these patterns emerged is simple – the code running closest to the user tends to be littered with logic and library calls that center around implementation details of showing and manipulating user interface widgets and when this type of code is interspersed with application domain logic it becomes difficult to understand and much more difficult to adequately test.  By removing domain logic from the View, we ensure that the View has a single responsibility of drawing the screen which, in turn, makes our application easier to understand and maintain. I was recently asked to take a look at an ASP.NET MVC View because the developer reviewing it thought that it possibly had too much going on in the view.  I looked at the .CSHTML file and the first thing that occurred to me was that it began with 40 lines of code declaring member variables and performing the necessary calculations to populate these variables, which were later either output directly to the page or used to control some conditional rendering action (such as adding a class name to an HTML element or not rendering another element at all).  This exhibited both of what I consider the primary heuristics (or code smells) indicating that the View is too smart: Member variables – in general, variables in View code are an indication that the Model to which the View is being bound is not sufficient for the needs of the View and that the View has had to augment that Model.  Notable exceptions to this guideline include variables used to hold information specifically related to rendering (such as a dynamically determined CSS class name or the depth within a recursive structure for indentation purposes) and variables which are used to facilitate looping through collections while binding. Arithmetic – as with member variables, the presence of arithmetic operators within View code are an indication that the Model servicing the View is insufficient for its needs.  For example, if the Model represents a line item in a sales order, it might seem perfectly natural to “normalize” the Model by storing the quantity and unit price in the Model and multiply these within the View to show the line total.  While this does seem natural, it introduces a business rule to the View code and makes it impossible to test that the rounding of the result meets the requirement of the business without executing the View.  Within View code, arithmetic should only be used for activities such as incrementing loop counters and calculating element widths. In addition to the two characteristics of a “Smart View” that I’ve discussed already, this View also exhibited another heuristic that commonly indicates to me the need to refactor a View and make it a bit less smart.  That characteristic is the existence of Boolean logic that either does not work directly with properties of the Model or works with too many properties of the Model.  Consider the following code and consider how logic that does not work directly with properties of the Model is just another form of the “member variable” heuristic covered earlier: @if(DateTime.Now.Hour < 12) {     <div>Good Morning!</div> } else {     <div>Greetings</div> } This code performs business logic to determine whether it is morning.  A possible refactoring would be to add an IsMorning property to the Model, but in this particular case there is enough similarity between the branches that the entire branching structure could be collapsed by adding a Greeting property to the Model and using it similarly to the following: <div>@Model.Greeting</div> Now let’s look at some complex logic around multiple Model properties: @if (ModelPageNumber + Model.NumbersToDisplay == Model.PageCount         || (Model.PageCount != Model.CurrentPage             && !Model.DisplayValues.Contains(Model.PageCount))) {     <div>There's more to see!</div> } In this scenario, not only is the View code difficult to read (you shouldn’t have to play “human compiler” to determine the purpose of the code), but it also complex enough to be at risk for logical errors that cannot be detected without executing the View.  Conditional logic that requires more than a single logical operator should be looked at more closely to determine whether the condition should be evaluated elsewhere and exposed as a single property of the Model.  Moving the logic above outside of the View and exposing a new Model property would simplify the View code to: @if(Model.HasMoreToSee) {     <div>There’s more to see!</div> } In this posting I have briefly discussed some of the more prominent heuristics that indicate a need to push code from the View into other pieces of the application.  You should now be able to recognize these symptoms when building or maintaining Views (or the Models that support them) in your applications.

    Read the article

  • k-d tree implementation [closed]

    - by user466441
    when i run my code and debugged,i got this error - this 0x00093584 {_Myproxy=0x00000000 _Mynextiter=0x00000000 } std::_Iterator_base12 * const - _Myproxy 0x00000000 {_Mycont=??? _Myfirstiter=??? } std::_Container_proxy * _Mycont CXX0017: Error: symbol "" not found _Myfirstiter CXX0030: Error: expression cannot be evaluated + _Mynextiter 0x00000000 {_Myproxy=??? _Mynextiter=??? } std::_Iterator_base12 * but i dont know what does it means,code is this #include<iostream> #include<vector> #include<algorithm> using namespace std; struct point { float x,y; }; vector<point>pointleft(4); vector<point>pointright(4); //we are going to implement two comparison function for x and y coordinates,we need it in calculation of median (we should sort vector //by x or y according to depth informaton,is depth even or odd. bool sortby_X(point &a,point &b) { return a.x<b.x; } bool sortby_Y(point &a,point &b) { return a.y<b.y; } //so i am going to implement to median finding algorithm,one for finding median by x and another find median by y point medianx(vector<point>points) { point temp; sort(points.begin(),points.end(),sortby_X); temp=points[(points.size()/2)]; return temp; } point mediany(vector<point>points) { point temp; sort(points.begin(),points.end(),sortby_Y); temp=points[(points.size()/2)]; return temp; } //now construct basic tree structure struct Tree { float x,y; Tree(point a) { x=a.x; y=a.y; } Tree *left; Tree *right; }; Tree * build_kd( Tree *root,vector<point>points,int depth) { point temp; if(points.size()==1)// that point is as a leaf { if(root==NULL) root=new Tree(points[0]); return root; } if(depth%2==0) { temp=medianx(points); root=new Tree(temp); for(int i=0;i<points.size();i++) { if (points[i].x<temp.x) pointleft[i]=points[i]; else pointright[i]=points[i]; } } else { temp=mediany(points); root=new Tree(temp); for(int i=0;i<points.size();i++) { if(points[i].y<temp.y) pointleft[i]=points[i]; else pointright[i]=points[i]; } } return build_kd(root->left,pointleft,depth+1); return build_kd(root->right,pointright,depth+1); } void print(Tree *root) { while(root!=NULL) { cout<<root->x<<" " <<root->y; print(root->left); print(root->right); } } int main() { int depth=0; Tree *root=NULL; vector<point>points(4); float x,y; int n=4; for(int i=0;i<n;i++) { cin>>x>>y; points[i].x=x; points[i].y=y; } root=build_kd(root,points,depth); print(root); return 0; } i am trying ti implement in c++ this pseudo code tuple function build_kd_tree(int depth, set points): if points contains only one point: return that point as a leaf. if depth is even: Calculate the median x-value. Create a set of points (pointsLeft) that have x-values less than the median. Create a set of points (pointsRight) that have x-values greater than or equal to the median. else: Calculate the median y-value. Create a set of points (pointsLeft) that have y-values less than the median. Create a set of points (pointsRight) that have y-values greater than or equal to the median. treeLeft = build_kd_tree(depth + 1, pointsLeft) treeRight = build_kd_tree(depth + 1, pointsRight) return(median, treeLeft, treeRight) please help me what this error means?

    Read the article

  • Extjs: Tree, Selecting node after creating the tree

    - by Natkeeran
    I have a simple TreePanel. I would like to select a particular node upon loading it. The nodes are from a remote file (json). The tree is loading as expected. However, the node is not being selected. Firebug shows node as undefined. This perhaps because of the async property. But, I an unable to configure this other wise, or specify the node be selected. Any suggestions welcomed, and thank you. LeftMenuTree = new Ext.tree.TreePanel({ renderTo: 'TreeMenu', collapsible: false, height: 450, border: false, userArrows: true, animate: true, autoScroll: true, id: 'testtest', dataUrl: fileName, root: { nodeType: 'async', iconCls:'home-icon', expanded:true, text: rootText }, listeners: { "click": { fn: onPoseClick, scope: this } }, "afterrender": { fn: setNode, scope: this } }); function setNode(){ alert (SelectedNode); if (SelectedNode == "Orders"){ var treepanel = Ext.getCmp('testtest'); var node = treepanel.getNodeById("PendingItems"); node.select(); } }

    Read the article

  • SVN project folder tree structure vs production folder tree structure

    - by Marco Demaio
    While developing a PHP+JS web application we always try to separate big blocks of code into small modules/components, in order to make these last ones as much reusable as possible in other applications. Let's say we now have: the EcommerceApp (an ecommerce main application) a Server-file-mgr component (a component to view/manage file on server) a Mylib (a library of useful functions) a MailistApp (another main application to handle mail lists) ... EcommerceApp needs both Server-file-mgr component and Mylib to work Server-file-mgr needs Mylib to work MaillistApp needs both Server-file-mgr component and Mylib to work too. My idea is to simply structure the SVN project folder tree putting everything at the same level: trunk/EcommerceApp trunk/Server-file-mgr trunk/Mylib trunk/MaillistApp But in real life to make these apps to work the folder tree structure must be the following: EcommerceApp |_ Mylib |_ Server-file-mgr MaillistApp |_ Mylib |_ Server-file-mgr I mean Mylib and Server-file-mgr needs to be inside the EcommerceApp/MaillistApp folder. How would you then structure the SVN folder, as I did or in a different/better/smarter way???

    Read the article

  • Insert element into a tree from a list in Standard ML

    - by vichet
    I have just started to learn SML on my own and get stuck with a question from the tutorial. Let say I have: tree data type datatype node of (tree*int*tree) | null insert function fun insert (newItem, null) = node (null, newItem, null) | insert (newItem, node (left, oldItem, right)) = if (newItem <= oldItem) then node (insert(newItem,left),oldItem, right) else node (left, oldItem, insert(newItem, right) an integer list val intList = [19,23,21,100,2]; my question is how can I add write a function to loop through each element in the list and add to a tree? Your answer is really appreciated.

    Read the article

  • Maximum depth of a B-tree

    - by Phenom
    How do you figure out the maximum depth of a B-tree? Say you had a B-tree of order 1625, meaning each node has 1625 pointers and 1624 elements. What is the maximum depth of the tree if it contains 85,000,000 keys?

    Read the article

  • Sorting by custom field and fetching whole tree from DB

    - by Niaxon
    Hello everyone, I am trying to do file browser in a tree form and have a problem to sort it somehow. I use PHP and MySQL for that. I've created mixed (nested set + adjacency) table 'element' with the following fields: element_id, left_key, right_key, level, parent_id, element_name, element_type (enum: 'folder','file'), element_size. Let's not discuss right now that it is better to move information about element (name, type, size) into other table. Function to scan specified directory and fill table work correctly. Noteworthy, i am adding elements to tree in specific order: folders first and then files. After that i can easily fetch and display whole table on the page using simple query: SELECT * FROM element WHERE 1=1 ORDER BY left_key With the result of that query and another function i can generate correct html code (<ul><li>... and so on). to display tree. Now back to the question (finally, huh?). I am struggling to add sorting functionality. For example i want to order my result by size. Here i need to keep in my mind whole hierarchy of tree and rule: folders first, files later. I believe i can do that by generating in PHP recursive query: SELECT * FROM element WHERE parent_id = {$parentId} ORDER BY element_type (so folders would be first), size (or name for example) asc/desc After that for each result which has type = 'folder' i will send another query to get it's content. Also it's possible to fetch whole tree by left_key and after that sort it in PHP as array but i guess that would be worse :) I wonder if there is better and more efficient way to do such a thing?

    Read the article

  • Family Tree :- myheritage.com

    - by Nitesh Panchal
    Hello, The other day i just accidently visited the site myheritage.com. I was just wondering, how they must have created one? Can anybody tell me what can be their database design? and if possible, algorithm that we can use to generate such a tree? Generating simple binary tree is very easy using recursion. But if you have a look at the site(if you have time please make account on it and add few nodes to feel) when we add son to a father, it's mother is automatically added(if you don't add explicitly). Mother's family tree is also generated side by side and many such fancy things are happening. In a simple binary tree we have a root node and then many nodes below it. Thus we cannot show wife and husband in the tree and then show a line from wife and husband to child. In spare time, can anybody discuss what can be it's database design and the recursive algorithm that we can follow to generate it? I hope i am not asking too much from you :).

    Read the article

  • How to Populate a 'Tree' structure 'Declaratively'

    - by mackenir
    I want to define a 'node' class/struct and then declare a tree of these nodes in code in such a way that the way the code is formatted reflects the tree structure, and there's not 'too much' boiler plate in the way. Note that this isn't a question about data structures, but rather about what features of C++ I could use to arrive at a similar style of declarative code to the example below. Possibly with C++0X this would be easier as it has more capabilities in the area of constructing objects and collections, but I'm using Visual Studio 2008. Example tree node type: struct node { string name; node* children; node(const char* name, node* children); node(const char* name); }; What I want to do: Declare a tree so its structure is reflected in the source code node root = node("foo", [ node("child1"), node("child2", [ node("grand_child1"), node("grand_child2"), node("grand_child3" ]), node("child3") ]); NB: what I don't want to do: Declare a whole bunch of temporary objects/colls and construct the tree 'backwards' node grandkids[] = node[3] { node("grand_child1"), node("grand_child2"), node("grand_child3" }; node kids[] = node[3] { node("child1"), node("child2", grandkids) node("child3") }; node root = node("foo", kids);

    Read the article

  • unique substrings using suffix tree

    - by user1708762
    For a given string S of length n- Optimal algorithm for finding all unique substrings of S can't be less than O(n^2). So, the best algorithm will give us the complexity of O(n^2). As per what I have read, this can be implemented by creating suffix tree for S. The suffix tree for S can be created in O(n) time. Now, my question is- How can we use the suffix tree for S to get all the unique substrings of S in O(n^2)?

    Read the article

  • Why is my Workspace switcher view skewed

    - by Lee
    I have been using Workspace switcher in Ubuntu just fine but recently have encountered this problem. The windows in the switcher don't fill the screen. I must have pressed some combination of buttons somehow but can't find any information anywhere in regards to resizing them. As you can see in the screen shot it looks like a perspective view or something. http://i1115.photobucket.com/albums/k553/lmt337/Screenshotfrom2012-07-04103519.png I should also add I have a dual monitor setup and nvidia graphics. The switcher still works but the fact the screens dont fit my actual screens is driving me nuts. Thanks in advance for any help.

    Read the article

  • how to push one view to another view?

    - by MD
    In my application there are two view.First view na dsecond view. In my second view there is one time for 60 sec.When i go first view to second view then timr is start.when i back to first view thne timer is running in background.when timer is over then one popup is generated.When i click on pop up(ok button) then i want to go in second view.Acctully pop is in second view. How to solve this problem

    Read the article

  • Is this the right strategy to convert an in-level order binary tree to a doubly linked list?

    - by Ankit Soni
    So I recently came across this question - Make a function that converts a in-level-order binary tree into a doubly linked list. Apparently, it's a common interview question. This is the strategy I had - Simply do a pre-order traversal of the tree, and instead of returning a node, return a list of nodes, in the order in which you traverse them. i.e return a list, and append the current node to the list at each point. For the base case, return the node itself when you are at a leaf. so you would say left = recursive_function(node.left) right = recursive_function(node.right) return(left.append(node.data)).append(right);` Is this the right approach?

    Read the article

  • adding nodes to a binary search tree randomly deletes nodes

    - by SDLFunTimes
    Hi, stack. I've got a binary tree of type TYPE (TYPE is a typedef of data*) that can add and remove elements. However for some reason certain values added will overwrite previous elements. Here's my code with examples of it inserting without overwriting elements and it not overwriting elements. the data I'm storing: struct data { int number; char *name; }; typedef struct data data; # ifndef TYPE # define TYPE data* # define TYPE_SIZE sizeof(data*) # endif The tree struct: struct Node { TYPE val; struct Node *left; struct Node *rght; }; struct BSTree { struct Node *root; int cnt; }; The comparator for the data. int compare(TYPE left, TYPE right) { int left_len; int right_len; int shortest_string; /* find longest string */ left_len = strlen(left->name); right_len = strlen(right->name); if(right_len < left_len) { shortest_string = right_len; } else { shortest_string = left_len; } /* compare strings */ if(strncmp(left->name, right->name, shortest_string) > 1) { return 1; } else if(strncmp(left->name, right->name, shortest_string) < 1) { return -1; } else { /* strings are equal */ if(left->number > right->number) { return 1; } else if(left->number < right->number) { return -1; } else { return 0; } } } And the add method struct Node* _addNode(struct Node* cur, TYPE val) { if(cur == NULL) { /* no root has been made */ cur = _createNode(val); return cur; } else { int cmp; cmp = compare(cur->val, val); if(cmp == -1) { /* go left */ if(cur->left == NULL) { printf("adding on left node val %d\n", cur->val->number); cur->left = _createNode(val); } else { return _addNode(cur->left, val); } } else if(cmp >= 0) { /* go right */ if(cur->rght == NULL) { printf("adding on right node val %d\n", cur->val->number); cur->rght = _createNode(val); } else { return _addNode(cur->rght, val); } } return cur; } } void addBSTree(struct BSTree *tree, TYPE val) { tree->root = _addNode(tree->root, val); tree->cnt++; } The function to print the tree: void printTree(struct Node *cur) { if (cur == 0) { printf("\n"); } else { printf("("); printTree(cur->left); printf(" %s, %d ", cur->val->name, cur->val->number); printTree(cur->rght); printf(")\n"); } } Here's an example of some data that will overwrite previous elements: struct BSTree myTree; struct data myData1, myData2, myData3; myData1.number = 5; myData1.name = "rooty"; myData2.number = 1; myData2.name = "lefty"; myData3.number = 10; myData3.name = "righty"; initBSTree(&myTree); addBSTree(&myTree, &myData1); addBSTree(&myTree, &myData2); addBSTree(&myTree, &myData3); printTree(myTree.root); Which will print: (( righty, 10 ) lefty, 1 ) Finally here's some test data that will go in the exact same spot as the previous data, but this time no data is overwritten: struct BSTree myTree; struct data myData1, myData2, myData3; myData1.number = 5; myData1.name = "i"; myData2.number = 5; myData2.name = "h"; myData3.number = 5; myData3.name = "j"; initBSTree(&myTree); addBSTree(&myTree, &myData1); addBSTree(&myTree, &myData2); addBSTree(&myTree, &myData3); printTree(myTree.root); Which prints: (( j, 5 ) i, 5 ( h, 5 ) ) Does anyone know what might be going wrong? Sorry if this post was kind of long.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >