Search Results

Search found 757 results on 31 pages for 'grouping'.

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

  • Need help with a Linq XML conditional grouping query

    - by FiveTools
    I have the following xml fragment: <BANNER ID="Banner 2" ROW_WIDTH="200"> <BANNER_TEXTS ID="BANNER_TEXTS"> <BANNER_TEXT UNDERLINE="false" SPAN_COL="1" WIDTHT="78px"></BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="3" WIDTHT="234px">Years In Practice</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="3" WIDTHT="234px">Internet Usage</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="4" WIDTHT="312px">Sales Reps Seen / Week</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="3" WIDTHT="234px">Prescription Volume</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="3" WIDTHT="222px">Patient Load</BANNER_TEXT> </BANNER_TEXTS> <BANNER_TEXTS ID="COLUMN_TEXTS"> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">Total</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">&#60; 11 years</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">11-20 years</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">21-30 years</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">Light 1-5 hrs</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">Medium 6-10 hrs</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">Heavy &#62;10 hrs</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">0</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">1-2</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">3-5</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">&#62;5</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">1-100</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">101-150</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="78px">&#62;150</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="74px">1-100</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="74px">101-200</BANNER_TEXT> <BANNER_TEXT UNDERLINE="true" SPAN_COL="1" WIDTHT="74px">&#62;200</BANNER_TEXT> </BANNER_TEXTS> <BANNER_TEXTS ID="COLUMN_TEXTS"> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(A)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(B)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(C)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(D)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(E)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(F)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(G)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(H)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(I)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(J)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(K)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(L)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(M)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(N)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(O)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(P)</COLUMN_TEXT> <COLUMN_TEXT UNDERLINE="false" SPAN_COL="1">(Q)</COLUMN_TEXT> </BANNER_TEXTS> </BANNER> I would like to group all the 'BANNER_TEXT' in the second sequence using the first sequence 'BANNER_TEXT' as the key (only include elements where string is not null or empty). The span_col attribute in the first 'BANNER_TEXT' sequence indicates which elements by position in the 2nd sequence are related. An example: 'Years in Practice' would be the first key and the attribute SPAN_COL=3 for that element indicates it would contain '< 11 years', '11-20 years', '21-30 years' (the first grouping of string.empty = Total would be skipped).

    Read the article

  • Disable Windows 7 taskbar grouping. Not combining.

    - by Byran
    I've look near and far but I cannot find a way (setting or hack) to prevent Windows 7 from grouping taskbar buttons together that are "related". I'm not talking about the option to combine or collapse related buttons into one item. I can find that setting at: Taskbar and Start Menu Properties Taskbar Taskbar buttons: This is what I an not looking for: How to Enable or Disable Windows 7 Taskbar Button Grouping I'm talking about how Windows 7 seams to think that it's doing me a favor by grouping all my Google Chrome buttons together and grouping all my Explorer buttons together etc. My workflow in Windows XP was to use the program Taskbar Shuffle to allow me to reorganize my taskbar buttons into related task "groups" I was working on. For example: [Start Button] | [iTunes] [Outlook Express] [Chrome Gmail] [layered design folder] [Photoshop CS4] [exported images folder] [website root folder] [Dreamweaver CS4] [Chrome www.MyAwesomeWebsiteImBuilding.com] [Chrome Recent web search] [some unrelated folder] Windows 7 doesn't seem to let me do this. It wants to do: [Start Button] | [layered design folder][exported images folder][website root folder][some unrelated folder] | [Chrome www.MyAwesomeWebsiteImBuilding.com]Chrome [Gmail][Chrome Recent web search] | [iTunes] | [Outlook Express] | [Photoshop CS4] | [Dreamweaver CS4] Does anyone know of a tool or hack to prevent Windows 7 from grouping taskbar buttons?

    Read the article

  • Simple Grouping With TableSorter Plugin

    - by HurnsMobile
    Im playing around with the Tablesorter plug-in for jQuery and was trying to get a very simple grouping functionality added into it. Using the follow html/js works great until you click sort again and reverse the order. The headers get moved to the bottom of the group when this happens. The following is my (admitedly hacky) attempt at it. Does anyone have any ideas? <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Table Manipulation Test</title> <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.1.custom.css" rel="stylesheet" /> <link rel="stylesheet" href="tablesorter/themes/green/style.css" type="text/css"/> <script type="text/javascript" src="js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="js/jquery-ui-1.8.1.custom.min.js"></script> <script type="text/javascript" src="tablesorter/jquery.tablesorter.min.js"></script> <script type="text/javascript"> $(document).ready(function() { $("#test_table").tablesorter({ sortForce: [[3,0]] }); $(".group_details").hide(); $(".group_header").click(function(){ var group = $(this).attr("group"); var $expander = $(this).children("td.expanderguy") if ($("." + group + ":visible").length){ $("." + group + "").fadeOut('fast'); $expander.html("<img src='icons/plus.gif'>"); } else{ $("." + group + "").fadeIn('fast'); $expander.html("<img src='icons/minus.gif'>"); } }); } ); </script> <style type="text/css"> .group_header td{ background-color: #888888; !important } </style> </head> <body> <table id="test_table" class="tablesorter"> <thead> <tr><th>First Name</th><th>Last Name</th><th>Email</th><th>Due Date</th><th>Amount Due</th></tr> </thead> <tbody> <tr class="group_header" group="group1"><td class="expanderguy"><img src="icons/plus.gif"></td><td></td><td></td><td>Monday, June 7</td><td></td></tr> <tr class="group_details group1"><td>Flavian</td><td>Wenceslas</td><td>[email protected]</td><td>Monday, June 7</td><td>$100</td></tr> <tr class="group_details group1"><td>Gordian</td><td>Ives</td><td>[email protected]</td><td>Monday, June 7</td><td>$1700</td></tr> <tr class="group_details group1"><td>Saladin</td><td>Tarquin</td><td>[email protected]</td><td>Monday, June 7</td><td>$1700</td></tr> <tr class="group_details group1"><td>Urban</td><td>Cyprian</td><td>[email protected]</td><td>Monday, June 7</td><td>$1500</td></tr> <tr class="group_details group1"><td>Sargon</td><td>Swithun</td><td>[email protected]</td><td>Monday, June 7</td><td>$1100</td></tr> <tr class="group_details group1"><td>Pompey</td><td>Ladislas</td><td>[email protected]</td><td>Monday, June 7</td><td>$300</td></tr> <tr class="group_details group1"><td>Attila</td><td>Hiawatha</td><td>[email protected]</td><td>Monday, June 7</td><td>$200</td></tr> <tr class="group_header" group="group2"><td class="expanderguy"><img src="icons/plus.gif"></td><td></td><td></td><td>Tuesday, June 8</td><td></td></tr> <tr class="group_details group2"><td>Bruce</td><td>Fenton</td><td>[email protected]</td><td>Tuesday, June 8</td><td>$1700</td></tr> <tr class="group_details group2"><td>Wade</td><td>Sequoia</td><td>[email protected]</td><td>Tuesday, June 8</td><td>$1400</td></tr> <tr class="group_details group2"><td>Eddie</td><td>Jerold</td><td>[email protected]</td><td>Tuesday, June 8</td><td>$1100</td></tr> <tr class="group_details group2"><td>Lynn</td><td>Lucan</td><td>[email protected]</td><td>Tuesday, June 8</td><td>$1200</td></tr> <tr class="group_details group2"><td>Taegan</td><td>Tadg</td><td>[email protected]</td><td>Tuesday, June 8</td><td>$100</td></tr> <tr class="group_details group2"><td>Clyde</td><td>Reed</td><td>[email protected]</td><td>Tuesday, June 8</td><td>$6100</td></tr> <tr class="group_details group2"><td>Alaois</td><td>Art</td><td>[email protected]</td><td>Tuesday, June 8</td><td>$2100</td></tr> <tr class="group_details group2"><td>Gilbert</td><td>Patsy</td><td>[email protected]</td><td>Tuesday, June 8</td><td>$1500</td></tr> <tr class="group_header" group="group3"><td class="expanderguy"><img src="icons/plus.gif"></td><td></td><td></td><td>Wednesday, June 9</td><td></td></tr> <tr class="group_details group3" ><td>Clem</td><td>Eben</td><td>[email protected]</td><td>Wednesday, June 9</td><td>$2100</td></tr> <tr class="group_details group3" ><td>Elijah</td><td>Julyan</td><td>[email protected]</td><td>Wednesday, June 9</td><td>$2100</td></tr> <tr class="group_details group3" ><td>Marvyn</td><td>Damian</td><td>[email protected]</td><td>Wednesday, June 9</td><td>$1100</td></tr> <tr class="group_details group3" ><td>Sawyer</td><td>Ryker</td><td>[email protected]</td><td>Wednesday, June 9</td><td>$500</td></tr> </tbody> </table> </body>

    Read the article

  • Python: Improving long cumulative sum

    - by Bo102010
    I have a program that operates on a large set of experimental data. The data is stored as a list of objects that are instances of a class with the following attributes: time_point - the time of the sample cluster - the name of the cluster of nodes from which the sample was taken code - the name of the node from which the sample was taken qty1 = the value of the sample for the first quantity qty2 = the value of the sample for the second quantity I need to derive some values from the data set, grouped in three ways - once for the sample as a whole, once for each cluster of nodes, and once for each node. The values I need to derive depend on the (time sorted) cumulative sums of qty1 and qty2: the maximum value of the element-wise sum of the cumulative sums of qty1 and qty2, the time point at which that maximum value occurred, and the values of qty1 and qty2 at that time point. I came up with the following solution: dataset.sort(key=operator.attrgetter('time_point')) # For the whole set sys_qty1 = 0 sys_qty2 = 0 sys_combo = 0 sys_max = 0 # For the cluster grouping cluster_qty1 = defaultdict(int) cluster_qty2 = defaultdict(int) cluster_combo = defaultdict(int) cluster_max = defaultdict(int) cluster_peak = defaultdict(int) # For the node grouping node_qty1 = defaultdict(int) node_qty2 = defaultdict(int) node_combo = defaultdict(int) node_max = defaultdict(int) node_peak = defaultdict(int) for t in dataset: # For the whole system ###################################################### sys_qty1 += t.qty1 sys_qty2 += t.qty2 sys_combo = sys_qty1 + sys_qty2 if sys_combo > sys_max: sys_max = sys_combo # The Peak class is to record the time point and the cumulative quantities system_peak = Peak(time_point=t.time_point, qty1=sys_qty1, qty2=sys_qty2) # For the cluster grouping ################################################## cluster_qty1[t.cluster] += t.qty1 cluster_qty2[t.cluster] += t.qty2 cluster_combo[t.cluster] = cluster_qty1[t.cluster] + cluster_qty2[t.cluster] if cluster_combo[t.cluster] > cluster_max[t.cluster]: cluster_max[t.cluster] = cluster_combo[t.cluster] cluster_peak[t.cluster] = Peak(time_point=t.time_point, qty1=cluster_qty1[t.cluster], qty2=cluster_qty2[t.cluster]) # For the node grouping ##################################################### node_qty1[t.node] += t.qty1 node_qty2[t.node] += t.qty2 node_combo[t.node] = node_qty1[t.node] + node_qty2[t.node] if node_combo[t.node] > node_max[t.node]: node_max[t.node] = node_combo[t.node] node_peak[t.node] = Peak(time_point=t.time_point, qty1=node_qty1[t.node], qty2=node_qty2[t.node]) This produces the correct output, but I'm wondering if it can be made more readable/Pythonic, and/or faster/more scalable. The above is attractive in that it only loops through the (large) dataset once, but unattractive in that I've essentially copied/pasted three copies of the same algorithm. To avoid the copy/paste issues of the above, I tried this also: def find_peaks(level, dataset): def grouping(object, attr_name): if attr_name == 'system': return attr_name else: return object.__dict__[attrname] cuml_qty1 = defaultdict(int) cuml_qty2 = defaultdict(int) cuml_combo = defaultdict(int) level_max = defaultdict(int) level_peak = defaultdict(int) for t in dataset: cuml_qty1[grouping(t, level)] += t.qty1 cuml_qty2[grouping(t, level)] += t.qty2 cuml_combo[grouping(t, level)] = (cuml_qty1[grouping(t, level)] + cuml_qty2[grouping(t, level)]) if cuml_combo[grouping(t, level)] > level_max[grouping(t, level)]: level_max[grouping(t, level)] = cuml_combo[grouping(t, level)] level_peak[grouping(t, level)] = Peak(time_point=t.time_point, qty1=node_qty1[grouping(t, level)], qty2=node_qty2[grouping(t, level)]) return level_peak system_peak = find_peaks('system', dataset) cluster_peak = find_peaks('cluster', dataset) node_peak = find_peaks('node', dataset) For the (non-grouped) system-level calculations, I also came up with this, which is pretty: dataset.sort(key=operator.attrgetter('time_point')) def cuml_sum(seq): rseq = [] t = 0 for i in seq: t += i rseq.append(t) return rseq time_get = operator.attrgetter('time_point') q1_get = operator.attrgetter('qty1') q2_get = operator.attrgetter('qty2') timeline = [time_get(t) for t in dataset] cuml_qty1 = cuml_sum([q1_get(t) for t in dataset]) cuml_qty2 = cuml_sum([q2_get(t) for t in dataset]) cuml_combo = [q1 + q2 for q1, q2 in zip(cuml_qty1, cuml_qty2)] combo_max = max(cuml_combo) time_max = timeline.index(combo_max) q1_at_max = cuml_qty1.index(time_max) q2_at_max = cuml_qty2.index(time_max) However, despite this version's cool use of list comprehensions and zip(), it loops through the dataset three times just for the system-level calculations, and I can't think of a good way to do the cluster-level and node-level calaculations without doing something slow like: timeline = defaultdict(int) cuml_qty1 = defaultdict(int) #...etc. for c in cluster_list: timeline[c] = [time_get(t) for t in dataset if t.cluster == c] cuml_qty1[c] = [q1_get(t) for t in dataset if t.cluster == c] #...etc. Does anyone here at Stack Overflow have suggestions for improvements? The first snippet above runs well for my initial dataset (on the order of a million records), but later datasets will have more records and clusters/nodes, so scalability is a concern. This is my first non-trivial use of Python, and I want to make sure I'm taking proper advantage of the language (this is replacing a very convoluted set of SQL queries, and earlier versions of the Python version were essentially very ineffecient straight transalations of what that did). I don't normally do much programming, so I may be missing something elementary. Many thanks!

    Read the article

  • Neural Network Output Grouping 0.5?

    - by Mike
    I tried to write a Neural Network system, but even running through simple AND/OR/NOR type problems, the outputs seem to group around 0.5 (for a bias of -1) and 0.7 (for a bias of 1). It doesn't look exactly "wrong"... The 1,1 in the AND pattern does seem higher than the rest and the 0,0 in the OR looks lower, but they are still all grouped so it's debatable. I was wondering a) if there's some obvious mistake I've made or b) if there's any advice for debugging Neural Nets... seeing as you can't always track back exactly where an answer came from... Thanks! Mike

    Read the article

  • Core Data grouping data in table

    - by OscarTheGrouch
    I am using core data trying to create a simple database app, I have an entity called "Game" which has a "creator". I have basically used the iPhone table view template and replaced the names. I have the games listed by creator. Currently the tableview looks like this... Chris Ryder Chris Ryder Chris Ryder Chris Ryder Dan Grimaldi Dan Grimaldi Dan Grimaldi Scott Ricardo Tim Thermos Tim Thermos I am trying to group the tableview, so that each creator has only one cell in the tableview and is listed once and only once like this... Chris Ryder Dan Grimaldi Scott Ricardo Tim Thermos any help or suggestions would be greatly appreciated.

    Read the article

  • grouping data from two dataset

    - by Garcia Julien
    hi, i've got a problem with dataset: I've got two dataset from two different server but they have the same columns. so it's like that: First DataSet : asset description make jobtype jan feb ... dec 0001 mine ik Acc 0 0 10 0002 yours ic Over 0 0 10 Second dataset : asset description make jobtype jan feb ... dec 0001 mine ik Acc 10 0 10 0002 yours ic Gen 0 0 0 But i would like to merge the 2 dataset into one like that: asset description make jobtype lhjan imjan lhfeb lhfeb ... lhdec imdec 0001 mine ik Acc 0 10 0 0 10 10 0002 yours ic Over 0 0 0 0 10 0 so all the data from one is combine with the second with the same asset and the same jobtype. I try linq but i can't arrive to make it like i want. I'm working on vb.net framework 3.5. could you help me? Julien

    Read the article

  • XSLT: Splitting none continues Elements/Grouping continues Elements

    - by Gerald
    Hi! Need some help with this problem in implementing with Xslt, I had already implemented a java code of this one using sax parser but it is a troublesome due to customer request to change something... so we are doing it now using an XSLT with don't need to be compiled and deployed to a web server. I have an xml like the one below Example 1: <ShotRows> <ShotRow row="3" col="3" bit="1" position="1"/> <ShotRow row="3" col="4" bit="1" position="2"/> <ShotRow row="3" col="5" bit="1" position="3"/> <ShotRow row="3" col="6" bit="1" position="4"/> <ShotRow row="3" col="7" bit="1" position="5"/> <ShotRow row="3" col="8" bit="1" position="6"/> <ShotRow row="3" col="9" bit="1" position="7"/> <ShotRow row="3" col="10" bit="1" position="8"/> <ShotRow row="3" col="11" bit="1" position="9"/> </ShotRows> Output 1: <ShotRows> <ShotRow row="3" colStart="3" colEnd="11" /> </ShotRows> -- Be cause the col is continues from 3 to 11 Example 2: <ShotRows> <ShotRow row="3" col="3" bit="1" position="1"/> <ShotRow row="3" col="4" bit="1" position="2"/> <ShotRow row="3" col="6" bit="1" position="3"/> <ShotRow row="3" col="7" bit="1" position="4"/> <ShotRow row="3" col="8" bit="1" position="5"/> <ShotRow row="3" col="10" bit="1" position="6"/> <ShotRow row="3" col="11" bit="1" position="7"/> <ShotRow row="3" col="15" bit="1" position="8"/> <ShotRow row="3" col="19" bit="1" position="9"/> </ShotRows> Output 2: <ShotRows> <ShotRow row="3" colStart="3" colEnd="4" /> <ShotRow row="3" colStart="6" colEnd="8" /> <ShotRow row="3" colStart="10" colEnd="11" /> <ShotRow row="3" colStart="15" colEnd="15" /> <ShotRow row="3" colStart="19" colEnd="19" /> </ShotRows> -- Basic idea is to group any continues col into one element, like the col 3 to 4, col 6 to 8, col 10 to 11, col 15 is only one, and col 19 is only one. Thanks in advance. Sincerely, Gerald

    Read the article

  • Flex AdvancedDataGrid with Grouping, how do I get objects to appear under first GroupingField if the

    - by shadenite
    I am using an AdvancedDataGrid with two GroupingFields. The dataProvider has a list of objects with these two field values, but occasionally the second field value can be null. When it loads, the AdvancedDataGrid UI has a root folder (first GroupingField) and some additional subfolders (second GroupingField). This is all good. However, the objects with a null value for the second GroupingField, just get placed in a subfolder with no label. I want the objects with a null second GroupingField value to appear as leaf nodes beneath the root folder (first GroupingField) minus the blank subfolder. A good way to picture this would be a file explorer. Is there a good way to do this? Make the folder icon disappear maybe after expanding this node through actionscript? ParentFolder SubFolder Leaf Object Leaf Object SubFolder Leaf Object Leaf Object Leaf Object

    Read the article

  • NSUndoManager grouping problem?

    - by anonymous
    I'm working on a barebones drawing app. I'm attempting to implement undo/redo capability, so I tell the view's undoManager to save the current image before updating the display. This works perfectly (yes, I understand that redrawing/saving the entire view is not incredibly efficient, but to solve this problem before attempting to optimize the code). However, as expected, when I 'undo' or 'redo', only the minute change is reflected. My goal is to have the whole finger stroke undone/redone. To do that, I told the undoManager to [beginUndoGrouping] in the [touchesBegan] method, and to [endUndoGrouping] in [touchesEnded]. That works for a bit, but after drawing a few strokes, the app crashes, and gdb exits with exc_bad_access. I'm very grateful for any insight you can give me. - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { mouseDragged = YES; currentPoint = [[touches anyObject] locationInView:self]; UIGraphicsBeginImageContext(drawingImageView.bounds.size); [drawingImageView.image drawInRect:drawingImageView.bounds]; CGContextRef ctx = UIGraphicsGetCurrentContext(); CGContextSetLineCap(ctx, kCGLineCapRound); CGContextSetLineWidth(ctx, drawingWidth); [drawingColor setStroke]; CGContextBeginPath(ctx); CGContextMoveToPoint(ctx, previousPoint.x, previousPoint.y); CGContextAddLineToPoint(ctx, currentPoint.x, currentPoint.y); CGContextStrokePath(ctx); [self.undoManager registerUndoWithTarget:drawingImageView selector:@selector(setImage:) object:drawingImageView.image]; drawingImageView.image = UIGraphicsGetImageFromCurrentImageContext(); UIGraphicsEndImageContext(); previousPoint = currentPoint; }

    Read the article

  • LINQ aggregate / SUM grouping problem

    - by Chrissi
    I'm having trouble getting my head around converting a traditional SQL aggregate query into a LINQ one. The basic data dump works like so: Dim result = (From i As Models.InvoiceDetail In Data.InvoiceDetails.GetAll Join ih As Models.InvoiceHeader In Data.InvoiceHeaders.GetAll On i.InvoiceHeaderID Equals ih.ID Join p As Models.Product In Data.Products.GetAll On i.ProductID Equals p.ID Join pg As Models.ProductGroup In Data.ProductGroups.GetAll On p.ProductGroupID Equals pg.ID Join gl As Models.GLAccount In Data.GLAccounts.GetAll On pg.GLAccountSellID Equals gl.ID Where (gl.ID = GLID) Select ih.Period,i.ExtendedValue) What I need to really be getting out is ih.Period (a value from 1 to 12) and a corresponding aggregate value for i.ExtendedValue. When I try to Group ih I get errors about i being out of scope/context, and I'm not sure how else to go about it.

    Read the article

  • Grouping consecutive identical items: IEnumerable<T> to IEnumerable<IEnumerable<T>>

    - by Romain Verdier
    I've got an interresting problem: Given an IEnumerable<string>, is it possible to yield a sequence of IEnumerable<string> that groups identical adjacent strings in one pass? Let me explain. Considering the following IEnumerable<string> (pseudo representation): {"a","b","b","b","c","c","d"} How to get an IEnumerable<IEnumerable<string>> that would yield something of the form: { // IEnumerable<IEnumerable<string>> {"a"}, // IEnumerable<string> {"a","b","b"}, // IEnumerable<string> {"c","c"}, // IEnumerable<string> {"d"} // IEnumerable<string> } The method prototype would be: public IEnumerable<IEnumerable<string>> Group(IEnumerable<string> items) { // todo } Important notes : Only one iteration over the original sequence No intermediary collections allocations (we can assume millions of strings in the original sequence, and millions consecutives identicals strings in each group) Keeping enumerators and defered execution behavior Is it possible, and how would you write it?

    Read the article

  • Grouping on Multiple Field

    - by Nisarg Mehta
    Hi , I am generating XML file from Database as below... <?xml version = '1.0'?> <T0019> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_STATUS_CODE>0 </IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <ADDRESS_TYPE>PH</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY>CALHOUN COUNTY</COUNTY> <COUNTRY>US</COUNTRY> </IFTA_ACCOUNT> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_STATUS_CODE>0 </IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <ADDRESS_TYPE>MA</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTRY>US</COUNTRY> </IFTA_ACCOUNT> </T0019> I have taken first two records from generated XSLT. With the use of XSLT I have tried lot to group record on basis of IFTA_LICENSE_NUMBER,IFTA_BASE_COUNTRY,IFTA_BASE_ST ATE,NAME_TYPE,ADDRESS_TYPE but i failed to generated XML like this.. <?xml version="1.0" encoding="UTF-8" ?> <T0019> <IFTA_ACCOUNT> <IFTA_CARRIER_ID_NUMBER>705</IFTA_CARRIER_ID_NUMBER> <IFTA_BASE_COUNTRY>US</IFTA_BASE_COUNTRY> <IFTA_BASE_STATE>AL</IFTA_BASE_STATE> <IFTA_LICENSE_NUMBER>631227666</IFTA_LICENSE_NUMBER> <IFTA_STATUS_CODE>0</IFTA_STATUS_CODE> <IFTA_STATUS_DATE>2009-01-01</IFTA_STATUS_DATE> <IFTA_ISSUE_DATE>2009-01-01</IFTA_ISSUE_DATE> <IFTA_EXPIRE_DATE>2009-12-01</IFTA_EXPIRE_DATE> <IFTA_UPDATE_DATE>2008-12-30</IFTA_UPDATE_DATE> <IFTA_NAME> <NAME_TYPE>LG</NAME_TYPE> <NAME>K D L TRUCKING INC</NAME> <IFTA_ADDRESS> <ADDRESS_TYPE>PH</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <STREET_LINE_2 /> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY>CALHOUN COUNTY</COUNTY> <COUNTRY>US</COUNTRY> </IFTA_ADDRESS> <IFTA_ADDRESS> <ADDRESS_TYPE>MA</ADDRESS_TYPE> <STREET_LINE_1>200 MARTIN LANE</STREET_LINE_1> <STREET_LINE_2 /> <CITY>OHATCHEE</CITY> <STATE>AL</STATE> <ZIP_CODE>36271</ZIP_CODE> <COUNTY /> <COUNTRY>US</COUNTRY> </IFTA_ADDRESS> </IFTA_NAME> </IFTA_ACCOUNT> </T0019>

    Read the article

  • How to do Grouping using JPA annotation with mapping given field

    - by hemal
    I am using JPA Annotation mapping with the table given below, but having problem that i am doing mapping on same table but on diffrent field given ProductImpl.java @Entity @Table(name = "Product") public class ProductImpl extends SimpleTagGroup implements Product { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private long id = -1; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name = "ProductTagMapping", joinColumns =@JoinColumn(name = "productId"), inverseJoinColumns =@JoinColumn(name = "tagId")) private List<SimpleTag> tags; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name = "ProductTagMapping", joinColumns =@JoinColumn(name = "productId"), inverseJoinColumns =@JoinColumn(name = "tagId")) private List<SimpleTag> licenses; @OneToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name = "ProductTagMapping", joinColumns =@JoinColumn(name = "productId"), inverseJoinColumns =@JoinColumn(name = "tagId")) private List<SimpleTag> os; I want to get values like windows and linux in os , GPLv2 and GPLv3 in licenses ,so we are using TagGroup table . but here i got all tagValues in each of the os,licenses and tag fileds,so how could i do group by or some other things with JPA. and ProductTagMapping is the mapping table between Tag and TagGroup TagGroup Table ID TAGGROUPNAME 1 PRODUCTTYPE 2 LICENSE 3 TAGS 4 OS SimpleTag ID TAGVALUE 1 Application 2 Framework 3 Apache2 4 GPLv2 5 GPLv3 6 learning 7 Linux 8 Windows 9 mature

    Read the article

  • Nesting, grouping Sqlite syntax?

    - by Linda
    I can't for the life of me figure out this Sqlite syntax. Our database contains records like: TX, Austin OH, Columbus OH, Columbus TX, Austin OH, Cleveland OH, Dayton OH, Columbus TX, Dallas TX, Houston TX, Austin (State-field and a city-field.) I need output like this: OH: Columbus, Cleveland, Dayton TX: Dallas, Houston, Austin (Each state listed once... and all the cities in that state.) What would the SELECT statement(s) look like?

    Read the article

  • django: grouping in an order_by query?

    - by AP257
    Hi all, I want to allocate rankings to users, based on a points field. Easy enough you'd think with an order_by query. But how do I deal with the situation where two users have the same number of points and need to share the same ranking? Should I use annotate to find users with the same number of points? My current code, and a pseudocode description of what I'd like to do, are below. top_users = User.objects.filter(problem_user=False).order_by('-points_total') # Wrong - in pseudocode, this should be # Get the highest points_total, find all the users with that points_total, # if there is more than one user, set status to 'Joint first prize', # otherwise set status to 'First prize' top_users[0].status = "First prize" if (top_users[1]): top_users[1].status = "Second prize" if (top_users[2]): top_users[2].status = "Third prize" if (top_users[3]): top_users[3:].status = "Highly commended" The code above doesn't deal with the situation where two users have the same number of points and need to share second prize. I guess I need to create a query that looks for unique values of points_total, and does some kind of nested ranking? It also doesn't cope with the fact that sometimes there are fewer than 4 users - does anyone know how I can do (in pseudocode) 'if top_users[1] is not null...' in Python?

    Read the article

  • SQL to retrieve the latest records, grouping by unique foreign keys

    - by jbox
    I'm creating query to retrieve the latest posts in a forum using a SQL DB. I've got a table called "Post". Each post has a foreign key relation to a "Thread" and a "User" as well as a creation date. The trick is I don't want to show two posts by the same user or two posts in the same thread. Is it possible to create a query that contains all this logic? # Grab the last 10 posts. SELECT id, user_id, thread_id FROM posts ORDER BY created_at DESC LIMIT 10; # Grab the last 10 posts, max one post per user SELECT id, user_id, thread_id FROM post GROUP BY user_id ORDER BY date DESC LIMIT 10; # Grab the last 10 posts, max one post per user, max one post per thread???

    Read the article

  • Need a jQuery Lightbox plugin that supports $.live() and grouping

    - by Throlkim
    I'm bringing in all of my images via Ajax, and I'm looking for a quick fix for the front-end of this project. I've tried a couple of jQuery lightbox plugins, but I can't seem to get them to perform in a live function (correct me if I'm wrong in thinking I need to do this). Currently attempting to use Balupton's Lightbox Plugin (can't link because of my being a new user), and after trying all of the examples to no avail, I've attempted it with this (also not working): $('a.lightbox-gallery').live('click', function(){ $(this).lightbox(); }); Any help is much appreciated!

    Read the article

  • Grouping a query with php

    - by Tom Hoad
    Basic question! I have 2 tables FRUIT id | fruit_name ------------------- 1 | Apple 2 | Banana 3 | Carrot VARIETIES id | fk_fruit_id | variety_name --------------------------------------- 1 1 Cox 2 1 Braeburn 3 2 Chester 4 3 Kotaka 5 3 Imperial 6 3 Oneal I'd like to output a list of varieties per fruit e.g. APPLE - Cox, Braeburn BANANA - Chester CARROT - Kotaka, Imperial, Oneal My current code is $query = "SELECT * FROM produce, varieties WHERE produce.id = varieties.fk_fruit_id"; $result = mysql_query($query) or die('Error : ' . mysql_error()); while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $produce_fruit_code = $row['fruit_code']; $variety_name = $row['variety_name']; echo $produce_fruit_code.' - '.$variety_name.'<br/>'; } which outputs: Apple - Cox Apple - Braeburn Banana - Chester Carrot - Kotaka Carrot - Imperial Carrot - Oneal Not a million miles away, but still not there. Any help is much appreciated, thanks!

    Read the article

  • android form Fields grouping?

    - by UMMA
    dear friends, i want to know that is there any way to create groups in a form? i am not talking about heading but groups we make with borders around set of specified field sets.(field sets are for example TextView,EditText and button). for example. Vital information: ----- Other information ----- any help would be appriciated.

    Read the article

  • Kohana 3 ORM - grouping where conditions with parentheses

    - by Greelmo
    I'm trying to run a query through the ORM like this: SELECT * from table where (fname like 'string%' or lname like 'string%') AND (fname like 'string2%' or lname like 'string2%'); Here's what i have so far: $results = ORM::factory('profiles'); foreach ($strings as $string) { $result->where('fname', 'like', "$string%"); $result->or_where('lname', 'like', "$string%"); } But this doesn't account for the parentheses. Any ideas?

    Read the article

  • Grouping geographical shapes

    - by grenade
    I am using Dundas Maps and attempting to draw a map of the world where countries are grouped into regions that are specific to a business implementation. I have shape data (points and segments) for each country in the world. I can combine countries into regions by adding all points and segments for countries within a region to a new region shape. foreach(var region in GetAllRegions()){ var regionShape = new Shape { Name = region.Name }; foreach(var country in GetCountriesInRegion(region.Id)){ var countryShape = GetCountryShape(country.Id); regionShape.AddSegments(countryShape.ShapeData.Points, countryShape.ShapeData.Segments); } map.Shapes.Add(regionShape); } The problem is that the country border lines still show up within a region and I want to remove them so that only regional borders show up. Dundas polygons must start and end at the same point. This is the case for all the country shapes. Now I need an algorithm that can: Determine where country borders intersect at a regional border, so that I can join the regional border segments. Determine which country borders are not regional borders so that I can discard them. Sort the resulting regional points so that they sequentialy describe the shape boundaries. Below is where I have gotten to so far with the map. You can see that the country borders still need to be removed. For example, the border between Mongolia and China should be discarded whereas the border between Mongolia and Russia should be retained. The reason I need to retain a regional border is that the region colors will be significant in conveying information but adjacent regions may be the same color. The regions can change to include or exclude countries and this is why the regional shaping must be dynamic. EDIT: I now know that I what I am looking for is a UNION of polygons. David Lean explains how to do it using the spatial functions in SQL Server 2008 which might be an option but my efforts have come to a halt because the resulting polygon union is so complex that SQL truncates it at 43,680 characters. I'm now trying to either find a workaround for that or find a way of doing the union in code.

    Read the article

  • t-sql grouping query

    - by stackoverflowuser
    Hi based on the following table Name --------- A A A B B C C C I want to add another column to this table called 'OnGoing' and the values should alternate for each group of names. There are only two values 'X' and 'Y'. So the table will look like Name OnGoing ---------------- A X A X A X B Y B Y C X C X C X how to write such a query that can alternate the values for each group of names.

    Read the article

  • Grouping Windows Forms Radiobuttons with different parent controls in C#

    - by Jerry
    Hi, I've got a Windows Forms application in which I have a number of RadioButtons. These RadioButtons are placed within a FlowLayoutPanel which automatically arranges them for me. All RadioButtons that are directly added to the FlowLayoutPanel are grouped, meaning I can select only one of them. However, some of these RadioButtons are paired up with a TextBox so I can supply some argument there. But to have all this arranged properly, I add a Panel control to the FlowLayoutPanel so I can control the alignment of the RadioButton and TextBox relatively to each other myself. These RadioButtons now have their own respective Panels as parent controls and thus are no longer included in the radio group with the other RadioButtons. I read that the the RadioButtons that are in the System.Web.UI namespace have a GroupName property, but unfortunately their System.Windows.Forms counterparts lack this property. Is there some other way I can group these radio buttons are am I going to have to handle onClick events myself? Thanks, Jerry

    Read the article

  • SQL Count Query with Grouping by multiple Columns

    - by Christian
    I have a table with three filled columns named "Name", "City" and "Occupation". I want to create a new column in the same table that contains the number of people who have the same occupation. "Name" | "City" | "Occupation" ------------------------------ Amy | Berlin | Plumber Bob | Berlin | Plumber Carol | Berlin | Lawyer David | London | Plumber I want to have a table that contains: "Name" | "City" | "Occupation" | "Number" --------------------------------------- Amy | Berlin | Plumber | 2 Bob | Berlin | Plumber | 2 Carol | Berlin | Lawyer | 1 David | London | Plumber | 1 How does the SQL Query that creates the new columns have to look like? I want to actually create a new column in the database that I can access later.

    Read the article

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