list

Using List.Find or LINQ on lists of enums in .NET 3.5

How come List.Find (and LINQ-queries on the list as well) always return the first enum element when the list does not contain the element I am searching for? Scenario: My enum: public enum TestEnum { EnumOne, EnumTwo, EnumThree } My test: var TestEnum1 = TestEnum.EnumOne; var TestEnum2 = TestEnum.EnumTwo; var TestEnum3 ...

Using DISTINCT in a CakePHP find function

Hello, I am writing a CakePHP 1.2 app. I have a list of people that I want the user to be able to filter on different fields. For each filterable field, I have a drop down list. Choose the filter combination, click filter, and the page shows only the records that match. In people_controller, I have this bit of code: $first_names = ...

How to create an email mailing list

Im creating a coming soon page for a website im developing, and im adding an option for the user to enter their email address so we can email them when the site is up. How do I do this? ...

In C#, what's the best way to search a list of a class by one of the class's members?

Say I have a class that looks something like this: class SomeClass { int m_member; public int Member { get { return m_member; } set { m_member = value; } } } And somewhere else, I have a list of type List<SomeClass> list. If I want to search the list for a particular instance of the class, I can just do ...

Getting the first n elements of a list in Common Lisp?

The title says it all, really. How would I get the first n elements of a list? CL-USER> (equal (some-function 2 '(1 20 300)) '(1 20)) T I am absolutely certain this is elementary, but help a brother newb out. Kisses and hugs. ...

Merge two lists in python?

Just as it sounds: listone = [1,2,3] listtwo = [4,5,6] #outcome we expect: mergedlist == [1, 2, 3, 4, 5, 6] ...

VS2008 How I can get rid of the "Error List" window

Hello, I don't really like the Error list window, I prefer to use the Output window. The only way I can hide the Error list window is to make it floating and to put it as a small popup window in a window corner Thanks! -Claudio ...

How to list all subdirectories in a given directory in C?

Is there a way to list all subdirectories in a given directory path in C? I was hoping I would be able to do it with the stat() function but it only works on files. ...

Find (and keep) duplicates of sublist in python

Hi, I have a list of lists (sublist) that contains numbers and I only want to keep those exists in all (sub)lists. Example: x = [ [1, 2, 3, 4], [3, 4, 6, 7], [2, 3, 4, 6, 7]] output => [3, 4] How can I do this? ...

Can't append one list to another in C#... trying to use AddRange.

Hi I'm trying to append 1 list to another. I've done it using AddRange() before but it doesn't seem to be working here... Here's the code: IList<E> resultCollection = ((IRepository<E, C>)this).SelectAll(columnName, maxId - startId + 1, startId); IList<E> resultCollection2 = ((IRepository<E, C>)this).SelectAll(columnName,...

How to check if a list is empty in Python?

The API I'm working with can return empty [] lists. What isn't working: if myList is not None: #not working if myList is not []: #not working What will work? ...

how bad is it to use dynamic datastuctures on an embedded system?

So IN an embedded systems unit, that i'm taking at uni next year, we will learn that dynamic data structures are a bad thing to have in an embedded system program. but the lecture notes don't go into why. Now i'm working on a moderate scale, embedded systems\ 'LURC' controller, mostly just takes advantages of the peripheral of the "Butt...

How do Make 3 inline elements ? Then add a seperate independent 4th elemt that floats on the otherside of the page ?

I desire to make 3 things in a straight line at the top of the page pretty much ok there, but the 4yh will not budge and if i do get it to move somehow, it conflicts with the other 3 causing those to break. Consider the following: <\Span style="textContainer"; CLASS = string; STYLE = string; TITLE = string;"> <\div id="searchBoxC...

Sorting a 3 parallel list that includes strings and numeric value in Python

how to sort using 3 parallel array lists: num1 = ['a','b','c,'] num2 = ['apple','pear','grapes'] num3 = [2.5,4.0,.68] I used 2 for statements followed by a if statement. Sorting by elements the output should be: a apple 2.5 b pear 4.0 c grapes .68 unfortunately, I am having issues with sorting the 3rd n...

How to remove unique, then duplicate dictionaries in a list?

Given the following list that contains some duplicate and some unique dictionaries, what is the best method to remove unique dictionaries first, then reduce the duplicate dictionaries to single instances? I gotta say I only recently started getting into Python but its making this project so much easier. I'm just a bit stumped on this kin...

Where do I get sample code in C++ creating iterator for my own container?

I have been searching for sample code creating iterator for my own container, but I haven't really found a good example. I know this been asked before (http://stackoverflow.com/questions/148540/c-creating-my-own-iterators) but didn't see any satisfactory answer with examples. I am looking for simple sample code to start how to design ...

How to Implement a counter for every number inside a list with Scheme ?

Okay I want to count the number of times each [number] has appeared inside a list using Scheme. How can I do that ? I also would like to store the counter of the given number and re-construct a new list. For example I have the following list ((1 2)(2 5)(5 7)(7 8)(6 8)(4 6)(3 4)(1 3)(4 8)) I was thinking first flatten the list, and the...

Where can I get C/C++ sample code for merge sort a link list?

Where can I get a sample code for merge sort a link list? ...

What is the best way to sort link list?

What is the best algorithm to sort a link list [in C/C++]? ...

Is there a list of known web crawlers?

I'm trying to get accurate download numbers for some files on a web server. I look at the user agents and some are clearly bots or web crawlers, but many for many I'm not sure, they may or may not be a web crawler and they are causing many downloads so it's important for me to know. Is there somewhere a list of know web crawlers with so...