w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
the delete Item of a list doesn't work
you use _id as column but you have not it. your create query is @Override public void onCreate(SQLiteDatabase dc) { dc.execSQL("CREATE TABLE " + TABLE_CLIENT + " (id INTEGER PRIMARY KEY, nom_complet TEXT NOT NULL, adresse_client TEXT NOT NULL, numero_telephone TEXT NOT NULL)"); } or you change the the query inside onCreate (id for _id), or use id in the delete query public void onListItemClick(final ListView parent, View v, final int position, final long id) { selectionc.setText("Vous êtes sur : " + stg1[position]); AlertDialog.Builder builder = new AlertDialog.Builder(this) .setTitle("Delete Item") .setMessage("are you sure to delete?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { @Override

Categories : Android

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#

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

Foreach property in item from list
Foreach only works with an enumerable item, and general classes don't implement IEnumerable. You need to put each item on there yourself. The best way would be to use something like Html.TextBoxFor(m => m.Property) for each property. edit: The best way would be to just use Html.LabelFor on the object itself. @for(int index = 0; index < Model.Count; ++index) { <tr> @Html.LabelFor(m => m[index]) <tr> }

Categories : Asp Net Mvc

WPF How to bind list to itemscontrol with each item being paired to a customcontrol and bound to the ith item in list
The DataContext for each UI item in the ItemsControl will automatically be assigned to the corresponding Data Item in the source Collection. Therefore this is valid and will work: <ItemsControl x:Name ="Signalviewer_Control" ItemsSource="{Binding Source = {StaticResource signal_data}, Path = list_of_signals}"> <ItemsControl.ItemTemplate> <DataTemplate> <wpfExp:SignalViewer Signal="{Binding}"/> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl>

Categories : Wpf

Python list manipulation: Add an item to a string element to make it a 2 item list
Modify a[0]: >>> a = ['spam', 'eggs', 100, 1234] >>> a[0] = [a[0], 'Devon'] >>> a [['spam', 'Devon'], 'eggs', 100, 1234] For your updated question: >>> items = ['devon', 'baloney'] >>> a = ['spam', 'eggs', 100, 1234] >>> a[0] = [a[0]] + items >>> a [['spam', 'devon', 'baloney'], 'eggs', 100, 1234] If you're not sure about the position of 'spam' then use a list comprehension: >>> a = ['spam', 'eggs', 100, 1234] >>> [item if item != 'spam' else [item, 'devon'] for item in a] [['spam', 'devon'], 'eggs', 100, 1234]

Categories : Python

Click on list item of a ListView doesn't respond
You should define on all of the child objects in the item listview (TextView, ImageView etc.): android:clickable="false" android:focusable="false" android:focusableInTouchMode="false" And for the root item RelativeLayout / LinearLayout and so, define: android:clickable="false" android:descendantFocusability="blocksDescendants" android:focusable="false" android:focusableInTouchMode="false" If you won't define those, they will "catch" the click event. And if you have a Custom listView adapter, just check that you override: @Override public boolean isEnabled(int position) { return true; }

Categories : Android

C List Pop doesn't work on first run
I just used your code with my implementation of GetOperations() and Print(). The code works fine. //Structure to represent node typedef struct node { char *data; struct node * next; } Node; //Pop top value from Linked list Node * Pop (Node ** head) { if (*head == NULL) { printf("Error popping! List is empty. "); return NULL; } Node * temp = *head; *head = (*head)->next; return temp; } //Create node and save data Node *createNode(int i) { char *n=malloc(sizeof(4*sizeof(char))); n[0]='O'; n[1]='p'; n[2]=(char)(((int)'0')+i); n[3]=''; Node *temp=(Node*)malloc(sizeof(struct node)); temp->data=n; temp->next=NULL; return temp; } //Create a list with data Node* GetOperations() { int i; Node *head=NULL,*curre

Categories : C

To do list example doesn't work for me
first check whether myEditText.setOnKeyListener is getting fired when you pressing Enter. If yes then add these properties in your edittext xml ndroid:singleLine="true" android:lines="1" Hope it will work.

Categories : Java

Background of Div with list doesn't work
Add overflow:auto; to #topbar. Check: http://jsfiddle.net/NGyWu/12/ Alternatively you can use clearfix

Categories : HTML

ThreadLocal and list doesn't work
You invoke run() method instead of start(). run() runs in the same thread it is invoked, while start() invokes run() in a new, separate thread. In effect, all your "threads" are executed in the same thread.

Categories : Java

Why does horizontal list item justification not work with dynamically added items
The principal difference between the static version and the dynamic version is that the static version has whitespace between each element. To fix the dynamic version, you need to also append some whitespace: list.appendChild(document.createTextNode(" ")); Here's a demo: http://jsfiddle.net/thirtydot/kQNNe/1/

Categories : Javascript

wrap_content doesn't work on list view
I want to add little comment, but my reputation isn't enough to. And my opinion could be wrong. Karakuri's answer on CommonsWare's links is exactly right answer i think. and this google guy said why we shouldn't use wrap_content on ListView. http://www.youtube.com/watch?v=wDBM6wVEO70&t=40m40s And about your comment, my opinion is that, ScrollView's height is probably wrap_content with scroll vertically. If then, ScrollView's height will be adapter's height or ImageView's height. Bcuz, ScrollView doesn't care how many ListItem should be displayed. It only check how many view or groupview is exist inside of itself. And I also recommend you don't use ListView inside of ScrollView (or opposite). Because, both view have to check touch-move event to scroll their view. If you mix it, andr

Categories : Android

why reversed() list iteration with step doesn't work properly?
Reversed takes a list and reverses it. The slicing notation iterates over the list and returns a new one. When you call reversed on the slice (with or without stepping) of a list, the slice is created first, and then reversed. For example, newL = reversed(L[0:len(L):2]) is the same as: M = L[0:len(L):2] newL = reversed(M) Thus, when you say reversed(L[0:len(L)-1:2]), reversed is called on a list containing every other element in L, starting with the first, and excluding the last. As a side note, L[::2] is the same as L[0:len(L):2], and L[:-1:2] is the same as L[0:len(L)-1:2]. Also, L[::-1] is L in reverse order. This notation is very powerful. If you want a checkio([5, 8, 13, 27, 14]) to return [14, 13, 5, 27, 8], then here are a few ways to do it: >>> L = [5, 8, 13, 27, 1

Categories : List

i18next and JQuery doesn't work in form's drop down list
I found a workaround. I noticed that when I sent my form and reset it, the dropdown list was correclty displayed. So after initializing i18n, I used this: document.getElementById("form").reset(); The form is now displayed correctly.

Categories : Jquery

Is it possible plot using ordered dictionary or list, OrderedDict doesn't work
Something like this? I assume you are trying to sort the dictionary by value pylab.plot(*zip(*sorted(dc.items(), key=lambda x:x[1]))) To switch the axes use this pylab.plot(*reversed(zip(*sorted(dc.items(), key=lambda x:x[1])))) To sort by key, just leave the key=... out

Categories : Python

Python: Split a list into nested list at points where item matches criteria
Something like this: li = [1,2,3,4000,5,6,7,8,9000,10,11,12,1300] r = [[]] # start with a list containing an empty sub-list for i in li: if i >= 2000: # start a new sub-list when we see a big value r.append([i]) else: # append to the last sub-list of r r[-1].append(i)

Categories : Python

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

Show SQLite data by clicking list item in a list populated by the Database
You need to change focusable mode of your TextView to false update TextView in XML android:focusable="false" lv.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int position, long id) { data.moveToPosition(position); Toast.makeText(getApplicationContext(), c.getString(c.getColumnIndex("notes")), Toast.LENGTH_LONG).show(); speakOut(c.getString(c.getColumnIndex(BaseColumns._ID))); } });

