Search Results

Search found 36179 results on 1448 pages for 'generic list'.

Page 45/1448 | < Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >

  • How can I tell if a set of parens in perl code will act as grouping parens or form a list?

    - by Ryan Thompson
    In perl, parentheses are used for overriding precedence (as in most programming languages) as well as for creating lists. How can I tell if a particular pair of parens will be treated as a grouping construct or a one-element list? For example, I'm pretty sure this is a scalar and not a one-element list: (1 + 1) But what about more complex expressions? Is there an easy way to tell?

    Read the article

  • How to configure SVN access list for directory/repository ?

    - by abatishchev
    I have next SVN repositories structure running Apache 2.2 under Windows Server 2008: http://example.com/svn/ is targeted to e:\svn (root) http://example.com/svn/dir/ is targeted to e:\svn\dir (some directory with a number of repositories) http://example.com/svn/dir/repo/ is targeted to e:\svn\dir\repo (a repository itself) How to access list so group @foo had rw access to repo? I have next access list: [groups] @foo = user1, user2 [/] * = r [dir/repo:/] @foo = rw The last string doesn't work in any combination I tried

    Read the article

  • Is it possible to use 'else' in a python list comprehension?

    - by Josh
    Here is the code I was trying to turn into a list comprehension: table = '' for index in xrange(256): if index in ords_to_keep: table += chr(index) else: table += replace_with Is there a way to add the else statement to this comprehension? table = ''.join(chr(index) for index in xrange(15) if index in ords_to_keep) Also, would I be right in concluding that a list comprehension is the most efficient way to do this?

    Read the article

  • Python: Multi list comprehension, is there such an unwieldy beast of prey ?

    - by bandana
    consider the following python 'code'. it demonstrates the concept of a multi-list comprehension: start = ['a', 'b', 'c'] middle = ['r', 'a', 'a'] finish = ['t', 'r', 't'] l = [s.upper() + m + f for s in start, m in middle, e in finish] >>> print l ['Art', 'Bar', 'Cat'] Alas, the above code does not work in python. What would be a good approximation of multi-list comprehension in python? Please discuss what happens when the lists have different lengths.

    Read the article

  • Converting generic type to it's base and vice-versa

    - by Pajci
    Can someone help me with the conversion I am facing in enclosed code ... I commented the lines of code, where I am having problem. Is this even the right way to achieve this ... what I am trying to do, is forward responses of specified type to provided callback. public class MessageBinder { private class Subscriber<T> : IEquatable<Subscriber<T>> where T : Response { ... } private readonly Dictionary<Type, List<Subscriber<Response>>> bindings; public MessageBinder() { this.bindings = new Dictionary<Type, List<Subscriber<Response>>>(); } public void Bind<TResponse>(short shortAddress, Action<ZigbeeAsyncResponse<TResponse>> callback) where TResponse : Response { List<Subscriber<TResponse>> subscribers = this.GetSubscribers<TResponse>(); if (subscribers != null) { subscribers.Add(new Subscriber<TResponse>(shortAddress, callback)); } else { var subscriber = new Subscriber<TResponse>(shortAddress, callback); // ERROR: cannot convert from 'List<Subscriber<TResponse>>' to 'List<Subscriber<Response>>' ... tried LINQ Cast operator - does not work either this.bindings.Add(typeof(TResponse), new List<Subscriber<TResponse>> { subscriber }); } } public void Forward<TResponse>(TResponse response) where TResponse : Response { var subscribers = this.GetSubscribers<TResponse>(); if (subscribers != null) { Subscriber<TResponse> subscriber; Type responseType = typeof (TResponse); if (responseType.IsSubclassOf(typeof (AFResponse))) { // ERROR: Cannot convert type 'TResponse' to 'AFResponse' ... tried cast to object first, works, but is this the right way? var afResponse = (AFResponse)response; subscriber = subscribers.SingleOrDefault(s => s.ShortAddress == afResponse.ShortAddress); } else { subscriber = subscribers.First(); } if (subscriber != null) { subscriber.Forward(response); } } } private List<Subscriber<TResponse>> GetSubscribers<TResponse>() where TResponse : Response { List<Subscriber<Response>> subscribers; this.bindings.TryGetValue(typeof(TResponse), out subscribers); // ERROR: How can I cast List<Subscriber<Response>> to List<Subscriber<TResponse>>? return subscribers; } } Thank you for any help :)

    Read the article

  • How come Java doesn't accept my LinkedList in a Generic, but accepts its own?

    - by master chief
    For a class assignment, we can't use any of the languages bultin types, so I'm stuck with my own list. Anyway, here's the situation: public class CrazyStructure <T extends Comparable<? super T>> { MyLinkedList<MyTree<T>> trees; //error: type parameter MyTree is not within its bound } However: public class CrazyStructure <T extends Comparable<? super T>> { LinkedList<MyTree<T>> trees; } Works. MyTree impleements the Comparable interface, but MyLinkedList doesn't. However, Java's LinkedList doesn't implement it either, according to this. So what's the problem and how do I fix it? MyLinkedList: public class MyLinkedList<T extends Comparable<? super T>> { private class Node<T> { private Node<T> next; private T data; protected Node(); protected Node(final T value); } Node<T> firstNode; public MyLinkedList(); public MyLinkedList(T value); //calls node1.value.compareTo(node2.value) private int compareElements(final Node<T> node1, final Node<T> node2); public void insert(T value); public void remove(T value); } MyTree: public class LeftistTree<T extends Comparable<? super T>> implements Comparable { private class Node<T> { private Node<T> left, right; private T data; private int dist; protected Node(); protected Node(final T value); } private Node<T> root; public LeftistTree(); public LeftistTree(final T value); public Node getRoot(); //calls node1.value.compareTo(node2.value) private int compareElements(final Node node1, final Node node2); private Node<T> merge(Node node1, Node node2); public void insert(final T value); public T extractMin(); public int compareTo(final Object param); }

    Read the article

  • How can I turn a single element in a list into multiple elements using Python?

    - by Trivun
    I have a list of elements, and each element consists of four seperate values that are seperated by tabs: ['A\tB\tC\tD', 'Q\tW\tE\tR', etc.] What I want is to create a larger list without the tabs, so that each value is a seperate element: ['A', 'B', 'C', 'D', 'Q', 'W', 'E', 'R', etc.] How can I do that in Python? I need it for my coursework, due tonight (midnight GMT) and I'm completely stumped.

    Read the article

  • Does the List in .NET work the same way as arraylist in Java?

    - by eflles
    When I learned Java, I was told that the arraylist works this way: It creates an array with room for 10 elements. When the 11th element is added, it is created a new list with room for 20 elements, and the 10 elements are copied into the new array. This will repeat as until there are no more elements to add, or to a maximum size. Is the List in .NET constructed the same way?

    Read the article

  • How to remove certain lists from a list of lists using python?

    - by seaworthy
    I can not figure out why my code does not filter out lists from a predefined list. I am trying to remove specific list using the following code. data = [[1,1,1],[1,1,2],[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]] data = [x for x in data if x[0] != 1 and x[1] != 1] print data My result: data = [[2, 2, 1], [2, 2, 2]] Expected result: data = [[1,2,1],[1,2,2],[2,1,1],[2,1,2],[2,2,1],[2,2,2]]

    Read the article

  • Can't find generic USB audio driver for a Samson COU1 USB microphone

    - by marcipollo
    I am unable to use a Samson USB CO1U microphone on a PC running XP, SP3. When I plug it into the USB port, Windows generates the sound indicating that it has found new hardware, and the green LED on the mic lights. But, it does not work, and the device manager reports that it cannot find a driver after searching. The same mic works on a Vista machine. Samson has no driver on their Web site, and insists that the generic audio driver in Windows should work. (http://www.samsontech.com/PRODUCTS/productpage.cfm?prodID=1810). I cannot find a generic USB audio driver at Microsoft.com. Can anyone help? Larry

    Read the article

  • Can't find generic USB audio driver for a Samson COU1 USB microphone

    - by user10321
    I am unable to use a Samson USB CO1U microphone on a PC running XP, SP3. When I plug it into the USB port, Windows generates the sound indicating that it has found new hardware, and the green LED on the mic lights. But, it does not work, and the device manager reports that it cannot find a driver after searching. The same mic works on a Vista machine. Samson has no driver on their Web site, and insists that the generic audio driver in Windows should work. (http://www.samsontech.com/PRODUCTS/productpage.cfm?prodID=1810). I cannot find a generic USB audio driver at Microsoft.com. Can anyone help? Larry

    Read the article

  • Generic Windows 98 USB Drive drivers?

    - by Electrons_Ahoy
    I've got an old Win98 machine that I'd like to pull some data off of. (Tens of gigs of data, actually.) The machine still runs fine, but due to the age, it doesn't have a cd burner, and the pre-NT networking won't connect to SMB shares without a fair amount of wrenching on the registry that I don't really want to do. What I really want to do is plug in an external USB hard drive and copy the files. But - Win98 didn't ship with generic USB drive drivers, and external drives don't ship with them these days. Can anyone point me at a reputable generic driver I can install?

    Read the article

  • ASA access lists and Egress Filtering

    - by Nate
    Hello. I'm trying to learn how to use a cisco ASA firewall, and I don't really know what I'm doing. I'm trying to set up some egress filtering, with the goal of allowing only the minimal amount of traffic out of the network, even if it originated from within the inside interface. In other words, I'm trying to set up dmz_in and inside_in ACLs as if the inside interface is not too trustworthy. I haven't fully grasped all the concepts yet, so I have a few issues. Assume that we're working with three interfaces: inside, outside, and DMZ. Let's say I have a server (X.Y.Z.1) that has to respond to PING, HTTP, SSH, FTP, MySQL, and SMTP. My ACL looks something like this: access-list outside_in extended permit icmp any host X.Y.Z.1 echo-reply access-list outside_in extended permit tcp any host X.Y.Z.1 eq www access-list outside_in extended permit tcp any host X.Y.Z.1 eq ssh access-list outside_in extended permit tcp any host X.Y.Z.1 eq ftp access-list outside_in extended permit tcp any host X.Y.Z.1 eq ftp-data established access-list outside_in extended permit tcp any host X.Y.Z.1 eq 3306 access-list outside_in extended permit tcp any host X.Y.Z.1 eq smtp and I apply it like this: access-group outside_in in interface outside My question is, what can I do for egress filtering? I want to only allow the minimal amount of traffic out. Do I just "reverse" the rules (i.e. the smtp rule becomes access-list inside_out extended permit tcp host X.Y.Z.1 any eq smtp ) and call it a day, or can I further cull my options? What can I safely block? Furthermore, when doing egress filtering, is it enough to apply "inverted" rules to the outside interface, or should I also look into making dmz_in and inside_in acls? I've heard the term "egress filtering" thrown around a lot, but I don't really know what I'm doing. Any pointers towards good resources and reading would also be helpful, most of the ones I've found presume that I know a lot more than I do.

    Read the article

  • iTextSharp error - cannot convert type 'Collections.Generic.List' to 'iTextSharp.text.Element'

    - by mike
    I am trying to export pdf file using aspx and c#. I got the following error. Cannot implicitly convert type 'System.Collections.Generic.List'' to 'iTextSharp.text.Element' I have the following code using iTextSharp.text; using iTextSharp.text.pdf; using iTextSharp.text.html.simpleparser; StringBuilder strB = new StringBuilder(); document.Open(); if (text.Length.Equals(0))//export the text { GridView1.DataBind(); using (StringWriter sWriter = new StringWriter(strB)) { using (HtmlTextWriter htWriter = new HtmlTextWriter(sWriter)) { GridView1.RenderControl(htWriter); } } } else //export the grid { strB.Append(text); } using (TextReader sReader = new StringReader(strB.ToString())) { StyleSheet styles = new StyleSheet(); List<Element> list = new List<Element>(); list = HTMLWorker.ParseToList(sReader, styles); foreach (IElement elm in list) { document.Add(elm); } } I got the error in this line: list = HTMLWorker.ParseToList(sReader, styles); It's the first time that I am trying to export pdf files. I tried to cast the list element , however this did not solve my error. Any advice would be helpful!!!

    Read the article

  • Index out of bounds exception while iterating through a List<string>.

    - by Sergio Tapia
    I have a List of the location of images on a folder. I have five pictureBoxes that emulate a coverflow type area for users to skim through the images of a given folder. I know that the error is fired because the first image in the collection is set to the first picturebox, then if I click on cycleLeft(), there is a negative number. How can I account for this? For example, if the first image in the List is already set to the farthest left and someone clicks flip left, have that first image put on the last position of the list. Any guidance? private void leftArrow_Click(object sender, EventArgs e) { cycleImagesLeft(); } private void rightArrow_Click(object sender, EventArgs e) { cycleImagesRight(); } public void cycleImagesLeft() { //imageThree is the center image, that's why I use it as a frame of reference. int currentImage = pictures.IndexOf(imageThree.ImageLocation); imageOne.ImageLocation = pictures[currentImage - 3]; imageTwo.ImageLocation = pictures[currentImage - 2]; imageThree.ImageLocation = pictures[currentImage - 1]; imageFour.ImageLocation = pictures[currentImage]; imageFive.ImageLocation = pictures[currentImage + 1]; } public void cycleImagesRight() { int currentImage = pictures.IndexOf(imageThree.ImageLocation); imageOne.ImageLocation = pictures[currentImage - 1]; imageTwo.ImageLocation = pictures[currentImage]; imageThree.ImageLocation = pictures[currentImage + 1]; imageFour.ImageLocation = pictures[currentImage + 2]; imageFive.ImageLocation = pictures[currentImage + 3]; }

    Read the article

  • Why is this unordered list formatting differently in IE7?

    - by Joel
    I'm better about getting things to look good in IE8, FF, and Safari, but IE7 still throws curve balls at me... Please check out this page and scroll down below the nav bar: http://rattletree.com/instruments.php It should become obvious when viewing in FF vs IE7. For some reason the formatting of the list is pushing the list items down on the page... any tips? <ul class="instrument"> <li class="imagebox"><img src="/images/stuff.jpg" width="247" height="228" alt="Matepe" /></li> <li class="textbox"><h3>Matepe</h3><p>This text should be to the right of the image but drops below the image in IE7</p></li> </ul> css: ul.instrument { text-align:left; display:inline-block; } ul.instrument li { list-style-type: none; display:inline-block; } li.imagebox { display:inline; margin:20px 0; padding:0px; vertical-align:top; } li.imagebox img{ border: solid black 1px; } li.textbox { display:inline; } li.textbox p{ margin:10px; width:340px; display:inline-block; }

    Read the article

  • How to specify generic method type parameters partly

    - by DNNX
    I have an extension method like below: public static T GetValueAs<T, R>(this IDictionary<string, R> dictionary, string fieldName) where T : R { R value; if (!dictionary.TryGetValue(fieldName, out value)) return default(T); return (T)value; } Currently, I can use it in the following way: var dictionary = new Dictionary<string, object(); //... var list = dictionary.GetValueAs<List<int, object("A"); // this may throw ClassCastException - this is expected behavior; It works pretty fine, but the second type parameter is really annoying. Is it possible in C# 4.0 rewrite GetValueAs is such a way that the method will still be applicable to different types of string-keyed dictionaries AND there will be no need to specify second type parameter in the calling code, i.e. use var list = dictionary.GetValueAs<List<int("A"); or at least something like var list = dictionary.GetValueAs<List<int, ?("A"); instead of var list = dictionary.GetValueAs<List<int, object("A");

    Read the article

  • Container of Generic Types in java

    - by Cyker
    I have a generic class Foo<T> and parameterized types Foo<String> and Foo<Integer>. Now I want to put different parameterized types into a single ArrayList. What is the correct way of doing this? Candidate 1: public class MMM { public static void main(String[] args) { Foo<String> fooString = new Foo<String>(); Foo<Integer> fooInteger = new Foo<Integer>(); ArrayList<Foo<?> > list = new ArrayList<Foo<?> >(); list.add(fooString); list.add(fooInteger); for (Foo<?> foo : list) { // Do something on foo. } } } class Foo<T> {} Candidate 2: public class MMM { public static void main(String[] args) { Foo<String> fooString = new Foo<String>(); Foo<Integer> fooInteger = new Foo<Integer>(); ArrayList<Foo> list = new ArrayList<Foo>(); list.add(fooString); list.add(fooInteger); for (Foo foo : list) { // Do something on foo. } } } class Foo<T> {} In a word, it is related to the difference between Foo<?> and the raw type Foo. Update: Grep What is the difference between the unbounded wildcard parameterized type and the raw type? on this link may be helpful.

    Read the article

< Previous Page | 41 42 43 44 45 46 47 48 49 50 51 52  | Next Page >