64,152 Solved Topics

Remove Filter
Member Avatar for
Member Avatar for mforeman

Hello, I’m trying to increment numbers in a file – for instance, I would like to change the below 3 lines in a file by incrementing the numbers by 2 (or whatever the user gives). Mikef<20:40> JoeyS<23> Samt<14:39> So the end results should look like this: Mikef<22:42> JoeyS<25> Samt<16:41> I …

Member Avatar for mforeman
0
163
Member Avatar for Skyline_GTR

I am very new to python and I have this code that I wrote... I am trying to make it so the turtle will bounce if it touches any of the box.. but somehow the turtle does not fuction the way it suppose.. I wonder can anyone give me a …

Member Avatar for Skyline_GTR
0
568
Member Avatar for bumsfeld

What are the ways to find substring in string in Python? Which way is most effiecient?

Member Avatar for shanenin
0
219
Member Avatar for bumsfeld
Member Avatar for bumsfeld
0
113
Member Avatar for desertstorm

Could someone help me with this. I need to know how to write this in code for C. "if hashValue(variable) has a non-zero bit in the 4 leftmost (highest) bits" It has to do with bitwise shifting and is basically just an if statement's condition. Thanks

Member Avatar for desertstorm
0
132
Member Avatar for mikul86

Hello, I'm very new to python script and I am attempting to understand a part of a program developed at my work place because the have the most computer knowledge here, though still very little and the person who developed the program is no longer accesible. Here's the problem i'm …

Member Avatar for vegaseat
0
75
Member Avatar for Drowzee

I'm almost done with my project, due in great part to the support and well-reasoned criticism here at Daniweb. But there's one last little problem that's only hitting me in release mode. In debug, the following function works fine to set information from a user-entered string to the CString/CString Map. …

0
109
Member Avatar for tayspen

ok, so i have been working on a program that i call "Sharppad" any ways it is a text editor. it has all teh basic functions. but it can also speak teh text you type. and convert text to .wav files. so you can listen to what you type. it …

Member Avatar for tayspen
0
263
Member Avatar for bumsfeld

I hear a lot about PyGame for writing games and that I understand is SDL in a Python coat. Is DirectX used in a similar fashon? Any examples?

Member Avatar for CrazyDieter
0
323
Member Avatar for mccarthp

Alright, I think my previous post about this subject was very confusing so I will try again. First off I appreciate all the responses to my prior post (Setting a Variable to the Exit Code). It is my understanding that when a script completes it returns an exit code. I …

Member Avatar for CrazyDieter
0
352
Member Avatar for SpS

sizeof (int) gives me 4 bytes...is it sufficient to say that my machine is of type 32-bit

Member Avatar for SpS
0
357
Member Avatar for coder_gus

Hello to all!How can i make a list from all the small letters of the alphabet without writing every one?Is there an operator/function that does that,something like ['a'-'z'].I've tried in many ways but i'm new in Python and if there is that operator i haven't discover it yet.My appreciation!

Member Avatar for coder_gus
0
245
Member Avatar for c_shaft05

Ok well I've hit a snag... i'm trying to write a program that makes Acronyms from user input... I can get all the letters capitalize, but the problem i am having is, well, taking the first letter from each and puting them together to make an acronym!!!!!

Member Avatar for vegaseat
0
3K
Member Avatar for Avner .H.

Hey everybody... Does sombody knows how can i use the getattr function in order to call to a sub function defined inside another one? somthing like this code: # ---------------------------- def func1 (self, func_name) : def func2 () : print "Blaaaa" def func3 () : print "Yaaaaa" getattr(?, func_name)() self.func1("func3") …

Member Avatar for vegaseat
0
163
Member Avatar for shanenin

I have been doing most all of my python programming in a linux bash shell. I mean I run all of my scripts from a bash shell. If my script produces an error(hardly ever happens :-), the error is outputted to the shell, so I am able to fix it. …

Member Avatar for shanenin
0
126
Member Avatar for toxic_iguana

#include<stdio.h> int main() { float f1,f2,f; double d1,d2,d; char s1[]="2.0045",s2[]="1.00056"; f1=atof(s1); f2=atof(s2); f=f1-f2; d1=atof(s1); d2=atof(s2); d=d1-d2; printf("\n%s %s",s1,s2); printf("\n%f %f : %f",f1,f2,f); printf("\n%ld %ld : %d\n",d1,d2,d); return 1; } Output: 2.0045 1.00056 1271310336.000000 869988544.000000 : 401321792.000000 -67108864 1104343465 : 1870659584 Desired Output: 2.0045 1.00056 2.0045 1.00056 : 1.00394 2.0045 1.00056 …

Member Avatar for toxic_iguana
0
102
Member Avatar for Niklas

