Search Results

Search found 6 results on 1 pages for 'coson'.

Page 1/1 | 1 

  • Python Random Question

    - by coson
    Good Day, I am using Python 2.6 and am trying to run a simple random number generator program (random.py): import random for i in range(5): # random float: 0.0 <= number < 1.0 print random.random(), # random float: 10 <= number < 20 print random.uniform(10, 20), # random integer: 100 <= number <= 1000 print random.randint(100, 1000), # random integer: even numbers in 100 <= number < 1000 print random.randrange(100, 1000, 2) I'm now receiving the following error: C:\Users\Developer\Documents\PythonDemo>python random.py Traceback (most recent call last): File "random.py", line 3, in <module> import random File "C:\Users\Developer\Documents\PythonDemo\random.py", line 8, in <module> print random.random(), TypeError: 'module' object is not callable C:\Users\Developer\Documents\PythonDemo> I've looked at the Python docs and this version of Python supports random. Is there something else I'm missing? TIA, coson

    Read the article

  • Python noob question - why is my simple regex not working?

    - by coson
    Good Day, I have a simple Python question that I'm having brain freeze on. This code snippet works. But when I substitue "258 494-3929" with phoneNumber, I get the following error below: # Compare phone number phone_pattern = '^\d{3} ?\d{3}-\d{4}$' # phoneNumber = str(input("Please enter a phone number: ")) if re.search(phone_pattern, "258 494-3929"): print "Pattern matches" else: print "Pattern doesn't match!" ####################################################### Pattern does not match Please enter a phone number: 258 494-3929 Traceback (most recent call last): File "pattern_match.py", line 16, in phoneNumber = str(input("Please enter a phone number: ")) File "", line 1 258 494-3929 ^ SyntaxError: invalid syntax C:\Users\Developer\Documents\PythonDemo btw. I did import re and tried using rstrip in case of the \n What else could I be missing? TIA, coson

    Read the article

  • ASP.NET Build Images Links Dynamically

    - by coson
    Good Day, I am developing a website that has product images on an external server. I have code that tests to see if the image exists like (pseudo code): DynamicString = FunctionThatCreatesDynamicString() ' DynamicString = "http://external_server/path/to/file1.jpg" If ImageExists(DyanmicString) = StatusCode.200 Then ' Embed link in ASP.NET page Else ' Embed not found image in ASP.NET page End If My code builds fine and appears to execute. The problem occurs when I attempt to view the external link in a browser, the image appears properly (I have to authenticate first, but that's OK considering I'm on an internal network and this app will be used internally). However, when I attempt the view the source in my generated HTML page, I am seeing the image to the "Not Found" image when I know the image is there. I compared all the characters in my dynamically assembled to the external link and all the characters are matching up correctly. I'm wondering if the authentication has anything to do with why the image is not rendering properly on my rendered HTML. Any thoughts? TIA, coson

    Read the article

  • Reporting Services Textbox Format Question

    - by coson
    Good Day, I am creating a report with Reporting Services and am using several text boxes horizontally aligned next to each other. I would like to put periods so that report looks like: 1234 Robert Jones................... (234) 921-4922 1235 Jennifer Wilson................ (919) 582-2914 Is this possible to right-pad the text box with periods, or would I need to roll out some code to accomplish the above effect. I tried doing this and the results looked like: 1234 Robert Jones............... (234) 921-4922 1235 Jennifer Wilson.......... (919) 582-2914 Is something like this even possible? TIA, coson

    Read the article

  • jquery asp.net combo box question

    - by coson
    Good Day, I have a small form with a combo box (ASP.NET Drop Down List control) and a text box (with a DIV id txtName). When the selected index of the combo box changes, I want to clear out the text box. I understand that: $("#txtName").val(''); clears the text box value The thing is the combo box. It contains a list of integers representing the months of the year. The drop down control is called ddlMonths. $("#ddlMonths").change(function() { $("#txtName").val(''); }); I thought by using change, an onSelectedIndexChange event handler would be associated with this control. I also tried (because I've ran into the client id being mangled in ASP.NET w/ jQuery) this: $("#<%=ddlMonths.ClientID%>").change(function() { $("#<%=txtName.ClientID%>").val(''); }); and neither approach seems to be working. Am I missing something? TIA, coson

    Read the article

  • Command-line input causes SyntaxError

    - by coson
    Good Day, I have a simple Python question that I'm having brain freeze on. This code snippet works. But when I substitue "258 494-3929" with phoneNumber, I get the following error below: # Compare phone number phone_pattern = '^\d{3} ?\d{3}-\d{4}$' # phoneNumber = str(input("Please enter a phone number: ")) if re.search(phone_pattern, "258 494-3929"): print "Pattern matches" else: print "Pattern doesn't match!" ####################################################### Pattern does not match Please enter a phone number: 258 494-3929 Traceback (most recent call last): File "pattern_match.py", line 16, in <module> phoneNumber = str(input("Please enter a phone number: ")) File "<string>", line 1 258 494-3929 ^ SyntaxError: invalid syntax C:\Users\Developer\Documents\PythonDemo> By the way, I did import re and tried using rstrip in case of the \n What else could I be missing? Thanks in advance.

    Read the article

1