64,152 Solved Topics
Remove Filter ![]() | |
I am slowly absorbing these python class concepts(kinda) this fails with an error [php] class Critter(object): def __init__(self): print "I am born" def talk(self,name): self.test = name print self.test crit = Critter('ralph') crit.talk()[/php] this one works [php] class Critter(object): def __init__(self,name): print "I am born" self.test = name print self.test … | |
Hey there all, i have a question about how to point my python install to my sql database. when i enter this:[CODE] db = MySQLdb.connect(user="user", passwd="pass", db="myDB")[/CODE] i get this: [CODE]Traceback (most recent call last): File "<pyshell#1>", line 1, in -toplevel- db = MySQLdb.connect(user="user", passwd="pass", db="MyDB") File "/usr/lib/python2.4/site-packages/MySQLdb/__init__.py", line 66, … | |
Hey, I've been trying to setup a search page for the last week with no luck. I've been reading books (maybe not the right ones) and searching the web for examples, also with no luck. I'm using Microsoft Access for my database and Coldfusion 6.1 for my server. What I've … | |
How can i display result of a single cell query? my query is [code]$author=$_POST["authorname"]; $q="Select authorid from authors where AuthorName=$author"; $resultauthor=mysql_query($q,$connect); $num=mysql_num_fields($resultauthor); [B]<<Error coming here![/B] :( mysql_num_fields(): supplied argument is not a valid MySQL result resource in[/code] | |
I was wondering if there was any way to make a for loop go through a string word by word, rather then character by character. For example, [B]for letter in "Hello world"[/B] [B]print letter[/B] it would print out H e l l o etc. I was wondering if I could … | |
Hello ladies and gents, Ive been reading about how when a class becomes to big due to to many memberfunctions, it is best to split the program up into several sections wich could be something like this: Interface section Implemenation section Application section I was given an example wich is … | |
Hello!! Does anybody know how to create a function that randomly changes elements in a string? And: does anybody know how to set the chances for the type of changes? I've tried to look it up in tutorials, but since I'm a beginner, most of the time creating random outputs, … | |
Sorry, I know that this is probably the wrong section to post this question in, but I'm sort of confused as to which one would have been appropriate. Anyways, I've been using regular expressions to find specific information such as e-mail addresses and whatnot inside textfiles, but I can't get … | |
I just finished my first program, other then a few test ones. it is tic-tac-toe. If you want to try it. here is the link [url]http://webpages.charter.net/lindbergfamily/game.py[/url] It is not very advanced, just mainly a bunch of if then and while statments. If any of you care to comment on my … | |
Hey all, I am very new to python, but I hear that it can be used to handle web forms. Does anybody know of where I can find a good tutorial on how to create something that will handle form input? Thanks in advance. -Nick | |
Okay I use Dev-C++ as my IDE. I have never linked my own files. I am pretty much a noob on C++, but not to programming in general. My issue that I have been almost pulling my hair out with is this. I am using a premade MD5 header file … | |
Hello ladies and gents, I'm trying to output a 2D array, but can't seem to find the solution, can anyone help me out here. [code] #include <stdafx.h> #include <iostream> using namespace std; int main() { int **pp; int i, j, n, ni; cout<<"Geef het aantal regels als volgt: "; cin>> … | |
I've gotten feedback from my instructor to modify my code because it contains poor design techniques. I need to add a " return " after each function without it going back to " main " and also to avoid the use of global headers. I've tried to modify it several … | |
i have an html form with a drop-down list that lists a bunch of images. how can i get my cgi script to load the image ? i have imported cgi and os text entered from a form and read from a file do ok, but i cant seem to … | |
hey there, i have written a script that gets my email messages, but i need to be able to strip off all of the stuff except the body of the message so i can write that to a text file. is there an easy way to do this ? Edit/Delete … | |
I do not understand why the instructions are being printed off of the margin(about 5 spaces). I would think they would be directly on the margin. I am talking about this part in particular [quote] you first need to choose to go first or second. If you choose to go … | |
I am getting really tired, so I am probably doing something dumb(disclaimer). below is a python function I am trying to test [php] # answer.py # # this function asks for a move and checks to see # if it is a legal place to choose. position = ['X','O',' ',' … | |
Hi i have a form with a mschart and a msflexgrid in it. What i want to do is that when the form is maximized, scale these two components and move the rest of them (command buttons, combo boxes, etc) I would apprecciate your help | |
Hello, Now that I have been instructed as to how to write unicode characters in Python, I would like to know if it is possible to get the unicode characters into a list, dictionary, etc. Here is my very simple code: [code]a = u'\u05e9\u05dc\u05d5\u05dd!' print a print print mylist = … | |
Hi all, I am trying to learn unicode relative to Python, but to be honest, I'm floundering a whole lot. I have never had so much trouble with anything before, but to put it simply, I just don't get it. For example, I want to use Hebrew words in my … | |
Hi i am re-studying C.So I just wanted to do a simple calculator program.I am using dev-c++ anyways the code is below please help. [CODE] #include <stdio.h> #include <conio.h> /*its a simple program that after getting the numbers from the user and inputs the operation*/ int main() { int i=0; … | |
Since C and C++ are different languages, would it benefit Daniweb to split the C/C++ forum into separate C and C++ forums? ![]() | |
from my understanding, a list can do everything a tuple can do plus more. The big advantage of using a list is you can change elements, lists are mutable. Are their situations where a tuple is preferable to a list? | |
I am trying to follow this code I am reading in a book. First I will show you the code as the book has it. This is for a word jumble program. This algorythm I am refering to jumbles a word [php] import random # create a sequence of words … | |
Hi everyone. This is my first post in the python thread and I am very new to the language. A while ago, i wrote a program that find the least common denominator for an array of numbers in Java. I recently started to look at the python language and I … | |
hey guys i got a problem with my program i cant get it to work properly. The question is: [COLOR=Purple]Write a C/C++ program to count the vowels and letters from the keyboard (maximum 50 characters). The string may contain spaces. Then it prints out the number of occurrences of each … | |
Hey there, i have a python cgi script that prints out html just fine in the Opera browser but doesnt print at all under FireFox. weird, eh? i am getting nothing in the apache logs about any error. perhaps its a firefox issue, but i doubt it. any suggestions. simple … | |
Hi. Im doing a c++ course. And we are doing a assignment to do with I/O File streams. We are using struct. I can add, update, print, and search for records. Now, I need help to read data into an array and sort the array on any one field and … | |
here below is my code [code] #!/usr/bin/python #this is my third python script print \ """ this is a python program to figure out total sales price, including tax\n\n \t\t\tprogrammed by\n \t\t\tShane Lindberg\n\n """ base_price=int(raw_input("please enter the base price of the car:\n$")) under_coat=int(1000) stereo=int(200) air=int(750) tax=int(base_price*.07) print "the total price … | |
Hey there. Here is the deal.... i have a script that is supposed to open a file based on criteria from a web form. i cant seem to get it to work though. here is the code: [CODE]form = cgi.FieldStorage() DataRecord = form['DataTime'].value Customer = form['CustName'].value # should be automatically … | |
I'm busy writing an application for work which needs to connect to a list of our servers and check some ports to ensure the correct ones we require are open and ones we don't use are closed. I'm using winsock and checking for a connection and the results are being … | |
Hello together... first excuse my not very good english. I wrote an JavaScript application which shows, hides and scrolls several layers included in my homepage. I used only DIV-Tags for my layers and I used intensively CSS for the site's layout. When scrolling my layer(s), I move a content layer … | |
Hellow I'm just started whit C. I'm usig gcc and get this error: [CODE]test.c: In function 'main': test.c:8: warning: passing argument 1 of 'strlen' makes pointer from integer without a cast ..... [/CODE] This is my code: [CODE]#include <stdio.h> #include <string.h> int main(int argc, char *argv[]){ int arg = atoi(argv[argc-1]); … | |
Hi everyone, i was hoping i could find some help here. I am trying to get settings i have written into a textfile to be put in an array. Here is what is in the txt file: 8 44100 1 2 1 I read the textfile with: pStream = new … | |
Hello ladies and gents, Wanted to make this part of an exercise in wich I enter each time two integers into an array for wich I have to use STL container vector. Ive got this sofar, but getting an error message when I entered two numbers and the exe shuts … | |
I was wondering if anyone knew of a good text editor for python ? | |
Hi all, I'm completly useless at C++ and was wondering if anyone can tell me how to tell a program that when I have pressed Enter, if the string is empty do nothing. Its for updating details. I'm using an Input header file that my lecturer wrote. This works fine … | |
Hi, I am a Java programmer dabbling in Python for the first time. Mostly, the transition has been pretty smooth, but this week something stumped me. Please forgive me if the answer to this is completely obvious - I've read van Rossum's tutorial and can't figure it out. I am … | |
![]() | Hi, I am a systems engineer/administrator and therefore new to programming and wanted some help pls... I dunno how long it would take to program, if it could be done at all, but could someone please create a small program to vnc pc’s automatically or provide me with step by … |
Hi. I'm a long time asp-developer, but fairly new to VB so I don't know all the trick yet. My problem: I'm writing a program that fetches file and directory information from a given drive/location and stores information in an array for further processing. During this procedure the application sometimes … | |
I'm doing my senior project to computer programming the teacher asked me to do a physical project but I don't know what to do I don't really know much about programming please if someone can give me an idea of anything easy i can do | |
Hey there, i am trying to write an online application using the cgi module. what i want to do is have an html form display a drop-down list and have the values of that list be the lines of text written in a file. this would be updated almost every … | |
I am new to pragramming and also Python. I was reading the intro and basics for beginners in the sticky of this forum and tired it out. It was cool and all but after saving the files, I click F5 to run it and i get the error message : … | |
![]() | HI! I am new to programming (*although i know some html*) and I was wondering if someone could tell me what is wrong with my C++ area calculator? Thanks! [CODE]#include <iostream> using namespace std; int main (int argc, char **argv) { int height; int width; int area = height*width; cout … ![]() |
With the following line I get a syntex error relating to the ifstream file [code]if ifstream file(filename.c_str()).find string1 ++counter;[/code] I have already declared the input file and do not understand why there is an error. Sorry for seeming dumb but I am new to this!! | |
I'm very new to to VB.net but have worked in vb6, I have recently tried to install vb.net standard edition. It installs fine with no errors but I am unable to make the content display in either msgboxes or listboxes. here is a sample of the code I am trying … | |
[code]Private Sub LoadList_Click() lstList.Clear CmDialog1.DialogTitle = "Load Your List" CmDialog1.InitDir = App.Path CmDialog1.flags = &H4 CmDialog1.Filter = "Lists (*.txt)|*.txt|All Files(*.*)|*.*" CmDialog1.ShowOpen Call xLoadList(CmDialog1.FileName, lstList) End Sub[/code] when i try to compile my program it says "argument not optional" and highlights "Call xLoadList". will someone help me with this? thanks | |
I'm wondering if i can create a program that reads texts file. In the text file is c++ code ... could that be compiled in the running exe? So basically you'll have somehting like this in this first file: [php] #include <iostream> #include <fstream> using namespace std; int main() { … | |
Hi can anyone tell me if i can write a string to a text file without it having the " Quotes at either side of the text "? I'm trying to input a line of text from a text file, change it and rewrite it. Example //(adt|dclk)\./ //ccas(\.clearchannel|_media/)/ would become … |
The End.