Search Results

Search found 36179 results on 1448 pages for 'generic list'.

Page 22/1448 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Python finding repeating sequence in list of integers?

    - by tijko
    I have a list of lists and each list has a repeating sequence. I'm trying to count the length of repeated sequence of integers in the list: list_a = [111,0,3,1,111,0,3,1,111,0,3,1] list_b = [67,4,67,4,67,4,67,4,2,9,0] list_c = [1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,23,18,10] Which would return: list_a count = 4 (for [111,0,3,1]) list_b count = 2 (for [67,4]) list_c count = 10 (for [1,2,3,4,5,6,7,8,9,0]) Any advice or tips would be welcome. I'm trying to work it out with re.compile right now but, its not quite right.

    Read the article

  • Python 2.7 creating a multidimensional list

    - by poop
    I don't know why I am having so much trouble creating a 3 dimensional list. I need the program to create an empty n by n list. So for n = 4: x = [[[],[],[],[]],[[],[],[],[]],[[],[],[],[]],[[],[],[],[]]] I've tried using: y = [n*[n*[]]] y = [[[]]* n for i in range(n)] Which both appear to be creating copies of a reference. I've also tried naieve application of the list builder with little success: y = [[[]* n for i in range(n)]* n for i in range(n)] y = [[[]* n for i in range(1)]* n for i in range(n)] I've also tried building up the array iteratively using loops, with no success. In my rapid flurry of attempts to not post something stupidly easy to SO, I came upon a solution: y = [] for i in range(0,n): y.append([[]*n for i in range(n)]) Is there an easier/ more intuitive way of doing this?

    Read the article

  • Ubuntu 12.10 unmet dependencies

    - by John
    I have Ubuntu 12.10 with 3.2.0.24-generic #39-Ubuntu running on a Dell Inspiron 700m laptop. I have unmet dependencies as follows: root@John-700m:/home/John# sudo apt-get remove --purge linux-image-3.5.0-{18,27,31,34}-generic Reading package lists... Done Building dependency tree Reading state information... Done Package 'linux-image-3.5.0-18-generic' is not installed, so not removed Package 'linux-image-3.5.0-27-generic' is not installed, so not removed Package 'linux-image-3.5.0-31-generic' is not installed, so not removed Package 'linux-image-3.5.0-34-generic' is not installed, so not removed You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies: linux-generic : Depends: linux-image-generic but it is not going to be installed linux-image-extra-3.5.0-18-generic : Depends: linux-image-3.5.0-18-generic but it is not going to be installed linux-image-extra-3.5.0-27-generic : Depends: linux-image-3.5.0-27-generic but it is not going to be installed linux-image-extra-3.5.0-31-generic : Depends: linux-image-3.5.0-31-generic but it is not going to be installed linux-image-extra-3.5.0-34-generic : Depends: linux-image-3.5.0-34-generic but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution). I tried to remove the packages, but I still get the same error message. Any help would certainly be appreciated. @Eric, well noted. Here is the reults: model name : Intel(R) Pentium(R) M processor 1.60GHz flags : fpu vme de pse tsc msr mce cx8 mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe up bts est tm2 Thanks again. @Eric, If I need to downgrade to Ubuntu 12.04 from 12.10, can I do it without having to mess my current partition or files? I also have Windows XP running on the machine. Best. @Eric, if you are online, I could use your help (or anybody's else). I installed the package for non-pae unit and I still get the same error. Any suggestions? Thanks

    Read the article

  • Move <option> to top of list with Javascript

    - by Adam
    I'm trying to create a button that will move the currently selected OPTION in a SELECT MULTIPLE list to the top of that list. I currently have OptionTransfer.js implemented, which is allowing me to move items up and down the list. I want to add a new function function MoveOptionTop(obj) { ... } Here is the source of OptionTransfer.js // =================================================================== // Author: Matt Kruse // WWW: http://www.mattkruse.com/ // // NOTICE: You may use this code for any purpose, commercial or // private, without any further permission from the author. You may // remove this notice from your final code if you wish, however it is // appreciated by the author if at least my web site address is kept. // // You may *NOT* re-distribute this code in any way except through its // use. That means, you can include it in your product, or your web // site, or any other form where the code is actually being used. You // may not put the plain javascript up on your site for download or // include it in your javascript libraries for download. // If you wish to share this code with others, please just point them // to the URL instead. // Please DO NOT link directly to my .js files from your site. Copy // the files to your server and use them there. Thank you. // =================================================================== /* SOURCE FILE: selectbox.js */ function hasOptions(obj){if(obj!=null && obj.options!=null){return true;}return false;} function selectUnselectMatchingOptions(obj,regex,which,only){if(window.RegExp){if(which == "select"){var selected1=true;var selected2=false;}else if(which == "unselect"){var selected1=false;var selected2=true;}else{return;}var re = new RegExp(regex);if(!hasOptions(obj)){return;}for(var i=0;i(b.text+"")){return 1;}return 0;});for(var i=0;i3){var regex = arguments[3];if(regex != ""){unSelectMatchingOptions(from,regex);}}if(!hasOptions(from)){return;}for(var i=0;i=0;i--){var o = from.options[i];if(o.selected){from.options[i] = null;}}if((arguments.length=0;i--){if(obj.options[i].selected){if(i !=(obj.options.length-1) && ! obj.options[i+1].selected){swapOptions(obj,i,i+1);obj.options[i+1].selected = true;}}}} function removeSelectedOptions(from){if(!hasOptions(from)){return;}for(var i=(from.options.length-1);i=0;i--){var o=from.options[i];if(o.selected){from.options[i] = null;}}from.selectedIndex = -1;} function removeAllOptions(from){if(!hasOptions(from)){return;}for(var i=(from.options.length-1);i=0;i--){from.options[i] = null;}from.selectedIndex = -1;} function addOption(obj,text,value,selected){if(obj!=null && obj.options!=null){obj.options[obj.options.length] = new Option(text, value, false, selected);}} /* SOURCE FILE: OptionTransfer.js */ function OT_transferLeft(){moveSelectedOptions(this.right,this.left,this.autoSort,this.staticOptionRegex);this.update();} function OT_transferRight(){moveSelectedOptions(this.left,this.right,this.autoSort,this.staticOptionRegex);this.update();} function OT_transferAllLeft(){moveAllOptions(this.right,this.left,this.autoSort,this.staticOptionRegex);this.update();} function OT_transferAllRight(){moveAllOptions(this.left,this.right,this.autoSort,this.staticOptionRegex);this.update();} function OT_saveRemovedLeftOptions(f){this.removedLeftField = f;} function OT_saveRemovedRightOptions(f){this.removedRightField = f;} function OT_saveAddedLeftOptions(f){this.addedLeftField = f;} function OT_saveAddedRightOptions(f){this.addedRightField = f;} function OT_saveNewLeftOptions(f){this.newLeftField = f;} function OT_saveNewRightOptions(f){this.newRightField = f;} function OT_update(){var removedLeft = new Object();var removedRight = new Object();var addedLeft = new Object();var addedRight = new Object();var newLeft = new Object();var newRight = new Object();for(var i=0;i0){str=str+delimiter;}str=str+val;}return str;} function OT_setDelimiter(val){this.delimiter=val;} function OT_setAutoSort(val){this.autoSort=val;} function OT_setStaticOptionRegex(val){this.staticOptionRegex=val;} function OT_init(theform){this.form = theform;if(!theform[this.left]){alert("OptionTransfer init(): Left select list does not exist in form!");return false;}if(!theform[this.right]){alert("OptionTransfer init(): Right select list does not exist in form!");return false;}this.left=theform[this.left];this.right=theform[this.right];for(var i=0;i

    Read the article

  • Generic Repositories with DI & Data Intensive Controllers

    - by James
    Usually, I consider a large number of parameters as an alarm bell that there may be a design problem somewhere. I am using a Generic Repository for an ASP.NET application and have a Controller with a growing number of parameters. public class GenericRepository<T> : IRepository<T> where T : class { protected DbContext Context { get; set; } protected DbSet<T> DbSet { get; set; } public GenericRepository(DbContext context) { Context = context; DbSet = context.Set<T>(); } ...//methods excluded to keep the question readable } I am using a DI container to pass in the DbContext to the generic repository. So far, this has met my needs and there are no other concrete implmentations of IRepository<T>. However, I had to create a dashboard which uses data from many Entities. There was also a form containing a couple of dropdown lists. Now using the generic repository this makes the parameter requirments grow quickly. The Controller will end up being something like public HomeController(IRepository<EntityOne> entityOneRepository, IRepository<EntityTwo> entityTwoRepository, IRepository<EntityThree> entityThreeRepository, IRepository<EntityFour> entityFourRepository, ILogError logError, ICurrentUser currentUser) { } It has about 6 IRepositories plus a few others to include the required data and the dropdown list options. In my mind this is too many parameters. From a performance point of view, there is only 1 DBContext per request and the DI container will serve the same DbContext to all of the Repositories. From a code standards/readability point of view it's ugly. Is there a better way to handle this situation? Its a real world project with real world time constraints so I will not dwell on it too long, but from a learning perspective it would be good to see how such situations are handled by others.

    Read the article

  • Announcing Oracle Receivables Generic Data Fix (GDF) for Refunds

    - by user793553
    Here's the first of what will be a series of Generic Data Fixes (GDF) to be released by Receivables Development. Generic Data Fix (GDF) are created by development to fix data issues caused by bugs/issues in the application code.  Other Generic Data Fix benefits/features include: Developed for bugs that can cause data issues. Provides a SELECT script that uses an identification/signature query to identify and report all data affected by issue/condition caused by a bug. Allow customers to view and modify what will be fixed. Provides a separate FIX script to fix the data reported by the SELECT script. The FIX script creates backup tables for the data that is fixed/updated. Available on My Oracle Support for download In Release 12, when creating a refund by either of the following methods: Applied a receipt to the Refund activity - which creates an Invoice in Payables Or you went directly into Payables to create a refund for an open Credit Memo in Receivables The Invoice in Payables that is associated to the refund is cancelled, the corresponding refund application or credit memo in Receivables is not properly re-instated. For the receipt application, it still remains applied to the Refund whereas this should be automatically unapplied. For the credit memo, it stays closed instead of getting re-opened. Doc ID 761993.1 includes the patch to make sure this doesn’t happen in the future as well as a GDF script to fix the current data (Script name: ar_std_refund_unapp.sql).  Download the script and run in READ_ONLY_MODE to identify 'refund' applications with this problem. Stay tuned for more GDF scripts coming soon...

    Read the article

  • after upgrade from 10.04 to 12.04 cannot boot with linux 3.2.0-24-generic-pae

    - by Ricardo
    After upgrade from 10.04 to 12.04, I cannot boot with linux 3.2.0-24-generic-pae: process gets frozen in a xubuntu initialization screen (I had qimo installed). If I try the recovery mode (with the same Linux version), booting freezes after this message: Begin: Mounting root file system. If in grub menu I choose Previous Linux versions, I can boot using Linux 2.6.32-41-generic-pae. But once logged in, some things don't seem to work (apt-get update fails, update manager fails, HID menu does not provide suggestions...) (to be honest, I have no idea whether this is part of the bigger issue) Reading in Ask Ubuntu through apparently similar problems, I decided to follow some advices: got boot-repair and run it. The problem remains & I got this report. I also run as root in terminal $ sudo update-initramfs -u and this is what I got: update-initramfs: Generating /boot/initrd.img-3.2.0-24-generic-pae cryptsetup: WARNING: failed to detect canonical device of /dev/sda1 cryptsetup: WARNING: could not determine root device from /etc/fstab /tmp/mkinitramfs_EIDlHy/scripts/classmate-bottom/45xconfig: 9: .: Can't open /scripts/casper-functions What else? My pc is Intel® Core™ i7 CPU 870 @ 2.93GHz × 8, graphs is GeForce 8400 GS/PCIe/SSE2, memory is 7,8 GiB. I have two questions: Is this a bug in the newest kernel I should report? Is there anything I can do appart from a fresh install?

    Read the article

  • Lubuntu 13.04, kernel still 3.8.0-32-generic

    - by Blue Ice
    My question is very similar to Ubuntu 13.10, kernel still 3.8.0-31-generic. Recently was updating to Saucy and the ethernet cable got unplugged. So I decided to run Software Update again, to reinstall files. It returned that "everything is up to date". But according to these command-line searches, that is incorrect. How can I install Saucy now safely from the command line? sudo apt-get install lubuntu-desktop Reading package lists... Done Building dependency tree Reading state information... Done lubuntu-desktop is already the newest version. The following package was automatically installed and is no longer required: linux-image-extra-3.8.0-19-generic Use 'apt-get autoremove' to remove it. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. sudo apt-get update Get:1 http://extras.ubuntu.com raring Release.gpg [72 B] Hit http://extras.ubuntu.com raring Release Get:2 http://az-1.hpcloud.mirror.websitedevops.com raring Release.gpg Hit http://extras.ubuntu.com raring/main Sources Hit http://extras.ubuntu.com raring/main i386 Packages Get:3 http://az-1.hpcloud.mirror.websitedevops.com raring-updates Release.gpg Get:4 http://az-1.hpcloud.mirror.websitedevops.com raring-backports Release.gpg Get:5 http://az-1.hpcloud.mirror.websitedevops.com raring-security Release.gpg Get:6 http://az-1.hpcloud.mirror.websitedevops.com raring Release Ign http://extras.ubuntu.com raring/main Translation-en_US Ign http://extras.ubuntu.com raring/main Translation-en Hit http://ppa.launchpad.net raring Release.gpg Ign http://az-1.hpcloud.mirror.websitedevops.com raring Release E: GPG error: http://az-1.hpcloud.mirror.websitedevops.com raring Release: The following signatures were invalid: NODATA 1 NODATA 2 lsb_release -rd Description: Ubuntu 13.04 Release: 13.04 uname -r 3.8.0-32-generic

    Read the article

  • Search in a List<DataRow>?

    - by grady
    Hello, I have a List which I create from a DataTabe which only has one column in it. Lets say the column is called MyColumn. Each element in the list is an object array containing my columns, in this case, only one (MyColumn). Whats the most elegant way to check if that object array contains a certain value? Thanks

    Read the article

  • Skip List vs. Binary Tree

    - by Claudiu
    I recently came across the data structure known as a Skip list. They seem to have very similar behavior to a binary search tree... my question is - why would you ever want to use a skip list over a binary search tree?

    Read the article

  • Python to MATLAB: exporting list of strings using scipy.io

    - by user292461
    I am trying to export a list of text strings from Python to MATLAB using scipy.io. I would like to use scipy.io because my desired .mat file should include both numerical matrices (which I learned to do here) and text cell arrays. I tried: import scipy.io my_list = ['abc', 'def', 'ghi'] scipy.io.savemat('test.mat', mdict={'my_list': my_list) In MATLAB, I load test.mat and get a character array: my_list = adg beh cfi How do I make scipy.io export a list into a MATLAB cell array?

    Read the article

  • Python most common element in a list

    - by Richard
    What is an efficient way to find the most common element in a Python list? My list items may not be hashable so can't use a dictionary. Also in case of draws the item with the lowest index should be returned. Example: >>> most_common(['duck', 'duck', 'goose']) 'duck' >>> most_common(['goose', 'duck', 'duck', 'goose']) 'goose'

    Read the article

  • List - Strings - Textfiles

    - by b3y4z1d
    I've got a few questions concerning text files,list and strings. I wonder if it is possible to put in a code which reads the text in a textfile,and then using "string line;" or something else to define each new row of the text and turn all of them into one list. So I can sort the rows, remove a row or two or even all of them or search through the text for a specific row.

    Read the article

  • Searchable list of objects in Java

    - by Christian
    I want to create a large (~300,000 entries) List of self defined objects of the class Drug. Every Drug has an ID and I want to be able to search the Drugs in logarithmic time via that ID. What kind of List do I have to use? How do I declare that it should be searchable via the ID?

    Read the article

  • Python filter/remove URLs from a list

    - by Eef
    Hi. I have a text file of URLs, about 14000. Below is a couple of examples: http://www.domainname.com/pagename?CONTENT_ITEM_ID=100&param2=123 http://www.domainname.com/images?IMAGE_ID=10 http://www.domainname.com/pagename?CONTENT_ITEM_ID=101&param2=123 http://www.domainname.com/images?IMAGE_ID=11 http://www.domainname.com/pagename?CONTENT_ITEM_ID=102&param2=123 I have loaded the text file into a Python list and I am trying to get all the URLs with CONTENT_ITEM_ID separated off into a list of their own. What would be the best way to do this in Python? Cheers

    Read the article

  • List<> own comparer

    - by netmajor
    I have a List where element is: struct element { double priority; int value; } How can I implement my own comparer which allow me sort List by priority ? I try with SortredList... but it don't allow douplicated keys :( Big thanks for help!

    Read the article

  • filtering directly and indirectly connected things from list

    - by Andreas Romeyke
    Hello, if you have a function "test a b" which returns true if a and b are connected directly and if you have a given unordered list of things, what would be an elegant and fast solution to filter all connected things from given list? Example: let test a b = let diff = a - b in diff == 0 ;; let lst = [4;1;7;3;8;9;2;0] ;; filter_connected 2 lst ;; - [4;1;3;2;0] Any hints?

    Read the article

  • sorting a doubly linked list with merge sort.

    - by user329820
    Hi I have found this code in the internet and it was for arrays ,I want to change it for doubly linked list(instead of index we should use pointer) would you please help me that how can i change merge method(I have changed sort method by myself) also this is not my home work ,I love working with linked list!! public class MergeSort { private DoublyLinkedList LocalDoublyLinkedList; public MergeSort(DoublyLinkedList list) { LocalDoublyLinkedList = list; } public void sort() { if (LocalDoublyLinkedList.size() <= 1) { return; } DoublyLinkedList listOne = new DoublyLinkedList(); DoublyLinkedList listTwo = new DoublyLinkedList(); for (int x = 0; x < (LocalDoublyLinkedList.size() / 2); x++) { listOne.add(x, LocalDoublyLinkedList.getValue(x)); } for (int x = (LocalDoublyLinkedList.size() / 2) + 1; x < LocalDoublyLinkedList.size`(); x++) {` listTwo.add(x, LocalDoublyLinkedList.getValue(x)); } //Split the DoublyLinkedList again MergeSort sort1 = new MergeSort(listOne); MergeSort sort2 = new MergeSort(listTwo); sort1.sort(); sort2.sort(); merge(listOne, listTwo); } private void merge(DoublyLinkedList a, DoublyLinkedList b) { int x = 0; int y = 0; int z = 0; while (x < first.length && y < second.length) { if (first[x] < second[y]) { a[z] = first[x]; x++; } else { a[z] = second[y]; y++; } z++; } //copy remaining elements to the tail of a[]; for (int i = x; i < first.length; i++) { a[z] = first[i]; z++; } for (int i = y; i < second.length; i++) { a[z] = second[i]; z++; } } }

    Read the article

  • How to publish a list of integers?

    - by Mason Wheeler
    I want to make a component that includes a list of integers as one of its serialized properties. I know I can't declare a TList<integer> as a published property, because it doesn't descend from TPersistent. I've read that you can define "fake" published properties if you override DefineProperties, but I'm not quite sure how that works, especially when it comes to creating a fake property that's a list, not a single value. Can someone point me in the right direction?

    Read the article

  • WPF List - ListItem Visibility

    - by niao
    Greetings, I have a FlowDocument where List control is placed. Inside this list I have some ListItem. Is there any way to set some kind of Visibility for specific ListItem? I don't see a coressponding Property like Visibility for ListItem. When I set fontsize="0.1" then application hangs (it goes into infinite loop).

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >