1,359 Posted Topics
Re: I doubt anyone here is laughing but you. What Rubberman said was serious - deadly serious. No one here is going to do your homework for you, and asking for someone to do so in the way you have is very likely to come to your professor's attention. We have … | |
Re: As an aside, assuming you are using ASCII character encoding (or something else with digits in order, such as UTF-8), you can simplify the section in lines 265-282 as: if (isdigit(k[1]) && k[1] != '0') num = k[1] - '1'; It isn't a huge improvement, but it should make it … | |
Re: I wouldn't assume so, no. There's nothing in the standard specifying atomicity, for that or (AFAIK) anything else in C. Even if it is an atomic operation on a specific processor and with a specific compiler, it is not certain to be on others. To the best of my knowledge, … | |
Re: **ivan.rodriguezsoria.7:** Please check the dates on the thread you are posting to before posting. This thread is over three years old. | |
Re: Iamthwee is correct, we don't. If you post whatever code you have written yourself, and ask a meaningful question about how to complete the project, we should be able to help, but we will not do your work for you. | |
Re: If you are asking about [RESTful APIs](http://lmgtfy.com/?q=RESTful+%20API) in general, that rather a larger question. To start with, an API is an [Application Programmer Interface](http://en.wikipedia.org/wiki/Application_programming_interface): basically, a set of hooks into a system, whether an operating system, an application, a webservice - anby large software system, more or less - that … | |
Re: Are you certain you don't mean to write an *HTTP* server? TCP is a transfer layer protocol used to send the packets peer-to-peer, and while World Wide Web (HTTP) messages are most often sent across TCP/IP metworks (e.g., the Internet), they are separate things. The server you describe would almost … | |
Re: Oh, I think that there's a definite issue with the code as written, then. First off, the code is wrong syntactically; if it compiles, I would be surprised. You are declaring all of the structures incorrectly. The correct syntax would be like this: struct the_struct { char *FirstName; char *LastName; … | |
Re: > firstly main() is C++ Actually, no, it isn't, at least not without the return type. In C++, you cannot define a function without explicitly defining it's return type. Since the standard is for `main()` to return an `int` value to the operating system shell, the correct forms are either … | |
Re: The scoping operator (`::`) is a standard part of C++, not anything specific to MFC. It has three main uses: * It indicates the membership of a method to its class, when the function is implemented outside of the class body (which is the usual case). For example, you could … | |
Re: Setting aside the timing issue, I would recommend storing the Circle data in a tuple, which should simplify the logic of the program significantly: def flash(self,count): diameter = 25 centers = ((50,30), (110,30), (170,30), (50,90), (110,90), (170,90), (50,150), (110,150), (170,150)) circles = list() for point in centers: c = Circle(Point(point), … | |
Re: > i and j does not have the value of theri own. they are just counters. I believe that this was Moschops' point. You are using them as the sizes in the `new` expression before they are initialized, with the result that the sizes of the rows and columns are … | |
Re: Assumiong that this is the exact code you are running, the error is that you are omitting the colons following the `if:` and `elif:` conditionals. | |
Re: I suspect the real problem is an old issue which comes up from time to time in C: the fact that the standard C I/O functions are all buffered, stream oriented functions, and that there is no standard way of getting unbuffered ('raw') console input. What this means is that … | |
Re: A few questions and comments, not directly relevant to your problem but possibly important: * What version of Dev-C++ are you using? The older Bloodshed edition is now ten years old, andif you are using that, you should switch to the newer [Orwell fork](http://sourceforge.net/projects/orwelldevcpp/), which is in current development and … | |
Re: What graphics package are you using? The one that comes standard with Python is TkInter, so I would assume that one, but if you are using a different one the answer will be different. Also, the version of Python you are using would help as well. Assuming TkInter and Python … | |
Re: Can you explain a little more about your intended design, please? This looks a like a control block for a file handle, but just what you mean to do with it isn't clear. If it needs to be sorted all the time, then a `priority_queue<>` as described in the other … | |
Re: Could you post the full error message you are getting, please? (The compiler and OS you are using would help as well.) If you could also give more information about your goals, it would help greatly in assessing your real needs. When you say that an array of queues doesn't … | |
Re: This is something of a difficult question to give a fixed answer for, as the efficiency of 'register painting' (as it is called by compiler writers) depends largely on the context of the program. One thing I will mention is that MIPS makes it a lot easier in general, simply … | |
Re: The [Intel 8088](http://en.wikipedia.org/wiki/Intel_8088) was, among other things, the CPU of the original IBM PC, and the modern Core i*x* processors are the distant descendants of that model. Thus, there are a [great number of pages and tutorials](http://lmgtfy.com/?q=8088+assembly) covering 8088 assembly programming and the [instruction set](https://www.google.com/search?q=intel+8088+processor+instruction+set), and several different assemblers for … | |
Re: Since you don't mention what architecture and assembler you are writing it for, it is hard to judge whether it is correct or not. I am assuming it is for the M68000 processor, correct? | |
Re: First off, we don't do other people's homework for them. Second, we don't do other people's homework for them. And third, we don't do other people's homework for them. Sensing a pattern here yet? No one here will simply hand you a solution on a silver platter. If you show … | |
Re: Ah, I think I see the problem: the function is a method of the clas, but you did not scope the function as being part of the class in the implementation. When you define a method for a class, and do not implement it inline (which is how most method … | |
Re: You may find [this page](http://wiki.osdev.org/Languages) at OSdev.org enlightening on the subject. Basically, the main reason Java in its usual form is problematic for systems programming is that it compiles to a bytecode rather than to native code. While this by itself is not a showstopper - it is possible to … | |
Re: Probably the simplest way is to use the standard function `max()`: skill = max(0, skill - change) I notcied that you aren't using any functions for this so far. I know that it is stilla relatively short game, but I can promise you that dividing the program into functions (and … | |
Re: **nullptr**: While I agree that removing `using namespace std;` and explicitly scoping is a Good Thing, the problem here doesn't seem related to that. Both of the overloads of `pow()` reside in the `std` namespace (and in the global namespace as well, in most cases), so that by itself wouldn't … | |
Re: Unfortunately, that approach *won't* work; there is no append operator for plain character arrays, and `strcat()`, the append function for C-style strings (which aren't *quite* the same thing) doesn't work on single characters. To add a character to a `char` buffer like you describe, you would need an index that … | |
Re: First off, we don't do other people's homework for them. Second, we don't do other people's homework for them. And third, we don't do other people's homework for them. Sensing a pattern here yet? No one here will simply hand you a solution on a silver platter. If you show … | |
Re: > NameError: global name 'Stack' is not defined – How do i fix this error? Do you have a class named `Stack` somewhere in another file? If not, you'll need to define one. Either way, you would also need to import the class into the module you are writing, something … ![]() | |
Re: It is certainly possible, though without the details of the hardware we probably can't help you beyond a certain point. What have you done so far? We cannot and will not do the work for you, though we will try to answer direct questions and give advice towards fixing problems. … ![]() | |
Re: Actually, it is not that minor a mistake: you never allocate any `listrec` nodes for the new list. What is surprising is that this doesn't cause a segfault, as you are writing to an area of memory you shouldn't have permissions for. There also seems to be a conceptual disconnect … | |
Re: Can you post the full traceback, please? It is hard to determine what ther error is without seeing the error messages. On a guess, though, it is that you need to put the name of the source file and the list in quotations. data = {'source': 'FACTS Daily Import', 'site_id': … | |
Re: No, some functions have no return. These functions are declared as having a `void` type, to indicate that they don't. void foo(int bar) { cout << bar << endl; } As for the value of the return and how it is used, that depends greatly on the function in question. … | |
Re: The built-in Boolean data type in C++, `bool`, is quite simple: it is a data type which can hold one of two values, `true` or `false`. It can be used to hold a truth value for comparisons: bool overflow = false; while (!overflow) { // ... do some things overflow … | |
Re: Can you be more specific? What didn't work? What was the path you were trying to use? What kind of error did it return? ALso, can you give us the OS you are running under? The `open()` function you describe is primarily a Unix/Linux system call, though there are versions … | |
Re: [This post](http://www.daniweb.com/software-development/cpp/threads/425578/only-delete-pointers-declared-with-new-operator#post1819772) may prove helpful. It covers heap memory in detail, while giving an overview of local memory with links to how it is implemented on the stack. | |
Re: I have long argued that 'Computer Science' is a poor term for what most people study in college, as it generally has very little to with science in even the broadest sense. Most CS classes are either the sort of hybrid curriculum Mike mentions, or else (more often than not) … | |
Re: Since this is a question about C, rather than C++, you should have posted it in te C forum. The two languages are distinct, despite their close relationship. I expect one of the moderators will move it for you. The first error is simple: whenever you use `#if`, `#ifdef`, or … | |
Re: For what it is worth, you can find a copy of the [reference guide](http://www.scribd.com/doc/59246820/Turbo-C-Version-2-0-Reference-Guide-1988) at Scribd.com; a quick look at it indicates that the answer you want is (I think) 'Crtl-K H'. If you don't mind me asking, how is it you are using this particular compiler? It is so … | |
Re: OK, now that the necessary roughness is out of the way, we can actually begin helping you. I do have to admit that this is terrible code, and most likely cannot be remediated; but it would be remiss of me not to point out *why* it is bad, or else … | |
Re: Can you please post the code you are using to call each of the three functions, and especially the section where the error is arising? Also, who originally wrote this code? It involves some moderately sophisticated techniques, and look it over, I would expect that anyone who knows enough Python … | |
Re: You won't be able to compile anything with the "windows.h" header in it (or the related "stdafx.h" header) for Linux with *any* compiler, as that is a Windows-specific header. If you need to run a Windows program under Linux, you'll need to use [WINE](http://www.winehq.org/) and a Windows compiler, and run … | |
Re: Interesting. There have been more answers to this question since the OP announced that he was deleting his account than before he did. Given that the OP is almost certainly not reading this, it seems rather quixotic to be answering this now. | |
Re: If the goal is to get the number of times a method is called, then the best solution is to apply a profiler, such as [jprof](http://perfinsp.sourceforge.net/jprof.html) or [jvmmonitor](http://code.google.com/a/eclipselabs.org/p/jvmmonitor/). There is even one which comes with Java called [hprof](http://www.javaworld.com/article/2075884/core-java/diagnose-common-runtime-problems-with-hprof.html) which will fit your needs, though of them all JVMMonitor seems best. … | |
Re: Guidance, certainly; but source code, no, at least not without you showing the effort you've put into it yourself. Post your design ideas and any code you've written, and we'll advise you as best we can. | |
Re: To address the question directly, I would want to know, how long are you setting `sleep()`. `usleep()`, and `nanosleep()` for, repsectively? While `sleep()` takes an argument in seconds, `usleep()` takes one in microseconds, and `nanosleep()` (as the name implies) takes a structure that has both seconds and nanoseconds. if you … | |
Re: The question doesn't seem to make musch sense. One cannot 'run' a class in Python - a class is a collection of methods and instance variables, and cannot be exectued per se. I suppose if you are coming from a Java perspective, one could see executing the `main()` function as … | |
Re: C doesn't allow overloaded functions. Are certain you don't mean C++? | |
Re: We all would be happy to help, once you've shown some work on your own part. We are willing to give advice, answer specific questions, and even show how to find and fix bugs. But we will not do the work for you. | |
Re: What version of Python are you using? If it is a Python 2, then you'll want to add this to the beginning of the file: from __future__ import print_function In Python 2.*x*, the print statement has it's own syntax, whereas this was removed in Python 3.*x* and replaced with a … |
The End.