Categories : Android

Appending an item to a python list in the declaration statement list = [].append(val) is a NoneType
The .append() function alters the list in place and thus always returns None. This is normal and expected behaviour. You do not need to have a return value as the list itself has already been updated. Use the dict.setdefault() method to set a default empty list object: >>> hash = {} >>> hash.setdefault('a', []).append('A') >>> hash {'a': ['A']} You may also be interested in the collections.defaultdict class: >>> from collections import defaultdict >>> hash = defaultdict(list) >>> hash['a'].append('A') >>> hash defaultdict(<type 'list'>, {'a': ['A']}) If you want to return a new list with the extra item added, use concatenation: lst = lst + ['val']

Categories : Python

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

Kendo UI Web - Drop-down list, different background color on each list item.
There is one easy part and one difficult part. The easy is getting the background the difficult is making it look nice. Easy, define a template for rendering each list item: <script id="template" type="text/kendo-tmpl"> <div style="background-color: #= text #;">#= text #</div> </script> And then define your ComboBox as: $(document).ready(function () { $('#combobox').kendoComboBox({ template : $("#template").html() }); }); but this is likely to do not be as nice as you want since before the <div> from my template there is a <li> introduced by KendoUI and unless you want to start playing with it, you might consider just displaying a color square with the item color. You can do something like: Start defining a CSS for the color

