338 Posted Topics
Re: or, you at least need another index for the characters you put into packets. When you switch to a new x index, you need to reset the output index to 0. [code=c] void split(char *original) { int x = 0; int i = 0; int jj = 0; while (original[i] … | |
Re: Ok this first comment is pretty minor, but I'll mention it anyway. The code for setup randomly selects the players card and the dealers card, then removes both cards from the deck. It does this twice to for the initial two cards. There is a chance (pretty small, but it … | |
Re: This didn't make any sense? [code=python] self.rtc.BeginTextColour((255, 0, 0)) self.rtc.WriteText("colour, like this red bit.") self.rtc.EndTextColour() [/code] It looks like you have to 'build' the contents of the Rich Text Control as you go. When you get to text you want in another (non-default) color, you call BeginTextColour with a tuple … | |
Re: Can you TRY to use some of what you got? If its not quite right, change it a little. Try starting the loop like this: [code=python] while house[5] == "Empty": print "Pick an item to fill in the empty space: \n1 - Lamp\n2 - bed\n3 - NDS\n\n" [/code] You will … | |
Re: The first point was a link to an article that describes why the concept of 'security through obscurity' was false. (The concept that just because you aren't telling anyone about how you do something that it is therefore secure.) The second half about the 'big enough target' refers to the … | |
Re: Python does string or number pretty well. If you need variables that are a specific size in bytes, look at ctypes | |
Re: the test [ICODE]if ((cMenu == 'A' && cMenu == 'a') || (cMenu == 'B' && cMenu == 'b') || (cMenu == 'C' && cMenu == 'c'))[/ICODE] can never be true because the character can not be both the uppercase and lowercase letter at the same time. With input where the … | |
Re: It may not be very efficient, but this creates an output file with the one string in it: [code=c#] using System; using System.IO; using System.Collections.Generic; using System.Linq; using System.Text; namespace FileCreationTesting { class Program { static void Main(string[] args) { String test = "This is some sample data\n"; FileStream fh … | |
Re: Both of your examples will do the same thing as the sizeof(char) is 1. | |
Re: In all of the code here, I don't really see the point for the threading. Unless you've simplified the code to demonstrate your question, reading from a file doesn't usually take very long (unless its really big) and in any case, there is nothing else going on so we end … | |
Re: What's your objective? What kind of interface do you need? Should the game play fully automated, or does the user interact with the game? If fully automated, where/how do you define the 'rules' for the player? Do you need to shuffle the deck? What keeps 'choice' from re-picking the same … | |
Re: [url]http://www.letmegooglethatforyou.com/?q=javascript+cookie[/url] | |
Re: I don't think I understand your request. Are you saying that your program creates a folder and then puts some files in it? Then later, your program creates another folder and you want to move the files from the first directory to the second? | |
Re: Python lists support several methods for example: append, count, extend, index, insert, pop, remove, reverse, sort [url]http://www.letmegooglethatforyou.com/?q=Python+List[/url] | |
Re: If the string only contains a date (month/day/year) then you're right the third '/' isn't strictly necessary, but you do need to call it a third time to get the year and the '/' works about as well as anything else that would not be in the 'year' part. If … | |
Re: you're not supposed to take part of the discussion out of the thread...now if someone were to search and find this thread, they can't see what you learned. For random number generation, I like the python random module: [code=Python] import random op1 = random.randint(1,10) op2 = random.randint(1,10) sum = op1 … | |
Re: The current implementation only looks at the first record returned and builds an output string with the question and answer options. If there was more than one question matched, how would it work? Should this return all of the questions delimited in some fashion? Should it always return a list … | |
Re: try something like: [code=python] import random wl = ["abacus", "biology", "chemistry", "dog", "elf", "ghost"] random.shuffle(wl) for word in wl: print word [/code] | |
Re: That's not a library reference, that's an include file reference. The compiler (ok, maybe the preprocessor) will search for a file of the specified name through each of the directories in the include path. It will use the first file it finds. The contents of the file it finds are … | |
Re: I'm suspecting you mean alignment of your output, but I'm not sure. It will be very difficult to guide you to a better solution without knowing what you're doing for the alignment presently. Could you post the following: The source code for your output function (use code=c++ tags for the … | |
Re: If the include line looks like: [code]#include "Test/Testnamespaces.h"[/code] it should look for the Test directory in the same directory the source file was located in, or in the include path. If you used: [code]#include <Test/Testnamespaces.h>[/code] the compiler will not look in the source file's directory first. Which style of include … | |
Re: We love to help people with their problems, why don't you post what you tried and what you think needs fixed (or why it didn't work) and we will help you fix it. | |
Re: Maybe you should look for a method to disable a control. (second big hint) | |
Re: where do figure() and show() come from? They don't exist in python without imports. What context are you using them in? | |
Re: But if the unit need to notify the army that it has died (a little strange in real-life, but not so bad in computers), the unit will need to know which army to notify. The other option might be for all operations which might 'kill' a unit to come through … | |
Re: Under windows, getting the file open by two programs is a matter of using file sharing modes. The 'reader' would commonly "deny none" the 'updater' would commonly 'deny write'. The only real concern I have is whether or not the two programs need to interact at all. How does the … | |
Re: don't use a list when assigning restype: [ICODE]res = bass_dll.BASS_SampleLoad.restype = ct.c_int[/ICODE] But I suspect you're in for a spot of trouble. a FILE * is NOT a char * fname; | |
Re: Would array initialization be legal? [code=c++] class Foo { Foo() { cout << "Hello, World\n"; } }; int main() { Foo myarray[100]; } [/code] | |
Re: As a note, I love using functions to help break things up. You have several things which would support that well. 1) The 'assignment' asks you to fill the board with pairs of numbers from 1-8. On line 15, you fill with a random number from 1 to 8. Where … | |
Re: don't you need to empty the factors array before you start factoring the next number? Try [ICODE]factors=[][/ICODE] just before the [icode]for k in range(1):[/icode] | |
Re: Well, you could look at the values in the debugger if you have one, or you could add additional print statements to better confirm the values. If you come to the conclusion that the values are correct then you have to chase back to where they came from to see … | |
Re: If I remember right, the JIT debugger from visual studio is enabled (or disabled) as an option from within studio. I think it was under the debugger section. | |
Re: Generally, you want to avoid the above. I think if you tried hard enough, you might be able to hack something together, but I don't think it would be worth the ongoing effort. I know in visual studio that once you tell it that one dll (or lib) depends on … | |
Re: Is this a problem: [code=c++] cout << "Enter field to be sorted(0-7): "; cin >> sortWhat; switch (sortThis){ case '1': [/code] You're getting the input into sortWhat and then switching on sortThis. | |
Re: If you can give me (us) an idea of what you want to use the arrays for, it will help us direct the focus. | |
Re: You probably can put it into 2 different functions. You could probably make it work if you tried hard enough. But was the point to make the two 20 argument functions work or to make the code work? I don't know if you saw the suggestion, but the creation of … | |
Re: So you want the loop to keep running while the xPos is different or the yPos is different. You wrote while the xPos is different AND the yPos is different. The loop needs to run while either doesn't match. [CODE=c++] while((board.getgXPos() != board.getXPos()) || (board.getgYPos() != board.getYPos())) [/CODE] | |
Re: Please use code tags when posting code, preferably the language-specific version so we get syntax highlighting. It makes the code MUCH easier to read. If you want the linked list to be ordered by last name, the convention is to put the record in the list where it belongs. If … | |
Re: I agree with ninwa, the function you have doesn't make much sense. [code=c++] void addressType::print_add(string str, string Cit, string St, int Z) { cout<<"Address: "<<str<<endl; cout<< Cit <<","<<St<<endl; cout<<"Zip: "<<Z<<endl; return ; } [/code] The function asks you pass in all of the address data when the address data is … | |
Re: It's the programmers responsibility to ensure the target buffer is sufficiently large enough to hold the maximum possible output size. I think lint (or something like it) might catch it, but I'm not sure. | |
Re: I did some initial review, and I was able to load the library and call hgeCreate using ctypes: Run this from a directory with the hge.dll in it, I was in the hge181 directory. [code=python] from ctypes import * hge = windll.hge hgeCreate = hge.hgeCreate hgeCreate.restype = c_void_p hge = … | |
Re: note that POINTS actually contains 3 full instances of the POINT (whatever that happens to be) while EDGE only contains 2 pointers to POINT. This code isn't quite right: [code=c++] POINTS some_points; EDGE an_edge; an_edge.p1 = some_points.pts[0]; [/code] This will work: [code=c++] POINTS some_points; EDGE an_edge; an_edge.p1 = &some_points.pts[0]; // … | |
Re: I had to massage it a little to get it to compile under VCPP Express. I think your key problem is that you have 2 copies of the array [icode]arrayGrid[/icode] one declared globally that never gets initialized and one declared in main that is never used. gamePlay() calls displayGrid() passing … | |
Re: You didn't post your whole source file, so the line numbers don't line up... [code] student.cpp: In member function `Student Student::operator+(const Course&)': student.cpp:67: error: no matching function for call to `Student::Student()' student.h:21: note: candidates are: Student::Student(const Student&) student.cpp:15: note: Student::Student(std::string, Date) [/code] The above error indicates that your operator+ implementation … | |
Re: [code=python] def isWhole(num): return num == int(num) [/code] Works pretty well, but can fail for numbers that are really close to whole: Test code and output [code] for ii in xrange(1,20): f = float('3.'+'9'*ii) print ii, f, isWhole(f) 1 3.9 False 2 3.99 False 3 3.999 False 4 3.9999 False … | |
Re: So if I understand it correcly, your application has 4 windows. The main window and 3 other forms. The 3 forms are updated by backgroud worker threads. Does the program always create all 3 forms, even if they are not visible? Does the program always start the 3 background threads, … | |
Re: LPT1 is a device, you are unable to open it to read what someone else has written (or will write) to it, it just doesn't work that way. To do what you are proposing, you would need to somehow 'get between' the other application and the output device. You could … | |
Re: you're getting stuck on the while loop: [code=c] while(strstr(arr,"RECORD DEFINITIONS")==NULL) { fgets(arr,120,fp); printf("\n%s",arr); } [/code] Nothing in the main [icode]while(!feof(fp))[/icode] ever resets the value in arr. So when you get to the second record's data you print 'INTO THE RECORDS NOW' but don't ever actually read any data because arr … | |
Re: From what I'm reading of the posts and assignment, you should remove the for loop from inputData() and add a for loop to main to call inputData for all three TMoney members of the array money. [code=c++] TMoney money[3]; for (int jj = 0; jj < 3; jj++) money[jj].inputData(); [/code] … |
The End.