Search Results

Search found 13450 results on 538 pages for 'recent items'.

Page 91/538 | < Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >

  • Python: Filter a dictionary

    - by Adam Matan
    Hi, I have a dictionary of points, say: >>> points={'a':(3,4), 'b':(1,2), 'c':(5,5), 'd':(3,3)} I want to create a new dictionary with all the points whose x and y value is smaller than 5, i.e. points 'a', 'b' and 'd'. According to the the book, each dictionary has the items() function, which returns a list of (key, pair) tuple: >>> points.items() [('a', (3, 4)), ('c', (5, 5)), ('b', (1, 2)), ('d', (3, 3))] So I have written this: >>> for item in [i for i in points.items() if i[1][0]<5 and i[1][1]<5]: ... points_small[item[0]]=item[1] ... >>> points_small {'a': (3, 4), 'b': (1, 2), 'd': (3, 3)} Is there a more elegant way? I was expecting Python to have some super-awesome dictionary.filter(f) function... Adam

    Read the article

  • Finding parents where child collection does not contain an item with a specific property value

    - by Colin Bowern
    I am trying to get a list of parents where the child collection does not contain an item of a specific type. The LINQ equivalent would be something like: dataset.Where(x => x.Items.FirstOrDefault(y => y.Type.Code == "ABC") == null) The object model is Parent Child (Items) Type Code If Parent is my aggregate root, how would I model this in NHibernate criteria/query? Here's my first attempt: var results = session.CreateCriteria<Parent>() .CreateCriteria("Items") .CreateCriteria("Type") .Add(Restrictions.Not(Restrictions.Eq("Code", "ABC"))) .SetResultTransformer(Transformers.DistinctRootEntity) .List<Parent>(); This doesn't seem to return the right entities - it just returns them all.

    Read the article

  • Architecture choice about representation of collections in Business Objects

    - by Rajarshi
    I have made certain choices in my architecture which I request the community to review and comment. I am breaking up the post in smaller sections to make it easier to understand the context and then suggest/comment. I am sorry that the post is long, but is required to explain the context. What am I building A typical business application where there are application users, security roles, business operation/action rights based on roles and several business modules like Stock Receive, Stock Transfer, Sale Order, Sale Invoice, Sale Return, Stock Audit etc. and several reports. The application is a WinForm application since it has a lot of rich and responsive UI requirements and has to operate in disconnected mode (with a local SQL Server), most of the time. What have I done I have built a framework - nothing to boast about, but just a set of libraries that serves the repetative requirements of my application, e.g. authentication, role based authorization, data access, validation, exception handling, logging, change status tracking, presentation model compliance and reasonable loose coupling between components. No, I have not written everything from scratch, you can say I have consolidated many things together like some concepts from CSLA, Martin Fowler for Presentation Model, blocks from Enterprise Library, Unity etc. to build a set of libraries that will help my developers be productive quickly without having to look up Google for many of the technical requirements. I have tried to keep the framework generic so that it can be used in typical business applications and also tried to follow some best practices that will support the same Business Objects to be used in an ASP.NET MVC environment also. My present architecture serves my objectives well, and have built several modules (on WinForm) without much trouble. The architecture also lent itself well to build some usable prototype on ASP.NET MVC with the same set of business objects, without changing a single line of code. My Dilemma I have used Custom Business Objects since that gives me a clearer OOP representation of the problem scope in my solution scope, and helps me visualize my entire solution as collection of objects with data and behavior rather than having a set of relational data (DataSet) and implement behaviours (business logic, validation) etc. separately. With rich databinding support in .NET 2.0 binding Custom Business Objects to UI was a breeze. Now while building my business objects, I am still in a dilemma about representation of collections in business objects. Currently I am using DataSets to represent collections while I have seen many suggestions to implement custom collections. For example, in my vision, a typical Sale Invoice Object will contain 'Sales Invoice Items' as a collection. Now theoritically, I can accept that the each 'Sales Invoice Item' should have its own behavior along with their data (ItemCode, Name, Qty, Price etc.) but typically managing of Sale Invoice Items in a Sale Invoice is handled by the Sale Invoice Object itself, e.g. adding/removing Items from collection. Additionally, we can also put business logic/rules for the Sales Invoice Items like "Qty should not be greater than the ordered qty", "Price should be max 10% above the price in Sale Order" etc. in the Sale Invoice object itself. With that kind of a vision, I felt that most business object child collections can be managed by the parent itself, including add/remove from collection as well and implementing business logic for the collection items, hence the collection items hold nothing but data. Additionally, typical collections are represented in UI in Grids, where ability to support DataBinding becomes very important for any collection. Implementing a custom collection, in that case would also mean, I have to implement robust DataBinding support as well, for the collection, which is of course time consuming. Now, considering child collection behaviors are implemented in the parent and the need for DataBinding of child collections, I chose DataSet to represent any child collection in my business objects. In the above example of Sale Invoice I will have 'Invoice Number', 'Date', 'Customer' etc. as attributes of the 'Sale Invoice' but 'InvoiceItems' as a DataSet. Of course, when I say DataSet, it is not a vanilla dataset but an extended DataSet that supports business rule validation and the same role based security model of my framework to allow/deny any business operation to rows/columns of the DataSet, automatically. This approach has allowed easier collection management and databinding in my business objects and my developers are able to deliver modules rapidly. Questions Do you feel that the approach is reasonable? Do you see any shortcomings of this approach? I am recently thinking of using 'Typed DataSets' as child collections, for easier representation in code, that will allow me to write 'currentInvoice.InvoiceItems' (for the DataTable) and 'invoiceItem.ProductCode' or 'invoiceItem.Qty', instead of 'drow["ProductCode"].ToString()' or '(int)drow["Qty"]' etc. Does this choice have any demerits? Thank you if you have read so far and a salute if you still have the Energy to answer.

    Read the article

  • MooTools Sortables with horizontal list having problems

    - by Anurag
    I am having problems sorting list items using the Sortables class when the list items are displayed horizontally. Removing this style fixed everything: display: inline Created an example on jsfiddle. This works. Check the stylesheet for .countries li - it does not display the list inline - http://jsfiddle.net/Wgpqw/ This does not work properly. I can drag the list items around the list, but the sort randomly happens when moving around - http://jsfiddle.net/Wgpqw/1/ I suspect it has something to do with the list element positioning in inline mode. Any help is greatly appreciated.

    Read the article

  • How to use custom drawing in QGraphicsViews in PyQt?

    - by DSblizzard
    I need to view QGraphicsScene in 2 QGraphicsViews with condition that they have different scale factors for items in scene. Closest function which I found is drawItems(), but as far I can understand, it must be called manually. How to repaint views automatically? I have these two code fragments in program: class TGraphicsView(QGraphicsView): def __init__(self, parent = None): print("__init__") QGraphicsView.__init__(self, parent) def drawItems(self, Painter, ItemCount, Items, StyleOptions): print("drawItems") Brush = QBrush(Qt.red, Qt.SolidPattern) Painter.setBrush(Brush) Painter.drawEllipse(0, 0, 100, 100) ... Mw.gvNavigation = TGraphicsView(Mw) # Mw - main window Mw.gvNavigation.setGeometry(0, 0, Size1, Size1) Mw.gvNavigation.setScene(Mw.Scene) Mw.gvNavigation.setSceneRect(0, 0, Size2, Size2) Mw.gvNavigation.show() _init_ works, Mw.gvNavigation is displayed and there are Mw.Scene items in it, but drawItems() isn't called.

    Read the article

  • iPhone: UITableView Becomes Invisible after Changing the Data it Displays

    - by Alexander Shemshurenko
    Hi I have application with a TabBar that controls several views. In one view, I control connections to different servers. Each server provides a different set of items. I display these items in UITableView on another view. The problem is that the tableview displays OK the first time but if I go back to view number one and change the server, thereby changing the list of items that should be displayed in tableview, the tableview becomes invisible for some reason. If I tap on the screen in the place where it should be, it becomes visible again. I create table view like this UITableView * aTableView = [[UITableView alloc] initWithFrame:CGRectMake(X,Y,Width,Height) style:UITableViewStyleGrouped]; [[self view] addSubview:aTableView]; aTableView.dataSource = self; Ive tried to call reloadData and setNeedsDisplay in viewWillAppear of the UIViewController that hosts this tableview but without success. Any advice? Thanks

    Read the article

  • Disappearing IE6 elements.

    - by Stefan Kendall
    I don't know what could be causing this issue, but for some reason, elements on my page (list navigation items, specifically), are disappearing in IE6. That is, from IE developer toolbar, I can see that the elements are there, and the DOM/css is correct, but the elements just aren't visible. The odd thing is that if you set or toggle ANY css element on the list items with the IE6 toolbar, the elements appear. I also have a hover() jQuery action set on the list navigation items, and the event fires as if the elements were visible and working correctly. What could possibly be going wrong here? I initially thought z-index could be an issue, but changing ANY attribute or css value (not necessarily z-index), causes the element to render. I should note, however, that doing this programmatically does not cause the elements to display properly, even if triggered seconds after the page load.

    Read the article

  • Maintain Added List Item while binding from datasource

    - by Kronass
    Hi, I have a drop down list, and I added some items in it as follows <asp:DropDownList ID="ddlInsAuther" runat="server" DataSourceID="ObjectDataSourceInsAuthers" DataTextField="AutherName" DataValueField="AutherID"> <asp:ListItem Value="-1">No Authers</asp:ListItem> </asp:DropDownList> And in Datasource <asp:ObjectDataSource ID="ObjectDataSourceInsAuthers" runat="server" SelectMethod="GetAll" TypeName="MyProject.BusinessLayer.AuthersFactory"> </asp:ObjectDataSource> When it loads it clears the list and loads the new items, I don't want to make a custom binder on page load, how can I maintain my added items in the list while binding from datasource?

    Read the article

  • jqueryUI: Drag element from dialog and drop onto main page?

    - by Seth Petry-Johnson
    I am trying to create a drag and drop system consisting of a workspace and a "palette". The workspace currently consists of re-orderable list items, and I want the palette to be a floating window from which I can drag items and add them to a specific position on the workspace. I am currently using the jqueryUI "sortable" plugin for the workspace and the jqueryUI "dialog" plugin for the palette. However, I cannot drag something out of the dialog and on to the main page. When I try, the item being dragged disappears as it crosses the boundary of the dialog (which makes sense). What can I change so that items will remain visible as I drag them out of the palette and allow me to drop them onto the main workspace? Alternatively, are there any jquery plugins that offer this sort of drag-n-drop palette as a primary feature?

    Read the article

  • .net 4.0 concurrent queue dictionary

    - by freddy smith
    I would like to use the new concurrent collections in .NET 4.0 to solve the following problem. The basic data structure I want to have is a producer consumer queue, there will be a single consumer and multiple producers. There are items of type A,B,C,D,E that will be added to this queue. Items of type A,B,C are added to the queue in the normal manner and processed in order. However items of type D or E can only exist in the queue zero or once. If one of these is to be added and there already exists another of the same type that has not yet been processed then this should update that other one in-place in the queue. The queue position would not change (i.e. would not go to the back of the queue) after the update. Which .NET 4.0 classes would be best for this?

    Read the article

  • How to return a code value into a variable

    - by Georges Sabbagh
    I have the below case in my report: Receivable: RunningValue(Fields!Receivable.Value,SUM,Nothing) Production: code.SumLookup(LookupSet(Fields!Currency_Type.Value, Fields!Currency_Type1.Value,Fields!Gross_Premium_Amount.Value, "DataSet2")) Rec/Prod: Receivable / Production. Public Function SumLookup(ByVal items As Object()) As Decimal If items Is Nothing Then Return Nothing End If Dim suma As Decimal = New Decimal() Dim ct as Integer = New Integer() suma = 0 ct = 0 For Each item As Object In items suma += Convert.ToDecimal(item) ct += 1 Next If (ct = 0) Then return 0 else return suma End Function The problem is for Rec/Prod, if prod = 0 i receive error. Ive tried to put the below condition: IIF(code.SumLookup(LookupSet(Fields!Currency_Type.Value, Fields!Currency_Type1.Value,Fields!Gross_Premium_Amount.Value, "DataSet2"))=0,0,RunningValue(Fields!Receivable.Value,SUM,Nothing)/(code.SumLookup(LookupSet(Fields!Currency_Type.Value, Fields!Currency_Type1.Value,Fields!Gross_Premium_Amount.Value, "DataSet2")))) but since in the false condition i am recalling code.SumLookup in order to get the value in regetting 0 for production and consiquently i get error for Rec/Prod. how can i call code.sumlookup on time only and save its value into a variable so i dont need to call it everytime i need to check the value. or if there any other solution please advise.

    Read the article

  • How to add classes for styling to Drupal when using menu_block?

    - by VoY
    I'm using the menu_block module in Drupal for my menus. This works very well, but I want my menu items styled as an image menu. This cannot be done nicely with the default settings - the menu items look something like this: <li class="leaf first menu-mlid-199"><a href="/this/is/some/nice/url" title="Homepage">Homepage</a></li> I'm guessing I could used the menu-mlid-199 class to get the styling I want, because it's a unique id of each menu item, but that seems rather ugly to me. Is there any other way to add reasonably named classes to my menu items, e.g. generate them from the page title or url alias? Even just a sequence would seem nicer - like menu-item-1 and so on.

    Read the article

  • SQL Query syntax, I want to use INNER JOIN

    - by amol kadam
    Hi . I'm working on a windows application project using front end "vb.net" & back end "Ms Access" I have problem in wrinting sql query Actually there are 5 tables Transaction,items,itemtitle,itemtype & userinfo. check the following query & with this referance if u get idea then plz change in correct query Thanking You SELECT TRANSACTIONS.ACCESSIONNO AS ACCESSIONNO,TRANSACTIONS.TYPEID, TRANSACTIONS.CHECKOUTDATE AS CHECKOUTDATE,ITEMTITLE.ITEMTITLE, TRANSACTIONS.CHECKEDOUTBY, USERINFO.FULLNAME_ENG, USERINFO.FULLNAME_MAR, TRANSACTIONS.ACCOUNTNO, ITEMTYPE.TYPES_MAR, ITEMTYPE.TYPES_ENG FROM TRANSACTIONS,ITEMTYPE, ITEMTITLE, USERINFO WHERE TRANSACTIONS.ACCOUNTNO=USERINFO.ACCOUNTNO AND TRANSACTIONS.ACCESSIONNO=ITEMS.ACCESSIONNO AND ITEMS.ITEMTITLEID=ITEMTITLE.ITEMTITLEID AND TRANSACTIONS.TYPEID=ITEMTYPE.TYPEID AND TRANSACTIONS.STATUS='Enabled'

    Read the article

  • Help with jQuery issue

    - by Espen Arnoy
    I have a simple page with a list if "items". I am allowing users to vote on these items, but I only want to allow the user to vote one per. item. Therefore i have made a jQuery script that adds a class to the items the user has voted on: if(! $(this).find(".item span").hasClass("voted")) { $(".item").hover(function() { $(this).find(".ratingbar").hide(); $(this).find(".votebar").show(); }, function() { $(this).find(".votebar").hide(); $(this).find(".ratingbar").show(); }); }; This is the script that prevents the user from voting again on the same item. $(".votebutton").click(function() { $("div#"+offerid).find(".item").addClass("voted"); } My problem is that this doesn´t work. When hovering an item, the hover function still runs even though the second script successfully added the class "voted" to the html. Why can this be?

    Read the article

  • Is there a C# open-source search app which scales cheaply?

    - by domspurling
    I need to quickly replace a listings website which has the following characteristics: smallish database (10,000 items, < 1GB) < 10% of the items updated/created/removed daily most common activity is searching the whole dataset, returning 1-1000 items traffic peaks at 1m page impressions per day Scaling strategy for the existing app has been to separate read-only and read/write activity. Multiple slave databases are used for searching and writes are done to a master, which update the slaves using MS SQL replication. Since read activity is more common than write, this has proved to be a cheap way to do database load balancing, without true clustering. I now need to replace the app - are there any C# open-source apps which scale as neatly as this?

    Read the article

  • Creating client-side dynamic dependent controls , interactive user interface

    - by igor
    Hello everyone! I am looking for client-side javascript plugin for jquery(prefered, or maybe other framework) or other javascript framework, that implements dynamic, interactive user interface (fig. 1) Requirements: 1) user interface shall be dynamic (client-side, javascript). 2) the displaying of the next control shall be dependent on input of previous control(s) 3) the dependency shall be implemented in declarative form (settings, mapping, xml...) 4) this scope of controls shall be supported: dropdown list - fixed list (static, list of items has fixed scope of items) edit input (loop-up) - dynamic list, dependent on user input dropdown list - fixed list (dynamic, list of items dependent on previous input) static structure controls to display dynamic data. 5) this scope of dependencies shall be implemented: one-way: one to one one-way: one to many 6) this scope of dependency actions shall be implemented: hide (remove) control show (add) control show disabled set default value 7) controls shall be filled in by using ajax requests to the server-side application (json, xml...) Any thoughts, references, I would appreciate any assistance. Fig. 1. Interactive user interface

    Read the article

  • How do I get all values from a listbox that are not selected in ASP.NET MVC

    - by Nick Reeve
    Hello, I have a form that (amongst other things) contains 2 multi-select listboxes. Basically you can add items to the one on the right from the full list of items on the left using some add/remove buttons. The problem is that I cannot see a way of picking up the contents of the listbox when posting back to the controller. I have followed this example: http://ittecture.wordpress.com/2009/04/30/tip-of-the-day-198-asp-net-mvc-listbox-controls/ This works fine if you have actually selected the items in the listbox before posting. That's not really the way I think this UI should behave though. Hope that makes sense, Nick

    Read the article

  • Simplified iphone In-app store implementation for built-in product features

    - by Joey
    This question is for those familiar with implementing the iphone in-app store functionality. The app I'm building has only built-in features that are unlocked when features are purchased. Further, any modifications or additions to store items will require an app update. Also, it is only in English so has no localized languages for the items. If we take those assumptions, is it feasible to skip the step of retrieving the product info with SKProductsRequest and simply use hardcoded data within the app? While I may want to extend my app to greater complexity in the future, I'd like to know if this step to keep it simple would introduce some serious issues. One issue might be, for instance, if we have to expect a few of the items to occasionally be unavailable due to issues on Apple's side and simply trying to purchase it and letting it fail would not be a permissible or workable option in that case (especially if it is uncommon). Thanks.

    Read the article

  • how to detect an IMAPMessage is not an email but a Task or Calendar item

    - by raticulin
    I am accessing Lotus and Groupwise using javamail via IMAP, recursively accessing all folders and processing email I find. But in folders like Tasklist and Calendar (those are from Groupwise but I think I remember Lotus had similar things), I get the items in there as instances of IMAPMessage, and so they are processed as if they were mail. I understand those items get exposed as mail through the IMAP protocol (either by design or by mistake), but I only want to process proper mail. Is there a way to do this? I have dismissed following approaches so far: Make sure the message has a message-id, at least in Groupwise Calendar items have it. Ignore folders by name (such as Calendar and Tasklist): is not totally correct as a user can move mail inside those folders. What I am looking is some IMAP api call I have missed so far or something in those lines...

    Read the article

  • How to hide Lists from specific group?

    - by DanSogaard
    How to hide Lists from specific group, but at the same time allow them to add items in it?. I edited permission levels for the site and created a permission that has these privileges: List Permissions: Add Items, View Items. Site Permissions: View Pages, Open. And then assign this permission to the group along with View Only. However this would still show Lists and the users are able to access them. How can I hide it from this specific group only?.

    Read the article

  • MS Chart Control for ASP.NET 100% Stacked Bar Chart Question.

    - by Jacob Huggart
    Hello All, I am trying to display a chart with several different bars that represent a ratio of some values. For example, one bar may say that there are 25 items in three different groups (maybe dirty, clean, and broken) and of those 25 items x items from each category add up to the total. Later the data will dynamically change and be displayed accordingly. But for now all I want to do is be able to display three different values on the same bar. Unfortunately, whatever properties I need to bind the data to are buried somewhere in the menus and I cannot seem to find them. Do any of you guys have experience with this sort of chart?

    Read the article

  • TStringList, Dynamic Array or Linked List in Delphi?

    - by lkessler
    I have a choice. I have an array of ordered strings that I need to store and access. It looks like I can choose between using: A TStringList A Dynamic Array of strings, and A Linked List of strings In what circumstances is each of these better than the others? Which is best for small lists (under 10 items)? Which is best for large lists (over 1000 items)? Which is best for huge lists (over 1,000,000 items)? Which is best tor minimize memory use? Which is best to minimize loading and/or access time? For reference, I am using Delphi 2009.

    Read the article

  • rails update whole index of a model with one click

    - by mattherick
    hello! i have a store model, this will handle my leaflet and my shoppingcart for my shop. now i d´like to show all items added from an user to his leaflet in the index of store. in the store an user can change the quantity of the choosen items. and now i want to save that the changes of the different quantities in the database with one click on a button "update store". so how could i implement an update over the whole index with one click? i´d like to do this with ajax and most dynamically. somebody has an idea? i render all items into a form so far, but now i have the problem, when i submit this form only the last quantity and item id are included in the params. further i pushed every quantity into an array and i want to submit this also as a param. but i could not. please give me some tips, will be very fine :) mattherick

    Read the article

  • Binding UserControl to a NULL DataContext

    - by user634981
    I have a UserControl and am binding its DataContext to an object. I also bind the IsEnabled property of the UserControl to a boolean property of that object eg: <my:MyUserControl DataContext="{Binding Items.SelectedItem}" IsEnabled="{Binding Path=IsEditable}"/> This works fine provided Items.SelectedItem is not null. However, if it is null (which can happen sometimes if the Items collection is empty), the IsEnabled binding does not get evaluated and is set to true, which is not the desired behaviour. I've tried using a MultiBinding but without success because I don't know if it's possible to bind to the DataContext. I've also tried using a DataTrigger, but again without success. Would somebody kindly point me in the right direction as to the correct way I should be doing this. Thanks!

    Read the article

  • Is there alternative way to write this query?

    - by Kugel
    I have tables A, B, C, where A represents items which can have zero or more sub-items stored in C. B table only has 2 foreign keys to connect A and C. I have this sql query: select * from A where not exists (select * from B natural join C where B.id = A.id and C.value > 10); Which says: "Give me every item from table A where all sub-items have value less than 10. Is there a way to optimize this? And is there a way to write this not using exists operator?

    Read the article

< Previous Page | 87 88 89 90 91 92 93 94 95 96 97 98  | Next Page >