Categories : CSS

Is it possible to paste a list to a select2 field and match each item in the list?
select2 provides a tokenizer option that lets you pre-process the input. here is a possible implementation for your particular usecase: tokenizer: function(input, selection, callback) { // no comma no need to tokenize if (input.indexOf(',')<0) return; var parts=input.split(","); for (var i=0;i<parts.length;i++) { var part=parts[i]; part=part.trim(); // todo: check for dupes (if part is already in [selection]) // check if the part is valid // todo: you will need a better way of doing this var valid=false; for (var j=0;j<unitIds.length;j++) { if (part===unitIds[j]) { valid=true; break; } } if (valid) callback({id:part,text:p

Categories : Jquery

How to I generate a CSV file from a python list with each list item in a seperate row
Use writerows as follow: myfile = open('/home/graham/Desktop/Experiment/listcsv.csv', 'wb') wr = csv.writer(myfile, quoting=csv.QUOTE_ALL) wr.writerows([path] for path in list_of_paths)

Categories : Python

Refreshing the order of an ordered list, after appending a list item
Firstly, note that value is not a valid attribute of li, so your code is invalid. You should use a data attribute for any non-standard attributes you require, the you need to write a sorter function. Try this: $('#addThird').one('click', function() { $('ol').append('<li data-value="3">Third</li>'); sortItems(); }); var sortItems = function() { var $items = $('ol li'); $items.sort(function(a, b) { var keyA = $(a).data('value'); var keyB = $(b).data('value'); return (keyA > keyB) ? 1 : 0; }); $.each($items, function(index, row){ $('ol').append(row); }); } Updated fiddle This sorts by the data-value attribute of the element, but that can be amended as required.

Categories : Javascript

Infinite loop on list item in unordered list using jQuery
So your update was a good start... I adapted it to include 3 items (jquery selector) rather than 1 and added a fadeOut on the callback of fadeIn to achieve the cycle what you were looking for. After the callback reaches the end of the list, we start over. See below function fadeInSequence($three) { //default to the first three list items if ($three == null) $three = $('.sponsors>li:lt(3)'); //fade in the 3 found $three.fadeIn(2000, function () { //fade out the 3 after fadein and start $(this).fadeOut(2000); }).promise().done(function () { if ($three.last().nextAll(':lt(3)').length) { //Same function, next 3 items fadeInSequence($three.last().nextAll(':lt(3)')); } else { //Same function, from the b

Categories : Jquery

Retrieve values from list item when there are varying layouts in the list
Here's an easy way - paste this into each of the xml Views: android:onClick="someFunction" Then inside this someFunction do: public void someFunction(View v){ switch (v.getId()){ case R.id.lblSub: // This layout was clicked, do something about it break; case R.id.lblMain: // This layout was clicked, do something about it break; }

Categories : Android

How to iterate through an unordered list and then select the parent div of the list item
$('.question').filter(function () { return ! $(this).find('input:checked').length; }).addClass('highlight'); Here's the fiddle: http://jsfiddle.net/XTDre/

Categories : Javascript

Adding Sharepoint List Item to Windows form list
Completely untested, made fresh while drinking morning coffee. Good luck! var list = siteWeb.Lists.TryGetList(listName); if (list == null) { return; } var items = list.GetItems(query); var countOfItems = items.Count; if (countOfItems == 0) { return; } var listItemFieldObjects = items.Cast<SPListItem>().Select(item => item[1]); foreach (var item in listItemFieldObjects) { var listViewItem = new ListViewItem("Object's value"); listView.BeginUpdate(); listViewItem.SubItems.Add(item.ToString()); listView.Items.Add(listViewItem); listView.EndUpdate(); }

Categories : Sharepoint

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

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#

I have designed a sorting algorithm for a char linked list in c++ but it doesn't work
Replace while (point != NULL) { while (current != NULL) { By while (point != NULL) { current = point->next; while (current != NULL) {

Categories : C++

How to make a list in Python distinct based on a property of the class in the list?
Assuming the property you wish to key on is immutable, you can use a dict: d = {} for x in xs: d[x.tag] = x Now d will contain a single x per tag value; you can use d.values() or d.itervalues() to get at the xs. NB. here last matching item wins; to have the first one win, iterate in reverse.

Categories : Python

property of type list modifying the original set of values in the list even when it's readonly
The readonly keyword means the variable is read-only -- but it doesn't guarantee that the object itself is immutable. For illustration: class Numbers { readonly List<int> num; public Numbers() { // ok - can write to read-only variables in the owner's constructor num = new List<int> { 1, 2, 3, 4 }; } void Test() { // this is fine -- I'm not writing to "num", just changing its state num.Clear(); // compiler error: "a readonly field cannot be assigned to" num = new List<int>(); } } If you want a read-only collection, there are .Net types that serve that purpose; see for example ReadOnlyCollection<T>. Related: Eric Lippert's famous article on different kinds of immutability.

Categories : C#

Using linq group by to get from a list of objects with a DateTime property to a list with an interval StartDate, EndDate
You can use GroupBy in combination with SelectMany and Aggregate for this: var setups = bookedRooms.GroupBy(x => Tuple.Create(x.TimePeriodId, x.VenueId)) .SelectMany(x => x.Aggregate( new List<EventSetup>(), AccumulateRooms)) .OrderBy(x => x.StartDate) .ToList(); List<EventSetup> AccumulateRooms(List<EventSetup> existingSetups, BookedRoom currentRoom) { var setup = existingSetups.LastOrDefault(); if(setup == null || setup.EndDate.AddDays(1) != currentRoom.Day.Date) { setup = new EventSetup { VenueId = currentRoom.VenueId, TimePeriodId = currentRoom.TimePeriodId, StartDate = currentR

Categories : C#

Getting unique values from a list of objects with a List as a property
If I understand, you want a list of all of the unique certifications among all of the employees. This would be a job for SelectMany: var uniqueCerts = empList.SelectMany(e => e.Certifications).Distinct().ToList();

Categories : C#

How can I update a MVC model list property first be compiling the list on client
It sounds like what you want is to asynchronously post the new item back to the server, and refresh the model. Here is a great example of how to do exactly that: http://blog.krisvandermast.com/UsingJQueryAjaxToLoadAPartialViewInASPNETMVC2AndThenRetrieveTheInputOnTheServerAgain.aspx In short, when the user clicks "Add Worker", the view posts the new worker to the server, which then retrieves the full list of workers to return to the view. The view can then be updated to show the full list of workers.

Categories : C#

How to get a list of checked item from Check List VB. Net Winform
How about using CheckedItems collection instead? EDIT: dim itemChecked as Object For Each itemChecked In checkList_Facility.CheckedItems MsgBox(itemChecked.ToString()) Next

Categories : Vb.Net

ValueError: list.remove(x): x not in list, item definitely exists
Instead of picking a random index from the list of snapshots, shuffle the list once and pop items from that shuffled list: shuffledSnapList = snapRoList[:] random.shuffle(shuffledSnapList) while shuffledSnapList: roSnapshot = shuffledSnapList.pop() By using a while loop testing against the list you are removing from, you guarantee the loop will terminate when the list is empty. Because the list is shuffled, the items are processed in random order.

Categories : Python

search an item of sublist in another list of list by position
Probably, you should try this: // This will only work, if smalllist is shorter than biglist SCRIPT: biglist = [['A'], ['C', 'T'], ['A', 'T']] smalllist = [['C'], ['T'], ['A', 'T']] for i, group in enumerate(smalllist): for item in group: if item not in biglist[i]: biglist[i].append(item) DEMO: print(biglist) # [['A', 'C'], ['C', 'T'], ['A', 'T']]

Categories : Python



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