389 Posted Topics
Re: There are a couple of problems with your code: First you redefined `display` to basically do nothing. With that definition of `display` you'll never get anything printed to the screen, no matter how you define your `foreach` macro. You should get rid of your definition of `display`, and just use … | |
Re: It should also be pointed out, that it's not only variables that take up space - temporary values do too. So if you're thinking about removing variable declarations in favor of larger expressions in order to save memory (or registers), don't - it won't work. | |
Re: You're trying to apply the prefix `++` operator to the result of the expression `a++`. The result of `a++` is a temporary value and thus not assignable, i.e. it is not an lvalue. Since you're only allowed to use `++` on lvalues, you get the error that you get. Somewhat … | |
Re: If `a` is an n-dimensional numpy array `a[..., j]` will return an (n-1)-dimensional numpy array where each innermost subarray is replaced by its jth element. So for example if `a` is 2-dimensional, `a[..., j]` will be a 1-dimensional array containing the `j`th column of each row. > Nothing in Python, … | |
Re: You call `Time.sleep` once before the loop. Inside the loop you keep making attacks without calling `Time.sleep`. For that reason your program will pause once before the loop. Inside the loop it will keep making attacks without pausing. | |
Re: Are you sure that the file actually contains tabs? It looks like the line simply contains multiple spaces, not tabs. | |
Re: `getValues` is a member function of the `EmployeeForm` class. That class does not have a member called `empList`. `empList` is a member of the `Payroll` class, so you can only access it through a `Payroll` object. | |
Re: Depending on your operating system data will be moved from your RAM into a swap file or partition once your RAM is full. That said there is no way that your hex editor reads your whole hard drive into memory before displaying it. Not only would reading such large amount … | |
Re: As someone who knows very little of conio.h, could you explain how cprintf, cscanf, cgets, cputs etc. behave differently than the standard functions of the same name minus the "c" at the beginning? | |
Re: Yes, they're the same. It only matters whether the `const` appears before or after the `*`. If it appears before the `*` it does not matter whether it appears before or after the typename. | |
Re: You've defined gem to take 2 arguments, but you're calling it without any arguments. You should also forward-declare `gem` or define it before the `main` function. | |
Re: > it is a function according to the javascript documentation. According to which documentation? | |
Re: > However my advice is not to define objects with a __del__() method because they can create uncollectable objects if they are part of a reference cycle Yes, but since his robots don't contain references to each other, that can't happen here. > Also there is no guarantee that the … | |
Re: This is probably not the solution your instructors are looking for. I imagine your instructors are looking for a solution where you caclulate n!/k! without calculating n!. Note that if you expand n!/k!, it will look like this: 1 * 2 * ... * n -------------------------- 1 * 2 * … | |
Re: A whitespace character (including \n) in the format string will cause scanf to discard any whitespace in the input stream upto the next token. If a whitespace character is the last character in the format string that means that the user must already enter the next token, so that scanf … | |
Re: > 250.000 - 50.000 = 249950. Does your system by any chance use a locale where `.` is used as a thousands separator and `,` as the decimal point? Because if so, the users should either input the numbers in a format compatible with the current locale (i.e. use `,` … | |
Re: None of those really seem necessary (or helpful) and some seem like incredibly bad ideas. Your out and in macros, will make your code look very strange. If you want to print an item it will look like `out foo`, which really doesn't make sense syntactically. `out(foo)` or `out << … | |
Re: The same amount of bytes as there are in all other types of pointers (except possibly function pointers, which might take up a different amount on some platforms). How many that are depends on the platform. You can find out how many bytes are in an int pointer on your … | |
Re: In this case, replacing the `&&`s with `||`s (i.e. "keep running while at least one of the `HullShip` variables is greater than 0) would have worked too. | |
Re: Dereferencing a pointer does not just read the byte that the pointer directly points to - it also reads the subsequent bytes depending on how large the pointed-to data type is. So if `ptr` is a variable of type `T*` that points to the address 12feac and `sizeof(T)` is 4, … | |
Re: You're never actually compiling the code. You need to call `make` to create `perl` and the other binaries you're trying to copy. | |
Re: According to google¹ those error codes mean "missing token", "missing type specifier" and "unexpected token" respectively. So it sounds like you have some sort of syntax error somewhere in your code. ¹ Next time please post the error *message*, not the error code, so I don't have to google it. … | |
Re: Yes, you're right - it's not correct. For one thing, as you said, the number of moves is wrong. Further when I enter 3 as the number of disks, it tells me that after the first step there will be 1 disk on the source pile, 2 disks on the … | |
Re: On the end of that line, right before the `&&`, you have a closing parenthesis. There is no opening parenthesis corresponding to this closing parenthesis anywhere in your script. So you get a syntax error. | |
Re: If you'd post your code, we could tell you whether your problem is with your code or your setup. | |
Re: Generally you should not need to manually download any RPMs. Most applications you want to install will be available in the official repositories and can be installed automatically. MySQL definitely is. To install the MySQL client and server either select "Add/Remove Software" from the Applications menu and then search for … | |
Re: The executable created by lex does not take any command line arguments and if you give it any, it will silently ignore them. It reads its input from stdin and writes its output to stdout. So as L7Sqr said, it doesn't do anything because it's waiting for you to enter … | |
Re: I don't know anything about Dwarf Fortress, but it's not possible for a terminal application to change the font used by the terminal (using curses or otherwise). So if Dwarf Fortress does that, it must be creating its own window, not running in the terminal. | |
![]() | Re: You have unclosed opening parentheses on lines 1 and 3. |
![]() | Re: You set j to 0 once before the outer loop starts. So when the inner loop is run for the first time, j goes from 0 to 15. On the second iteration of the outer loop, j will still be 15 because you never reset it to 0 after the … ![]() |
Re: C is not garbage collected. So the garbage collected is never called because there is no garbage collector (unless you're using a lib which provides one - in which case it depends on the lib of course). The reason that your code (which of course invokes undefined behavior, so might … | |
Re: Floats in C are usually stored as 32-bit (i.e. single precision) [IEEE floating point](http://en.wikipedia.org/wiki/IEEE_floating_point) numbers. | |
![]() | Re: > Can your mac/linux do this? Yes, of course, it can. It should also be noted, that in that video the user manually resizes the VLC window on which he wants to focus. In the Mac video to which this was a response, the windows was focused and restored to … ![]() |
Re: The expression `condition ? then_expression : else_expression` evaluates to the result of `then_expression` if `condition` evaluates to `true` and to `else_expression` otherwise. So the above expression evaluates to `1` if `f` is `0` and to `f * fact(f-1)` otherwise. | |
Re: `using my_type = old_type` is a new syntax in C++11 which is basically the same as using `typedef old_type my_type`, with the important difference that it can be templated (whereas typedefs can't be). So in the code you've shown, `matrix<T>` is defined as an alias for `vector< vector<T> >` (for … | |
Re: The easiest solution would simply be to sort the strings by length (using Java's built-in sort method) and then simply take the first three (or last three depending on the order in which you sorted) strings from the sorted array. That solution would be much shorter, simpler and easier to … | |
Re: > Hint: Open the file and read every string stored on it. Each time you read a string, increment a counter variable. When you've read all the strings from the file, the counter variable will contain the number of names stored in the file. That sounds about right. So why … | |
Re: The [System.Console.GetOpt](http://hackage.haskell.org/packages/archive/base/latest/doc/html/System-Console-GetOpt.html) module (which is part of base and thus doesn't add any dependencies to your project) is the proper way to handle command line arguments. Yes, it's easy enough to write your own code for handling command line options, but there's no need to. There's no point in reinventing … | |
Re: Scheme does have an if expression. It's used as `(if condition then-expression else-expression)` and works in the obvious way (i.e. it evaluates `then-expression` if the condition is true and `else-expression` if its not - the result of evaluating an if expression is the result of whichever of `then-expression` or `else-expression` … | |
Re: `(x:y:a:s:d)` (and the other expressions like it) will cause a type error because the right operand to `:` needs to be a list and here it's not. The proper way to achieve what you're trying do would be to use pattern matching like this: compact (D:C:C:C:C:xs) = [C,M] ++ compact … | |
Re: Because most C implementations don't perform bounds checking when accessing an array. So when you give an index to an array, that index (multiplied by the size of the element type according to the rules of pointer arithmetic) will simply be added to the address where the array begins and … | |
Re: None of the variables in your loop ever change, so you get the same output on each iteration of your loop. For example you set `rembalance` to `balance - principle`. Since `balance` and `principle` are never changed, `balance - principle` will evaluate to the same value every time, so `rembalance` … | |
Re: Does the [explanation on Wikipedia](http://en.wikipedia.org/wiki/Determinant) help you? If not, could you maybe rephrase your question to be more specific? | |
Re: "In file included from ..." is not the error. It tells you where the error occurs. The actual error message comes after that. Anyway an `std::map` is a sorted map and thus needs its keys to be comparable to each other. So if you want to use a given type … | |
Re: The error message is telling you that you're trying to convert an empty string into a number. So are you sure that your 'money.$' file isn't empty? | |
Re: You left out the part of other.py where you import main, but if you didn't use the `from main import ...` form of import, you'll have to refer to main's variables, functions and classes as `main.app` etc. instead of just `app`. | |
Re: If your path doesn't start with a drive letter or a (back- or forward-)slash, it's interpreted relative to the current directory. So Chophouse is right, you need to make your path absolute unless Users is a subdirectory of your current directory. You also need to escape your backslashes or use … | |
![]() | Re: First of all a isn't a pointer, it's an array. It *decays* to a pointer in certain contexts, but it decays to a pointer to an int-array, not a pointer to an int, so you need to cast it if you want to use it as an int-pointer. And yes, … ![]() |
Re: According to my compiler the following things are wrong with your code: > bla.c: In function 'main': > bla.c:5:5: error: array size missing in 'SqareNumArray' > bla.c:9:1: error: 'SquareNumArray' undeclared (first use in this function) > bla.c:9:1: note: each undeclared identifier is reported only once for each function it appears … |
The End.