Search Results

Search found 3722 results on 149 pages for 'choice'.

Page 22/149 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • Errno socket error in python

    - by Emma
    i wrote this code : import random import sys import urllib openfile = open(sys.argv[1]).readlines() c = random.choice(openfile) i = 0 while i < 5: i=i+1 c = random.choice(openfile) proxies = {'http': c} opener = urllib.FancyURLopener(proxies).open("http://whatismyip.com.au/").read() ::: I put 3 proxy in a txt file . : http://211.161.159.74:8080 http://119.70.40.101:8080 http://124.42.10.119:8080 but when execute it i get this error : IOError: [Errno socket error] (10054, 'Connection reset by peer') what am i going to do ? please help me .

    Read the article

  • Know any unobstrusive, simple GUI guidelines or design recommendations for notifications?

    - by Vinko Vrsalovic
    Hello again. I'm in the process of designing and testing various ideas for an application whose main functionality will be to notify users of occurring events and offer them with a choice of actions for each. The standard choice would be to create a queue of events showing a popup in the taskbar with the events and actions, but I want this tool to be the less intrusive and disrupting as possible. What I'm after is a good book or papers on studies of how to maximize user productivity in these intrinsically disruptive scenarios (in other words, how to achieve the perfect degree of annoying-ness, not too much, not too little). The user is supposedly interested in these events, they subscribe to them and can choose the actions to perform on each. I prefer books and papers, but the usual StackOverflow wisdom is appreciated as well. I'm after things like: Don't use popups, use instead X Show popups at most 3 seconds Show them in the left corner Use color X because it improves readability and disrupts less That is, cognitive aspects of GUI design that would help users in such a scenario.

    Read the article

  • Django, ModelForms, User and UserProfile - not hashing password

    - by IvanBernat
    I'm trying to setup a User - UserProfile relationship, display the form and save the data. When submitted, the data is saved, except the password field doesn't get hashed. Additionally, how can I remove the help_text from the username and password (inherited from the User model)? Full code is below, excuse me if it's too long. Models.py USER_IS_CHOICES = ( ('u', 'Choice A'), ('p', 'Choice B'), ('n', 'Ninja'), ) class UserProfile(models.Model): user = models.ForeignKey(User, unique=True) user_is = models.CharField(max_length=1, choices=USER_IS_CHOICES) Forms.py class UserForm(forms.ModelForm): class Meta: model = User fields = ["first_name", "last_name", "username", "email", "password"] def clean_username(self): username = self.cleaned_data['username'] if not re.search(r'^\w+$', username): raise forms.ValidationError('Username can contain only alphanumeric characters') try: User.objects.get(username=username) except ObjectDoesNotExist: return username raise forms.ValidationError('Username is already taken') class UserProfileForm(forms.ModelForm): class Meta: model = UserProfile fields = ['user_is'] Views.py if request.method == 'POST': uform = UserForm(request.POST) pform = UserProfileForm(request.POST) if uform.is_valid() and pform.is_valid(): user = uform.save() profile = pform.save(commit = False) profile.user = user profile.save() return HttpResponseRedirect('/') else: uform = UserForm() pform = UserProfileForm() variables = RequestContext(request, { 'uform':uform, 'pform':pform }) return render_to_response('registration/register.html', variables)

    Read the article

  • Django Custom Template Tages: Inclusion Tags

    - by Harry
    Hello world! Im trieng to build my own template tags Im have no idea why I get the errors I get, im following the django doc's. this is my file structure of my app: pollquiz/ __init__.py show_pollquiz.html showpollquiz.py This is showpollquiz.py: from django import template from pollquiz.models import PollQuiz, Choice register = template.Library() @register.inclusion_tag('show_pollquiz.html') def show_poll(): poll = Choice.objects.all() return { 'poll' : poll } html file: <ul> {% for poll in poll <li>{{ poll.pollquiz }}</li> {% endfor </ul> in my base.html file im am including like this {% load showpollquiz %} and {% poll_quiz %} Bu then I get the the error: Exception Value: Caught an exception while rendering: show_pollquiz.html I have no idea why this happens. Any ideas? Please keep in mind Im still new to Django

    Read the article

  • Access 2007 VBA : Building a listbox with selection choices from another list box

    - by Justin
    So there are 8 categories that may be associated to each order, but not necessarily all of them. So i was going to build a list box that allowed the user to double click each of the category they wish to associate when they have an "Order Detail" form opened up (unbound form that has hidden text boxes with all needed ID numbers). I want to have another empty text box right beside it that will allow me to append the selections (up to 8) so the user can see that they have been added. So one list box with the default choices, and when a choice is double clicked, it adds that choice to the second list box to see the tally so to speak. What is the VB for getting something like this done? Thanks Justin

    Read the article

  • Are these tables too big for SQL Server or Oracle

    - by Jeffrey Cameron
    Hey all, I'm not much of a database guru so I would like some advice. Background We have 4 tables that are currently stored in Sybase IQ. We don't currently have any choice over this, we're basically stuck with what someone else decided for us. Sybase IQ is a column-oriented database that is perfect for a data warehouse. Unfortunately, my project needs to do a lot of transactional updating (we're more of an operational database) so I'm looking for more mainstream alternatives. Question Given these tables' dimensions, would anyone consider SQL Server or Oracle to be a viable alternative? Table 1 : 172 columns * 32 million rows Table 2 : 453 columns * 7 million rows Table 3 : 112 columns * 13 million rows Table 4 : 147 columns * 2.5 million rows Given the size of data what are the things I should be concerned about in terms of database choice, server configuration, memory, platform, etc.?

    Read the article

  • Schemas and tables versus user-ids in a single table using PostgreSQL

    - by gvkv
    I'm developing a web app and I've come to a fork in the road with respect to database structure and I don't know which direction to take. I have a database with user information that I can structure one of two ways. The first is to create a schema and a set of tables for each user (duplicating the structure for each user) and the second is to create a single set of tables and query information based on user-id. Suppose 100000 users. Here are my questions: Considering security, performance, scalability and administration where does each choice lie? Would the answers change for 1000000 or 10000? Is there a set of best practices that lead to one choice or the other? It seems to me that multiple schemas are more secure since it's trivial to restrict user privileges but what about performance and scalability? Administration seems like a wash since dumping (and restoring) lots of schemas isn't any more difficult than dumping a few.

    Read the article

  • Python Django vs ASP.NET MVC

    - by eddyc05
    Hey guys ! i'm fairly new at web development scene and i was wondering if you guys can help me break up the pros and cons of using python django vs asp.net mvc besides the maturity level of its framework. I have intermediate experience with JAVA. As of right now, i'm leaning towards python but i just wanted to make sure i am making the right choice. I find myself limited with books available on asp.net web developments. I am aware that there is the storefront example on the official asp.net site. However, that tutorial was a little hard for me to follow. I've done a research around and was hoping python could be my next available choice. There are more tutorials available online for python anyways. What do you guys think??

    Read the article

  • XSD sequence shows as abiguous!

    - by Tim C
    I have an XSD which was transformed from a RELAX NG schema with a few errors I am trying to fix. The big issue I have it with the following <xs:element name="list"> <xs:complexType> <xs:sequence> <xs:choice> <xs:sequence> <xs:element minOccurs="0" ref="preamble"/> <xs:element minOccurs="0" ref="title"/> </xs:sequence> <xs:sequence> <xs:element minOccurs="0" ref="title"/> <xs:element minOccurs="0" ref="preamble"/> </xs:sequence> </xs:choice> <xs:group maxOccurs="unbounded" ref="block-selectionListItem"/> </xs:sequence> <xs:attributeGroup ref="attlist-selectionList"/> </xs:complexType> </xs:element> As you can see the xs:choice block allows you to pick between two xs:sequence blocks. Seems to make sense except that Visual Studio gives the following warning on the second <xs:element minOccurs="0" ref="title/> element which is throwing everything off: Multiple definition of element 'title' causes the content model to become ambiguous. A content model must be formed such that during validation of an element information item sequence, the particle contained directly, indirectly or implicitly therein with which to attempt to validate each item in the sequence in turn can be uniquely determined without examining the content or attributes of that item, and without any information about the items in the remainder of the sequence. Because you can only choose one I do not see how this is ambiguous. Any help would be greatly appreciated! Edit: To be a bit more concise here are the possible outputs of the XML that would validate with this schema: <list> <preamble>My Preamble</preamble> <title>My Title</title> </list> or: <list> <title>My Title</title> <preamble>My Preamble</preamble> </list> As you can see it can be either one way or the other but not both. Also you could just have a title or a preamble and not both.

    Read the article

  • After I've installed it, NUnit doesn't appear in VS2008

    - by Richard77
    Hello, I downloaded and installed NUnit successfuly (or so I was told by the installer). Now, when I start a project, I don't see NUnit in the 'Create UnitTest' prompt as one the choice I'm givven to. All I can see are (i) VS Unit Test and (ii) Mb Unit v3 as choices. In fact, I downloaded today the MbB Unit. After, installing it, I was able to see it right away in the prompt. What happen to the NUnit? Althought, I can see it when I do Start - All Programs Or maybe NUnit dosn't need to appear in the prompt as choice since it has its own GUI. Thanks for helping

    Read the article

  • Retrieving search results from Google, Google Images, Wikipedia, Flickr, Dictionary.com

    - by Arjun Vasudevan
    I've an ASP.NET page with a textbox and a option from user of the following choices: Wikipedia, Google, Dictionary.com, Flickr, Google images. The user enters a word(s) in the textbox and selects a choice among the following. Depending on the choice select by the user I wish to return the following. Wikipedia: Return the content and link to the page corresponding to the topic about the word. Google: Return the top 10 results of google search for this word. Flickr: Return a few images atmost 10 images from flickr search GoogleImage: Return a few images from google image search. Dictionary: Return the meaning of the word. How can I do that? Which tool box control can I use for holding the results coming from these sites?

    Read the article

  • Dashcode: How to create a custom/new Project Template?

    - by JJBigThoughts
    I'm trying to customize the javascript that Dashcode uses. So that I won't step on Apple's Project Templates, I want to make a custom project template that would appear as a choice after you click "New Project." I have been able to modify one of the existing templates (like, Custom, Browser, Utility, RSS, and Podcast). I can not, however, seem to add a new template to the list, like adding "JJ's Awesome New Cross Platform Template" as a choice. I have tried copying the directory Plugins/TemplateWebCustom.wdgtTemplate and changing in Custom's Info.plist file the com.apple.Dashcode.template.web.custom to, say com.apple.Dashcode.template.web.custom2 and in Resouces/project.plist updating the key value pair: TemplateIdentifier ==>com.apple.Dashcode.template.web.custom Is it possible to add a new Project Template? What the minimum steps? Thanks, JJ

    Read the article

  • Django: many-to-one fields and data integrity

    - by John
    Let's say that I have a Person who runs an inventory system. Each Person has some Cars, and each Car has a very large number of Parts (thousands, let's say). A Person, Bob, uses a Django form to create a Car. Now, Bob goes to create some Parts. It is only at the form level that Django knows that the Parts belong to some specific Car, and that the Parts.ForeignKey(Car) field should only have a specific Car as a choice. When creating a Part, you have to mess with the form's constructor or similar in order to limit the choice of Cars to only the cars owned by Bob. It does not seem proper that to enforce this ownership at the form level. It seems that other users' Cars must be inaccessible to anyone but the owner of the Car. What do you all think about this, and is there any way to enforce this?

    Read the article

  • Are there any small scale, durable document/object databases?

    - by Joe Doyle
    I have a few .Net projects that would benefit from using a document/object database opposed to a relational one. I think that db4o would be a good choice, but we're not sure how much the cost is. I'd love to use MongoDB but it's design isn't for small scale, single server applications. Are there other options out there that I just haven't run across for small scale applications? EDIT: So is this a space that doesn't have a good solution, yet? Are there no small scale & durable document databases? Would my best choice be to use MongoDB and set the --syncdelay option set to 1?

    Read the article

  • How to do call function after client finishes download from tornado web server?

    - by Shabbyrobe
    I would like to be able to run some cleanup functions if and only if the client successfully completes the download of a file I'm serving using Tornado. I installed the firefox throttle tool and had it slow the connection down to dialup speed and installed this handler to generate a bunch of rubbish random text: class CrapHandler(BaseHandler): def get(self, token): crap = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(100000)) self.write(crap) print "done" I get the following output from tornado immediately after making the request: done I 100524 19:45:45 web:772] 200 GET /123 (192.168.45.108) 195.10ms The client then plods along downloading for about 20 seconds. I expected that it would print "done" after the client was done. Also, if I do the following I get pretty much the same result: class CrapHandler(BaseHandler): @tornado.web.asynchronous def get(self, token): crap = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(100000)) self.write(crap) self.finish() print "done" Am I missing something fundamental here? Can tornado even support what I'm trying to do? If not, is there an alternative that does?

    Read the article

  • How do I get selected background color from SecondView to pass to FirstView?

    - by rob
    I am going insane! This is a simple app with two Views. FirstView is a text field with info button to flip to SecondView. In SecondView I have 6 buttons for background color choice. When button is pushed the color of background changes perfectly but cannot make it also change background color for FirstView. Any help would be GREAT! Thanks! I am using Objective C class working on a iPhone app. Sorry new at this. The SecondView acts almost like a settings page in the fact that when a button is pushed the background color changes to the button color. I need it so when I push the "back" button to go back to FirstView the background color has also changed to that color choice. Been thru sooooooooo many tutorials and codes that now I am totally lost......... Thanks again!

    Read the article

  • How to save a value in a plist file in iphone?

    - by Warrior
    I am new to iphone development.I am using the below code to add the value to the plist but when check the plist after executing the code i dont see any value saved in the plist.Where do i go wrong? please help me out.The plist i have created is in the resource folder.Thanks. NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathComponent:@"regvalue.plist"]; NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:finalPath]; [plistDict setValue:@"hello" forKey:@"choice"]; [plistDict writeToFile:finalPath atomically: YES]; For retrieving the value NSString *path = [[NSBundle mainBundle] bundlePath]; NSString *finalPath = [path stringByAppendingPathComponent:@"regvalue.plist"]; NSMutableDictionary* plistDict = [[NSMutableDictionary alloc] initWithContentsOfFile:finalPath]; NSString *value; value = [plistDict objectForKey:@"choice"]; NSLog(@"the value is %@",value); It gives only null value.Please help me out.Thanks.

    Read the article

  • cleaned_data() doesn't have some of the entered data

    - by SC Ghost
    I have a simple form for a user to enter in Name (CharField), Age(IntegerField), and Sex(ChoiceField). However the data that is taken from the Sex choice field is not showing up in my cleaned_data(). Using a debugger, I can clearly see that the data is being received in the correct format but as soon as I do form.cleaned_data() all sign of my choice field data is gone. Any help would be greatly appreciated. Here is the relative code: class InformationForm(forms.Form): Name = forms.CharField() Age = forms.IntegerField() Sex = forms.ChoiceField(SEX_CHOICES, required=True) def get_information(request, username): if request.method == 'GET': form = InformationForm() else: form = RelativeForm(request.POST) if form.is_valid(): relative_data = form.cleaned_data

    Read the article

  • Can a user-chosen image be inserted directly into a JEditorPane?

    - by JIM
    What I am trying to do is open up a JFilechooser that filters jpeg,gif and png images, then gets the user's selection and inserts it into the JEditorPane. Can this be done? or am i attempting something impossible? Here is a sample of my program.(insert is a JMenuItem and mainText is a JEditorPane) insert.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ JFileChooser imageChooser = new JFileChooser(); imageChooser.setFileFilter(new FileNameExtensionFilter("Image Format","jpg","jpeg","gif","png")); int choice = imageChooser.showOpenDialog(mainText); if (choice == JFileChooser.APPROVE_OPTION) { mainText.add(imageChooser.getSelectedFile()); } } }); What i tried to do is use the add method, i know it's wrong but just to give you an idea of what i'm trying to do. Before you complain, i'm sorry about the code formatting, i don't really know all the conventions of what is considered good or bad style. Thank you very much.

    Read the article

  • Python code that needs some overview

    - by fabio
    Hi guys, im currently learning python (in the very begining), so I still have some doubts about good code manners and how should I proceed with it. Today I created this code that should random trought 01 to 60 (but is running from 01 to 69) import random dez = ['0', '1', '2', '3', '4', '5', '6'] uni = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] sort = [] while len(sort) <= 5: random.shuffle(dez) random.shuffle(uni) w = random.choice(dez) z = random.choice(uni) chosen = str(w) + str(z) if chosen != "00" and chosen not in sort: sort.append(chosen) print chosen I'm also in doubt how to make the code stop at "60".

    Read the article

  • Symfony2 Entity to array

    - by Adriano Pedro
    I'm trying to migrate my flat php project to Symfony2, but its coming to be very hard. For instance, I have a table of Products specification that have several specifications and are distinguishables by its "cat" attribute in that Extraspecs DB table. Therefore I've created a Entity for that table and want to make an array of just the specifications with "cat" = 0... I supose the code is this one.. right? $typeavailable = $this->getDoctrine() ->getRepository('LabsCatalogBundle:ProductExtraspecsSpecs') ->findBy(array('cat' => '0')); Now how can i put this in an array to work with a form like this?: form = $this ->createFormBuilder($product) ->add('specs', 'choice', array('choices' => $typeavailableArray), 'multiple' => true) Thank you in advance :) # Thank you all.. But now I've came across with another problem.. In fact i'm building a form from an existing object: $form = $this ->createFormBuilder($product) ->add('name', 'text') ->add('genspec', 'choice', array('choices' => array('0' => 'None', '1' => 'General', '2' => 'Specific'))) ->add('isReg', 'choice', array('choices' => array('0' => 'Material', '1' => 'Reagent', '2' => 'Antibody', '3' => 'Growth Factors', '4' => 'Rodents', '5' => 'Lagomorphs'))) So.. in that case my current value is named "extraspecs", so i've added this like: ->add('extraspecs', 'entity', array( 'label' => 'desc', 'empty_value' => ' --- ', 'class' => 'LabsCatalogBundle:ProductExtraspecsSpecs', 'property' => 'specsid', 'query_builder' => function(EntityRepository $er) { return $er ->createQueryBuilder('e'); But "extraspecs" come from a relationship of oneToMany where every product has several extraspecs... Here is the ORM: Labs\CatalogBundle\Entity\Product: type: entity table: orders__regmat id: id: type: integer generator: { strategy: AUTO } fields: name: type: string length: 100 catnumber: type: string scale: 100 brand: type: integer scale: 10 company: type: integer scale: 10 size: type: decimal scale: 10 units: type: integer scale: 10 price: type: decimal scale: 10 reqcert: type: integer scale: 1 isReg: type: integer scale: 1 genspec: type: integer scale: 1 oneToMany: extraspecs: targetEntity: ProductExtraspecs mappedBy: product Labs\CatalogBundle\Entity\ProductExtraspecs: type: entity table: orders__regmat__extraspecs fields: extraspecid: id: true type: integer unsigned: false nullable: false generator: strategy: IDENTITY regmatid: type: integer scale: 11 spec: type: integer scale: 11 attrib: type: string length: 20 value: type: string length: 200 lifecycleCallbacks: { } manyToOne: product: targetEntity: Product inversedBy: extraspecs joinColumn: name: regmatid referencedColumnName: id HOw should I do this? Thank you!!!

    Read the article

  • How to display specific data from a file

    - by user1067332
    My program is supposed to ask the user for firstname, lastname, and phone number till the users stops. Then when to display it asks for the first name and does a search in the text file to find all info with the same first name and display lastname and phones of the matches. import java.util.*; import java.io.*; import java.util.Scanner; public class WritePhoneList { public static void main(String[] args)throws IOException { BufferedWriter output = new BufferedWriter(new FileWriter(new File( "PhoneFile.txt"), true)); String name, lname, age; int pos,choice; try { do { Scanner input = new Scanner(System.in); System.out.print("Enter First name, last name, and phone number "); name = input.nextLine(); output.write(name); output.newLine(); System.out.print("Would you like to add another? yes(1)/no(2)"); choice = input.nextInt(); }while(choice == 1); output.close(); } catch(Exception e) { System.out.println("Message: " + e); } } } Here is the display code, when i search for a name, it finds a match but displays the last name and phone number of the same name 3 times, I want it to display all of the possible matches with the first name. import java.util.*; import java.io.*; import java.util.Scanner; public class DisplaySelectedNumbers { public static void main(String[] args)throws IOException { String name; String strLine; try { FileInputStream fstream = new FileInputStream("PhoneFile.txt"); // Get the object of DataInputStream DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); Scanner input = new Scanner(System.in); System.out.print("Enter a first name"); name = input.nextLine(); strLine= br.readLine(); String[] line = strLine.split(" "); String part1 = line[0]; String part2 = line[1]; String part3 = line[2]; //Read File Line By Line while ((strLine= br.readLine()) != null) { if(name.equals(part1)) { // Print the content on the console System.out.print("\n" + part2 + " " + part3); } } }catch (Exception e) {//Catch exception if any System.out.println("Error: " + e.getMessage()); } } }

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >