Search Results

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

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

  • Python: Remove items from a list while iterating in Python

    - by xApple
    My problem is simple: I have a long list of elements that I want to iterate through and check every element against a condition. Depending on the outcome of the condition I would like to delete the current element of the list, and continue iterating over it as usual. I have read a few other threads on this matter. Two solutions seam to be proposed. Either make a dictionary out of the list (which implies making a copy of all the data that is already filling all the RAM in my case). Either walk the list in reverse (which breaks the concept of the alogrithm I want to implement). Is there any better or more elegant way than this to do it ? def walk_list(list_of_g): g_index = 0 while g_index < len(list_of_g): g_current = list_of_g[g_index] if subtle_condition(g_current): list_of_g.pop(g_index) else: g_index = g_index + 1

    Read the article

  • NHibernate: insert multiple items at once

    - by Gart
    Hello, all! I am learning NHibernate now and I would like to know is it possible to save multiple objects to database in one operation. For example, consider this test code private static void SaveTestBillNamesInSession(ISession session, params string[] names) { var bills = from name in names select new Bill { Name = name, DateRegistered = DateTime.Now, }; foreach (var bill in bills) session.SaveOrUpdate(bill); } This loop here generates many INSERT statements which may be sub-optimal in SQL Server 2008 which allows to include multiple data rows in one INSERT statement. Is it possible to rewrite this code to make use of this functionality - insert all the data in one operation?

    Read the article

  • How to handle similar items in rails MVC?

    - by mocker
    I'm working on building a pretty simple site mainly as an exercise in learning more about rails. You can see my rough progress at statific.com. It's working pretty much as I wanted it for keeping track of server information, but now I'd like to expand it to other things, next on the list being firewalls. I can pretty easily duplicate all the models, views, etc.. that I have for my servers. The problem I see with that is that it isn't very DRY since most of the code would look the same, the only difference would be the attributes I have setup for firewalls would be different than for servers. I know in plain ruby this is pretty simple, you can have a 'Product' w/ common attributes ('manufacturer', 'model') and then have children with more specific attributes. Does the same type of concept exist for rails, or am I just over thinking this?

    Read the article

  • How to change behavior of items in Firefox context menu

    - by tom
    Hi, I'm trying to change the behavior of in placesOverlay.xul. My goal is to disable the Properties entry upon conditions that I need to figure out using Javascript. I am new to XBL bindings and handlers and don't know how to register such a handler for an existing/browser-defined XUL element. Or is there a simpler way? Thanks.

    Read the article

  • C++ Returning Multiple Items

    - by Travis Parks
    I am designing a class in C++ that extracts URLs from an HTML page. I am using Boost's Regex library to do the heavy lifting for me. I started designing a class and realized that I didn't want to tie down how the URLs are stored. One option would be to accept a std::vector<Url> by reference and just call push_back on it. I'd like to avoid forcing consumers of my class to use std::vector. So, I created a member template that took a destination iterator. It looks like this: template <typename TForwardIterator, typename TOutputIterator> TOutputIterator UrlExtractor::get_urls( TForwardIterator begin, TForwardIterator end, TOutputIterator dest); I feel like I am overcomplicating things. I like to write fairly generic code in C++, and I struggle to lock down my interfaces. But then I get into these predicaments where I am trying to templatize everything. At this point, someone reading the code doesn't realize that TForwardIterator is iterating over a std::string. In my particular situation, I am wondering if being this generic is a good thing. At what point do you start making code more explicit? Is there a standard approach to getting values out of a function generically?

    Read the article

  • Solution Items in Visual Studio 2005/2008

    - by Muneeb
    Is it possible to add a class as a solution item and use it as a linked item in all the projects in the solution? Basically I was thinking of creating a class (which will inherit ConfigurationSection) and keeping it as the Solution Item. I wanted to add it as a linked item in all the projects in the solution, so that everyone can use it to access the configuration properties. (Refer to this tutorial for more details) Now the issue I am facing is that when I create a class in the solution item, it doesn't have any namespace. And it shows up in intellisense, inside the projects but once I create an object of the solution item class, the object doesn't show up in intellisense. Any ideas why?

    Read the article

  • List Item Sort Order - TFS Work Items

    - by Sunil Ramu
    Is there any way to display the vaule order as the same given below in the work item template. When I see the template the value display order is changed. It is sorted alphabetically. Is there any way to change the sort order ? <ALLOWEDVALUES> <LISTITEM value="Pass" /> <LISTITEM value="Fail" /> <LISTITEM value="Blocked" /> <LISTITEM value="N/A" /> <LISTITEM value="Not Completed" /> <LISTITEM value="Ready For Review" /> <LISTITEM value="Approved" /> </ALLOWEDVALUES>

    Read the article

  • Java XML Output - proper indenting for child items

    - by Dr1Ku
    Hello, I'd like to serialize some simple data model into xml, I've been using the standard java.org.w3c -related code (see below), the indentation is better than no "OutputKeys.INDENT", yet there is one little thing that remains - proper indentation for child elements. I know that this has been asked before on stackoverflow , yet that configuration did not work for me, this is the code I'm using : DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder builder = factory.newDocumentBuilder(); Document doc = builder.newDocument(); doc = addItemsToDocument(doc); // The addItemsToDocument method adds childElements to the document. TransformerFactory transformerFactory = TransformerFactory.newInstance(); transformerFactory.setAttribute("indent-number", new Integer(4)); // switching to setAttribute("indent-number", 4); doesn't help Transformer transformer = transformerFactory.newTransformer(); transformer.setOutputProperty(OutputKeys.METHOD, "xml"); transformer.setOutputProperty(OutputKeys.INDENT, "yes"); DOMSource source = new DOMSource(doc); StreamResult result = new StreamResult(outFile); // outFile is a regular File outFile = new File("some/path/foo.xml"); transformer.transform(source, result); The output produced is : <?xml version="1.0" encoding="UTF-8" standalone="no"?> <stuffcontainer> <stuff description="something" duration="240" title="abc"> <otherstuff /> </stuff> </stuffcontainer> Whereas I would want it (for more clarity) like : <?xml version="1.0" encoding="UTF-8" standalone="no"?> <stuffcontainer> <stuff description="something" duration="240" title="abc"> <otherstuff /> </stuff> </stuffcontainer> I was just wondering if there is a way of doing this, make it properly indented for the child elements. Thank you in advance ! Happy Easter coding :-) !

    Read the article

  • Fastest way to check array items existence in mySQL table

    - by Enrique
    User writes a series of tags (, separated) and posts the form. I build an array containing the tags and delete dupes with array_unique() php function. I'm thinking of doing: go through the array with foreach($newarray as $item) { ... } check each $item for existence in the tags mySQL table if item does not exists, insert into tags table Is there a FASTER or MORE OPTIMUM way for doing this?

    Read the article

  • iPhone - finding items in current entity that share related item

    - by Pedro
    G'day Folks My core data driven app has an Events entity, essentially a list of times & venues, with a related Acts entity, the names & bios of the acts appearing at those events. I have a table view that shows the event time & venue (as a table section with 1 row), the act name & act bio that works nicely. If that act is appearing at more than one event I'd like to include another table section that lists those events. I think could get that with event.act.events except that it would include the event I'm currently displaying. Can anyone suggest how to get the data I want & exclude the current record? Cheers & TIA, Pedro :) PS... I have not quite 18 hours until the promised time for a prototype of my app to be available for some testers to download.

    Read the article

  • How to reverse items in WPF Datagrid?

    - by irf1x
    If i have DataGrid which looks like: Col 1 Col 2 ------- ------- 1 a 2 b 3 c ... ... n n Can the order be reversed easily without sorting? So that n is first, and 1 is last. I have custom sort implemented from this article, but sorting the same column twice in a row calls sorting function twice (which is slow), so just reversing the order should be faster and have the same effect.

    Read the article

  • Xcode 4: deleting items in Build Settings

    - by occulus
    In XCode 4.0 there's a newly designed Build Settings page. My problem is that I can't see how to remove a setting once I've specified it. Example: I've changed "Versioning System" to "Apple Generic" at the target level. Afterwards I realised I should set it at the project level, and so I want to delete the target level setting. However, there's no way I can see to remove the setting -- you click on it and there's two options, neither of which is the default "not specified" empty setting. Hitting the delete key on the keyboard nothing. The same goes for fields that accept text -- if I try to delete a setting by just deleting all the text set, it still shows that field in green, but with no text in it, and regards it as the presence of a setting.

    Read the article

  • Horizontal(tabbed) menu with ability to wrap overflowed items into collapsible dropdown

    - by wik
    It's about html/css/javascript menu ;) I am looking for unified solution to hide extra tabs of horizontal/tabbed menu when it overflows it's container. The initial idea plagiarized from firefox tabs workflow, i.e. when you have too much tabs it will wrap extra ones into collapsible dropdown button "List all tabs". I am thinking to play with overflow:auto in conjunction with javascript, but is there anything like this already implemented or maybe some better idea? Thanks.

    Read the article

  • UitableView Problem in deleating items from database

    - by Arun Sharma
    Hi All, I am using in UitableView database.My table view works successfully (add single item,add multiple item,delete all) only problem is there when i want to delete single item for this i using Uitableview edit option. so how i add database method for deleting single item from database and also from table view. Please help me.

    Read the article

  • unique items from an observableArray of object properties

    - by Joe
    I'm trying to extract unique properties from a knockout.js observableArray of objects, to populate a drop menu. Being new to knockout, I'm really struggling with this! I want to iterate over a contacts list, and populate a drop menu with a unique value from each person object within the observableArray. So in my code example below, I wish to populate my drop menu with a list of people 'type' - family, friend etc. Looking on Google, I found a similar function, but it does not return any values, even if I console.log the results? //dummy data more rows in actual code... var people = [ { name: "Contact 1", address: "1, a street, a town, a city, AB12 3CD", tel: "0123456789", email: "[email protected]", type: "family" }, { name: "Contact 2", address: "1, a street, a town, a city, AB12 3CD", tel: "0123456789", email: "[email protected]", type: "friend" } ]; function ContactsViewModel(people) { var self = this; self.contacts = ko.observableArray(people); self.uniqueSelect = ko.dependentObservable(function() { return( ko.utils.arrayGetDistinctValues(self.contacts().type).sort()); }, self); }; ko.applyBindings(new ContactsViewModel()); And HTML template <p>Show me: <select data-bind="options: ContactsViewModel.uniqueSelect"></select></p> Any help appreciated, as a noob I'm lost! Thanks

    Read the article

  • Windows 7: Loop through Taskbar items

    - by balint
    Hi, I'm trying to build a small utility for myself only to hide labels of running programs with windows visible in the taskbar where the label holds no information (for example "iTunes", "Microsoft SQL Server Mngmt Studio", "~cmd.exe") but keep windows like Windows Explorer and Visual Studio and MSN ungroupped, with labels (to know which folders you are currently listing, which projects are open, and who are you chatting with by name). I'm trying to loop through all windows in the taskbar on windows 7, but without any luck. I found some samples for XP's taskbar reorders, they no longer usable. I've checked the samples in WindowsAPICodePack for Windows 7 Taskbar manipulation, but it only lets me access my processes' windows.

    Read the article

  • Concatenate arrays items

    - by j.
    I have two arrays: x = [ [0, "#0"], [1, "#1"] ] y = [ [00, "00 description"], [10, "10 description"] ] What i need is to merge them so i get the following as result: result = [ [000, "#0 00 description"], [010, "#0 10 description"], [100, "#1 00 description"], [110, "#1 10 description"]] Is there a method for that? Or I'll need to use collect or something like this? Thanks in advance.

    Read the article

  • jQuery Grouping Similar Items w/ Multidimensional Array

    - by NessDan
    So I have this structure setup: <ul> <li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li> (Vid1) <li>http://www.youtube.com/watch?v=bOF3o8B292U</li> (Vid2) <li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li> (Vid3) <li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li> <li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li> <li>http://www.youtube.com/watch?v=bOF3o8B292U</li> <li>http://www.youtube.com/watch?v=yAY4vNJd7A8</li> <li>http://www.youtube.com/watch?v=dw1Vh9Yzryo</li> </ul> Vid1 is repeated 3 times, Vid2 is repeated 3 times, and Vid3 is repeated 2 times. I want to put them into a structure where I can reference them like this: youtube[0][repeated] = 3; youtube[0][download] = "http://www.youtube.com/get_video?video_id=dw1Vh9Yzryo&fmt=36" youtube[1][repeated] = 3; youtube[1][download] = "http://www.youtube.com/get_video?video_id=bOF3o8B292U&fmt=36" youtube[2][repeated] = 3; youtube[2][download] = "http://www.youtube.com/get_video?video_id=yAY4vNJd7A8&fmt=36" "This video was repeated " + youtube[0][repeated] + " times and you can download it here: " + youtube[0][download]; How can I set this multidimensional array up? Been Googling for hours and I don't know how to set it up. Can anyone help me out?

    Read the article

  • Return only the new database items since last check in Rails

    - by Smith
    I'm fairly new to Ruby, and currently trying to implement an AJAX style commenting system. When the user views a topic, all the current comments on that topic will be displayed. The user can post a comment on the page of a topic and it should automatically display without having to refresh the page, along with any new comments that have been posted since the last comment currently displayed to the user. The comments should also automatically refresh at a specified frequency. I currently have the following code: views/idea/view.html.erb <%= periodically_call_remote(:update => "div_chat", :frequency => 1, :position => "top", :url => {:controller => "comment", :action => :test_view, :idea_id => @idea.id } ) %> <div id="div_chat"> </div> views/comment/test_view.html.erb <% @comments.each do |c| %><div id="comment"> <%= c.comment %> </div> <% end %> controllers/comment_controller.rb class CommentController < ApplicationController before_filter :start_defs def add_comment @comment = Comment.new params[:comment] if @comment.save flash[:notice] = "Successfully commented." else flash[:notice] = "UnSuccessfully commented." end end def test_render @comments = Comment.find_all_by_idea_id(params[:idea_id], :order => "created_at DESC", :conditions => ["created_at > ?", @latest_time] ) @latest = Comment.find(:first, :order => "created_at DESC") @latest_time = @latest.created_at end def start_defs @latest = Comment.find(:first, :order => "created_at ASC") @latest_time = @latest.created_at end end The problem is that every time periodically_call_remote makes a call, it returns the entire list of comments for that topic. From what I can tell, the @latest_time gets constantly reset to the earliest created_at, rather than staying updated to the latest created_at after the comments have been retrieved. I'm also not sure how I should directly refresh the comments when a comment is posted. Is it possible to force a call to periodically_call_remote on a successful save?

    Read the article

  • algorithm advice for finding maximum items within a time period

    - by darren
    Hi everyone. I have a database schema that is similar to the following: | User | Event | Date |--------|---------------|------ | 111 | Walked dog | 2009-10-1 | 222 | Walked dog | 2009-10-2 | 333 | Fed Fish | 2009-10-5 | 222 | Did Laundry | 2009-10-6 | 111 | Fed Fish | 2009-10-7 | 111 | Walked dog | 2009-10-18 | 222 | Walked dog | 2009-10-19 | 111 | Fed Fish | 2009-10-21 I would like to produce a query that returns the maximum number of times a user performs some action within a time period. For example, given a time period of 5 days, what is the maximum number of times user 111 walked the dog? The most obvious solution would be to start at some zero point and move forward each day, summing up 5 day periods along the way, then taking the maximum total out of all the 5 day windows. the approach seems incredibly costly however. I would appreciate any suggestions you may have.

    Read the article

  • UItableView Problem in deleting items from database

    - by Arun Sharma
    Hi All, I am using in UitableView database.My table view works successfully (add single item,add multiple item,delete all) only problem is there when i want to delete single item for this i using Uitableview edit option. so how i add database method for deleting single item from database and also from table view. Please help me.

    Read the article

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