I have stumbled across some code that is adding strings to a List but hashing the value before adding it.
It's using an MD5 hash (MD5CryptoServiceProvider) on the string value, then adding this to the list.
Is there any value in doing this in terms of speed to find the key in the list or is this just unnecessary?
...
Using C# what is the best way to sort a List numerically?
my list has items 5,7,3 and I would like them sorted 3,5,7. I know some longer ways, but I would imagine linq has a quicker way?
sorry this was end of day, my mind is else where it worked, didn't see it change the first time:(
...
I am generating multi-series graphs with the date along the X-Axis. The problem is that not all of the series in the graph have the same dates in the date range. Meaning that if I choose 1 Feb through 30 Apr that one series may have data that starts at 1 Feb but only goes through the end of March but another series may have data for th...
Hello everybody!
Exscusme buy my English )))
I have this problem:
I must iterate items in STL list with posible editing items: remove, add, edit.
This is my approach:
void MoveOnNewPlace(Tree& parent, Tree& child)
{
Tree *temp=&parent;
while(temp->GetParent()!=temp && temp->GetItem().GetChar()=='(')
temp=temp->GetPar...
The name for Lisp derives from LISt Processing. Linked lists are the major data structure of Lisp languages, and Lisp source code is itself made up of lists. As a result, Lisp programs can manipulate source code as a data structure (this is known as homoiconicity).
However, a list is by definition a sequential construct. This encourages...
Scenario: I have an unordered list < ul > of width (lets say 200px) with four < li > elements that are sized equally. Therefore each should be 50px. When I add a 5th < li > element each width should re-size to 40px. If I change the width of the < ul > to 500px with 5 < li > elements, each < li > element should be 100px.
Is this possible...
Building an application, before using a real database, just to get things work I can first use a hard-coded list as a fake, in-memory repository:
public class FakeProductsRepository
{
private static IQueryable<Product> fakeProducts = new List<Product> {
new Product{ ProductID = "xxx", Description = "xxx", Price = 1000},
...
Related to this: http://stackoverflow.com/questions/3741756/adding-new-items-dynamically-to-iqueryable-hard-coded-fake-repository/3741768#3741768
How could I build the method for the following class, which would remove items from the list based on the value of one of its fields?
public class FakeProductsRepository
{
private readonly...
hello
I wanna remove duplicated value in list on clojure?
for example)
from
("a" "b" "c" "a")
to
("a" "b" "c")
...
I am trying to write a scheme function that takes a list of the form:
((#f ((1 1) (2 1)))
(#f ((1 3) (5 1)))
(#f ((1 4) (7 1)))
)
and removes all the #f to give a list like:
( ((1 1) (2 1))
((1 3) (5 1))
((1 4) (7 1))
)
I have tried the following code but cannot get it to work:
(define meth
(lambda lst
(if (equal? (cdr...
I have a list of tuples:
[(3,4), (18,27), (4,14)]
and need a code merging tuples which has repeated numbers, making another list where all list elements will only contain unique numbers. The list should be sorted by the length of the tuples, i.e.:
>>> MergeThat([(3,4), (18,27), (4,14)])
[(3,4,14), (18,27)]
>>> MergeThat([(1,3), (15,...
I have created three features - fields, content types and lists. I deployed the solution and everything was fine. However, I deleted my list instance from the Lists section in my site. Now I cannot create it again. I tried to deploy the solution again but no instance was created. How can that be done?
<ListInstance Id="2" Title="My Cont...
I'm writing an XSLT 1.0 stylesheet to transform multi-namespace XML documents to HTML. At some place in the result HTML I want to list all the namespaces, that occured in the document.
Is this possibile?
I thought about something like
<xsl:for-each select="//*|//@*">
<xsl:value-of select="namespace-uri(.)" />
</xsl:for-each>
but o...
Hi All,
I once read an article by Imaar Spaanjars on how to build 3 tier applications. (http://imar.spaanjaars.com/416/building-layered-web-applications-with-microsoft-aspnet-20-part-1) which has formed the basis of my coding for a while now.
Thus I implement collections as he has done, by inheriting a List<T>. So if I have a class na...
i'have a List of String like
List<String> MyList=new List<String>{"A","B"};
and a
Dictionary<String, Dictionary<String,String>> MyDict=new Dictioanry<String,Dictionary<String,String>>();
which contains
Key Value
Key Value
"ONE" "A_1" "1"
"A_2" "2"
"X_1" "3"
...
Hello,
I have a list like this:
item.Add("a");
item.Add("as");
item.Add("b");
item.Add("fgs");
item.Add("adsd");
How can I find all items that start with (for example) "a"?
This "a" is not some hardcoded string, so I will need a function that do this for each string.
I try with FindAll, but I did not figured out how it works.
Br, ...
I have a list of items that has numeric values and I need to achieve a sum using these items. I need your help to build such an algorithm. Below, there is a sample that describes my problem, written in C#:
int sum = 21;
List<Item> list = new List<Item>();
list.Add(new Item() { Id = Guid.NewGuid(), Value = 3 });
list.Add(new Item() { Id...
This might be a strange question but if I want to define a list of integers from:
1, 2, 3, 4, 5, 6, 7, 8, 9
Do I need to do it using the ; character?
[ 1; 2; 3; 4; 5; 6; 7; 8; 9 ]
instead of?:
[ 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
It just seems to me , is more natural and easy on the eyes. Just wondering the idea behind using ;? (Not cr...
I have a structure from java, a List < List < String > > containing
elements like:
[[ "Node0", "Node00", "Leaf0"],
[ "Node0", "Node00", "Leaf1"],
[ "Node1", "Leaf2"],
[ "Node0", "Leaf3"],
[ "Node2", "Node20", "Node200", "Leaf4"]]
What I want to do is to create a XML structure (using Scala) in
the most simple way, ending in somethi...
Is there a pythonic way to check if a list is already sorted in AESC or DESC.
listtimestamps=[1,2,3,5,6,7]
something like listtimestamps.isSorted() that returns True or False.
EDIT: I want to input a list of timestamps for some messages and check if the the transactions appeared in the correct order.
and I can write a custom function...