Search Results

Search found 35275 results on 1411 pages for 'white list'.

Page 12/1411 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Using a Loop to add objects to a list(python)

    - by Will
    Hey guys so im trying to use a while loop to add objects to a list. Heres bascially what i want to do: (ill paste actually go after) class x: blah blah choice = raw_input(pick what you want to do) while(choice!=0): if(choice==1): Enter in info for the class: append object to list (A) if(choice==2): print out length of list(A) if(choice==0): break ((((other options)))) as im doing this i can get the object to get added to the list, but i am stuck as to how to add multiple objects to the list in the loop. Here is my actual code i have so far... print "Welcome to the Student Management Program" class Student: def init (self, name, age, gender, favclass): self.name = name self.age = age self.gender = gender self.fac = favclass choice = int(raw_input("Make a Choice: " )) while (choice !=0): if (guess==1): print("STUDENT") namer = raw_input("Enter Name: ") ager = raw_input("Enter Age: ") sexer = raw_input("Enter Sex: ") faver = raw_input("Enter Fav: ") elif(guess==2): print "TESTING LINE" elif(guess==3): print(len(a)) guess=int(raw_input("Make a Choice: ")) s = Student(namer, ager, sexer, faver) a =[]; a.append(s) raw_input("Press enter to exit") any help would be greatly appreciated!

    Read the article

  • Trim email list into domain list

    - by hanjaya
    The function below is part of a script to trim email list from a file into domain list and removes duplicates. /* define a function that can accept a list of email addresses */ function getUniqueDomains($list) { // iterate over list, split addresses and add domain part to another array $domains = array(); foreach ($list as $l) { $arr = explode("@", $l); $domains[] = trim($arr[1]); } // remove duplicates and return return array_unique($domains); } What does $domains[] = trim($arr[1]); mean? Specifically the $arr[1]. What does [1] mean in this context? How come variable $arr becomes an array variable?

    Read the article

  • C++ Generic List Assignment

    - by S73417H
    I've clearly been stuck in Java land for too long... Is it possible to do the C++ equivalent of the following Java code: // Method List<Bar> getBars() { return new LinkedList<Bar>(); } // Assignment statement. List<Foo> stuff = getBars(); Where Foo is a sub-class of Bar. So in C++.... std::list<Bar> & getBars() { std::list<Bar> bars; return bars; } std::list<Foo> stuff = getBars(); Hope that makes sense....

    Read the article

  • Flex list-controls - maintain remote data

    - by artemb
    Hello. I have a TileList which represents some remote data. I also have a form which allows me to change the data. And the data may be changed by someone else too. What is the best way to maintain data in the list in an up-to-date state? The simplest option I see is the following: Select an item in the list Edit it in the form Save it. The form submits the data to the server When the server reports success the list re-fetches it's data The very bad thing about this workflow is that the list loses selection (a tree would also loose the nodes' expanded/collapsed state). I would really love to find out another option which would enable the list to maintain it's selection state. Any guesses on how it may be done?

    Read the article

  • Linked List Inserting in sorted format

    - by user2738718
    package practise; public class Node { public int data; public Node next; public Node (int data, Node next) { this.data = data; this.next = next; } public int size (Node list) { int count = 0; while(list != null){ list = list.next; count++; } return count; } public static Node insert(Node head, int value) { Node T; if (head == null || head.data <= value) { T = new Node(value,head); return T; } else { head.next = insert(head.next, value); return head; } } } This work fine for all data values less than the first or the head. anything greater than than doesn't get added to the list.please explain in simple terms thanks.

    Read the article

  • python: creating a list inside a dictionary

    - by user1871081
    I just started using python and I'm trying to create a program that will read a file that looks like this: AAA x 111 AAB x 111 AAA x 112 AAC x 123 ... the file is 50 lines long and I'm trying to make the letters into keys in a dictionary and the numbers lists that correspond with the keys. I want the output to look like this: {AAA: ['111', '112'], AAB: ['111'], AAC: [123], ...} This is what I've tried file = open("filename.txt", "r") readline = file.readline().rstrip() while readline!= "": list = [] list = readline.split(" ") j = list.index("x") k = list[0:j] v = list[p + 1:] d = {} if k in d == False d[k] = [] d[k].append(v) else d[k].append(v) readline = file.readline().rstrip() I keep getting syntax errors on my if statement and I can't figure out what I've done wrong.

    Read the article

  • Black & White Video with Youtube

    - by RobertPitt
    Hey'a guys, I have an issue with the Youtube Player within Ubuntu, it seems that when playing videos there in black & white, no matter if there normal or HD. I kind of figured out how to prevent this from happening by deleting the cookie PREF that holds a KV Pair like so: PREF f1=50000000&fv=10.2.154 .youtube.com / Sat, 12 Mar 2011 11:38:29 GMT The issue is the Flash Version key, when I Delete this the color comes back, but obviously when I navigate to another page the cookie is set again. Does anyone know why this issue occurs and a possible fix? Using Latest Google Chrome on the latest version of Ubuntu (Installed 3 days ago) Thanks

    Read the article

  • Best Practices for SOA 11g Multi Data Center Active – Active Deployment – White Paper

    - by JuergenKress
    Best practice for High Availability This paper describes the recommended Active - Active solutions that can be used for protecting an Oracle Fusion Middleware 11 g SOA system against downtime across multiple locations (referred to as SOA Active - Active Disaster Recovery Solution or SOA Multi Data Center Active - Active Deployment). It provides the required configuration steps for setting up the recommended topologies and guidance about the performance and failover implications of such a configuration. Get the white paper here. SOA & BPM Partner Community For regular information on Oracle SOA Suite become a member in the SOA & BPM Partner Community for registration please visit www.oracle.com/goto/emea/soa (OPN account required) If you need support with your account please contact the Oracle Partner Business Center. Blog Twitter LinkedIn Facebook Wiki Mix Forum Technorati Tags: high availability,best practice,active deployment,SOA Community,Oracle SOA,Oracle BPM,Community,OPN,Jürgen Kress

    Read the article

  • Black & White screen after resuming from Suspend [Ubuntu 12.04]

    - by Rakatash
    I recently thought of giving Linux a try with Ubuntu 12.04. So far I managed to figure out how to troubleshoot and fix some of my older issues. But i wasnt able to find a problem similar to mine. The issue is, whenever my laptop starts up after suspend, the screen stays black for a short while. then after that comes a black and white 8-bit kinda screen with nothing else. I am not sure if it's an issue with the graphic card or not. because I am able to write my login password and proceed normally if i wait till this screen shows up...after that everything is displayed normally. is there a fix for this?

    Read the article

  • Problems with NVIDIA drivers: White screen with full(or almost full)screen apps

    - by Felipe
    My NVIDIA graphic card is a 7050/610i. My problem is that after upgrading to the last NVIDIA drivers when I use fullscreen apps (or almost fullscreen) the windows goes white. My xorg.conf file: # nvidia-xconfig: X configuration file generated by nvidia-xconfig # nvidia-xconfig: version 270.29 ([email protected]) Wed Feb 23 16:38:34 PST 2011 Section "Monitor" Identifier "Monitor0" VendorName "Unknown" ModelName "Unknown" HorizSync 28.0 - 33.0 VertRefresh 43.0 - 72.0 Option "DPMS" EndSection Section "Screen" Identifier "Screen0" Device "Device0" Monitor "Monitor0" Option "AddARGBGLXVisuals" "True" DefaultDepth 24 SubSection "Display" Depth 24 EndSubSection EndSection Section "Module" Load "glx" EndSection Section "InputDevice" Identifier "Mouse0" Driver "mouse" Option "Protocol" "auto" Option "Device" "/dev/psaux" Option "Emulate3Buttons" "no" Option "ZAxisMapping" "4 5" EndSection Section "InputDevice" Identifier "Keyboard0" Driver "kbd" # generated from default EndSection Section "ServerLayout" Identifier "Layout0" Screen 0 "Screen0" 0 0 InputDevice "Keyboard0" "CoreKeyboard" InputDevice "Mouse0" "CorePointer" EndSection Section "Device" Identifier "Device0" VendorName "NVIDIA Corporation" Driver "nvidia" Option "NoLogo" "True" EndSection Any idea on how to solve this? <--Sorry for bad english, ask for more info--

    Read the article

  • White Paper on Parallel Processing

    - by Andrew Kelly
      I just ran across what I think is a newly published white paper on parallel  processing in SQL Server 2008 R2. The date is October 2010 but this is the first time I have seen it so I am not 100% sure how new it really is. Maybe you have seen it already but if not I recommend taking a look. So far I haven’t had time to read it extensively but from a cursory look it appears to be quite informative and this is one of the areas least understood by a lot of dba’s. It was authored by Don Pinto...(read more)

    Read the article

  • New White Papers Available

    - by mattande
    New Master Data Services white papers are now available on MSDN. For an application-agnostic overview of Master Data Management, see Organizational Approaches to Master Data Management . For the steps needed to configure Master Data Services to work with a SharePoint workflow, see SharePoint Workflow Integration with Master Data Services . Share this post: email it! | bookmark it! | digg it! | reddit! | kick it! | live it!...(read more)

    Read the article

  • SQLAuthority News List of Master Data Services White Paper

    Since my TechEd India 2010 presentation I am very excited with SQL Server 2010 MDS. I just come across very interesting white paper on Microsoft site related to this subject. Here is the list of the same and location where you can download them. They are all written by Top Experts at Microsoft. Master Data [...]...Did you know that DotNetSlackers also publishes .net articles written by top known .net Authors? We already have over 80 articles in several categories including Silverlight. Take a look: here.

    Read the article

  • Bursts of white noise sound when playing videos

    - by Dave M G
    I've recently freshly reinstalled Ubuntu, and Mythbuntu, on all my computers. On one of my computers, Mythbuntu 11.10, when I play a video, when it starts, I get a burst of white noise (static) that stays on. If I stop the video and restart it, the noise goes away. Sometimes if I fast forward or manipulate the video, the noise will start. It seems to be initiated, and stopped, by starting or interacting with the video. Any ideas as to why this is happening and how I can get rid of it?

    Read the article

  • The White Screen of Death

    - by TATWORTH
    A few days ago I was browsing a particular commerical web site, the site crashed and I encountered the "White Screen of Death". The detailed dump showed me what the site was using:zendMySqlPHPMageMagentoBesides all this detailed information of use to a hacker, the copyright on Magento cited a date of 2009.  Does this means that out of date software was in use?There is a more basic point - in your site please ensure that fatal errors are trapped and redirected to a page that gives away no information useful to a hacker. I suggest also that you provide a means for an administrator to simulate an error to check the error handling.

    Read the article

  • New White Paper: The Career Benefits Of Certification

    - by Harold Green
    Is Certification Worth It? The answer is a resounding YES for IT professionals who are looking to boost their career. While there are no guarantees, certification has been shown to enhance various aspects of an IT professional’s career, including: Employability Salary Job Effectiveness Job Satisfaction With the economy in a slump and unemployment at record levels, it’s tougher than ever to stand out in the competitive field of IT. Numerous research studies have shown that certification can provide IT professionals the knowledge & skills they need to succeed. This new white paper from Oracle and Pearson VUE summarizes the key advantages of certification and provides examples from IT professionals on the benefits of certification. Download your copy now.

    Read the article

  • improve my code for collapsing a list of data.frames

    - by romunov
    Dear StackOverFlowers (flowers in short), I have a list of data.frames (walk.sample) that I would like to collapse into a single (giant) data.frame. While collapsing, I would like to mark (adding another column) which rows have came from which element of the list. This is what I've got so far. This is the data.frame that needs to be collapsed/stacked. > walk.sample [[1]] walker x y 1073 3 228.8756 -726.9198 1086 3 226.7393 -722.5561 1081 3 219.8005 -728.3990 1089 3 225.2239 -727.7422 1032 3 233.1753 -731.5526 [[2]] walker x y 1008 3 205.9104 -775.7488 1022 3 208.3638 -723.8616 1072 3 233.8807 -718.0974 1064 3 217.0028 -689.7917 1026 3 234.1824 -723.7423 [[3]] [1] 3 [[4]] walker x y 546 2 629.9041 831.0852 524 2 627.8698 873.3774 578 2 572.3312 838.7587 513 2 633.0598 871.7559 538 2 636.3088 836.6325 1079 3 206.3683 -729.6257 1095 3 239.9884 -748.2637 1005 3 197.2960 -780.4704 1045 3 245.1900 -694.3566 1026 3 234.1824 -723.7423 I have written a function to add a column that denote from which element the rows came followed by appending it to an existing data.frame. collapseToDataFrame <- function(x) { # collapse list to a dataframe with a twist walk.df <- data.frame() for (i in 1:length(x)) { n.rows <- nrow(x[[i]]) if (length(x[[i]])>1) { temp.df <- cbind(x[[i]], rep(i, n.rows)) names(temp.df) <- c("walker", "x", "y", "session") walk.df <- rbind(walk.df, temp.df) } else { cat("Empty list", "\n") } } return(walk.df) } > collapseToDataFrame(walk.sample) Empty list Empty list walker x y session 3 1 -604.5055 -123.18759 1 60 1 -562.0078 -61.24912 1 84 1 -594.4661 -57.20730 1 9 1 -604.2893 -110.09168 1 43 1 -632.2491 -54.52548 1 1028 3 240.3905 -724.67284 1 1040 3 232.5545 -681.61225 1 1073 3 228.8756 -726.91980 1 1091 3 209.0373 -740.96173 1 1036 3 248.7123 -694.47380 1 I'm curious whether this can be done more elegantly, with perhaps do.call() or some other more generic function?

    Read the article

  • Subset a data.frame by list and apply function on each part, by rows

    - by aL3xa
    This may seem as a typical plyr problem, but I have something different in mind. Here's the function that I want to optimize (skip the for loop). # dummy data set.seed(1985) lst <- list(a=1:10, b=11:15, c=16:20) m <- matrix(round(runif(200, 1, 7)), 10) m <- as.data.frame(m) dfsub <- function(dt, lst, fun) { # check whether dt is `data.frame` stopifnot (is.data.frame(dt)) # check if vectors in lst are "whole" / integer # vector elements should be column indexes is.wholenumber <- function(x, tol = .Machine$double.eps^0.5) abs(x - round(x)) < tol # fall if any non-integers in list idx <- rapply(lst, is.wholenumber) stopifnot(idx) # check for list length stopifnot(ncol(dt) == length(idx)) # subset the data subs <- list() for (i in 1:length(lst)) { # apply function on each part, by row subs[[i]] <- apply(dt[ , lst[[i]]], 1, fun) } # preserve names names(subs) <- names(lst) # convert to data.frame subs <- as.data.frame(subs) # guess what =) return(subs) } And now a short demonstration... actually, I'm about to explain what I primarily intended to do. I wanted to subset a data.frame by vectors gathered in list object. Since this is a part of code from a function that accompanies data manipulation in psychological research, you can consider m as a results from personality questionnaire (10 subjects, 20 vars). Vectors in list hold column indexes that define questionnaire subscales (e.g. personality traits). Each subscale is defined by several items (columns in data.frame). If we presuppose that the score on each subscale is nothing more than sum (or some other function) of row values (results on that part of questionnaire for each subject), you could run: > dfsub(m, lst, sum) a b c 1 46 20 24 2 41 24 21 3 41 13 12 4 37 14 18 5 57 18 25 6 27 18 18 7 28 17 20 8 31 18 23 9 38 14 15 10 41 14 22 I took a glance at this function and I must admit that this little loop isn't spoiling the code at all... BUT, if there's an easier/efficient way of doing this, please, let me know!

    Read the article

  • latex list environment inside the tabular environment: extra line at top preventing alignment

    - by Usagi
    Hello good people of stackoverflow. I have a LaTeX question that is bugging me. I have been trying to get a list environment to appear correctly inside the tabular environment. So far I have gotten everything to my liking except one thing: the top of the list does not align with other entries in the table, in fact it looks like it adds one line above the list... I would like to have these lists at the top. This is what I have, a custom list environment: \newenvironment{flushemize}{ \begin{list}{$\bullet$} {\setlength{\itemsep}{1pt} \setlength{\parskip}{0pt} \setlength{\parsep}{0pt} \setlength{\partopsep}{0pt} \setlength{\topsep}{0pt} \setlength{\leftmargin}{12pt}}}{\end{list}} Renamed ragged right: \newcommand{\rr}{\raggedright} and here is my table: \begin{table}[H]\caption{Tank comparisons}\label{tab:tanks} \centering \rowcolors{2}{white}{tableShade} \begin{tabular}{p{1in}p{1.5in}p{1.5in}rr} \toprule {\bf Material} & {\bf Pros} & {\bf Cons} & {\bf Size} & {\bf Cost} \\ \midrule \rr Reinforced concrete &\rr \begin{flushemize}\item Strong \item Secure \end{flushemize}&\rr \begin{flushemize}\item Prone to leaks \item Relatively expensive to install \item Heavy \end{flushemize} & 100,000 gal & \$299,400 \\ \rr Steel & \begin{flushemize}\item Strong \item Secure \end{flushemize} & \begin{flushemize}\item Relatively expensive to install \item Heavy \item Require painting to prevent rusting \end{flushemize} & 100,000 gal & \$130,100 \\ \rr Polypropylene & \begin{flushemize}\item Easy to install \item Mobile \item Inexpensive \item Prefabricated \end{flushemize} & \begin{flushemize}\item Relatively insecure \item Max size available 10,000 gal \end{flushemize} & 10,000 gal & \$5,000 \\ \rr Wood & \begin{flushemize}\item Easy to install \item Mobile \item Cheap to install \end{flushemize} & \begin{flushemize}\item Prone to rot \item Must remain full once constructed \end{flushemize} & 100,000 gal & \$86,300\\ \bottomrule \end{tabular} \end{table} Thank you for any advice :)

    Read the article

  • Linked list recursive reverse

    - by Phoenix
    I was looking at the code below from stanford library: void recursiveReverse(struct node** head_ref) { struct node* first; struct node* rest; /* empty list */ if (*head_ref == NULL) return; /* suppose first = {1, 2, 3}, rest = {2, 3} */ first = *head_ref; rest = first->next; /* List has only one node */ if (rest == NULL) return; /* put the first element on the end of the list */ recursiveReverse(&rest); first->next->next = first; /* tricky step -- see the diagram */ first->next = NULL; /* fix the head pointer */ *head_ref = rest; } What I don't understand is in the last recursive step for e.g if list is 1-2-3-4 Now for the last recursive step first will be 1 and rest will be 2. So if you set *head_ref = rest .. that makes the head of the list 2 ?? Can someone please explain how after reversing the head of the list becomes 4 ??

    Read the article

  • std::list iterator: get next element

    - by sheepsimulator
    I'm trying to build a string using data elements stored in a std::list, where I want commas placed only between the elements (ie, if elements are {A,B,C,D} in list, result string should be "A,B,C,D". This code does not work: typedef std::list< shared_ptr<EventDataItem> > DataItemList; // ... std::string Compose(DataItemList& dilList) { std::stringstream ssDataSegment; for(iterItems = dilList.begin(); iterItems != dilList.end(); iterItems++) { // Lookahead in list to see if next element is end if((iterItems + 1) == dilList.end()) { ssDataSegment << (*iterItems)->ToString(); } else { ssDataSegment << (*iterItems)->ToString() << ","; } } return ssDataSegment.str(); } How do I get at "the-next-item" in a std::list using an iterator? I would expect that it's a linked-list, why can't I get at the next item?

    Read the article

  • std::list : get next element

    - by sheepsimulator
    I'm trying to build a string using data elements stored in a std::list, where I want commas placed only between the elements (ie, if elements are {A,B,C,D} in list, result string should be "A,B,C,D". This code does not work: typedef std::list< shared_ptr<EventDataItem> > DataItemList; // ... std::string Compose(DataItemList& dilList) { std::stringstream ssDataSegment; for(iterItems = dilList.begin(); iterItems = dilList.end(); iterItems++) { // Lookahead in list to see if next element is end if((iterItems + 1) == dilList.end()) { ssDataSegment << (*iterItems)->ToString(); } else { ssDataSegment << (*iterItems)->ToString() << ","; } } return ssDataSegment.str(); } How do I get at "the-next-item" in a std::list using an iterator? I would expect that it's a linked-list, why can't I get at the next item?

    Read the article

  • C# Changing Objects within a List

    - by kwong22
    Hi, I'm having a little problem changing members of an object in a list using a found index. So this is the method I am currently working with: static void addToInventory(ref List<baseItem> myArray, baseItem item, float maxAmount, ref float currentAmount) { if (currentAmount + item.getWeight() <= maxAmount) { Console.WriteLine("item.Quantity = {0}", item.Quantity); if (myArray.Contains(item)) { Console.WriteLine("Item ({0}) already exists", item.Name); int id = myArray.IndexOf(item); myArray[id].Quantity += item.Quantity;//Change occurs in this line, item.Quantity becomes the same as myArray[id].Quantity } else { Console.WriteLine("Adding new item ({0})", item.Name); myArray.Add(item); } currentAmount += item.getWeight(); } else { Console.WriteLine("Inventory full"); } myArray.Sort(); } This method takes several parameters including the inventory/list. I check if the item fits in and if it does, I see if there is another item of the same name in the list, find the index, and add more of the item. However, the quantity of the item added suddenly becomes the same as the quantity of the item in the list. For some reason, this also changes the quantity of the item outside of the list. So therefore, instead of quantities adding up like this: 1, 2, 3, 4, they add up like this: 1, 2, 4, 8. I've just started to learn how to use lists so if there is anything I'm missing, don't hesitate to criticize. Thanks in advance.

    Read the article

  • List modification in Python

    - by user2945143
    We are given an algorithm to modify a list of numbers from 1 to 28. There are 5 steps in the algorithm. We have written functions for each step (all correct). We need to write a function that combines all 5 steps. The algorithm modifies the list to get a value. Each time you get a new value, you use the list created by the algorithm from the previous step. This is what we have gotten so far for the code: get_card_at_top_index(insert_top_to_bottom(triple_cut((move_joker_2( move_joker_1(deck)))))) When we run the code to generate the get_card_at_top_index, the first answer is correct. However, the rest are not. Instead of using from the new list, python uses the value that it generated from the last step. What did we do wrong? UPDATE: The other 5 codes passed the tests, they are correct. Code 1 (List) = list1 Code 2 (list1) = list2 Code 3 (list2) = list3 Code 4 (list3) = list4 Code 5 (list4) = list5 we generate a number from 5. We need to run the algorithm again to generate 25 more numbers. We will use list 5 start from step 1

    Read the article

  • F# insert/remove item from list

    - by Timothy
    How should I go about removing a given element from a list? As an example, say I have list ['A'; 'B'; 'C'; 'D'; 'E'] and want to remove the element at index 2 to produce the list ['A'; 'B'; 'D'; 'E']? I've already written the following code which accomplishes the task, but it seems rather inefficient to traverse the start of the list when I already know the index. let remove lst i = let rec remove lst lst' = match lst with | [] -> lst' | h::t -> if List.length lst = i then lst' @ t else remove t (lst' @ [h]) remove lst [] let myList = ['A'; 'B'; 'C'; 'D'; 'E'] let newList = remove myList 2 Alternatively, how should I insert an element at a given position? My code is similar to the above approach and most likely inefficient as well. let insert lst i x = let rec insert lst lst' = match lst with | [] -> lst' | h::t -> if List.length lst = i then lst' @ [x] @ lst else insert t (lst' @ [h]) insert lst [] let myList = ['A'; 'B'; 'D'; 'E'] let newList = insert myList 2 'C'

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >