Search Results

Search found 31721 results on 1269 pages for 'adjacency list'.

Page 71/1269 | < Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >

  • More elegant way to initialize list of duplicated items in Python

    - by Claudiu
    If I want a list initialized to 5 zeroes, that's very nice and easy: [0] * 5 However if I change my code to put a more complicated data structure, like a list of zeroes: [[0]] * 5 will not work as intended, since it'll be 10 copies of the same list. I have to do: [[0] for i in xrange(5)] that feels bulky and uses a variable so sometimes I even do: [[0] for _ in " "] But then if i want a list of lists of zeros it gets uglier: [[[0] for _ in " "] for _ in " "] all this instead of what I want to do: [[[0]]*5]*5 Has anyone found an elegant way to deal with this "problem"?

    Read the article

  • How to add List<> values to gridview?

    - by ranadheer
    I created a asp.net website. and added a class file to it. i wrote this code in classfile.(person.cs) public class Person { public string name{get; set;} public int age { get; set; } public float sal { get; set; } public Person(string n, int a, float s) { name = n; age = a; sal = s; } public List<Person> getDetails() { Person p1 = new Person("John",21,10000); Person p2 = new Person("Smith",22,20000); Person p3 = new Person("Cena",23,30000); List<Person> li = new List<Person>(); li.Add(p1); li.Add(p2); li.Add(p3); return li; } } and i want this list to display in my gridview. so, i have added a default page in website. then what should i write in default.aspx.cs file?so that my list values are shown on gridview? Thanks.

    Read the article

  • C++: incorrect swapping of nodes in linked list

    - by Dragon
    I have 2 simple structures: struct Address { char city[255]; }; typedef Address* AddressPtr; struct Person { char fullName[255]; Address* address; Person* next; }; typedef Person* PersonPtr; The Person structure forms the Linked list where new elements are added to the beginning of the list. What I want to do is to sort them by fullName. At first I tried to swap links, but I lost the beginning of the list and as a result my list was sorted partially. Then I decided to sort list by swapping the values of nodes. But I get strange results. For a list with names: Test3, Test2, Test1, I get Test3, Test3, Test3. Here is my sorting code: void sortByName(PersonPtr& head) { TaskPtr currentNode, nextNode; for(currentNode = head; currentNode->next != NULL; currentNode = currentNode->next) { for(nextNode = currentNode->next; nextNode != NULL; nextNode = nextNode->next) { if(strcmp(currentNode->fullName, nextNode->fullName) > 0) { swapNodes(currentNode, nextNode); } } } } void swapNodes(PersonPtr& node1, PersonPtr& node2) { PersonPtr temp_node = node2; strcpy(node2->fullName, node1->fullName); strcpy(node1->fullName, temp_node->fullName); strcpy(node2->address->city, node1->address->city); strcpy(node1->address->city, temp_node->address->city); } After the sorting completion, nodes values are a little bit strange. UPDATED This is how I swapped links void swapNodes(PersonPtr& node1, PersonPtr& node2) { PersonPtr temp_person; AddressPtr temp_address; temp_person = node2; node2 = node1; node1 = temp_person; temp_address = node2->address; node2->address = node1->address; node1->address = temp_address; }

    Read the article

  • Make SharePoint 2007 List View read-only

    - by FireSnake
    I need to deploy a new List View for the standard List View Web Part in MOSS 2007 via the object model (the list already exists, a new view should be added). I need and want to make this list view read-only. This is because saving changes to the view would corrupt modifications made to Header/Footer. How can I do that via the object model? I looked at the content db, the read-only flag (0x20) is stored with the view and could technically be updated using calls to proc_GetAllWebPartsOnPage and proc_UpdateView[Properties]. NOTE: The database interface and all mentioned stored procs are all documented by Microsoft. Is there ANY way to do that via the object model, because I would strongly prefer that?

    Read the article

  • Adding the text area input to a list with jquery

    - by amylynn83
    I am making a shopping list app. When an item is added to the text input, it should be converted into a list item with a class of "tile" and added to the beginning of the list with a class of ".shopping_item_list". Here is my HTML: <section> <h1 class="outline">Shopping List Items</h1> <ul class="shopping_item_list"> <li class="tile">Flowers<span class="delete">Delete</span></li> </ul> </section> My jQuery: $("input[name='shopping_item']").change(function() { var item = $(this).val(); $("<li class='tile'>+ item +</li>").prependTo(".shopping_item_list"); $(".tile").removeClass("middle"); $(".shopping_item_list li:nth-child(3n+2)").addClass("middle"); }); This isn't working, and I can't figure out why. I'm new to jQuery. Also, I need to add the "delete" span to the list item and am not sure how. Thanks for any help you can offer! Edited to add: Thanks to the feedback here, I was able to make it work with: $("input[name='shopping_item']").change(function() { var item = $(this).val(); $("<li class='tile'>" + item + "<span class='delete'>Delete</span>" + " </li>").prependTo(".shopping_item_list"); $(".tile").removeClass("middle"); $(".shopping_item_list li:nth-child(3n+2)").addClass("middle"); }); However, in my jquery, I have functions for the classes "tile" and "delete" that are not working for newly added items. // hide delete button $(".delete").hide(); // delete square $(".tile").hover(function() { $(this).find(".delete").toggle(); }); $(".tile").on("click", ".delete", function() { $(this).closest("li.tile").remove(); $(".tile").removeClass("middle"); $(".shopping_item_list li:nth-child(3n+2)").addClass("middle"); }); // cross off list $(".tile").click(function() { $(this).toggleClass("deleteAction"); }); The new items, which have these classes applied aren't using these functions at all. Do I need to add the functions below the add item? Does the order in which they appear in my js file matter? Do I need to add some kind of function?

    Read the article

  • NSRunningApplication, return list of recent used applications?

    - by Martijn
    i'm trying to get a list of the most recent used applications. NSWorkspace returns me a list of active applications and i can sort them on a few options using NSRunningApplication. see list below: launchDate finishedLaunching processIdentifier i dont want the lauch date but the recent 'active' date (like the way cmd-tab sorts). Does anyone knows the solution for this?

    Read the article

  • SubSonic 3 issue creating List<>

    - by Brian Cochran
    I have an application that requires we use distinct user connection strings per user. We are trying to upgrade from SubSonic 2.x to 3.0. I'm running into issues with trying to create a List< of objects. When I try to create a List like this: List<table_name> oList = table_name.All().Where(tn => tn.table_id == TableId).ToList(); I get the error "Connection string 'ConnectionStringName' does not exist." So, I try to create the List< like this: List<table_name> oList = table_name.All(sConnectionString, "System.Data.SqlClient").Where(tn => tn.table_id == TableId).ToList(); I get the error "The name 'table_name' does not exist in the current context." I'm using SQL Server, and the sConnectionString is definitely verified to be a good connection string, and the table_name is a table in the database. What am I doing wrong?

    Read the article

  • How to create a drop down menu like the one displayed on Amazon?

    - by webdev_newbee
    I am kind of new to web development. I am trying to create a drop down menu, something I have now is like: <select> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="opel">Opel</option> <option value="audi">Audi</option> </select> but this is not exactly what I want. I want to create a drop down list very similar to the one on Amazon.com (the dropdown list beside "Search"), shown in following pic. so whenever user click on the button, the list will be displayed in the button as text. Please feel free to give me any ideas. Thank you,

    Read the article

  • Including a List<SpecificType> in a model, and how to populate it

    - by Ray Sülzer
    I currently have two Model classes: class Leaders: List<Leaders> { public string LeaderName { get; set; } public string PrecintName { get; set; } } public class MarketReport { //A list of activists public Leaders leaderlist { get; set; } } Now, I have no idea if I am doing the above correctly, but I want to populate the list within the MarketReport foreach (var store in stores) { MarketReport.leaderlist.AddItem //I want to add an item of type Leader to the list //so that I can pass it to MVC view }

    Read the article

  • Align jQuery List

    - by William Lewis
    I'm creating a mobile website with jQuery, and I was wondering if there was a way to align a list to the bottom of a page, I just want the list to stay at the very bottom of the page, and be fixed in the spot. Thanks This is the list im trying to get fixed on the bottom of the page: <div data-role="content"> <div class="content-primary"> <ul data-role="listview"> <li><a href="link.html"><img src="file.jpg" /><h3>List name</h3></a> </li> </div>

    Read the article

  • MS Access Dropdown List/Combo Box

    - by noblethrasher
    This should probably be pretty simple but my Google-Fu is as yet unable to find an answer. I simply want to create a dropdown list in Access so that upon selection I can perform some action based on the value of the selection. For instance, I have a list of people and I would like to populate the combo box so that their names appear in the list but the "value" is set to their ID (the primary key).

    Read the article

  • iOS - How to iterate through list of files on website directory

    - by svjim
    On iOS, I am looking for the proper way to return the URLs for a list of files that are in a directory. /images 1.jpg 2.jpg 3.jpg ... I know the URL for the directory and know all the files in the directory will be of type jpeg. It is not clear to me how to properly format the NSURLRequest to return the list of files in the images directory. Once the list is returned, I will iterate through it to return the individual images.

    Read the article

  • Java: ListA.addAll(ListB) fires NullPointerException?

    - by HH
    The err part is Capitalized in the code, it also comes in foreaching. Because of the abstract list, it cannot be initialized, declaration is in a static field. The lists have the same type. import java.util.*; public class Test { public static final List<String> highPrio = Arrays.asList("*","/"); public static List<String> ops; public static void main(String[] args) { //ERROR HERE, why do it throw nullPointer? ops.addAll(highPrio); for(String s : ops) { System.out.println(s); } } }

    Read the article

  • walking list in KDB/kernel debugger

    - by user291849
    I need to walk a link list in the kernel debugger. How can I determine the head pointer and walk the list? I have a listing and can find the address and location in the code where I check to see if I have a head, so I know the specific code location and address. But not sure how to determine the pointer or how to determine the next element and pointer on the list.

    Read the article

  • Efficient retrieval of lists over WebServices

    - by Chris
    I have a WCF WebService that uses LINQ and EF to connect to an SQL database. I have an ASP.NET MVC front end that collects its data from the webservice. It currently has functions such as List<Customer> GetCustomers(); As the number of customers increases massively the amount of data being passed increases also reducing efficiency. What is the best way to "page data" across WebServices etc. My current idea is to implement a crude paging system such as List<Customer> GetCustomers(int start, int length); This, however, means I would have to replicate such code for all functions returning List types. It is unfortunate that I cannot use LINQ as it would be much nicer. Does anyone have any advice or ideas of patterns to implement that would be "as nice as possible" Thanks

    Read the article

  • Displaying a list of items vertically in a table instead of horizonally

    - by MichaelMM
    I have a list of items sorted alphabetically: list = [a,b,c,d,e,f,g,h,i,j] I'm able to output the list in an html table horizonally like so: | a , b , c , d | | e , f , g , h  | | i  , j  ,    ,     | What's the algorithm to create the table vertically like this: | a , d , g , j | | b , e , h ,   | | c , f  ,  i  ,  | I'm using python, but your answer can be in any language or even pseudocode. Thanks

    Read the article

  • Selecting a sequence of elements from the IList

    - by KhanS
    I have a IList. where the object PersonDetails consists of the persons name, address and phone number. The list consists of more than 1000 person details. I would like to display 50 PersonDetails per page. Is there a way to select only 50 elements from the list, and return them. For example. myList.select(1,50) myList.select(51, 100) I am able to select only first 50 by using. myList.Take(50); The entire list is at the wcf service, and i would like to get only fifty elements at a time.

    Read the article

  • Allow users to enter a variable length list of items in asp.net form

    - by EJB
    I need to let my users enter a variable length list of items into something that looks like a grid view (or a series of standard text boxes stacked vertically). Each item could be a few characters or a few hundred characters long, and I just want them to enter a "sentence", and then tab to the next row, and always having another blank one ready to go at the bottom of the list. I don't want to save any data to my SQL Server DB until they enter the entire list and then click on a "save all" button. When they hit the "save all" button they will be given a preview screen where the data will be presented as standard HTML ordered list. If they confirm/save, then each row of the grid will then be saved as a separate row into my SQL Server database (with an index to remember the order). What ASP.Net (or Jquery/javascript) UI control would be the best to use in this situation?

    Read the article

  • Increase the length of Xcode's "recent project" list?

    - by Bogatyr
    I switch in Xcode between working on a lot of different projects frequently (some I'm actively working on, some are old projects where I'm looking up code I want to re-use or quote in SO answers :)), so that part of my "working set" of projects invariably ends up falling off the recent project list. I do use finder tabs for the full working set of current project folders, but I really like the fast switching available using the recent projects list. Is there a way to increase the length of this list so that I can see more recently opened projects?

    Read the article

  • A question about comparing List<T>

    - by Varyanica
    i have two lists: List<comparerobj> list_c = new List<comparerobj>(); List<comparerobj> list_b = new List<comparerobj>(); i'm filling lists somehow then i'm trying to find elements in list_b which list_c doesnt contain: foreach (comparerobj b in list_b) { bool lc = !list_c.Contains(b); if (lc != true) { data.Add(b); } } but for any b i'm getting that lc = true. what am i doing wrong?

    Read the article

  • Join data from two Lists into one object

    - by Petr Mensik
    I ran into following situation and I am wondering about best solution. Let's say I have List<Object1> and List<Object2>, these lists are result of two separated queries. Both of them have the same size and there is relationship 1:1 between elements in the lists based on ID. I know that best solution would be fetching data in one DB query but that's possible right now. So my question is, what is the best way to join these lists into let's say List<Object3>?

    Read the article

  • Group Objects by Common Key

    - by Marshmellow1328
    I have a list of Customers. Each customer has an address and some customers may actually have the same address. My ultimate goal is to group customers based on their address. I figure I could either put the customers in some sort of list-based structure and sort on the addresses, or I could drop the objects into some sort of map that allows multiple values per key. I will now make a pretty picture: List: A1 - C1, A1 - C2, A2 - C3, A3 - C4, A3 - C5 Map: A1 A2 A3 C1 C3 C4 C2 C5 Which option (or any others) do you see as the best solution? Are there any existing classes that will make development easier?

    Read the article

< Previous Page | 67 68 69 70 71 72 73 74 75 76 77 78  | Next Page >