Search Results

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

Page 57/538 | < Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >

  • Python: Get items at depth? (set library?)

    - by Mark
    I have a nested list something like this: PLACES = ( ('CA', 'Canada', ( ('AB', 'Alberta'), ('BC', 'British Columbia' ( ('van', 'Vancouver'), ), ... )), ('US', 'United States', ( ('AL', 'Alabama'), ('AK', 'Alaska'), ... I need to retrieve some data out of it. If depth is 0 I need to retrieve all the countries (and their codes), if depth == 1, I need to retrieve all the states/provinces, if depth == 2 I need to retrieve all the cities... and so forth. Is there some set library for doing stuff like this? Or can someone point me in the right direction? I started coding up a solution only to realize it wouldn't work for levels deeper than 1 because you have to go in and out of each list...

    Read the article

  • What options exist to get text/ list items to appear in columns?

    - by alex
    I have a bunch of HTML markup coming from an external source, and it is mainly h3 elements and ul elements. I want to have the content flow in 3 columns. I know there is something coming in CSS3, but what options do I have to get this content to flow nicely into the 3 columns at the time being? I'm not that concerned about IE6 (as long as it degrades gracefully). Am I stuck using jQuery to parse the markup and chop it up into 3 divs which float? Thank you Update As per request, here is some of the HTML I am working with <h3>Tourism Industry</h3> <ul> <li><a href="">Something</a></li> <li><a href="">Something</a></li> <li><a href="">Something</a></li> <li><a href="">Something</a></li> </ul> <h3>Small Business</h3> <ul> <li><a href="">Something</a></li> <li><a href="">Something</a></li> <li><a href="">Something</a></li> <li><a href="">Something</a></li> <li><a href="">Something</a></li> </ul> And a whole lot more following the same format.

    Read the article

  • How to make msbuild ItemGroup items be separated with a space rather than semi-colon?

    - by mark
    Dear ladies and sirs. Observe the following piece of an msbuild script: <ItemGroup> <R Include="-Microsoft.Design#CA1000" /> <R Include="-Microsoft.Design#CA1002" /> </ItemGroup> I want to convert it to /ruleid:-Microsoft.Design#CA1000 /ruleid:-Microsoft.Design#CA1002 Now, the best I came up with is @(R -> '/ruleid:%(Identity)'), but this only yields /ruleid:-Microsoft.Design#CA1000;/ruleid:-Microsoft.Design#CA1002 Note the semi-colon separating the two rules, instead of a space. This is bad, it is not recognized by the fxcop - I need a space there. Now, this is a simple example, so I could just declare something like this: <PropertyGroup> <R>/ruleid:-Microsoft.Design#CA1000 /ruleid:-Microsoft.Design#CA1002</R </PropertyGroup> But, I do not like this, because in reality I have many rules I wish to disable and listing all of them like this is something I wish to avoid.

    Read the article

  • Ruby on Rails: How to find all items with a hash that contain a specific value...

    - by kingjeffrey
    Suppose I have three models: Student, SchoolClass, and DayOfWeek. There is a HABTM relationship between Student and SchoolClass, and between SchoolClass and DayOfWeek. What I'd like to do is find all school classes belonging to a given student that meet on Monday. Now I suppose I could do something like: @student = Student.find(:student_id) @student_classes = @student.school_classes.find(:all) @student_classes_on_monday = Array.new @student_classes.each do |student_class| if student_class.day_of_week.include?("Monday") @student_classes_on_monday << student_class end end But there has to be a more elegant way. Can you help me find it?

    Read the article

  • how to get items that hasnot got a certain class in jquery?

    - by manraj82
    <ul id ='caseStudies'> <li class="humor crime fantasy hidden"> A </li> <li class="crime"> B </li> <li class="humor crime hidden"> C </li> <li class="humor crime"> D </li> <li class="humor crime fantasy action hidden"> E </li> <li class="fantasy action"> F </li> <li class="humor fantasy"> G </li> <li class="crime action hidden"> H </li> </ul> $('ul#caseStudies li.hidden').each(function() { }//this will get all the LI in the UL that has got class 'hidden' But how do i get all the LI in the UL that hasn got a class 'hidden'?

    Read the article

  • select n largest using LINQ

    - by Mathias
    This is likely a novice question about LINQ, but assuming I have a set of Items with a DateTime property, one date having at most one item, how would I go about selecting the N most recent items from a date of reference, that is, the N items which have a date smaller that the requested date, and the largest date? My naive thought would be to first select items with a date smaller than the reference date, sort by date, and select the N first items from that subset. var recentItems = from item in dataContext.Items where item.Date<=date orderby item.Date descending select item; var mostRecentItems = recentItems.Take(5).ToList(); Is this the "right" way to do it, or are there obviously better ways to achieve my goal?

    Read the article

  • Creating a json array and json items with jquery?

    - by user246114
    Hi, I made a simple javascript class like this: function Horse() { this.color = 'brown'; this.speed = 'somewhat slow'; } I attached a few instances to some elements, like this: $("#horse1").data('d', new Horse()); $("#horse2").data('d', new Horse()); $("#horse3").data('d', new Horse()); now I want to create a JSON array with a JSON representation of each horse object. So I'm doing this: // How do I create an empty JSON array here?: var myJsonArray = ?; var children = $("#horses").children(); for (var i = 0, m = children.size(); i < m; i++) { var panel = children[i]; var horse = $(panel).data('h'); // And how do I create a JSON rep of my horse here? var myJsonHorse = new JsonHorse(?); // Finally, how do I add it to the json array? myJsonArray.push(myJsonHorse); } yeah my end goal is to have a single json array of all the horses after iterating over all the children - not sure if this should be done in plain javascript or in jquery? Thanks

    Read the article

  • Ruby: UnknownAttributeError

    - by Flexo
    Hi i have some Orders that can have several Items and these Items have an associated Kind. The Kind can belong to many Items. but i get a "unknown attribute: kinds" in my OrdersController when i hit the submit form button. I use nested forms btw. Order.rb class Order < ActiveRecord::Base validates_presence_of :ref_nr, :total_price has_many :items, :dependent => :destroy has_many :kinds, :through => :items accepts_nested_attributes_for :items accepts_nested_attributes_for :kinds validates_associated :items validates_associated :kinds end Item.rb class Item < ActiveRecord::Base belongs_to :order has_one :kind accepts_nested_attributes_for :kind validates_associated :kind end Kind.rb class Kind < ActiveRecord::Base belongs_to :item end OrdersController.rb:Create def create @order = Order.new(params[:order]) end new.erb.html <% form_for @order do |f| %> <%= f.error_messages %> <% f.fields_for :items do |builder| %> <table> <tr> <% f.fields_for :kinds do |m| %> <td><%= m.collection_select :kind, Kind.find(:all, :order => "created_at DESC"), :id, :name, {:prompt => "Select a Type" }, {:id => "selector", :onchange => "type_change(this)"} %></td> <% end %> <td><%= f.text_field :amount, :id => "amountField", :onchange => "change_total_price()" %></td> <td><%= f.text_field :text, :id => "textField" %></td> <td><%= f.text_field :price, :class => "priceField", :onChange => "change_total_price()" %></td> <td><%= link_to_remove_fields "Remove Item", f %></td> </tr> </table> <% end %> <p><%= link_to_add_fields "Add Item", f, :items %></p> <p> <%= f.label :total_price %><br /> <%= f.text_field :total_price, :class => "priceField", :id => "totalPrice" %> </p> <p><%= submit_tag %></p> <% end %> i cant see what im missing

    Read the article

  • C# Property Access vs Interface Implementation

    - by ehdv
    I'm writing a class to represent a Pivot Collection, the root object recognized by Pivot. A Collection has several attributes, a list of facet categories (each represented by a FacetCategory object) and a list of items (each represented by a PivotItem object). Therefore, an extremely simplified Collection reads: public class Collection { private List<FacetCategory> categories; private List<PivotItem> items; // other attributes } What I'm unsure of is how to properly grant access to those two lists. Because declaration order of both facet categories and items is visible to the user, I can't use sets, but the class also shouldn't allow duplicate categories or items. Furthermore, I'd like to make the Collection object as easy to use as possible. So my choices are: Have Collection implement IList<PivotItem> and have accessor methods for FacetCategory: In this case, one would add an item to Collection foo by writing foo.Add(bar). This works, but since a Collection is equally both kinds of list making it only pass as a list for one type (category or item) seems like a subpar solution. Create nested wrapper classes for List (CategoryList and ItemList). This has the advantage of making a consistent interface but the downside is that these properties would no longer be able to serve as lists (because I need to override the non-virtual Add method I have to implement IList rather than subclass List. Implicit casting wouldn't work because that would return the Add method to its normal behavior. Also, for reasons I can't figure out, IList is missing an AddRange method... public class Collection { private class CategoryList: IList<FacetCategory> { // ... } private readonly CategoryList categories = new CategoryList(); private readonly ItemList items = new ItemList(); public CategoryList FacetCategories { get { return categories; } set { categories.Clear(); categories.AddRange(value); } } public ItemList Items { get { return items; } set { items.Clear(); items.AddRange(value); } } } Finally, the third option is to combine options one and two, so that Collection implements IList<PivotItem> and has a property FacetCategories. Question: Which of these three is most appropriate, and why?

    Read the article

  • Query to retrieve records by aplhabetic order, except for n predefined items which must be on top

    - by Ashraf Bashir
    I need to retrieve all records ordered alphabetically. Except for a predefined list of record's columns which their records should appear first in a given predefined order, then all other records should be sorted alphabetically based on the same column For instance, assume we have the following table which is called Names Lets assume the predefined list is ("Mathew", "Ashraf", "Jack"). I.e. these are the names of whom their records should be listed first as in the predefined order. So the desired query result should be: Which query could retrieve this custom order ? P.S, I'm using MySQL. Here's my trial based on comments' request: (SELECT * FROM Names WHERE Name in ('Mathew', 'Ashraf', 'Jack')) UNION (SELECT * FROM Names WHERE Name NOT IN ('Mathew', 'Ashraf', 'Jack') ORDER BY Name ASC); the first query result wasn't ordered as required.

    Read the article

  • How to access items by "group" in an Outlook VB macro?

    - by Noah Yetter
    By "group" I mean the collapsible classifications that you get when you enable View-Arrange By-Show in Groups. This divides e.g. messages in a folder into Today, Yesterday, Last Week, Two Weeks Ago, and so on. What I'd like to be able to do is iterate over the messages that are currently classified within a given group. Is this possible?

    Read the article

  • How to make items fill available space in JToolBar?

    - by Konrad Garus
    I have a horizontal JToolbar with JToggleButtons. For some reason it is placed in a container that has larger height. My JToggleButtons use only as much space as they need, leaving ugly empty space below and under them. How can I make them fill all available space without setting size arbitrarily? Similar question: How I can make components fill all horizontal space in a vertical tool bar?

    Read the article

  • How to keep the popup menu of a JComboBox open on populating it ?

    - by Stormshadow
    I have a JComboBox on my Panel. One of the popup menu items is 'More' and when I click that I fetch more menu items and add them to the existing list. After this, I wish to keep the popup menu open so that the user realizes that more items have been fetched however, the popup closes. The event handler code I am using is as follows public void actionPerformed(ActionEvent e) { if (e.getSource() == myCombo) { JComboBox selectedBox = (JComboBox) e.getSource(); String item = (String) selectedBox.getSelectedItem(); if (item.toLowerCase().equals("more")) { fetchItems(selectedBox); } selectedBox.showPopup(); selectedBox.setPopupVisible(true); } } private void fetchItems(JComboBox box) { box.removeAllItems(); /* code to fetch items and store them in the Set<String> items */ for (String s : items) { box.addItem(s); } } I do not understand why the showPopup() and setPopupVisible() methods are not functioning as expected.

    Read the article

  • How to use CSS to ensure items remain offscreen even if window is resized?

    - by Ashley Ward
    I am trying to implement a type of slider using jquery. However this question is about the CSS involved in trying to achieve the functionality. My site design occupies a central column of width 960px. Within this layout there is a central element, that I wish to slide right, on click of a "next" button, and at the same time, another element of the same class slides in from the left to occupy the space vacated. I have drawn a diagram of what I am trying to achieve. In this diagram the red blocks are the element I want to slide in and out, it is grouped by a div which moves left to produce the effect using jQuery I have 2 main questions: How do I get the correct margin values, given that the browser window width can vary and that all elements that are not the current item should be offscreen? 2.If the user were to resize the margins could be dynamically altered based on the values returned using the jQuery resize() event. Or is there a neater quicker better way of doing it using pure CSS?

    Read the article

  • Is it possible to guarantee a unique id for multiple items using the same id variable at a point in

    - by Scarface
    First of all, do not be overwhelmed by the long code, I just put it for reference...I have a function that preg_replaces content and puts it in a jquery dialog box with a matching open-link. For example, if there is a paragraph with two matches, they will be put inside two divs, and a jquery dialog function will be echoed twice; one for each div. While this works for one match, if there are multiple matches, it does not. I am not sure how to distribute unique ids at a point in time for each of the divs and matching dialog open-scripts. Keep in mind, I removed the preg replace function since it kind of complicates the problem. If anyone has any ideas, they will be greatly appreciated. <?php $id=uniqid(); $id2=uniqid(); echo "<div id=\"$id2\"> </div>"; ?> $.ui.dialog.defaults.bgiframe = true; $(function() { $("<?php echo"#$id2"; ?>").dialog({hide: 'clip', modal: true ,width: 600,height: 350,position: 'center', show: 'clip',stack: true,title: 'title', minHeight: 25, minWidth: 100, autoOpen: false}); $('<?php echo"#$id"; ?>').click(function() { $('<?php echo"#$id2"; ?>').dialog('open'); }) .hover( function(){ $(this).addClass("ui-state-hover"); }, function(){ $(this).removeClass("ui-state-hover"); } ).mousedown(function(){ $(this).addClass("ui-state-active"); }) .mouseup(function(){ $(this).removeClass("ui-state-active"); }); });

    Read the article

  • Any way to animate new elements in a GridView being added?

    - by Ben L.
    My app polls a server every 15 seconds to see if there are any new items to display, then downloads the new items and disposes of the old items so that there are always exactly 100 items in the GridView. Unfortunately, this process can be confusing to the user if they see a page of images change without knowing where the items went. My idea is that there could be some kind of animation (such as the new items being inserted at the top and pushing the older ones down the list) to show what action is happening. Unfortunately, I have no clue how to make this animation happen. Is my idea even possible? How would I accomplish this?

    Read the article

  • How can I use SQL to select duplicate records, along with counts of related items?

    - by mipadi
    I know the title of this question is a bit confusing, so bear with me. :) I have a (MySQL) database with a Person record. A Person also has a slug field. Unfortunately, slug fields are not unique. There are a number of duplicate records, i.e., the records have different IDs but the same first name, last name, and slug. A Person may also have 0 or more associated articles, blog entries, and podcast episodes. If that's confusing, here's a diagram of the structure: I would like to produce a list of records that match this criteria: duplicate records (i.e., same slug field) for people who also have at least 1 article, blog entry, or podcast episode. I have a SQL query that will list all records with the same slug fields: SELECT id, first_name, last_name, slug, COUNT(slug) AS person_records FROM people_person GROUP BY slug HAVING (COUNT(slug) > 1) ORDER BY last_name, first_name, id; But this includes records for people that may not have at least 1 article, blog entry, or podcast. Can I tweak this to fit the second criteria?

    Read the article

  • Best way to insert items from a Derived class's constructor into a Base class's private std::vector?

    - by Will
    I have these classes: class Base { ... private: std::vector<X> v; }; class Derived { Derived(X*, int n); } where the constructor of Derived is passed an array of item Xs, which I need to insert into my vector v in the Base class. (X is a smart pointer) Currently I see two ways to do this: 1) Create a function in Base: InsertItem(X*) that will insert an item into the vector. 2) Create a vector in Derived that contains the full list, then get it into Base by moving the entire vector. I dont see any advantages to #2, but was wondering if #1 was a good solution, or if there are better ways to do this. Thanks!

    Read the article

  • ASP.NET - DropDown DataBinding (Rebind?)

    - by Bob Fincheimer
    I have a drop down which has a method which binds data to it: dropDown.Items.Clear() dropDown.AppendDataBoundItems = True Select Case selType Case SelectionTypes.Empty dropDown.Items.Insert(0, New ListItem("", "")) Case SelectionTypes.Any dropDown.Items.Insert(0, New ListItem("ANY", "")) Case SelectionTypes.Select dropDown.Items.Insert(0, New ListItem("Select One", "")) End Select BindDropDown(val) The BindDropDown method simply sets the datasource, datakeyname, datavaluename, and then databinds the data. For a reason which I cannot avoid, I MUST call this method twice sometimes. When it is called twice, All of the databound items show up two times, but the top item (the one I manually insert) is there only once. Is ASP doing something wierd when i databind twice even though i clear the list between? Or does it have to do something with the viewstate/controlstate? EDIT__ The entire page, and this control has EnableViewState="false" EDIT___ The dropdown is inside a form view. After the selected value is set I have to rebind the dropdown just in case the selected value is not there [because it is an inactive user]. After this, the formview duplicates the databound items.

    Read the article

< Previous Page | 53 54 55 56 57 58 59 60 61 62 63 64  | Next Page >