deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Is there any reason as to why the option to specify the quoted user isn't included anymore nowadays?

Our current Markdown parser doesn't support this as far as I'm aware. In general Dani has been against me modifying those parts (ie. the Markdown parser and the editor parser) of the system because it either locks us into a specific version of third party tools or drastically complicates upgrades.

However, I'll be happy to take a look and see what kind of effort it would be to offer quote block labeling at the very least, and possibly even linking to a post/member directly. Off the top of my head I don't see any problem with the syntax or display of quote headers, it's all about how much code I'd have to change to allow it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Specify a section. The three most common are:

  • 1: General Commands
  • 2: System Calls
  • 3: Library Functions

So if you want the open() function, you'd search using man 3 open

fyra commented: thanks. +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What I know is that the size of Pointers vary according to the size of Address.

The size of pointers can vary according to the datatype they point to as well. So a pointer to int isn't guaranteed to be the same size as a pointer to double. There's also no guarantee that the size of a pointer match the largest address on the platform. For modern PC platforms you'll find that they do tend to have these properties, but the C++ language definition does not require it.

It's kind of silly to make assumptions about your platform if it's not needed, and I'd be very interested to hear ways that it would be needed in this case.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Sorry, but it doesn't work like that. All of the links in your tree are pointers to the memory of your current process. If you save those pointer values, they'll be meaningless when read by another proces. Really the best you can do is save the tree's data in a way that's convenient for reconstructing it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Probably not, unless the publisher has released the book for free. Otherwise it's under copyright and free downloads are illegal.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I honestly feel this person's post has been misunderstood.

Helping someone who has openly admitted to piracy validates and enables piracy. Allowing threads on pirated software could potentially put Daniweb in a sticky legal position, so the appropriate response is to strongly suggest acquiring a legitimate copy of the software regardless of the problem.

Whether he mistakenly believes it's pirated or it's actually pirated doesn't matter. All that matters is the claim that the software is pirated.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Does that clear things up?

Yes indeed. That has nothing to do with Daniweb (not 100% on that, but I'm reasonably sure). It's your browser remembering previous input. I don't get any options because I haven't flagged any posts. ;)

The other issue can be seen by logging out of your account and you read the message, it says its an error :)

I was actually confused about the first issue and kind of ignored the second. I'll look into it.

edit: No issues logging out from this thread. What pages are you viewing when it happens?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

4 * sizeof(double*) bytes. You can't assume the size of a pointer, so the 32-bit machine part is irrelevant to the question.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Yes, I mean it returns -2.

Then it's working properly and the problem is your understanding of the bitwise NOT operator.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I have unfortunately installed a fake copy of xp

Then unfortunately you should uninstall the pirated copy, buy a legit copy, and install that.

the microsoft co-operation has tracked it and the screen display has turned upside down

That's utterly ridiculous. I don't doubt that you've accidentally hit the hotkey to flip your screen (fixable with alt+ctrl+down arrow), but to blame it on Microsoft tracking your piracy and doing something so silly without direct remote access is ludicrous.

By the way, discussion of pirated software is against Daniweb's rules.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

That program does not work