Ive searched through google and most are not free, and the ones that are are being declared have a virus inside by norton as well as ewido. BTW im trying to do this because there was a PSP (playstation protable bin loader released) [URL=http://www.psp-hacks.com]website and article here[/URL]. I wanted to …

Member Avatar for Niklas
0
229
Member Avatar for bumsfeld

I am just starting to look at writing class in Python. Can a class that I write inherit Python calendar?

Member Avatar for bumsfeld
0
153
Member Avatar for bumsfeld

Does anyone have a meaningfull example of the use of the Profiler included in Python?

Member Avatar for bumsfeld
0
146
Member Avatar for bumsfeld

I know that lambda is some kind of function in Python. What does it do? Why would one use it?

Member Avatar for vegaseat
2
412
Member Avatar for bumsfeld

I hope the spelling isn't too far off, but what is list comprehension statement and why would one use it?

Member Avatar for vegaseat
0
154
Member Avatar for FinnDutch

Hello! I'm a total dummy when it comes to programming, and now I have a heck of a data extracing job to do for my graduation thesis :cry: Hopefully somebody can help me in the right direction here, because a whole day of surfing didn't get me to the right …

Member Avatar for FinnDutch
0
156
Member Avatar for mina1984

hey, um i was wondering if anyone could help me with a program where if the user inputs a number no more than 5 digits and the program tells you how many times the number 2 appears in that number. i know that the modulus and division have to be …

Member Avatar for mina1984
0
229
Member Avatar for vegaseat

[B]Python and the JPEG Image File, Part 1, The Header[/B] [B]Intro[/B] The JPEG image file format (.jpg) is very popular on the internet because you can pack a lot of picture information into a relatively small file. There are competing file formats like GIF and PNG. GIF is rather limited …

0
681
Member Avatar for Niklas

:mrgreen: I've just started learning and doing examples out of the book but I wanted to see if I could actually make something besides just copying stuff out of a book. So I tried to make an addition calculator. This isnt the entire source code but just a few snippets …

Member Avatar for Niklas
0
257
Member Avatar for Acidburn

Can anyone help us out in this dept, everytime I go through my program when it terminates I get the famous windows: "main.exe has encountered a problem and needs to close. We are sorry for the inconvencience ........ Debug, Send Error Report, Don't Send Yep that one... Can anyone offer …

Member Avatar for Acidburn
0
257
Member Avatar for Acidburn

[php] hangman::hangman( char * surname, int size) { name = new char[size]; encryption = new char[size]; strcpy(name,surname); for (int i = 0 ;i <size; i++) { encryption[i]='*'; } lives = 5; found = 0; } [/php] encryption seems to be heading over its borders!! the size = 45 ; I've …

Member Avatar for Acidburn
0
161
Member Avatar for stinus

Hi all, I have a problem that is hopefully easy to solve for you guys: I have written a rather large C++ program as part of my Master's. Now, I have to use an open source C-library ([url]http://www.tbi.univie.ac.at/~ivo/RNA/RNAlib_toc.html[/url]). I have never tried to combine C and C++. To figure out …

Member Avatar for stinus
0
500
Member Avatar for Acidburn

[php] int j; for ( j= 0 ;j <sizeOfArray ; j++) { if( letter == array2[j] ) { ++found ; encryption[j] = array2[j]; } } if ( array2[j] =='\0' && found!=0) { cout << "not found" <<endl; --looselife; cout << "You now have" << looselife << "remianing" <<endl; } [/php] …

Member Avatar for Narue
0
111
Member Avatar for SpS

[code] char *name; cout<<name; [/code] and [code] char*name; name=new char[20]; cout<<name;[/code] both of these work....then why do i need memory allocation....where does the first code fails

Member Avatar for SpS
0
163
Member Avatar for vegaseat

[B]Intro[/B] When you declare an integer variable in C, the variable is assigned a fixed memory location with enough space to hold the type integer. When you then initialize the variable with a value, the value is put into that space. Take a look at the C code sample below: …

0
6K
Member Avatar for Blazer

Hi everyone, I require some help for this project I am currently working on. Basically what I have to do is read from two text files, then calculate some numbers from both files (eg: add the numbers and average them) and after that, write the results to a another file. …

Member Avatar for boyzz
0
183
Member Avatar for Dani

I am currently finishing up my B.S. in Computer Science at a local private University. When I started a couple of years ago, C++ was taught in the intro to programming course for freshmen. About two years later, Java was taught as a first language. (I disagree with that because …

Member Avatar for vegaseat
0
157
Member Avatar for bumsfeld

Is there a way one can interrupt the sleep() function with a key press in Python?

Member Avatar for a1eio
0
296
Member Avatar for shanenin

For my simple programs I have wirtten, I have just been using a simple editer with syntax highlighting. This seems sufficient. What kinds of thing can a good IDE do for me?

Member Avatar for vegaseat
0
142
Member Avatar for Ene Uran

Couldn't sleep last night, so I was browsing and found the "Starting Python" thingy. I must say Python looks interesting from the examples. I learned C++ in school, Python sure looks easier to understand. Does any one think it's better than C++?

Member Avatar for vegaseat
0
178
Member Avatar for tayspen

ok so i open notepad and paste this code [code] ContactsXPortPath As String = "E:\Ipod\Contacts" Const CalendarXPortPath As String = "E:\Ipod\Calendars" Const NotesXPortPath As String = "E:\Ipod\Notes" Const EmailXPortPath As String = "E:\Ipod\Notes" Sub ExportAll() ExportToVCard ExportToiCalendar ExportToText ExportToEmail MsgBox ("Export to iPod Complete") End Sub Sub ExportToVCard() Dim ns …

0
91
Member Avatar for sifuedition

Why are my exceptions not working? here is the teststack.cpp #include <iostream> #include <iomanip> #include "teststack.h" using namespace std; struct StackFullException { StackFullException(); }; StackFullException::StackFullException() { cout << "The stack is full."; } struct StackEmptyException { StackEmptyException(); }; StackEmptyException::StackEmptyException() { cout << "The stack is empty."; } Here is the …

Member Avatar for CrazyDieter
0
166
Member Avatar for bumsfeld

Python is relatively new to me. I have mostly programmed in C and C++. I read that Python has a good build-in debugger, but I can not understand the information in the reference manual. Can anybody please give an actual commented example how this works.

Member Avatar for Micko
0
123
Member Avatar for ashneet

Hello all what i am really trying to do is to use POST method to send info to next page with just HYPERLINK; Here is what i want: Get method: [CODE] <a href="http://www.someting.com?date=9/15/05&age=21">age and time</a> [/CODE] I want this to be in POST method without using forms. also i am …

Member Avatar for aarya
0
8K
Member Avatar for wdowell84

Hello, noob here. I just started taking a C++ class this semester and I've been understanding everything so far, but I'm sorta confused on the nested if statements. My homework is to have the user enter a number and it'll show the roman numeral. However whenever someone enters an invalid …

Member Avatar for Judas
0
182
Member Avatar for Avner .H.

hello fellows, I seem to have a little problem: I tried to use the function getattr([I]object[/I], [I]attribute[/I]) with two strings which is being read from a xml file as arguments, and seem to have a problem with sending the first one as a string. the function thinks that the string …

Member Avatar for kerumai
0
235
Member Avatar for MIGSoft

Hi, I am looking for a text justification algorithm that fully justifies the text. I suppose that I could design one of my own. However, why reinvent the wheel? I tried googling and doing other stuff, but it surprisingly was unable to find anything useful. Any help will be greatly …

Member Avatar for Rashakil Fol
0
743
Member Avatar for nikto

I have a vector of objects of the Virus class. This vector is called 'Viruses.' I have a deque of objects of the Host class. Each Host class object has a deque of pointers to Virus objects, i.e., deque< Virus * > currentInfections Each Host object is randomly infected with …

Member Avatar for nikto
0
160
Member Avatar for bumsfeld

I have read vegaseat's "Projects for the Beginner" sticky and got really interrested in the eqaution solver for physics or mathematics problem. I just need a little Python hint how to get this started.

Member Avatar for vegaseat
0
118
Member Avatar for CutCrusader

Thanks a lot for the help on my last question. I have another problem that I need help with. I need to generate the check digit for an ISBN number. Like if the input is 076372339 the function should return 8. To find the check digit, which is the last …

Member Avatar for vegaseat
0
131
Member Avatar for bumsfeld

I know Python has adopted Java's decorator, but I can not make much sense from the reference manual example. It would be nice if soemone could give a good example of the implimentation of a Python function decorator.

Member Avatar for vegaseat
0
109
Member Avatar for sifuedition

What is wrong with this: [code] for(int b = 0;b < c.length();b++) { temp[b] << S.Pop(); // or temp[b] = S.Pop(); } [/code] to have a string made up of the contents of the stack? When I do this and cout << temp, temp is blank. This iterates through the …

Member Avatar for sifuedition
0
90
Member Avatar for sifuedition

What is happening here? [code] void palindromemgr(ifstream& in, ofstream& out, Stack& S) { string c; //candidate while (true) { cout << "entering first loop" << endl; //debugging line if (in.eof()) break; in >> c; cout << "this is the value in c :" << c << endl; //debugging line for …

Member Avatar for sifuedition
0
151
Member Avatar for sgtrock40

Okay, another easy one, but I can't remember how to do it. I have a table that I want to be able to update multiple records in. I thought I could just run an update query, but I have 2 yes/no fields and one text field that I want to …

0
84

The End.