1,359 Posted Topics
Re: Please post what you have done already so we can advise you about it. | |
Re: This is a difficult thing to really give any advice on, as everyone has a different 'feel' for their favorite tools. I can only tell you my own impressions, and hope yours may be similar. Of the handful of Python editors and IDEs I have tried, the best I personally … | |
Re: Why are you initializing the data this way? With most MIPS assemblers (including those for SPIM and MARS, as far as I know), you should be able to declare the string constants as, well, *constants*, like so: .data vtdPrompt: .asciiz "vals to do? " entIntPrompt: .asciiz "enter an int: " … | |
Re: Could you tell us more about what you think is the problem with the code as given? By that I mean, is it not compiling, or running without completing, or completing but giving the wrong result? What are you supposed to return other than the computed diameter? Nind you, I … | |
Re: Is this the entire header file? If so, you will need to `#include` the header for the base class (as well as `<windows.h>`, to bring in `CString`) at the beginning of the file. I would also recommend adding [include guards](http://en.wikibooks.org/wiki/More_C%2B%2B_Idioms/Include_Guard_Macro) around the file, to prevent multiple definition errors. A minor … | |
Re: The subject of the suitability of different languages for OS development is discussed at length on the [OS-Dev Wiki: Languages page](http://wiki.osdev.org/Languages). | |
Re: This approach won't work on [C++ `string` objects](http://www.cplusplus.com/reference/string/string/), at least not consistently. The `string` class does not use zero-delimiters to check the length of a string, but rather keeps a private size variable that is updated automagically as the string gets manipulated. In any case, the `string` class has a … | |
Re: As others have already mentioned, you need to show that you have already tried to solve the project in some manner. That having been said, can you give us some idea of what you need help with? Have you tried writing the program on your own yet? A few basic … | |
Re: Not on the C++ forum, that's for certain. Try the [Jobs & Resumes](http://www.daniweb.com/business-exchange/jobs-and-resumes/52) forum here, or go to sites specifically for that purpose such as [vWorker](http://www.vworker.com/) or [Freelancer.com](http://www.freelancer.com/). [Craigslist](http://www.craigslist.com) is an excellent site for freelance gigs as well, if you're in an area that is covered by it. | |
Re: First off, for future reference, is is considered bad form to [cross-post](http://forums.netbeans.org/topic52201.html) questions like this, as it can lead to a duplication of effort. In the future, I recommend posting to different forums one at a time, and only if you haven't gotten a response after at least four days … | |
Re: I would recommend using the [`pickle`](http://docs.python.org/2/library/pickle.html) library with the protocol set to 2. This is a binary format that should be unreadable in a text editor. Mind you, this means that any Python program that uses your class can still un-pickle and read it. For added security, I would suggest … | |
Re: Could you please tell us what you're having trouble with? I can see several things that need to be done, but it would be helpful if we knew what you were looking for specifically. | |
Re: If all else fails, you can always add another level of abstraction; indeed, that what it looks like you intended, with the `PhoneNumber` class. Rather than declaring separate arrays for `aName` and `aNumber`, you should define the `PhoneNumber` class, and then in `Phonebook` you could declare an array (or better … | |
Re: Can you please post the code you have so far, and describe any problems you're having with it? | |
Re: That's going to depend on a lot of factors, really. Different programmers find different languages appealing. As for which language to choose, the obvious choice would be Java itself. However, you could in principle use any language which runs on the Java JVM platform, which includes [Jython](http://www.jython.org/) (a Python port … | |
Re: Are you sure that you want to inherit from `runtime_error` (that is, that a `Name` is a specific example of a `runtime_error`), or just `throw` such an error? | |
Re: I think you'll find that, in order to match the grades up with their counts, you'll want to use a dictionary keyed on the grades. | |
Re: In the future, please let give more information about **how** the program is failing, otherwise we won't have enough to go by. As it happens, the answer is quite simple: the function doesn't return a value. Try adding `return s` at the end of the function and it should work … | |
Re: The problem is that you are taking the size of the array as the highest index: int i = n; while (i > 0) { int pos = positionOfMax(a, i); //find the latest one's position rotateLeft(a, i, pos); //move the latest one to the end i--; pos = 0; } … | |
Re: OK, can you post what you have so far? | |
Re: I've seen some ludicrous assignments in my day, but this one is among the most absurd I've ever encountered. I would be tempted to walk out on the class if I were handed a project as pointless as this. Still, an assignment is an assignment... The key to this assignment … | |
Re: I think that if you actually open up the file `grade.txt`, you'll see that there is no actual line with the text `EOF` on it; rather, in the example given, the `EOF` stands in the for the actual end-of-file marker, which isn't a printable character. In any case, Python provides … | |
Re: I can see a number of issues with the code as it stands, but the most serious one is that you are repeatedly walking off the end of the `attachedNodes` array; for an array of 4 items, the range of indices is 0, 1, 2, and 3, not 0, 1, … | |
Re: The main problem I see is that you are indexing the arrays incorrectly, which is probably the cause of the segfault. In C++, arrays are zero-indexed, that is to say, an array `arr[5]` would have elements `arr[0]`, `arr[1]`, `arr[2]`, `arr[3]`, and `arr[4]`. When you try to access `arr[5]`, you overrun … | |
Re: There are two ways to do this, though one of them only works on 2.5 and later (it was developed for Python 3, then later backported to Python 2). In either approaches, you first need to use `split()` to divide the string into a list of individual words. aprime = … | |
Re: For this case, you would use the alternate method calling syntax, using the class name instead of the object name, and passing the self argument explicitly: class.method(self, args) This isn't specific to inherited methods; it could be used anywhere you have a method call. It's uncommon to use it for … | |
Re: Ah, in that case, you want while sum in point: It may be better, too, if you were to declare `point` explicitly as a list or tuple; as it is, it becomes a tuple anyway, because of the assignment unpacking rules, but it would be better to explicit. point = … | |
Re: In the future, when getting this kind of error, please post the traceback and error message as well as he code where it is occurring. I was able to work out the problem this time, but the traceback makes it much easier to figure out the problem once you learn … | |
Re: I think that you're having some conceptual issues with inheritance, resulting in what is sometimes called 'spaghetti inheritance' (that is, inheriting from an otherwise unrelated class just to get a desired behavior). There's a simple test to see if the inheritance is valid: is a `Board` a specific example of … | |
Re: Can you be a bit more specific, please? A few things we'd need to know include: * The version of Python you're using, and the platform it is running on. * Your goal - is this to test the program, or spoof it in some way? Did you want this … | |
Re: I assume here that the x and y coordinates refer to a particular point in the shape, such as the centerpoint, or the top left. > If I have x,y in Shape, I do not need x,y to exist in Square right? Correct, they will be inherited by the child … | |
Re: To understand classes, you need to know both the conceptual meaning and their concrete implementation. Abstractly, a class is a description of a type, for example, the class Animal would describe the properties which all animals have. The class acts as a template for creating objects of it's type. A … | |
Re: The keyword `def` is used to define functions (and methods, when you start studying classes and objects). It essentially allows you to give a name to a piece of code, so that you can use it over and over. For example, this is a one line function, followed by a … | |
Re: In order to get the desired effect for the method `getWord()`, you will need to make three changes. First, you'll need to track the centerpoint of the circle; a simple list pair would do nicely: self.center = [200, 200] # initialize to the original center of the canvas Then you … | |
Re: Well, to begin with, do you have [Eclipse](http://http://www.eclipse.org/) installed and running? Pydev is an add-on for Eclipse; it doesn't do anything by itself. | |
Re: The [generator expression](http://www.python.org/dev/peps/pep-0289/) says, return a list of characters for every alphabetical character in `string`. The [`.join()` method](http://docs.python.org/2/library/stdtypes.html#str.join) (applied to an empty string, and taking the generated list as it's argument) then fuses the list elements into a new string, with no separator character between them. The practical upshot of … | |
Re: Just to clarify: the code posted is the **`mapmaker.py`** file, while the data is the contents of **`samos.txt`**, correct? It seems to me that the first part of the problem is to figure out how to parse the data. Fortunately, the format seems fairly simple: each item starts with a … | |
Re: You may want to edit the code a bit; the indentation is off. I was able to reproduce the results described, but without knowing what it *means*, or what it was supposed to come out with, I can't tell you why it isn't giving the desired results. | |
Re: Actually, the error message is exactly correct - you invoked a class method (`info()`, which as written does not take a `self` argument) with the name of an instance, which in Python is the same as passing it an argument (namely,`help_` itself). Just to make it clearer what is happening, … | |
Re: Sounds rather open-ended, don't you think? Has the professor given you any further instructions or suggestions on how to do this? Or is that what you came here to ask for? For future reference, you should never simply post your project requirements here and expect someone to do the work … | |
Re: I would try asking the user for the number of questions to ask before the `for:` loop, and use `enumerate()` to get a count of how many questions have been asked. Then, add an `if:` clause that checks whether you have reached the number of questions, and break if you … | |
Re: **@gwolf1:** The link which Deceptikon provided - which I will repeat [here](http://eternallyconfuzzled.com/tuts/datastructures/jsw_tut_hashtable.aspx) - gives detailed explanations and code samples for managing different sorts of hash tables. It should give you enough of an overview to get you started, and would surely do a better job than we could do by … | |
Re: If you need to sort two different arrays, then you need to test both of the arrays separately. It would make far more sense (in general, and in this specific case) to re-write the sorting algorithm as a function, which could then be passed the array to sort. Here is … | |
Re: Certainly you can nest lists inside another list, and you wouldn't necessarily need another method to do it. If you already have the list to insert, the it is as easy as >>> alist = [1,2,3] >>> blist = [4,5,6] >>> clist = [] >>> clist.append(alist) >>> clist.append(blist) >>> clist … | |
Re: A few questions: Are `BufferPixels`, `Bpp`, `height`, and `width` instance variables? They aren't declared or passed anywhere in the method as shown. Why couldn't `unsigned char* Pixels = &BufferPixels[0];` be written as `unsigned char* Pixels = BufferPixels;`? What does `Bpp` represent? Pixel depth (bits per pixel)? If so, shouldn't the … | |
Re: The only processor architecture I know of which has a register file that large is the UltraSPARC, which has (IIRC) 128 64-bit registers (divided into 8 overlapping register windows of 32 registers each). | |
Re: I was wondering why you weren't using the [`Time`](http://docs.python.org/library/datetime.html#module-datetime) class out of the `datetime` module. It correctly handles a lot of what you are doing manually right now. | |
Re: First off, are you using a system `Date` (`java.util.Date`) or a database `Date` (`java.sql.Date`)? I am assuming the former, but if you are working with a SQL database, you may be talking about the latter. Either way, you will want to use one of the `Calendar` classes, probably [`GregorianCalendar`](http://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html). The … | |
Re: No. Turbo C (at least the version most people here seem to talk about) is a 16-bit DOS compiler, and cannot create Windows DLL files. Frankly, you would do well to drop both Turbo C and Visual Basic 6.0 and get modern compilers for both languages (OK, so VB.Net is … |
The End.