list

Reading files to list of strings in Python

When you use the fileName.readlines() function in Python, is there a symbol for the end of the file that is included in the list? For example, if the file is read into a list of strings and the last line is 'End', will there be another place in the list with a symbol indicating the end of the file? Thanks. ...

Java: how to convert a List<?> to a Map<String,?>

I would like to find a way to take the object specific routine below and abstract it into a method that you can pass a class, list, and fieldname to get back a Map. If I could get a general pointer on the pattern used or , etc that could get me started in the right direction. Map<String,Role> mapped_roles = new HashMap<String,Role>()...

excess positional arguments, unpacking argument lists or tuples, and extended iterable unpacking

This question is going to be rather long, so I apologize preemptively. In Python we can use * in the following three cases: I. When defining a function that we want to be callable with an arbitrary number of arguments, such as in this example: def write_multiple_items(file, separator, *args): file.write(separator.join(args)) In ...

Why do lists start outside of the containing element?

This has always bugged the hell out of me. Why are lists like this? If you set margin and padding to 0, you would expect it to align normally at the left where the text around it would be, but no. That's where the text within the list item tags begins, then it renders the bullets and/or numbers to the left of that, overlapping borders et...

findall in List<T>

I can't find any FindAll method in my List, how can i select objects from the List that respond to a specific criteria, without using the old iterating method? List<oPage> mylist = new List<oPage>(); my oPage class has a property called Title of type string. I added a few items of oPage inside myList. now i want to select all items ...

Unicode character as bullet for list-item in CSS

Hi, I need to use, for example, star-symbol(★) as a bullet. I have read the CSS3 module: Lists, that describes, how to use custom text as bullet, but it's not working for me. I think, the browsers simple does't support ::marker pseudo-element How to do it, without using images ? ...

python - appending different columns from a file to different lists?

Hi, I have a tab-delimited file as below: A 3 A 6 B 6 B 9 C 0 C 2 I wish to read the file in as below: LIST = [['A', '3'], ['B', '6'], ['C', '0'], ['A', '6'], ['B', '9'], ['C', '2']] The order is not important. I am only concerned that each row is read in increments of two and assigned to a sub list. An...

Getting User Count From IRC

I am making IRC chat client and I am wanting to grab the user list or simply the user count, how can I go about doing this. This is the method I'm using to connect to the IRC: Private Sub IRCConnect() Dim stream As NetworkStream Dim irc As TcpClient Dim reader As StreamReader Try irc = New Tcp...

STL List copies a struct, but the copied values are offset by two memory addresses.

I'm compiling using Code::Blocks on Windows 7 using the MinGW compiler (which I can only assume is the latest version; both Code::Blocks and MinGW were installed this past week). My issue crops up under a particular circumstance, and my attempts to write a simpler script that demonstrates the problem have failed (which implies that there...

List Output in C#

Possible Duplicate: List<int> in c# I have the following program. I am confused about the output. The line - Console.WriteLine(listIsARefType.Count) prints 0 instead of 1. Any idea why ?. class Program { static void Main(string[] args) { ListTest d = new ListTest(); d.Test(); } } cl...

How do I specify types for Haskell's set builder notation ?

Specifically, I want to do something like this : myfunc:: [(Integer, Integer)] myfunc = [(x^2 - y^2, 2 * x * y) | x <- [1..], y <- [1.. (x-1)]] When I try to load this through ghci I get Warning: Defaulting the following constraint(s) to type `Integer' `Integral t' arising from a use of `^' at myfunc.hs:76:20-22 So I ...

Binding a list of strings to an IN clause

Consider this (using apsw here): s = ["A", "B", "C"] c.execute("SELECT foo.y FROM foo WHERE foo.x in (?)", (s, )) This doesn't work, because a binding parameter cannot be a list. I want to bind a list of strings to ?. I know how to build the appropriate query-string manually, but I wonder if there is a way to do this with bindings. ...

Interleaving sparse sorted arrays

I've got a set of lists of events. The events always happen in a given order, but not every event always happens. Here's an example input: [[ do, re, fa, ti ], [ do, re, mi ], [ do, la, ti, za ], [ mi, fa ], [ re, so, za ]] The input values don't have any inherent order. They're actually messages like "creating symlinks" and "r...

ASP.NET - Is it possible to render a TreeViewControl as an unordered list instead of a table?

Is it possible to render a TreeViewControl as an unordered list instead of a table? ...

Comparing two generic lists on a specific property

I'm using VB.NET with .NET 2.0. I have two lists, and I want to compare the lists on a specific property in the object, not the object as a whole, and create a new list that contains objects that are in one list, but not the other. myList1.Add(New Customer(1,"John","Doe") myList1.Add(New Customer(2,"Jane","Doe") myList2.Add(New Cust...

If x is list, why does x += "ha" work, while x = x + "ha" throw an exception?

From what little I know, + op for lists only requires the 2nd operand to be iterable, which "ha" clearly is. Thanks in advance. In Code: >>> x = [] >>> x += "ha" >>> x ['h', 'a'] >>> x = x + "ha" Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: can only concatenate list (not "str") to list ...

Firefox not rendering list item as a link

Hi there, I've never come across this problem before and its quite annoying me. I have a list which when hovered over, a box appears around it. I have a list set out like the following <div id="sidebar"> <h2>Our Services</h2> <ul> <a href="furniture.php"><li>Furniture</li></a> <a href="kitchens.php"><li>Kitchen...

Calculating percent difference between elements in a list with functional programming in Mathematica?

This stems from a related discussion, How to subtract specific elements in a list using functional programming in Mathematica? How does one go about easily calculating percent differences between values in a list? The linked question uses Differences to easily calculate absolute differences between successive elements in a list. Howev...

Python list initialization (by ref problem)

I have some simple code that represents a graph using a square boolean matrix where rows/columns are nodes and true represents an undirected link between two nodes. I am initializing this matrix with False values and then setting the value to True where a link exists. I believe the way I am initializing the list is causing a single boo...

Using redis' list data structure or a serialized ruby hash for storing data

Greetings, I want to store some data in a redis db and don't know which way I should go. The data is equivalent to something like an address with the variables name, street and number. They will be stored under the lower cased name as key, there won't be doublets. Now, should I save it as a list or should I serialize the hash ({:name =...