Search Results

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

Page 37/1269 | < Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >

  • Linq filtering an IQueryable<T> (System.Data.Linq.DataQuery) object by a List<T> (System.Collection.

    - by Klaptrap
    My IQueryable line is: // find all timesheets for this period - from db so System.Data.Linq.DataQuery var timesheets = _timesheetRepository.FindByPeriod(dte1, dte2); My List line is: // get my team from AD - from active directory so System.Collection.Generic.List var adUsers = _adUserRepository.GetMyTeam(User.Identity.Name); I wish to only show timesheets for those users in the timesheet collection that are present in the user collection. If I use a standard c# expression such as: var teamsheets = from t in timesheets join user in adUsers on t.User1.username equals user.fullname select t; I get the error "An IQueryable that returns a self-referencing Constant expression is not supported" Any recommendations?

    Read the article

  • What do you do when you feel you need a variatic list comprehension?

    - by cspyr0
    I would like to make a method where I could give it a list of lengths and it would return all combinations of cartesian coordinates up to those lengths. Easier to explain with an example: cart [2,5] Prelude> [ [0,0],[0,1],[0,2],[0,3],[0,4],[1,0],[1,1],[1,2],[1,3],[1,4] ] cart [2,2,2] Prelude> [ [0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1] ] A simple list comprehension won't work because I don't know how long the lists are going to be. While I love Haskell's simplicity for many problems, this is one that I could write procedurally (in C or something) in 5 minutes whereas Haskell gives me an aneurysm! A solution to this specific problem would help me out a lot; I'd also love to hear about your thought processes when tackling stuff like this.

    Read the article

  • ASA firewalls: how does stateful filtering affect my access lists?

    - by Nate
    Ok, so assume that I have an ingress access list that looks like this: access-list outside_in extended ip permit any X.Y.Z.1 eq 25 access-group outside_in in interface outside And I want to do egress filtering. I want to allow inside machines to respond on port 80, and I want to allow ports over 1024. Given that the firewall is statefull, do I need to have the rule access-list inside_in extended ip permit X.Y.Z.1 any eq 25 in my inside_in ACL, or can I get away with just access-list inside_in extended ip permit any any gt 1024 access-group inside_in in interface inside In other words, if I apply an egress access list, do I have to explicitly allow machines to respond to requests allowed by the ingress access list, or does the statefullness of the firewall handle that for me? Thanks!

    Read the article

  • How to remove Excel List Manager?

    - by jdmuys
    I have a spreadsheet with columns set as using the List Manager. I want to remove the list manager. However, the "Remove List Manager" item in the "List" menu of the List toolbar is always disabled. I tried selecting a number of different set of cells in the list, to no avail. "Remove List Manager" stays stubbornly disabled (grayed out). What am I missing? I am using Excel 2008 version 12.1.5.

    Read the article

  • Why increase pointer by two while finding loop in linked list, why not 3,4,5?

    - by GG
    I had a look at question already which talk about algorithm to find loop in a linked list. I have read Floyd's cycle-finding algorithm solution, mentioned at lot of places that we have to take two pointers. One pointer( slower/tortoise ) is increased by one and other pointer( faster/hare ) is increased by 2. When they are equal we find the loop and if faster pointer reaches null there is no loop in the linked list. Now my question is why we increase faster pointer by 2. Why not something else? Increasing by 2 is necessary or we can increase it by X to get the result. Is it necessary that we will find a loop if we increment faster pointer by 2 or there can be the case where we need to increment by 3 or 5 or x.

    Read the article

  • how to add a color to a line in sharepoint 2007 list that has a specific text ?

    - by gadym
    hello there, I would like to know how to add a color to a line in sharepoint 2007 list if in one field there is a specific text contained ? for example : I have a list that have three fields: list1 1.id 2.name 3.full description now i want to show only the first and the second field to the user. list1 id name 1 abc 2 edv second thing, i want to give a color (let say red) to a row that contains in the hidden field - "full description", a text with the word for example 'color'. I found a javascript code that i can add to the aspx page : (document).ready(function(){ $Text = $("td .ms-vb2:contains('color')"); $Text.parent().css("background-color", "red"); }); but it's only works if the the "full description" is shown. can someone give me an idea ? thanks, gadym

    Read the article

  • What do you do when you feel you need a variadic list comprehension?

    - by cspyr0
    I would like to make a method where I could give it a list of lengths and it would return all combinations of cartesian coordinates up to those lengths. Easier to explain with an example: cart [2,5] Prelude> [ [0,0],[0,1],[0,2],[0,3],[0,4],[1,0],[1,1],[1,2],[1,3],[1,4] ] cart [2,2,2] Prelude> [ [0,0,0],[0,0,1],[0,1,0],[0,1,1],[1,0,0],[1,0,1],[1,1,0],[1,1,1] ] A simple list comprehension won't work because I don't know how long the lists are going to be. While I love Haskell's simplicity for many problems, this is one that I could write procedurally (in C or something) in 5 minutes whereas Haskell gives me an aneurysm! A solution to this specific problem would help me out a lot; I'd also love to hear about your thought processes when tackling stuff like this.

    Read the article

  • Design pattern: polymorphisim for list of objects

    - by ziang
    Suppose I have a class A, and A1, A2 inherits from A. There are 2 functions: List<A1> getListA1(){...} List<A2> getListA2(){...} Now I want to do something similar to both A1 and A2 in another function public void process(List<A>){...} If I want to pass the instance of either ListA1 or ListA2, of course the types doesn't match because the compiler doesn't allow the coercion from List< A1 to List< A. I can't do something like this: List<A1> listA1 = getListA1(); List<A> newList = (List<A>)listA1; //this is not allowed. So what is the best approach to the process()? Is there any way to do it in a universal way rather than write the similar code to both List and List?

    Read the article

  • In C# how can I serialize a List<int> to a byte[] in order to store it in a DB field?

    - by Matt
    In C# how can I serialize a List to a byte[] in order to store it in a DB field? I know how to serialize to a file on the disk, but how do I just serialize to a variable? Here is how I serialized to the disk: List<int> l = IenumerableofInts.ToList(); Stream s = File.OpenWrite("file.bin"); BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(s, lR); s.Close(); I'm sure it's much the same but I just can't wrap my head around it.

    Read the article

  • make a tree based on the key of each element in list.

    - by cocobear
    >>> s [{'000000': [['apple', 'pear']]}, {'100000': ['good', 'bad']}, {'200000': ['yeah', 'ogg']}, {'300000': [['foo', 'foo']]}, {'310000': [['#'], ['#']]}, {'320000': ['$', ['1']]}, {'321000': [['abc', 'abc']]}, {'322000': [['#'], ['#']]}, {'400000': [['yeah', 'baby']]}] >>> for i in s: ... print i ... {'000000': [['apple', 'pear']]} {'100000': ['good', 'bad']} {'200000': ['yeah', 'ogg']} {'300000': [['foo', 'foo']]} {'310000': [['#'], ['#']]} {'320000': ['$', ['1']]} {'321000': [['abc', 'abc']]} {'322000': [['#'], ['#']]} {'400000': [['yeah', 'baby']]} i want to make a tree based on the key of each element in list. result in logic will be: {'000000': [['apple', 'pear']]} {'100000': ['good', 'bad']} {'200000': ['yeah', 'ogg']} {'300000': [['foo', 'foo']]} {'310000': [['#'], ['#']]} {'320000': ['$', ['1']]} {'321000': [['abc', 'abc']]} {'322000': [['#'], ['#']]} {'400000': [['yeah', 'baby']]} perhaps a nested list can implement this or I need a tree type?

    Read the article

  • Is there a fast concat method for linked list in Java?

    - by rocker
    How can I concat two linked lists in O(1) with Java via jdk, google or apache commons collection or whatever? E.g. in jdk there is only the addAll method which is O(n). Another feature I miss is to concat two lists where each of them could be in inverse order. To illustrate this assume two lists a-b-c and e-f-g could merged into a-b-c-e-f-g a-b-c-g-f-e c-b-a-e-f-g c-b-a-g-f-e Do you know of such a list implemenation or do I have to implement my own linked list? It would be also helpful to know how to tweak existing solutions (e.g. the jdk LinkedList has a lot of private methods only). These features seems to me very obvious, hopefully I am not missing something stupid.

    Read the article

  • Is there an easy way to copy an iterator into a list in Java?

    - by Space_C0wb0y
    I want something like this: public void CopyIteratorIntoList(Iterator<Foo> fooIterator) { List<Foo> fooList = new ArrayList<Foo>(); fooList.addAll(fooIterator); } which should be equivalent to: public void CopyIteratorIntoList(Iterator<Foo> fooIterator) { List<Foo> fooList = new ArrayList<Foo>(); while(fooIterator.hasNext()) fooList.add(fooIterator.next()); } Is there any method in the API to achieve that, or is this the only way?

    Read the article

  • Design pattern: Polymorphism for list of objects

    - by ziang
    Suppose I have a class A, and A1, A2 inherits from A. There are 2 functions: List<A1> getListA1(){...} List<A2> getListA2(){...} Now I want to do something similar to both A1 and A2 in another function public void process(List<A>){...} If I want to pass the instance of either ListA1 or ListA2, of course the types doesn't match because the compiler doesn't allow the coercion from List< A1 to List< A. I can't do something like this: List<A1> listA1 = getListA1(); List<A> newList = (List<A>)listA1; //this is not allowed. So what is the best approach to the process()? Is there any way to do it in a universal way rather than write the similar code to both List and List?

    Read the article

  • Any way to make a generic List where I can add a type AND a subtype?

    - by user383178
    I understand why I cannot do the following: private class Parent { }; private class Child extends Parent { }; private class GrandChild extends Child { }; public void wontCompile(List<? extends Parent> genericList, Child itemToAdd) { genericList.add(itemToAdd); } My question is there ANY practical way to have a typesafe List where you can call add(E) where E is known to be only a Parent or a Child? I vaguely remember some use of the "|" operator as used for wildcard bounds, but I cannot find it in the spec... Thanks!

    Read the article

  • How can I convert this string to list of lists?

    - by Phrixus
    Hi, what I'm trying to do is.. if a user types in [[0,0,0], [0,0,1], [1,1,0]] and press enter, the program should convert this string to several lists; one list holding [0][0][0], other for [0][0][1], and the last list for [1][1][0] I thought tuple thing would work out but no luck... :( I started phython yesterday -- (I'm C / C++ guy.) and cannot use the full advantages of this language... Does python have a good way to handle this? I need help~ :'(

    Read the article

  • How do I put unordered list items into an array

    - by Clint
    Hi, My code is... How do I get the text in each list item into an array using native javascript? <ul id="list"> <li>List Item 1</li> <li>List Item 2</li> <li>List Item 3</li> <li>List Item 4</li> </ul> <script type="text/javascript"> var list = document.getElementById('list').childNodes.TextNode; for(var i=0;i < list.length; i++) { var arrValue = list[i]; alert(arrValue); } </script> Many thanks.

    Read the article

  • How do I make a recursive list that checks company rankings?

    - by Sera
    I have a set of companies in rank order. I want my rule to check if the companies in a specified list are in rank order, and for the rule to recur until all companies in the list have been checked. I currently have the following: isOrder([]). isOrder([COM1,COM2|T]) :- rank(COM1,D), rank(COM2,E), D<E, print("in order"), isOrder([COM2|T]). However, this does not seem to work. Sometimes, the recursion goes on forever without ending, and sometimes the recursion doesn't work at all. This is when I vary the code to try and get the correct answer. Can anybody help me? I have just started Prolog and my understanding of it is severely limited. Any help would be greatly appreciated.

    Read the article

  • How can I check if a value is in a list in Perl?

    - by ablimit
    I have a file in which every line is an integer which represents an id. What I want to do is just check whether some specific ids are in this list. But the code didn't work. It never tells me it exists even if 123 is a line in that file. I don't know why? Help appreciated. open (FILE, "list.txt") or die ("unable to open !"); my @data=<FILE>; my %lookup =map {chop($_) => undef} @data; my $element= '123'; if (exists $lookup{$element}) { print "Exists"; } Thanks in advance.

    Read the article

  • Mutation Problem - Clojure

    - by Silanglaya Valerio
    having trouble changing an element of my function represented as a list. code for random function: (defn makerandomtree-10 [pc maxdepth maxwidth fpx ppx] (if-let [output (if (and (< (rand) fpx) (> maxdepth 0)) (let [head (nth operations (rand-int (count operations))) children (doall (loop[function (list) width maxwidth] (if (pos? width) (recur (concat function (list (makerandomtree-10 pc (dec maxdepth) (+ 2 (rand-int (- maxwidth 1))) fpx ppx))) (dec width)) function)))] (concat (list head) children)) (if (and (< (rand) ppx) (>= pc 0)) (nth parameters (rand-int (count parameters))) (rand-int 100)))] output )) I will provide also a mutation function, which is still not good enough. I need to be able to eval my statement, so the following is still insufficient. (defn mutate-5 "chooses a node changes that" [function pc maxwidth pchange] (if (< (rand) pchange) (let [output (makerandomtree-10 pc 3 maxwidth 0.5 0.6)] (if (seq? output) output (list output))) ;mutate the children of root ;declare an empty accumulator list, with root as its head (let [head (list (first function)) children (loop [acc(list) walker (next function)] (println "----------") (println walker) (println "-----ACC-----") (println acc) (if (not walker) acc (if (or (seq? (first function)) (contains? (set operations) (first function))) (recur (concat acc (mutate-5 walker pc maxwidth pchange)) (next walker)) (if (< (rand) pchange) (if (some (set parameters) walker) (recur (concat acc (list (nth parameters (rand-int (count parameters))))) (if (seq? walker) (next walker) nil)) (recur (concat acc (list (rand-int 100))) (if (seq? walker) (next walker) nil))) (recur acc (if (seq? walker) (next walker) nil)))) ))] (concat head (list children))))) (side note: do you have any links/books for learning clojure?)

    Read the article

  • A list of game mechanics

    - by Iain
    I'm trying to compile a list of game mechanics, by which I mean high-level/meta game mechanics like Cooperation, Resource Management, Chance and Time Manipulation rather than low level mechanics like running, jumping climbing ladders, etc Does any one have any suggestions or can point me to good existing lists? My WIP list is already proving to be quite useful to me in the way I think about games.

    Read the article

  • Command-line to list DNS servers

    - by Anurag Uniyal
    Is there a command to list dns servers? I tried $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.0.1 $ cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback But it doesn't list any servers, if I go to "Network GUI Tool", in Wireless section it lists "DNS 192.168.1.1 8.8.8.8 8.8.4.4" Can I get same information from command line? I am using Ubuntu 12.04 LTS

    Read the article

  • List of usage information to collect in a web application

    - by Thomas Levine
    I'm writing a web application that will allow people to create accounts, edit stuff, send stuff to people, &c. I plan on recording things like when things were created and sent and stuff. Is there a list of usage information that one should collect in a web application? I'd like to see whether I'm missing something. Also, is there a list of usage information that I shouldn't collect (Like maybe information that people find private)?

    Read the article

< Previous Page | 33 34 35 36 37 38 39 40 41 42 43 44  | Next Page >