• Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in An example of a threading background decorator (Python)

    You could also do this with a `Process`. import functools import multiprocessing def background(func): @functools.wraps(func) def wrapper(*args, **kwargs): p = multiprocessing.Process(target=func, args=args, kwargs=kwargs) p.start() return wrapper Also, I wanted to …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching Use the top-down modular approach and pseudocode to design a suitable progr

    Alberta Einstein teaches a business class at Podunk University. To evaluate the students in this class, she has given three tests. It is now the end of the semester and …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Use the top-down modular approach and pseudocode to design a suitable progr

    The formatting on this makes it hard to read. How about some indention and blank lines in between sections?
  • Member Avatar for chriswelborn
    chriswelborn

    Gave Reputation to sepp2k in Programming and C++

    I haven't read How to Design Programs, so I don't know how good it is, but if you're having success so far, I'd say just stick with it. In my …
  • Member Avatar for chriswelborn
    chriswelborn

    Gave Reputation to sepp2k in Programming and C++

    I haven't read How to Design Programs, so I don't know how good it is, but if you're having success so far, I'd say just stick with it. In my …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Solving...but YET so far away

    @codewar, this is not the complete code. Please post the code in question and any errors that are printed. "the system is not allowing me to run the program" does …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Get current scripts path/location and name.

    This question comes up a lot. There are almost 13 million google-results for 'get bash scripts actual directory', for what that's worth. Most people use it to ensure that a …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Contents of web form to python script

    @snippsat, you're right about that JavaScript bit. I don't know what I was thinking. I guess if you were trying to do some validation on the client side, besides what …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Solving...but YET so far away

    `applyDiscount()` doesn't return anything. You shouldn't be using it like that. If you want it to return the discounted price then refactor it to do so.
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching How can I fix this function for this C++ MyProgrammingLab exercise?

    Define a function named isDivisor that has two parameters of type int and returns a value of type bool. A call to isDivisor(m,n) should return true if and only if …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in How can I fix this function for this C++ MyProgrammingLab exercise?

    Switch m and n around in the if statement. 24 % 6 == 0 // not 6 % 24 == 6 25 % 6 == 1 // not 6 % …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Solving...but YET so far away

    What is the error? `return this.price` instead of `return price`? Also, your second print.. you never set the `discount` for that product. So I don't think it will have any …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching Contents of web form to python script

    The idea is to have an HTML page that looks like this: PROJECT1 Send what goes into the web form below to a python script! _________________________________________________ ____ | Input some …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Contents of web form to python script

    You could look at making a [cgi](https://docs.python.org/3.4/library/cgi.html) script, but I don't recommend it. You should look into [HTML](www.w3schools.com/html/)/[JavaScript](http://www.w3schools.com/js/) and [AJAX](http://www.w3schools.com/ajax/default.ASP)/[Forms](http://www.w3schools.com/html/html_forms.asp), and make a Python backend like [Flask](http://flask.pocoo.org/), [Django](http://djangoproject.com), or [Bottle](http://bottlepy.org). …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching Solving...but YET so far away

    Yes, I am new to Java as you will see from my post. I have done most of the work therefore; I am not interested in someone to doing my …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Solving...but YET so far away

    The constructor takes `Product(string product, double price)`, but you are creating it (on line 8) with `Product("200.00", 0)`. You set the `price` to `0` and the `product` to `200.00`. Try …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching Coding for Privacy

    With just about everybody snooping around your emails today with the excuse of hunting the bad guys, coding to keep some resemblance of privacy is getting important. I will start …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Coding for Privacy

    This is an old post, but I didn't see any translation tables in here. So here you go, a less secure encryption method for low-risk data: rot13 = str.maketrans( 'ABCDEFGHIJKLMabcdefghijklmNOPQRSTUVWXYZnopqrstuvwxyz', …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching translate values

    A data that will declare the following variables with the corresponding data types and initialization value. Output the variables names together with the values. **Variables** **Data types initial value** Letter …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in translate values

    Is this a question? What language is this for? What have you tried? If this is a question about programming please take a minute to look under the [Software Development](https://www.daniweb.com/software-development/2) …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in cmplex python problem

    Like @woooee said, your code is tackling the numbers backwards because of your use of `mod` to get the digits. You can fix that, or make n zero-based to shift …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in cmplex python problem

    @woooee, your print statements are off. Output: 2+4+6 = 11 3*5*7 = 126 Should be: 2+4+5 = 11 3*7*6 = 126
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching On Mac OS X, how to collect all songs in library w/ titles 4 chars in len.?

    How might I gather all the songs in my music library (maintained in iTunes) on Mac OS X 10.8.5 with ID3 title tags (I guess? their titles in iTunes) that …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in On Mac OS X, how to collect all songs in library w/ titles 4 chars in len.?

    How much python do you know? What have you tried? You can walk a directory like this: import os for root, dirs, files in os.walk('/my_directory'): for filename in files: if …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching python code to change the xml attribute value dynamically

    from xml.dom import minidom dict[1] = "country" xmldoc = minidom.parse('TestStep.xml') itemlist = xmldoc.getElementsByTagName('TestStepBody') print len(itemlist) print itemlist[0].attributes['Author'].value itemlist[0].setAttribute("Author",dict[1]); for s in itemlist : print s.attributes['Author'].value dict[1] value will be changing …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in python code to change the xml attribute value dynamically

    I don't really use the `xml` module, and it would really help if you could [format your code](https://www.daniweb.com/community/syntax). But this is what I found: s = '<foo name="test"><foobar name="original"></foobar></foo>' d …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching cmplex python problem

    Write a program that reads n digit number. after reading the number, compute and display the sum of odd positioned digits,multiply all even positioned digits and add the two numbers. …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in cmplex python problem

    The odd numbers in your example are 2 and 4. So 6 is correct. The even number in your example is 3. So 3 is correct. I would've probably did …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching Facing problem on data load

    Sir I am facing problem,I want that when I open my form then select combo box value and by combo box my bellow grid and text box fill...but it is …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Facing problem on data load

    Start by posting what you have tried already. Condense it down to only what is needed to show your problem. If there are any errors then post the error message …
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching Practice

    Hello, I mainly wanted some tips and advice on ways to optimize this code, it's actually an exercise from my class' power point file. It says: Exercise 1 Sam and …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Practice

    Line 28: if(overnightCheck >= 0 && overnightCheck <= 1) { if(overnightCheck == 1) overnightPrice = 5.00; } That wrapper to make sure overnightCheck is 1 or 0 is pointless. Because …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Help with Classes

    If libraries aren't allowed, you could make your own Counter. words = ['this', 'this', 'that', 'that', 'that', 'and'] wordcount = {} for word in words: existing = wordcount.get(word, 0) wordcount[word] …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in SFD FileName Without Extension

    The only other thing I can think of is the 'DefaultExt' setting. Which should be an empty string. Sorry.
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching SFD FileName Without Extension

    The title may not be as clear so let me elaborate a little bit. I am creating an application that minifies CSS and JS files for web developers. All of …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in SFD FileName Without Extension

    I couldn't replicate it on my machine, but I'm using Mono so that is to be expected. It only added extras when I failed to type in the complete extension. …
  • Member Avatar for chriswelborn
    chriswelborn

    Marked Solved Status for User got 7,745 activity points for logging in the first time

    Is this correct? ![b2b188d015f982534475f938e7bb255c](/attachments/large/2/b2b188d015f982534475f938e7bb255c.png "b2b188d015f982534475f938e7bb255c") That seems like a lot of points for someone that has never contributed. Bug, or exploit?
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in User got 7,745 activity points for logging in the first time

    You already know about this. Sorry.
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching c#

    Hello everyone! i tried to run this code on the command prompt and got this error: "Invalid token '(' in class, struct or interface member declaration". Please how do i …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in c#

    You closed the `Accept` function's block of code with `}`. To the compiler, all of that code is just hanging there in the namespace. Also, I'm not sure if you …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in User got 7,745 activity points for logging in the first time

    Oh, or he logged in 7,745 times maybe?
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in User got 7,745 activity points for logging in the first time

    Or maybe I just don't know how stuff works. It just seemed odd that people answering questions right now are at 80-93, and then this guy.
  • Member Avatar for chriswelborn
    chriswelborn

    Created User got 7,745 activity points for logging in the first time

    Is this correct? ![b2b188d015f982534475f938e7bb255c](/attachments/large/2/b2b188d015f982534475f938e7bb255c.png "b2b188d015f982534475f938e7bb255c") That seems like a lot of points for someone that has never contributed. Bug, or exploit?
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching User got 7,745 activity points for logging in the first time

    Is this correct? ![b2b188d015f982534475f938e7bb255c](/attachments/large/2/b2b188d015f982534475f938e7bb255c.png "b2b188d015f982534475f938e7bb255c") That seems like a lot of points for someone that has never contributed. Bug, or exploit?
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching Help with Classes

    I have a class containing: class CounterList: __n_comparisons__ = 0 def __init__(self, data=None): if data is None: self.data = [] else: self.data = data self.__n_accesses__ = 0 def __getitem__(self, i): …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Help with Classes

    There is also `collections.Counter`. from collections import Counter wordcount = Counter(['this', 'this', 'that', 'that', 'that', 'and']) print(repr(wordcount)) # Reveals: # {'this': 3, 'that': 2, 'and': 1} Not only is it …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Unanswered should not include snippets

    That's what I like about this site. It's just a real person (people?) hacking on things to produce something nice and helpful.
  • Member Avatar for chriswelborn
    chriswelborn

    Marked Solved Status for Unanswered should not include snippets

    I think Snippets and Tutorials should be excluded from 'Unanswered', or a new section should be created called 'Open Questions' that doesn't include snippets and tutorials. Most of the snippets/tutorials …
  • Member Avatar for chriswelborn
    chriswelborn

    Replied To a Post in Unanswered should not include snippets

    Awesome. Thanks Dani.
  • Member Avatar for chriswelborn
    chriswelborn

    Began Watching How to Make a Video Game With Cmd

    @echo off title ‘My Game’ color zz if "%1" neq "" ( goto %1) :Menu cls echo ‘1. Start’ echo ‘2. Instructions’ echo ‘3. Exit’ set /p answer=‘Type the number …

The End.