deceptikon 1,790 Code Sniper Team Colleague Featured Poster

But it doesnt make sense thread to make a question thread a article either.......

I think you're making a mountain out of a molehill. So far the only one who has really been bothered by the terminology is you. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Markdown's official stance is that color should be irrelevant to the content as is just for "decoration", and Markdown is all about preserving the integrity of what's being said both in raw form and parsed form. You can emphasize a part of a post by making it bold or italicize it, or divide a post into headings or sub-headings. Color is, essentially, just a styling issue.

That's an inconsistent argument. How are italics, for example, any less a styling issue than color? You can emphasize part of a post with color as well, when bold or italics wouldn't make sense. One example that I've used many times in the past is red for incorrect parts of code and green for correct(ed) parts. The color is more than decoration in that case, it's critical to the post's meaning.

Besides, we already use an extended version of Markdown, so I don't see any reason why their official stance should be relevant to us. ;)

A much better argument against color would be two reasons that apply directly to Daniweb:

  1. Color wasn't used very much even when we supported it.
  2. When it was used, it tended to be abused.
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Also, it actually would not make sense to me to make EVERYTHING a "thread".

The implication was that labels would adjust according to the entity being described, not that everything would become a thread.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Not sure. I think maybe it should given some thought or at least a option.

Um, it's totally cosmetic. Even if we treat everything as articles under the hood, simply changing a few labels to say "thread" instead of "article" would make the "a thread is an article" thing invisible. Like I said, if it causes too much confusion we'll change the labels and the problem goes away. ;)

AFAIK, this is the only forum that sees everything as articles.

Or maybe it's just the only one you've seen that exposes that choice to end users. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I use Nettalk now that mIRC has tightened up their trial, and it works well for just chatting.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

how about bumping threads several years old?

It depends on the context. If it's a reasonable continuation of the thread, all is well. However, if it's just a rehash of the original question or only tangentially related then it should have been posted as a new thread and falls under Keep It Organized.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Can you modify the parser to save the last line?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Unnecessary bumping is frowned upon because bumping sends the last post on page 1 to page 2 (which is tantamount to the kiss of death on Daniweb). But you're correct that there's no rule against it. Legitimate bumping that continues a discussion is fine, though it still annoys certain people. ;)

Special circumstances require special handling of course, and if someone regularly bumps with pointless posts that are clearly for the sole purpose of sending their thread to the top of the list, I'd say that it's fine to close the thread and explain our take on bumping.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

This will match the first full line preceded by two newlines and a tab or at least four spaces:

((\n{2})(\t|\s{4,})(.*))

