w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How can I make list items fill up a div horizontally?
Please upload your code. However if my understanding is correct set the width of the unordered list to 100% this way if should span the full length of the div. ul{ width:100%; } That should do it.

Categories : CSS

Find list index of list items within other list items
Maybe something like?: my_list = ['abc-123', 'def-456', 'ghi-789', 'abc-456'] things_to_find = ['abc', 'def'] for n, e in enumerate(my_list): for m in things_to_find: if m in e: print '%s is in %s at %s' % (m, e, n) Output: abc is in abc-123 at 0 def is in def-456 at 1 abc is in abc-456 at 3

Categories : Python

How to show inner content in list item outside of that list item without being covered up by descending list items
You must set the z-index of the clicked 'li' higher and in return the former clicked 'li' back. Here is the example: fiddle And here the script: var oldli; $('li').click( function(){ $(oldli).toggleClass('displayNone displayBlock'); $(oldli).css("z-index","1"); $(this).toggleClass('displayBlock displayNone'); $(this).css("z-index","5"); oldli=$(this); } );

Categories : Javascript

jQuery replacing list items with different list items with specific classes
You don't have to use .load there, If, classes are already there, you don't have to do anything - Simply remove this Line $(this).load("li a.add-this-list-on-click-instead > *").fadeIn("slow"); and if .add-this-list-on-click-instead are hidden initially - then just make it visible with this - $("#dynamic").click(function() { $this = $(this); var refreshId = setInterval(function() { $('.remove-this-list-on-click').fadeOut("slow", function () { $this.find("a.add-this-list-on-click-instead").fadeIn("slow"); }); }); });

Categories : Jquery

Adding Sharepoint 2010 List Items to a List with external Items
One option is to create an SQL server trigger. This trigger would fire whenever a new sales order is created in your source database. You could make it a CLR trigger, and in the function make use of the SharePoint client interface. After you provided a clearer description of the problem: I believe that you're looking for something like the list event handler. This will run on the events you care about, and you can pull from the database at the appropriate time. Essentially, you need to make a Visual Studio SharePoint project (from my past experience this method requires you to use VS right on the SharePoint server, or else you have to copy a lot of DLLs manually from the server); and make an event receiver.

Categories : SQL

Select items from a List where the children contain the items from another List using LINQ
If you want to return all the products which has all the provided categories in its Categories which means it selects product where it has category1 AND category2. Then you need to use the All with the combination of Contains: public List<Product> FilterProducts(List<Category> categories) { return products.Where(p => categories.All(c => p.Categories.Contains(c)) .ToList(); } If you want to return all the product where it has it least one cetegory from the provided categories which means it selects product where it has category1 OR category2. Then you need to use Any public List<Product> FilterProducts(List<Category> categories) { return products.Where(p => categories.Any(c => p.Categories.Contains(c)

Categories : C#

conditionally adding multiple items to a list of lists via python list comprehension
The line html = BeautifulSoup(urllib2.urlopen('http://domain.com').read(), 'lxml') implies you have lxml installed, so you could use an XPath using | to pull out text or attribute values: import urllib2 import lxml.html as LH html = LH.parse(urllib2.urlopen('http://domain.com')) clean_data = [[elt for elt in tr.xpath('td/a/text() | td/a/@href | td/text()')] for tr in html.xpath('//table[@id="targeted_table"]/tr')] print(clean_data) yields [['http://domain.com', 'data 01', 'data 02', 'data 03', 'data 04'], ['http://domain.com', 'data 11', 'data 12', 'data 13', 'data 14'], ['http://domain.com', 'data 01', 'data 22', 'data 23', 'data 24'], ['http://domain.com', 'data 01', 'data 32', 'data 33', 'data 34']] You could also do it with a single call to the xpath met

Categories : Python

Adding checked items in a custom list view to array list in android
initialize the "ArrayList" ArrayList<List> selectedItems; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home_page); selectedItems = new ArrayList<List>(); }

Categories : Android

Counting visible list items and then applying class to nth item of that list in jQuery?
Use $.each to iterate over the elements and then apply the logic. var $elems = $('.row-fluid ul.thumbnails li:visible'); $elems.each(function() { var $this = $(this); if($this.hasClass('span3')) { $this.filter(':nth-child(4n + 5)').addClass('span-left'); } else if($this.hasClass('span4')) { $this.filter(':nth-child(3n + 4)').addClass('span-left'); } else if($this.hasClass('span6')) { $this.filter(':nth-child(2n + 3)').addClass('span-left'); } });

Categories : Jquery

knockoutjs - How to Create a List style app in with entry before adding list items
You are in fact very close to making it work. The problem was that you did not define the donationAmount observable property in the main view model, which resulted in KnockoutJS failing when binding this unavailable property to the input tag. Here is the part of the code that had to be changed so that it works now: function DonationsViewModel() { var self = this; self.donationAmount = ko.observable(); // .... } and here's some little change to your HTML: <div> <select data-bind="options: availableDonations, optionsCaption: 'Please select...', value: selectedDonation, optionsText: 'label'"></select> <input data-bind="value: donationAmount"/> <button typ="button" data-bind="click: addDonation">Add Donation<

Categories : Knockout Js

Generate unique list item id for all list items in site collection
There is no comparable feature to the documentID service for Items in general out of the box. You would have to build it using Custom code. You can create a custom ID which appends the list GUID and the OOTB item ID which is unique to every item in the site collection.

Categories : Sharepoint

Make check box items indent like an unorderded list inside a list?
Without more info it's difficult to figure out what you want, but I think this may come very close. Just give the labels for the checkboxes display:block. And some cosmetics to make it look right. li label {display:inline-block; max-width:80%; vertical-align:top} See http://jsfiddle.net/MrLister/6VyL6/1 If that's not what you're after, you may have to show some code of your own.

Categories : HTML

Adding specific items from a list to a new list, index out of range error
The simple fix is to wrap your append in a try catch statement. for item in stock_data: try: closing_prices.append(stock_data[count]) except IndexError: break print (closing_prices) count = count + 6 the reason you are getting to the error is that when you get to the 5th to the last item in the list then add 6 to it you are now out of range of the lists maximum index so to speak. Another possible solution is to use a while loop. closing_prices = [] count = 10 while count < len(stock_data): closing_prices.append(stock_data[count]) count += 6 print closing_prices

Categories : Python

Dynamic drop down list - SelectedValue which is invalid because it does not exist in the list of items
You have set the SelectedValue to -1 which must exist. Don't confuse it with the SelectedIndex where -1 indicates that nothing should be selected. So i assume that you actually want: ' ... modelDD.Items.Clear() modelDD.SelectedIndex = -1 ' instead of SelectedValue = -1 ' ...

Categories : Asp Net

Selenium adding items from a Web element list to a string array list
Please try using following sample code, change xpath/data accordingly List<WebElement> resultList = _driver.findElements(By.xpath("//img[contains(@src,'tab-close.png')]/preceding-sibling::span[@class='tab-name ng-binding']")); for (WebElement resultItem : resultList){ String tabname=resultItem.getText(); if(resultItem.getText().equalsIgnoreCase("Dashboard")){ GlobalFunctions.clickOnButtonCustomised(false, _driver, By.xpath("//span[@class='tab-name ng-binding' and contains(text(),'"+tabname+"')]/following-sibling::img[contains(@src,'tab-close.png')]"), ""); } }

Categories : Java

How can I apply a transition onto a list element and make it grow without affecting its background image or the other list items?
I think you just need to reduce the margin top value and the margin bottom value on the #facebook:hover css rule: #nav ul li#facebook:hover{ background-color:#2a4887; padding:5px; margin-left:10px; margin-right:-5px; margin-top:-15px; margin-bottom:0px; } See this fiddle: http://jsfiddle.net/jessekinsman/wgLWT/3/ Not sure if this is what you were trying to get at though. They are lining up at the bottom and the other elements are not moving.

Categories : HTML

Should adding a new item to a list<> update previous items in the list?
You're not adding several different items to the list, you're adding the same exact item several times and modifying it each time. Classes in C# are reference types; that means each variable doesn't hold the data for the object itself, it just hold onto a reference to where that object is. Assigning an object to another variable doesn't create a new object, it just copies the reference to that same object. The issue is that you should be creating a new object (i.e. using the new keyword) each time you go to add a new item to the list. From the looks of your code it would seem that StaticLists.GetStockMultibuyForBarcode(sBarcode) isn't returning a new item each time; it's just returning the same item, or at the very least one of the existing items. You should be creating a new item, co

Categories : C#

Filtering out items from a list using nested list comprehensions in Python
You got the order mixed up: [sentence for sentence in sentences for word in words if banned_word not in sentence] Not that that'll work as that'll list the sentence every time a banned word does show up in the sentence. Take a look at the fully expanded nested loops version: for sentence in sentences: for word in words: if banned_word not in sentence: result.append(sentence) Use the any() function to test for banned words instead: [sentence for sentence in sentences if not any(banned_word in sentence for banned_word in words)] any() loops over the generator expression only until a True value is found; it'll stop doing work the moment a banned word is found in the sentence. This is more efficient at least.

Categories : Python

delete items from a list that equals to index of other list item
checkboxtry this: <ul id="listone"> <li><input type="checkbox" class='chk' value="item1"/>item 1</li> <li><input type="checkbox" class='chk' value="item2"/>item 2</li> <li><input type="checkbox" class='chk' value="item3"/>item 3</li> </ul> <ul id="listtwo"> <li class="list_item1">item 1</li> <li class="list_item2">item 2</li> <li class="list_item3">item 3</li> </ul> <ul id="listThree"> <li class="list_item1">other item 1</li> <li class="list_item2">other item 2</li> <li class="list_item3">other item 3</li> </ul> $(".chk").click(function () { var isChecked = $(this).is(':checked'); if (!isChecked) {

Categories : Javascript

Make a list out of items in a sublist of a multidimensional list (python)
Using a list comprehension: L = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] M = [y for [x, y, z] in L]

Categories : Python

Find duplicate items within a list of list of tuples Python
Update: After rereading your question, it appears that you're trying to create equivalence classes, rather than collecting values for keys. If [[(1, 2), (3, 4), (2, 3)]] should become [(1, 2, 3, 4)] , then you're going to need to interpret your input as a graph and apply a connected components algorithm. You could turn your data structure into an adjacency list representation and traverse it with a breadth-first or depth-first search, or iterate over your list and build disjoint sets. In either case, your code is going to suddenly involve a lot of graph-related complexity, and it'll be hard to provide any output ordering guarantees based on the order of the input. Here's an algorithm based on a breadth-first search: import collections # build an adjacency list representation of you

Categories : Python

Make a list containing distinct list items from dataset containing duplicates
Since Dictionary won't allow for duplicate entries (it throws an ArgumentException was unhandled exception), thus handling the "heavy lifting" of ensuring uniqueness and sequence order (still testing that one). I think I'm using GSI.Sequence wrong because there could be multiple sequences for receipe items. (This is NOT the answer, but a place I could put code. I hope I did it right) Hat tip to http://williablog.net/williablog/post/2011/08/30/Generic-AddOrUpdate-Extension-for-IDictionary.aspx while(reader.Read()) { RecipeItems GSI = new RecipeItems(); GSI.RecipeItem = reader[0].ToString(); GSI.Sequence = Convert.ToInt32(reader[1].ToString()); GSI.RecipeName = reader[2].ToString();

Categories : C#

Linq how to query a list of items for a combined list of a child collection based on a property of the parent item
You may just want to group the invoice headers by the group: var groups = invoiceHeader.GroupBy(ih => ih.Group); Then you can access the lines of the groups: foreach(var group in groups) { Console.WriteLine("Group " + group.Group); Console.WriteLine("Lines:"); Console.WriteLine(string.Join(", ", group.SelectMany(h => h.InvoiceHeader.InvoiceLines))); } Output would be something like Group A Lines: invoice1, invoice2, invoice3, invoice4 Group B Lines: invoice5, invoice6, invoice7, invoice8

Categories : C#

In Scala getting a list from certain items of a different list or file respectivly
You could do for example: val s = Source.fromFile("fileWithNumbers") val nums = for { line <- s.getLines num <- line.split(',') } yield num.toInt This will get you all the numbers of all the lines in a single list. Note that it will throw an exception if you there is a string that cannot be converted to an Int.

Categories : List

Python list comprehension: list sub-items without duplicates
You can use set to remove the duplicates but the order is not maintained. >>> letterlist = list({x for y in wordlist for x in y}) >>> letterlist ['a', 'c', 'b', 'd', 'g', 'i', 'o', 'r', 't'] >>>

Categories : Python

Add items with same date to sub list of item main list
You can try something like this, using linq var mySubList = lessons.Where(l => l.HOURstartDT == AddYourDataHere); mySubList.ForEach(item => { lessons.remove(item); }); Not sure I understand the full question, but this will be a start

Categories : C#

How to delete random items in a list to keep the list in a certain length?
Shuffle the list first and then slice it: from random import shuffle random.shuffle(your_lis) your_lis = your_lis[:10000] If order matters: from random import randrange diff = len(your_lis) - 10000 for _ in xrange(diff): ind = randrange(len(your_lis)) your_lis.pop(ind) #a quick timing check suggests that `pop` is faster than `del`

Categories : Python

Android using another XML list items combined with an array list
What you need to understand is the use of adapters. You have 3 things. Activity (user interface), Data (which you want to display on the user interface) and Adapter (the link between the Data source and the Activity which gets displayed to the user. This is a very good tutorial on using adapters: http://www.vogella.com/articles/AndroidListView/article.html In fact, there are lots of them. Google "Android ListView Adapter tutorial" and read through a couple and see different ways people use Custom Adapters to get a hang of their structure.

Categories : Android

Can List.Distinct() apply to the list type of List>?
That's because List<T> has no Equals and GetHashCode implemented, so standard reference comparison is being performed. And it returns false, because you have two separated lists. You can write your own IEqualityComparer<List<string>> implementation and provide it as Distinct method parameter. Within the comparer you can use Enumerable.SequenceEqual) method to check if lists has the same content.

Categories : C#

Linq - How to select items from a list that contains only items of another list?
This returns the items which all states are in stateList, I think that that's what you need: Items.Where(x => x.TestList.All(s => stateList.Contains(s.State)));

Categories : C#

Move First 10 List Items to Another Item List
Try this: NewItems.AddRange(OldItems.Take(10)); OldItems = OldItems.Skip(10).ToList(); alternate: NewItems.AddRange(OldItems.Take(10)); OldItems.RemoveRange(0,10); Take will take x first items from your list look here. Skip will skip x elements from your list look here. RemoveRange is an alternative option if you will use lists reference. As Matthew said second option won't create new list and do removal in-place, so it's prefered.

Categories : C#

Check if one list contains all items from another list in order
Here's a quick way: var equal = listA.Count - listB.Count < 0 ? false : Enumerable.Range(0, listA.Count - listB.Count).Any(i => listA.Skip(i).Take(listB.Count).SequenceEqual(listB)); However, I'd prefer to use an extension method like this: public static bool ContainsSequence<T>(this IEnumerable<T> outer, IEnumerable<T> inner) { var innerCount = inner.Count(); for(int i = 0; i < outer.Count() - innerCount; i++) { if(outer.Skip(i).Take(innerCount).SequenceEqual(inner)) return true; } return false; } which you can call like: var equals = listA.ContainsSequence(listB); And here's a more efficient version of the same extension method specific to List<T&g

Categories : C#

Sorting List according to an array that contains list items Ids
Why not generate your list of countries from the IDs: IEnumerable<Country> tripCountries = usedCountriesIds.Select(uc => LeafCountries.Single(lc => lc.ID == uc));

Categories : C#

How do I check to see if all of the items in one list are in a second list in python?
>>> '[%s]'%"test_1" '[test_1]' You are checking if "[test_1]" is a substring of some string in list_B, and so forth. This should work: for item in List_A: match = any(item in b for b in List_B) print "%10s %s" % (item, "Exists" if match else "No Match in List B") But since you are not really looking for substrings, you should test in and nothing more: for item in List_A: match = item in List_B print "%10s %s" % (item, "Exists" if match else "No Match in List B") but you can simply use set difference: print set(List_A) - set(List_B)

Categories : Python

How to select multiple items from dropdown list, save it and again repopulate the dropdown with the selected list?
The default DropDown helper that is provide in asp.net mvc does not support multiselet. You'll have to create your own custom multiselect dropdown helper. Here are some links that can help you create you own custom dropdown helper: http://blogs.msdn.com/b/rickandy/archive/2012/01/30/asp-net-mvc-dropdownlist-multiselect-and-jquery.aspx http://utsavized.com/chosen-multiselect-dropdown-list-with-asp-net-mvc3/

Categories : Asp Net Mvc

iterating list of array-list and assigning each list to single dynamically created div in jsp
Try this, <c:forEach var="user" items="${userList}" varStatus="count"> <div id="col${count}"> <c:out value="${user.name}"/> </div> </c:forEach>

Categories : Java

Python: given a list of lists, create a list ordered by the number of occurrences in inner list
You can use collections.Counter to keep a counter for each element inside each sublist. Something like this, >>> from collections import Counter >>> lst = [['a','b','c'], ['a'], ['a','b']] >>> counts = Counter() >>> for sublst in lst: ... for ele in sublst: ... counts[ele] += 1 ... >>> [ele for ele, _ in counts.most_common()] ['a', 'b', 'c']

Categories : Python

In a responsive site design, how do i put a list below other list that contains a sub-list without overlap the main lists
Pretty simple : remove the fixed height of your li.menulinks, add a "header" (green rounded rectangle with 35px height) div as first child of the li and...you're set ! Look at this fiddle : http://jsfiddle.net/32pga/ <div class="sitemap"> <div class="row-fluid"> <ul> <li class="menulinks"> <div class="menulinks-header"></div> <ul> <li class="submenulinks"> <div>Test 1</div> </li> <li class="submenulinks"> <div>Test 2</div> </li> <li class="submenulinks"> <div>Test

Categories : HTML

How do I append list items
  • from an Unordered list
  • var lists = { numbers: [], AH: [], IP: [], QZ: [] }; $('.brand').each(function () { var letter = $.text(this).substr(0, 1); if ( /d/.test(letter) ) { lists.numbers.push(this); } else if ( /[a-h]/i.test(letter) ) { lists.AH.push(this); } else if ( /[i-p]/i.test(letter) ) { lists.IP.push(this); } else if ( /[q-z]/i.test(letter) ) { lists.QZ.push(this); } }); $('.brand-directory-list-num').append( lists.numbers ); $('.brand-directory-list-ah').append( lists.AH ); $('.brand-directory-list-ip').append( lists.IP ); $('.brand-directory-list-qz').append( lists.QZ ); Here's the fiddle: http://jsfiddle.net/q697n/ If you want to make the code a little DRYer, you can store the regular expressions in a map objec

    Categories : Javascript

    How to modify the style in list(ordered list and unordered list) in HTML?
    Here you go. WORKING DEMO The HTML: <ul style="list-style-type:decimal;"> <li>First</li> <li>Second</li> <li>Third</li> </ul> The CSS: li{ position: relative; } li:before{ position: absolute; left: -13px; content: ')'; background:white;} Hope this helps.

    Categories : HTML



    © Copyright 2017 w3hello.com Publishing Limited. All rights reserved.