- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 3
- Posts with Upvotes
- 2
- Upvoting Members
- 3
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
34 Posted Topics
I have a question about how the message loop works in a windows application [code] while ( GetMessage(&msg, NULL, 0, 0) ) { TranslateMessage(&msg); DispatchMessage(&msg); } [/code] Does the windows o/s maintain a message queue that the app retrieves a message from the front of then dispatch it bck to … | |
Hi I'm wondering how you would write a function that could iterate through any stl container so it didn't matter what you were using e.g list, vector, deque and found an item that matched in that list so the function declaration would look something like this [CODE] template <class TypeList, … | |
Hi im doing a basic script to parse a text file I want to look for a particular set of words. When i find the word then record the lines until there is a line that is blank [code=python] for line in logfile: for word in line.split(): if word in … | |
Re: These are two great sites for getting started with SDL with great practical examples on how to use it [url]http://www.sdltutorials.com/[/url] [url]http://www.lazyfoo.net/SDL_tutorials/[/url] Also if you're not totally set on SDL I would recommend looking into SFML [url]http://www.sfml-dev.org/index.php[/url] | |
I wrote this code to convert from number in denary to a different base I was curious if anyone has any tips on a better way to write this code I'm always looking to improve my coding and I find others critiques to be a great way of improving. In … | |
This is a text based solitaire game I wrote. It tested it on Ubuntu Linux and Windows and it worked okay for me. Move cards between rows using their row number (7 for the deck) Let me know what people think. Critiques welcome..... don't be too harsh ;) | |
I'm trying to change a char to an int using the stdlib.h atoi function It works perfectly on windows using VC++ however on Ubuntu Linux using g++ the value of [B]t[/B] is off and from is correct. [CODE] char from = '0', to = '0'; cout<< "From: "; cin >> … | |
Re: This web page should help you [URL="http://www.w3schools.com/HTML/html_frames.asp"]http://www.w3schools.com/HTML/html_frames.asp[/URL] There is an example on it called navigation frame that does what you want | |
Re: Also if your looking for large numbers lets say 5400 and you want to write five thousand you could count the digits. So the number 5 is the forth number from the end which makes it easy to determine it represents 5 thousand. The number 4 is three digits in … | |
Re: [code=python] filename = "aFile.txt" thefile = open(filename,'r') # the second parameter is the # mode in which you want to open the # file in this case read mode thefilesText = thefile.readlines() thefile.close() for text in thefilesText: print text [/code] There are other methods such as read depending on how … | |
Re: I think this should answer your question [URL="http://www.codeguru.com/forum/showthread.php?t=231056"]http://www.codeguru.com/forum/showthread.php?t=231056[/URL] | |
Re: Post the code you have people are here to help with problems not to do your homework for you [URL="http://www.daniweb.com/forums/announcement8-2.html"]http://www.daniweb.com/forums/announcement8-2.html[/URL] | |
Re: I'm gueessing this line will throw an exception if it is not a digit [code] int y=Convert::ToInt32(guessBox2->Text); [/code] so but this code in a try block and have a corresponding catch block to handle the exception | |
Re: Somebody may have a look if you attach the document (though I'm not sure since it's multiple choice questions) but no one will have a look if they have to download it from rapidshare. | |
Re: If you post the code that is causing you problems someone may be able to help | |
Re: I think this should work [code=python] import os # windows os.system("cls") # bash ( mac, linux ) os.system("clear") [/code] | |
Re: There are a few problems but one of the biggest ones that should get rid of most of the errors is that you wrote end1 but it should really be endl i didn't even notice until i tried to compile it. endl as in the letter L stands for end … | |
Re: [code=python] if string1.rindex(chr(32)) and string2.rindex(chr(32)): print "You have entered the special characters" [/code] That is how you would write the code however this probably isn't the best way as an exception is thrown if the case comes back false something like a for loop would probably be better [code=python] for … | |
Re: I found the SDL libraries to be great for graphics. They are really easy to use and there are lots of great tutoials on using them | |
Re: You could use your hard drives serial number as a unique ID as you probably won't be removing it or you could use your MAC Address from the installed network interface card (NIC) however i would recommend using ther hard drive serial number as you can have more than one … | |
Re: I don't know if there's a pre defined function but it shouldn't be too hard to code yourself. Ignore the first two charactes and then convert from base sixteen to base 10. You could use a for loop starting at the end of the string and multiply the number by … | |
Re: That sounds like it would be a lot for python to handle. Personally I'd use something like c++ for this kind of program but if you really want to use python you should have a look at the pygame modules [URL="http://www.pygame.org"]http://www.pygame.org[/URL] | |
Re: The best way to understand these is to get a compiler and step through while it is debugging or get it to print out at certain steps. One thing the pointer p is assigned the address of x but x is not assigned a value so i guess your assuming … | |
Re: First of all lose is not a tuple its a list a tuple is declared as follows [code=python] lose = ('fdasf','dfasf','asdf') [/code] for pseudo random numbers you import the random module [code=python] i = range(len(lose)) random.shuffle(i) [/code] The values of i are now shuffled and can be used to access … | |
I was wondering how to change a url in javascript for example if i wrote an address [url]www.google.ei[/url] How would i get the script to change the address to [url]www.google.ie[/url] | |
Re: Have you tried coding anything yourself? Things like printing the contents of a list are fairly basic and you should be able to find out how in the python documentation or some basic python tutorial [code=python] for x in y: print y [/code] | |
Re: You could find out the os by importing the platform module platform.system() should give the os or if your looking for a particlar release you could use the platform.release() [code=python] import platform if platform.system() == 'Windows': #Do something else: #Do something else [/code] | |
Re: I wrote your code in the one file like this and it worked [code=python] class MonsterStats: def __init__(self, name): self.__monName = name def setName(self, name): self.__monName = name def fileWrite(self): monFile = open('MonsterFile.txt', 'w') monFile.write(self.__monName) monFile.close() name = raw_input('enter name: ') monStats = MonsterStats(name) monStats.fileWrite() [/code] | |
Re: The probem is that you have to see seed the random generator with the srand function I believe this thread has the answer your looking for [url]http://www.daniweb.com/forums/thread1769.html[/url] | |
I keep getting errors when i try and use the vector class I have an object vector<CSquare*>m_OldSquare; however when i try and add elements to the list [code] CSquare** tempArray = m_FocusBlock->GetSquares(); for(int i=0; i<4; i++) { m_OldSquares.push_back(tempArray[i]); } [/code] I get this error unresolved external symbol __imp___CrtDbgReportW referenced in … | |
Re: since your only typing in one word you could have used [code] cin>> message1; [/code] but it doesn't really matter Your if statements are wrong try some nested if statements for example [code] if(len1 > len2 && len1 > len3) { cout<< message1 << endl; if(len2 > len3 ) { … | |
I was trying to format the string of type CString so that when you input for example once upon a time in Mexico it would return Once Upon A Time In Mexico [code] m_VideoName.Replace(m_VideoName[0],toupper(m_VideoName[0])); for(int i=1; i<m_VideoName.GetLength(); i++) { if(isspace(m_VideoName[i])) { m_VideoName.Replace(m_VideoName[i+1],toupper(m_VideoName[i+1])); } } [/code] however it keeps returning Once … | |
Re: the ; just means it is being to taken from where sPtr currently is pointing to the first value in a for loop is just assigning a value to start looking from [code] for(i=0; i<10; i++) {} [/code] would be the same as [code] int i = 0 for(; i<10; … | |
Re: do you mean a pointer as an argument well the syntax obviously changes but they are similar. when an array is passed its actually a pointer to the address of the first element of the array of values if you say a[1] its the same as *(a+1) when you pass … |
The End.