It's broken down into three capture groups:

  1. (\n{2}) finds the leading two newlines.
  2. (\t|\s{4,}) finds the leading tab or spaces.
  3. (.*) finds the actual content of the first line (the . operator doesn't match newlines by default).

But whether or not \n actually matches a newline in the content depends on what kind of transformations are done on the source string. If they're all <br />, \r, or \r\n then the regex will fail to match. That's probably why you've been having trouble.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Fix it too ;)

Dani doesn't let me publish to the production server, so while I can fix stuff, it still has to go through her approval process before you see it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'd recommend dropping dynamic arrays entirely and letting the string class do the heavy lifting. It'll save you all kinds of complexity and potential bugs:

#include <iostream>
#include <string>

using namespace std;

int main()
{
    string input;

    cout << "Enter a string: ";

    if (getline(cin, input))
    {
        cout << "Before: " << input << endl;

        // Append 'U'
        input += 'U';

        cout << "After: " << input << endl;
    }
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So far everyone has been assuming you want 3 of 9 barcodes, which isn't necessarily a safe assumption. If 3 or 9 or another simple linear barcode symbology is acceptable then it can be as easy as adam_k suggested: barcode readers are usually USB and send translated results directly through standard input as if it were a keyboard. Printing barcodes is equally trivial given a font and minimal formatting efforts (ie. the asterisk wrapping for 3 of 9).

However, if you need to use stacked or 2D barcodes things get harder because there are encoding steps involved. For example, the PDF417 symbology uses a complex algorithm to produce the encoded result, which is then displayed by the font. Without the encoding, readers will fail to recognize the barcode. This is where it makes sense to use a library to do the heavy lifting.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You'd have to merge the source files manually and rebuild, but what's wrong with having two projects in the solution? You can reference one from the other (there's a Projects tab in the add reference dialog) if sharing is necessary.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

There problem is exactly as stated. sequence is a pointer to char (a dynamic array), so sequence[i] produces a single character, not a pointer to a character. I can't say how to fix it because I'm not sure what you're trying to accomplish with that line, but on the assumption that you're trying to get the length of the substring starting at i, you can do this:

char* arr = &sequence[i];

Taking the address of the character produced by sequence[i] will give you a slice of the string. Alternatively you can use this syntax if it's more intuitive:

char* arr = sequence + i;
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It's really just a customized trim algorithm. Search from the beginning until you find a valid character, then mark that position. Search from the end as well until you find a valid character and mark that position. Now you have enough information to extract a substring:

#include <iostream>
#include <string>
#include <sstream>

#include <cctype>

using namespace std;

string sanitize(string const& s, int valid_character(int))
{
    string::size_type first = 0;
    string::size_type last = s.size();

    // Skip leading and trailing invalid characters
    //
    while (first != s.size() && !valid_character(s[first]))
    {
        ++first;
    }

    while (last != 0 && !valid_character(s[last - 1]))
    {
        --last;
    }

    // Trim and remove the located invalid characters (leave embedded "invalid" characters)
    return s.substr(first, last - first);
}

int main()
{
    istringstream src(
        "Here's a \"TEST\" file. (DateD 5 April, 2012)\n"
        "Will this #*PrOGRAM+=@ that includes\n"
        "!user-defined?!?> FUNCTIONS\n"
        "really work? Only time will\n"
        "tell.............");
    string word;

    while (src >> word)
    {
        cout << sanitize(word, isalnum) << '\n';
    }
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I just noticed this as well. Dani has been tweaking the editor and posting process, so something may have gotten through accidentally. I'll take a look.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

He probably wants you to be familiar with the core .NET framework, and at least one language tied to it, such as C# or VB.NET.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Can i start making money, even very little from this?

Unlikely. Freelancers are expected to hit the ground running, and if you lack real world experience it'll be even harder finding a gig than a permanent junior position. Sure, you could bid on sites like rentacoder.com, but I wouldn't expect to make any kind of living off of it given that most people there bid stupidly low as a supplement to their day job.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I've noticed that when pasting code, the editor doesn't maintain the tab level. This is probably a huge contributing factor in people's failure to correctly use code blocks under Markdown. Retaining the starting tab level would fix that particular problem...does CodeMirror support such an option?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Since constructors can run before main() in C++, order of construction can sometimes be an issue with global and static objects that touch each other. Unfortunately, I'm as stumped as you are, probably more so in that I'm so far disconnected from the actual running code. ;)

Apologies.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Like I said, it was a very unlikely theory. ;) In the actual code, are you by any chance calling somefunct() from a constructor in a global object?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Hmm, interesting. Two things to consider since there's some potential funkiness involved. When you call malloc(), make sure that the correct header is included, and also cast the result as C++ doesn't support implicit conversion from void*. This is all speculation since I haven't used a Borland compiler in ages, but it could be that the lack of a matching definition causes the compiler to assume this:

int malloc(size_t)
{
    return 0;
}

Granted that's unlikely, but it would explain your results. At the very least, making sure the code is C++ compatible would be a start in troubleshooting the issue. :)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Your pointer to dynamic memory was corrupted somehow or was otherwise invalid. Usually this is the result of writing outside the boundaries of the requested memory because those areas are often used by the memory manager to store bookkeeping information, and thus they're very fragile.

The following stands out as both a memory leak and a likely disconnect because your destructor doesn't differentiate between a string literal (which cannot be deleted) and the result of new[] (which can be deleted).

str = new char[9];
str ="Default";

The non-default constructors also have an issue because they try to delete str before doing anything else. However, unless str is a valid pointer returned by new[] or a null pointer, calling delete[] is undefined behavior. Since the object is completely new at this point, trying to delete existing memory is nonsensical.

MyString::MyString(char newstr[]){
    length = strlen(newstr);
    delete [] str;
    str = new char[length];

I suspect both of these issues work together to corrupt your memory and throw errors, so if you fix them, the class will probably work more to your liking. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

A constructor may only called during a declaration (under normal circumstances), so your code should look like this if you want to reset the dent_space1 string object:

dent_space1 = std::string(max_space, ' ');

Or since the object already exists:

dent_space1.assign(max_space, ' ');
Vasthor commented: thnx for the second method! +2
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Your job would be vastly simplified by storing the numbers in an array rather than as separate variables. Then you can sort the array and choose the median with ease.

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

What are the errors?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Have to agree, "article" is not a good generic term. In forums, "topic" or "thread" are the accepted terms.

Blame Dani, we used her preferred terminology in the back end (everything derives from an article) and let it filter to the frond end. ;) Ultimately it's cosmetic, and should there prove to be excessive confusion the front end will be tweaked to use the most familiar terms. But in the meantime, "article" is our term for an initial article (whether it be a thread, a news story, a code snippet, etc...) and the attached replies constituting subsequent discussion.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

All admins, moderators, team colleages are employees or some of them just contribute their time to site. And if they are employees how do you work together? at one place?

Any compensation is between the individual and Dani, but to the best of my knowledge the team is mostly composed of volunteers. And only Dani and Kerry work from the Daniweb office. The rest of us are in our respective homes and home lands. We communicate through the forum, private messages, email, and in some cases (such as Dani and I discussing more extensive coding tasks) we speak on the telephone. Daniweb also has events every now and then in New York, for those who are able to travel there and participate, but that's open to anyone and not just team members.

Also Can I ask if you know what happened to Narue?

Narue has decided to retire her account on Daniweb. Sanjay and I will be picking up the slack as the two new admins.

Sahil89 commented: Perfect answer :) +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

i need to display the numbers 1 to 9 randomly but they cannot be repeated!

Then technically it's not random. ;) There are two ways to get a non-repeating set of random numbers:

  • Store the generated numbers and try again if you generate one that's already been generated.
    #include <algorithm>
    #include <iostream>
    #include <iterator>
    #include <vector>
    #include <cstdlib>
    #include <ctime>

    using namespace std;

    int main()
    {
        srand((unsigned)time(0));

        vector<int> rnum;

        while (rnum.size() < 9)
        {
            int r = 1 + rand() % 9;

            if (find(rnum.begin(), rnum.end(), r) == rnum.end())
            {
                rnum.push_back(r);
            }
        }

        copy(rnum.begin(), rnum.end(), ostream_iterator<int>(cout, " "));
        cout << endl;
    }
  • Fill an array (or other data structure) with the full range of numbers you want, then randomly shuffle it.
    #include <algorithm>
    #include <iostream>
    #include <iterator>
    #include <vector>
    #include <cstdlib>
    #include <ctime>

    using namespace std;

    int main()
    {
        srand((unsigned)time(0));

        vector<int> rnum(9);

        for (vector<int>::size_type i = 0; i < rnum.size(); i++)
        {
            rnum[i] = i + 1;
        }

        random_shuffle(rnum.begin(), rnum.end());

        copy(rnum.begin(), rnum.end(), ostream_iterator<int>(cout, " "));
        cout << endl;
    }
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Out of interest how many man hours have been spent by how many people rolling your own forum code?

Dani and I had our first call to discuss design probably near the end of November 2011.

I run a phpBB3 board on which spamot reg became epidemic last year but managed to kill it stone dead with the right settings.

It's not just the settings, which I'm reasonably sure could have been tweaked in vBulletin to improve matters, it's that vBulletin simply was no longer a good fit for Daniweb's needs. Every new feature was either not possible, or a constant battle. Other BB systems would suffer similar problems due to generality, which is why we decided to go with a completely custom solution in the end. Given the amount of customization already in place under vBulletin, I'm also not convinced that switching to another BB product would have been any faster or less work than writing a new one (perfectly tailored to Daniweb) from scratch.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If it ain't broke, don't fix it...

Rest assured that the decision to dump vBulletin and start over from scratch wasn't made lightly.

I tried using the basic quote tags and they don't work and are displayed literal....

BBCode no longer works, we've moved to a new system called Markdown. And no offense, but shouldn't you take the time to learn the new system and give it an honest try before complaining about it? The general response among those who have done so has been almost completely positive (and that was before we fixed the inital rollout bugs).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Article is a more generic term for the same things you're familiar with. Threads are articles, news stories are articles, white papers are articles, code snippets are articles, etc... Articles may also contain replies, which are post; this makes sense because Daniweb is a discussion community. ;)

and when I try to use tags and stuff, it doesnt act like it normally does.

Can you elaborate? We didn't really make any big design changes to the way tagging works.

Any way to go back to the old way?

Nope. The old way used a heavily customized vBulletin as the back-end, and it was far too limiting. Now we have a custom solution on the back-end which is far more suitable for our needs. Because it's completely ours and written to suit our needs, we're in a much better position to implement complex features that simply weren't possible because of vBulletin.

So feel free to ask for stuff. :)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

My convention-going friends have a fit when I don't go because I live in the area. So yeah, I'll be there, probably all three days. :D

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Geeks and conventions go hand in hand, right? ;) Who here plans to go to this year's Dragon*Con in Atlanta?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Here is my code:

You didn't ask a question. What do you want help with?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I agree, that rotating array is better, but I decided to do it with queue.

A queue is an abstract data type, the rotating array is one option for implementing a queue. Just FYI.

Can you help me with that to?

If you have any specific problems with your code, feel free to post them on this forum and someone will help you.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

After watching the first episode, Acchi Kocchi looks promising. I was kind of annoyed when Danshi Koukousei no Nichijou ended, so woot!

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I said there's no need for a name, not that we'd refuse to use a really cool one. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Cscgal, not a bug but maybe one for the new system's FAQ.

It's really only an issue if you have multiple pages of private messages, which the majority of members don't. However, with that said, improved filtering of private messages is on my todo list. ;)

BTW: Has the new system got a name? "daniBB" or "vDani" maybe?

I guess it's called...Daniweb. :D Given that the system is 100% tailored to Daniweb's needs and there's no intention of productizing it, there's really no need for a productish name.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How do we add an attachment to a post?

In the post editor there's a button called Files. Click that guy to bring up the attachment view, and from there it's your typical file upload process.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Yes that's what I'm looking for, but I can't find that link on my Profile page!

There are two tabs on your profile page: Community and Post Comments. Community is your member and activty summary while Post Comments is the list of your reputation comments.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I think the main thing I'm not entirely sure of is how to "cut" the numeric format down and get the last two digits for the "secret message".