How does it "not work"? Are you getting a compilation error or does it simply not produce the result you expected? The reason I ask is that ~1 is -2 (in a two's complement system), not 0.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Because it's required in the Assignment.

Then I suspect you've misinterpreted the assignment. Could you post it?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Have you tried that code? I mean, a simple test program would have answered your question in far less time than it took for me to notice it and answer. But yes, you can use bitwise NOT in a preprocessor directive.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You don't embed DLLs into executables, you package them in an installer such that they're copied to and registered with the target machine. So in your case you need to create a setup and deployment project. This project will produce an MSI that will handle installing all of the required files to run your application.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

My question to you all is, are there elements from each of the commercial and open source operating system that you would combine to make the best operating system.

While looking at prior art is a good way to get started, I wouldn't buy an OS that's nothing more than a mishmash of existing competitors. I'd rather buy the mature competitor and tailor it to fit my needs.

For example, would you take the GUI from one the speed from the other and the reliability from the third?

Somehow I doubt that any OS in history has been pitched as being slow or unreliable. Those aren't elements of the OS design, they're problems with the implementation.

Are there elements in the three big boys operating systems that they have gotten completely wrong or need improving?

Well, it seems you already have pre-existing bias. So, I'd start by taking the two of the three "big boys" you think are slow and unreliable, then identify why you think that's the case, and design competing features that correct what you believe the problem is.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

First and foremost, I think insFirstNode() is poorly named. It implies that the node will be prepended to the list in all cases, but in reality what it does is append.

As far as converting the list to an array, it's simplicity itself. But a few things will need to change for the code to make sense. You can't really call the class linkedlist anymore. Since it's only a collection of students, why not student_collection? From there just keep an index for the most recently appended item, and increment it when you add a new student:

struct student {
    string name;
    int id;
    string prog;
    double cgpa;
};

class student_collection {
private:
    student _students[50];
    int last;
public:
    student_collection(): last(0) {}

    void add(string name, int id, string prog, double cgpa);

    //...
};

void student_collection::add(string name, int id,string prog, double cgpa)
{
    if (last == sizeof _students / sizeof *_students) {
        throw "Oh noes!";
    }

    _students[last].name = name;
    _students[last].id = id;
    _students[last].prog = prog;
    _students[last].cgpa = cgpa;

    ++last;
}

Of course now you have to concern yourself over reaching the end of the array, and the size of the array on the stack becoming a problem for a large number of students. Ideally you'd dump arrays entirely in favor of std::vector, which handles dynamic allocation of memory on the heap and will adjust its size accordingly.

on93 commented: thanks +1
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So am I to assume that you completely ignored the replies from your other thread that asks essentially the same question?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm not sure I understand what you're describing, can you be more specific?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

unordered_set is a hash table, it does manage collisions. How it works is solely dependent on which variation of hash table the author chose to use. You use it for any number of cases where a hash table is a viable solution.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

so , i want to know how unordered_set works and does it hash the values or not and how it retrive the results for queries. thanks

Please read my posts in their entirety. You'll find that I already answered this question: it's some variation of hash table. If you want to learn how unordered_set probably works under the hood, go learn about hash tables.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

i want to knoe the working or some knowledge about its implementation.

The whole point of abstracting things into an interface is that you don't need to know about the implementation. But it's a fairly safe bet that you're looking at some variation of a hash table. Open up the header and see if you can decipher the code, it'll tell you everything you want to know.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You're trying to concatenate to a variable that was never truly given an initial value. Somewhere before the first concatenation, add this:

$topic = '';
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

its ok u cant help.

It's not a matter of "can't". We won't help when you're looking for a handout. The sad part is that not only did you steal the posted code to trick people into believing you did any work (which you clearly did not), you stole it from Daniweb, which makes it doubly easy for us to find and expose your lies.

Please read our rules, this thread is closed as a violation of the homework rule.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

My educated guess is that you're using Turbo C to run this program. Turbo C's int is 2 bytes rather than 4, so 34545666 is waaay out of range. Use a long int instead of int to ensure that the code works even on ancient compilers or compilers that target funky systems:

#include <stdio.h>

int main(void)
{
    long int num;

    printf("Enter a whole number: ");
    fflush(stdout);

    if (scanf("%ld", &num) == 1)
    {
        while (num != 0)
        {
            printf("%ld", num % 10);
            num /= 10;
        }

        puts("");
    }

    return 0;
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm not able to duplicate this.

Zoom out by one tick (hold down ctrl then hit '-'). It happens in Chrome and Firefox, but not Opera or IE.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

However java does not seem to allow 2 returns in the same method

That's not correct.

and considers the following code as not having a return statement.

This is correct. Not all paths end in a return statement, so your compiler is complaining. You have a return for the if clause, one for the else if clause, but no return for the implicit else clause. It doesn't matter that the implicit else clause is logically impossible, your compiler isn't checking the conditions, only the paths.

In this case you can turn the else if into a simple else to fix the problem, because that wouldn't break your logic.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Your push_in_tree() function has no way of telling the caller what changed. Consider this:

EL *push_in_tree(EL *new_ptr, EL *root)
{
    if (root == NULL)
    {
        root = new_ptr;
    }   
    else if (new_ptr->id < root->id)
    {
        root->left = push_in_tree(new_ptr, root->left);
    }
    else
    {
        root->right = push_in_tree(new_ptr, root->right);
    }

    return root;
}

Then it would be called like so:

root = push_in_tree(current, root);

This ensures that at all levels of recursion, you can propagate changes back up the tree.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

how do i fix the error that says "E:\Pet\src\Pet.java:56: error: class PetTest is public, should be declared in a file named PetTest.java public class PetTest"

That's what I was talking about with my addendum that if both classes must be public, they should be split across two files (just like the error says).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

im sorry im three weeks into my course on java

At this point you should know that Java is a case sensitive language. I kind of assumed you weren't so helpless that I'd have to point it out.

Read the errors and try to understand them. If you don't learn how to debug, you'll fall into a frustrating death spiral that will result in quitting programming.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You have an import statement just before PetTest, remove it. Actually, if you want both classes to be public then you need to split them into two files and the import statement can remain at the top of the file for PetTest.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Even when they are gone it is still causing the same error

Where did you remove them? One example of an incorrect semicolon is here:

public static void main(String[] args);

You don't terminate the signature of a function definition with a semicolon.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster
for i in range(0, n):
    List.append(random.randint(0,1000))
    return (List)

This generates one number, appends that one number, and returns immediately on the first iteration of the loop. You need to move the return statement outside of the loop:

for i in range(0, n):
    List.append(random.randint(0,1000))

return (List)
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Double check your use of semicolons. You have a bunch of them where they shouldn't be.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I wasn't aware of that.

Which means you didn't read the reference link in my initial reply. Sometimes I wonder why I even bother.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

We are only allowed to use the cstring functions in my class.

It's convenient that strstr() is in that library, isn't it? :rolleyes:

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

strcmp() returns a comparison, not equality. If the result is 0, the two strings match. If the result is less than 0 the first string is lexicographically smaller, and if the result is greater than 0 the first string is lexicographically larger. So your test should look like this:

if (strcmp(word1,word2) == 0)

However, strcmp() compares strings in totality. If you want to search for a substring, you want strstr() instead:

if (strstr(word1, word2))

strstr() returns a null pointer if the second argument is not found within the first, so you can use an implicit failure check in the if statement. If you want to be explicit, you can do this:

if (strstr(word1, word2) != NULL)
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Please post a sample program that exhibits the problem.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

method expects address of the variable/ pointer varible instead of passsing value of the variable while calling the method
but you called this method by passing the value directly so that is the reason you got skipping over the function call

That's a good guess, but you're wrong. The argument evaluates to a pointer, it already represents an address, so no address-of operator is needed in this case. The problem is that reverseString() is all borked up; it shouldn't even compile. Anyway, replace reverseString() with the following and watch the problem go away:

char *reverseString(char *original)
{
    int i, j;

    for (i = 0, j = strlen(original) - 1; i < j; i++, j--) {
        char temp = original[i];
        original[i] = original[j];
        original[j] = temp;
    }

    return original;
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It's very difficult to suggest anything useful due to the incredibly vague nature of the question and lack of code.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

fp1=fopen("**********.CPP.SAVE","w");

This is a little confusing, are you trying to use wildcards or placeholders to pick up any file matching that pattern? If so, fopen() doesn't do that. If it happens, that would be an extension provided by your compiler that you need to confirm rather than asking people who are unlikely to be familiar with your platform.

If fopen() on your compiler doesn't do pattern matching, which is a good assumption, you'll need to use some non-standard functions to read the files in the directory, check them against your pattern, and open/process them each in turn.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

i have not defined <stdlib.h> header and included rand() function and it works without this header. How?

If you don't declare a function before using it, the compiler will assume that it's an external function accepting an unknown number of arguments and returning int. If those assumptions hold true, you're good. It's a horrible practice, but it'll work (barring functions with variable arguments like printf()).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I updated my previous reply by the way? are you aware of that?

Ninja updates should be expected to go unnoticed. But to answer your update, pick whatever you want. This is pseudocode, it doesn't matter.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I was also told to stay away from classes completly until he's ready for me to move in that direction.

That sounds like the kind of thing a teacher who's only a step or two ahead of you in the learning process would say to avoid being embarrassed.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Yes, that's fine.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

hows this look?

Does it give you the correct answer? If so, it looks fine. If not, it doesn't look fine. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Take each number and subtract the mean, then square the result. Finally, divide by the length of the array and add that to your sum. The sum is the variance, and the square root of that is the standard deviation:

double sd = 0;

for (int i = 0; i < numbers.length; i++)
{
    sd += square(numbers[i] - average) / numbers.length;
}

double standardDeviation = math.sqrt(sd);

You could total up the squared difference and do the division after the loop, but if there are a ton of large numbers you may end up overflowing the data type.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How would I write the calender as a pseudocode? complete writing ? or assume the calender() method is already exists ?

If it's an extraneous utility that's not related to the logic you're trying to outline, just pretend a function already exists that does the work. If the calendar logic is what you're trying to outline, you need to write it. Pseudocode works much like flowcharting. If you have an operation that's not really necessary to flowchart in detail, you just leave it as an execution block, right? It's the same with pseudocode and "magic" functions; they're just placeholders.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

In the context of a program's instructions it's a non-issue. You access the logical addresses and the operating system will handle the conversion to physical addresses.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What should i do to handle this exception.

Don't cause it in the first place. If values can be null, be sure to check for null when doing things like output and use a safe alternative.