Use division and remainder math:

19546 / 100 = 195
19546 % 100 = 46

It's easier to keep the numbers stored as integers so that you can use them as indexes in the key lookup without doing a string -> integer conversion. Of course, if the message is long enough for the sequence number to overflow and integer you'll need to approach the problem differently, but I don't think that'll happen provided you use long int as the data type (note that int is only guaranteed to be at least 16 bits).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

In your shoes my struct definitions would probably look like this:

struct Subject
{
    char name[MAX_SUBJECT];
};

struct Node
{
    struct Subject data;
    struct Node* prev;
    struct Node* next;
};

struct Queue
{
    struct Node* head;
    struct Node* tail;
    int size;
}

struct Student
{
    int id;
    char first_name[MAX_FIRST];
    char last_name[MAX_LAST];
    struct Queue* subjects;
};

I prefer a linked list based queue because it's more extensible. However, in this case the nubmer of subjects may have a hard upper limit, in which case a rotating array implementation would work fine. But without knowing for sure if that's the case, I'll have to suggest a linked list as the go-do implementation. ;)

So from here your task would be to implement the queue.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I know this is for school, but a dedicated matrix object or vector of vectors would be much better in terms of usability and flexibility than a multidimensional array:

#include <iomanip>
#include <iostream>
#include <vector>

#include <cstdlib>
#include <ctime>

using namespace std;

typedef vector<int> Row;
typedef vector<Row> Matrix;

Matrix matrixGenerator(int m, int n, int lbound = 0, int ubound = 10000, bool reseed = true)
{
    if (reseed)
    {
        srand((unsigned)time(0));
    }

    Matrix result(m, Row(n));

    for (int x = 0; x < m; x++)
    {
        for (int y = 0; y < n; y++)
        {
            result[x][y] = lbound + rand() % ubound;
        }
    }

    return result;
}

int main()
{
    Matrix mat = matrixGenerator(3, 3);

    for (Matrix::const_iterator row = mat.begin(); row != mat.end(); ++row)
    {
        for (Row::const_iterator item = row->begin(); item != row->end(); ++item)
        {
            cout << right << setw(6) << *item << ',';
        }

        cout << endl;
    }
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'd like to see the list of reputation comments in our Profile similar to the one that was in vBulletin.

What do you feel is missing from the list we have now?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It was your control panel in vBulletin. The new design is intentionally "plain" because it's only a first version of the system and a simpler design improves both performance and usability. The control panel from vBulletin in particular was excessively complicated and it confused people.

Now that we're relatively stable from the initial bugs, feel free to make feature requests. But please provide a specific description of what you want. Using your description of the lost features, "statistics about traffic income to daniweb for code snippets and stuff like that", isn't quite detailed enough to work out a new feature design.

Philippe.Lahaie commented: +1 for "control panel" ! :D +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

And no one will be capable of replying when I lock the thread. Care to try again?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You neglected to specify what the problem you're having is, but I do have some notes on the code as it stands:

temp1 = (node*)malloc(sizeof(node)); // allocate space for node
temp1 = head;

You allocate space for a node, then immediately throw away your only reference to it. Not a good idea. The search algorithm for a linked list shouldn't require any space beyond a pointer.

bool find = false;

find is already used in C++ as the name of a standard library function. You should avoid reusing such names.

cout<<"The value entered found at position : "<<counter<<endl;

counter is never updated within the loop.

return main();

Never call main() recursively. Technically it's not even legal in C++, but even for compilers that allow such nonsense, it's a terrible idea.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Am I the only one who feels this way?

Nope. I'm giving the OP the benefit of the doubt though, because it's possible that this has legitimate uses. However there's a strong chance that it's a very naive attempt at virus propagation logic.

Also, wrong forum.

Looks fine to me.