deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Do we need vs 2005 redistributables compulsorily?

Yes.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What could have gone wrong..

Clearly you passed a null pointer to fprintf on line 55. Focus on what possible circumstances would result in that action when troubleshooting.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If you only need to determine whether a number could be in a certain base, just check the digits. If there are any illegal digits for the base, you can exclude that base.

If you need to say conclusively that something like 1001011001 is binary, it's much harder. That particular number is perfectly valid for any base, so unless you're making assumptions about what constitutes a binary value, you're SOL. With some reasonable assumptions that limit what each base can represent, you can introduce heuristics, but there will still be false positives or false negatives for degenerate input that go against your assumptions.

So...what are your allowed assumptions?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I called it elitist because that's the vibe I've always felt from the argument, rooted from 'you can't/don't do what we do'.

The relevant part of the quote has been bolded. How you feel is irrelevant in light of the facts. A markup language is indeed not a programming language, and calling it such is factually incorrect. Reading between the lines and then calling people elitist for pointing that out is no more fair than saying "you can't do what we do".

Also note that "can't" and "don't" are two very different words with different connotations in this context. In general and without qualification the former is demeaning while the latter is more neutral and could hardly be described as offensive.

Are you saying that you do not think that Python and PHP are programming languages

No. The intention is to describe "true" scripters as being offended that a "mere" markup author would be elevated to their status. The sentence is kind of twisty, but still internally consistent.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

confusing your and you're

I see what you did there. ;D

and HR departments still get it wrong...

Indeed. I recall seeing a prominent job offer for a Java position requiring 10+ years of experience...in 2001. Clearly they were just using buzzwords and random numbers that sounded experienced.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You could delete an account of a member, but what about the answers he/she gave in all the different threads?

Thread continuity isn't affected when an account is deleted, it just shows up as a deleted account. While we could delete Dave's account without any negative effect, I'd be against it on principle.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Here you can download visual c++ ...

Visual C++ no longer supports <iostream.h>. Nice try, but please attempt to understand the question before answering. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

what was the greatest programming challenge you ever had

Being a good programmer. It's a constant challenge. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

it adds automatically an empty line between 1. Item One and 2. Item Two

Yes, that's a quirk or the Markdown formatting that I've been unable to fix without introducing other quirks.

When going to submit I get this error:

Yup, that's because you indented the nested items with a tab or 4+ spaces. Markdown will accept the nesting regardless of source text indentation, so you can just ignore it and leave everything at column 0. However, if you want to have nested lists of the same type, you can use a 1, 2, or 3 space indentation to give a hint to the parser and still get around our code validation. Here's an example with 2 spaces:

* Item One
* Item Two
  * Nested One
  * Nested Two
* Item Three

Which is formatted like this:

  • Item One
  • Item Two

    • Nested One
    • Nested Two
  • Item Three

Also, I thought the absence of an empty line before and after a presumed "code block" as a nested list, would have avoided the check.

No, that ensures that you'll get an error. ;) The editor will not format such text as code, but the validation runs after you try to submit.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What's the favorite OS among the daniweb people? aha

That's a much better question than "which is the best?". My favorite would be Windows 7, but similarity with Windows 7 and obvious improvements make Windows 8 a strong contender. I just have more experience with Windows 7 presently, so it's easier to say that one is my favorite from a knowledgeable position.

Learn your computing history. Linux doesn't do things the way it does to deliberately be different from Windows. Linux was developed by Linus Torvalds because he wanted a Unix system but couldn't afford the exhorbitant licencing fees. He developed Linux to be like Unix, which was around a very long time before Windows or even PCs. Unix was first released in 1969. Windows 3.0 was released in 1990. The Linux kernel was first released in 1991.

It's somewhat amusing that you tell someone to learn their computing history, then immediately proceed to ignore all but the earliest history of Linux to make your point. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

when I run the code and press y it says access is denied. So what can I do?

Log in with an account that has permission to shut the computer down and then run the program.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

input reads a whole line.

Including the newline character?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Try contacting the people who submitted solutions and ask what their approach was. Don't ask for the solution itself, just voice your concern about the ambiguity over N and ask how they got around it. My guess is that they made an unwarranted assumption that happened to be safe on the testing machine.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

But he already did that:

I'm not hip on Python, but I would assume that input() has a similar problem as you'd see with scanf() in C. Something gets left in the input stream that a subsequent call to input() will terminate successfully on without blocking for the user. The behavior clearly suggests something like this, and my first suggested fix should be preferred anyway because it's more flexible. ;)

I know how to run a cmd window, but have never needed a seperate console window.

Since it sounds like you're using Windows as your OS, go to your programs list and open a command prompt. It should open up in your user home folder. For example, my command prompt in Windows 7 would open under C:\Users\deceptikon. For XP it might be C:\Documents and Settings\deceptikon. Then you cd to the directory where the program is and run it by typing its name.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

well if you have read the question(in the link), then you will know that these arrays are not 'created' by me, these are input to me. if you have participated in any Topcoder SRM then you will better 'understand' this.

If somebody gives you an unchangeable interface where the size is not passed, assumed to be something, acquired from input, or requires a sentinel value, you're SOL. At that point all you have is a pointer, and there's no standard way to figure out the size of an array when given a pointer to the first element (as stated clearly in my first reply).

I've read the question in the link and nowhere does it specify how you're to determine the value of N, thus the problem definition itself is ambiguous and faulty. Contact the author of the problem and complain.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

That happens because the window is owned by the executing program. When the program ends, the window is destroyed. This is normal and expected behavior that doesn't happen when using the Python shell because the Python shell is owned at a higher level than the running program.

If you start the console separately, then navigate to your program and run it that way, the console window won't close because it's owned by its own process and not dependent on the Python program's process.

Alternatively, you can add a request for input at the end of your program to force the process from terminating until input is provided.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How are you starting the console?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You can modify the show state for another process' window using ShowWindow:

#include <iostream>
#include <tchar.h>
#include <Windows.h>

using namespace std;

int main()
{
    TCHAR *title = _T("Untitled - Notepad");

    if (HWND h = FindWindow(0, title)) {
        ShowWindow(h, SW_HIDE);
    }
    else {
        cerr << "Window not found\n";
    }
}

However, if the application isn't designed to run in the background, you'll have issues in making it do things after being hidden, and will also need to close it by killing the process.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

That's a very myopic view of geekdom.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What about daniweb, lol.

Same questions, different site. There are a large number of forums, bulletin boards, news groups, and exchange sites out there. Adding a new one that's not guaranteed to be still born would require a certain measure of uniqueness, unusually good usability, and/or revolutionary design.

Stack Overflow is a good example of those traits, and that's why it has done so well in such a short time. That's also why I used it as the defining example rather than Daniweb. Daniweb is more of a classic forum, but it's a mature community rather than a new kid on the block. Most classic forums that are created die quickly, and unless it's a niche that's not currently filled, success is very unlikely.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Let me be more specific: what's so awesome about your idea that would encourage people to use your site instead of established and mature Q&A sites like Stack Overflow? So far I'm not seeing anything enticing.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

A what?

Begginnerdev commented: Same reaction! +8
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

its a site that makes a registered user ask questions to the world, with interest points that links those questions to other users. and a user can also direct the question to another user...

How is this different from, say, Stack Overflow?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The data inside the object is guaranteed to remain unchanged.

Unless it's mutable, or the function does something tricky to bypass constness. Rule #1 of C++ is that there are no guarantees. Stupid or malicious code can get around any language restriction. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

He passed away a couple years ago, I think it's time for DaniWeb to retire his account and move on.

No offense toward Dave's memory in any way as he was easily one of my best friends online, but why would we need to retire his account? How is it different from any other member that suddenly stops posting?

I guess it should mean that it is deactivated in the sense that it won't "participate" anymore (e.g., doesn't show up on endorsements, cannot send him PMs, etc.). But obviously, all past posts and stuff should remain, probably also the user profile (maybe with a eulogy-like notice).

There's no way to do that presently, we don't make a distinction between active accounts an inactive accounts except through hard deletion (though deletion does a lot of what "retiring" seems to be). And I'd be against deleting Dave's account, for personal reasons.

What DaniWeb needs is a 'memorial account' option, similar to Facebook, perhaps?

That I can get behind. Something to mark an account as being special in the hearts of the community even though it's no longer active.

But how would you know if a Daniwebber is no longer living...? Wouldn't that be kind of challenging to figure out?

It depends on the cause of death and how friendly the member is with other members. In Dave's case it was advanced cancer. While things progressed shockingly fast, there was plenty of advance warning that …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Pass the size in using two more parameters. There's no standard way to determine the size of an array when given nothing but a pointer to the first element.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You can, but it violates the EULA and thus constitutes an illegal action. Therefore discussion of such is not allowed on Daniweb. You can find plenty of information on Google.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Well, with that rule absolutely any and every word is permissible. Can a filter of any kind, for words or images, be justified with such a rule?

Exactly my point. No word should inherently be prohibited because it's not the word that's the problem, it's the way the word is used. If the word is used in a non-offensive context, it shouldn't be offensive, in my opinion. Then again, profanity never bothered me even when it was intended to be offensive. And one could certainly argue what it means to be "offensive". In our current social climate, people tend to be extremely sensitive, which is why Daniweb has a censor in the first place.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

A special type of variable (Different from oridinary variable)

What's special about it? A variable holds a value. A pointer's value is an address. How is that different enough to warrant being called "special"? Further, what constitutes an "ordinary" variable? Be forewarned, if you say int is an ordinary variable then I'll respond by saying that both int and pointers are scalar variables that are nearly identical in concept and functionality. ;)

Really the only thing that could be construed as "special" about pointers is support for the indirection operator (this also happens to be the most confusing part of pointers). But that's just different, not special. int supports the multiplication and division operators while pointers do not. Does that make int special? ;D

Basically used to store address of other variable

To be strictly correct you'd say a pointer just stores an address. Or if you want to be especially pedantic, the C standard says that a pointer is an object whose value provides a reference to an entity of the referenced type. Consider this:

char *p = malloc(N);

The only variable involved is the pointer, so how can you say that it points to another variable?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It's _Bool, not _bool. Case matters. ;) But yes, if you use _Bool, 0, and 1, then you don't need to include any headers.

can u plzz give a small program or prototype so i can clearly understand the syntax!

...

This is C (assuming C99 or newer):

#include <stdbool.h>
#include <stdio.h>

int main(void)
{
    _Bool x = 0;
    bool y = false;

    if (x) {
        puts("x is true");
    }
    else {
        puts("x is false");
    }

    if (y) {
        puts("y is true");
    }
    else {
        puts("y is false");
    }

    x = 1;
    y = true;

    if (x) {
        puts("x is true");
    }
    else {
        puts("x is false");
    }

    if (y) {
        puts("y is true");
    }
    else {
        puts("y is false");
    }

    return 0;
}

If <stdbool.h> is included, you can mix and match the defined keywords, such as bool x = 0, or _Bool x = false. The usage in C++ is the same, except _Bool is not an accepted keyword and you don't include any special headers.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

James, did you really mean to say that given the context? If so, then kudos to you sir! :)

The choice of wording was intentional, yes. ;)

However, there is a danger in taking the freedome of speech route that aomething really offensive could either go unnoticed or, much worse, get noticed by others but left undealt with by mods for a period of time

People aren't stupid. It's not difficult to infer from context what the poster actually typed. I'm of the opinion that it isn't the words themselves that are the problem, but the intention with which they are used. Replacing "shit" with "poo" but retaining the offensive context is no less offensive than if you used "shit", for example. This focus on words completely ignores the very real fact that it's the intentionally offensive use of some arbitrary word that constitutes profanity, not necessarily the arbitrary word itself.

That's precisely why I try to avoid calling people names of any kind. If I call someone a poo-poo eater or a short bus window licker, it might encourage a giggle because they're silly, but if I mean it as a serious attack on that person, those names are no better than more ubiquitous or universally recognized profanity.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How difficult will it be for a 41 year old, former CPA but recently graduated Computer Science major, to find a good programming job?

Probably as difficult as it would be for anyone with your level of experience. Age generally isn't that big of a deal in our field, not to mention the myriad age anti-discrimination laws out there that will probably help you out.

Also, I am interested to know the viability of breaking into a gaming programming role?

Heh, good luck. The game programming field is extremely competitive and intense. It would be difficult to get your foot in the door with little to no prior development experience, which seems to be the case in your situation. That doesn't mean you shouldn't try, just don't get your hopes up.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It really would be best to use word granularity rather than character granularity. Collect all of the words in a list and then you can use a simply greedy word wrapping algorithm to display them in a bounded area. For example:

#include <algorithm>
#include <fstream>
#include <iostream>
#include <regex>
#include <string>
#include <utility>
#include <vector>

using namespace std;

namespace {
    const string::size_type line_width = 40;
}

int main()
{
    ifstream in("test.txt");

    if (in) {
        vector<string> words;
        string line;

        // Build the word list
        //
        while (getline(in, line)) {
            auto x = vector<string>(
                sregex_token_iterator(line.begin(), line.end(), regex("\\s+"), -1), 
                sregex_token_iterator());

            x.erase(remove_if(x.begin(), x.end(), [](const string& s) { return s.empty(); }), x.end());

            for (auto& word : x) {
                words.push_back(move(word));
            }
        }

        // Display each wrapped line
        //
        auto remaining = line_width;

        cout << string(line_width, '#') << '\n';

        for (const auto& word : words) {
            auto width = word.size() + 1;
            bool wrap = width > remaining;

            cout << (wrap ? "\n" : "") << word << ' ';
            remaining = (wrap ? line_width : remaining) - width;
        }

        cout << '\n' << string(line_width, '#') << '\n';
    }
}

How you collect the words is up to you and generally straightforward, so I did something concise. The important part is the word wrapping algorithm.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If you're using C99 or later, then the underlying type is called _Bool, and you can include <stdbool.h> for macros that define the more convenient bool along with true and false. Prior to C99, there's technically no boolean type, though the integer types all work well as a facsimile.

In C++ bool, true, and false are all keywords.

In both languages the smallest storage for a boolean is one byte, despite the fact that they can only represent two values: true or false. This is because the smallest addressible unit in C and C++ is a byte, and boolean objects are addressible.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What have you tried?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm afraid that given the apparent attitude of your question I'm forced to say this for your benefit: help yourself first.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I shot from pistols, but never from revolvers.

My condolences. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

On a side note, if you reply to a thread then that ties our hands in terms of deleting it (unless it's supremely offensive or flat out illegal), even if the thread should have been deleted in the first place as a violation of the rules.

If you feel a thread violates our homework rule, consider reporting it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Why?

The long and short of it is that shit, while technically profanity, is rarely used as a malicious attack in the context of our community. Most often it's a descriptive term for actions, objects, or concepts (eg. "That code is shit", "Your idea is shitty", "That's some funny shit"). Sometimes it's an exclamation (eg. "Well, shit!"). The key usage that's rare to the point of not being present would be a pejorative term against another, such as "You're a piece of shit". However, even that smells better than the more ubiquitous "fuck you", which happens to be censored. ;)

Ultimately it's pretty subjective what gets censored. For example, piss was censored for the longest time, and I'd like to think that my whining about it (I like to use "piss off" and "piss poor") was the main catalyst for getting it off the list on both the forum and IRC. ;)

My personal opinion is that nothing should be censored, and abusive profanity should be reported for the moderators to deal with. It's just too much trouble and too difficult to censor words programmatically in a way that makes everyone happy.

~s.o.s~ commented: And I agree with this opinion +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Oh, I see. Actually, I don't remember that particular feature, so I'm not in a position to do more the speculate on how useful it would be. But if it just pops up the favorite forums then I'd say it's not equivalent because I often navigate to forums other than my favorites. Granted that's a moderator pattern rather than something I'd do as a regular member, so my needs are a little biased. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Hmm, I'll give that a shot for a bit and let you know.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I think it should work on all pages. Consistency is important, for one thing. For another, I often move to another forum from within a thread and that currently involves jumping to the top of the page for the dropdowns. So it's also enlightened self interest based on my own usage patterns. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Directly you'd do it like this:

#include <stdio.h>

#define length(a) (sizeof (a) / sizeof *(a))

int main(void)
{
    char Colstr[3][15] = {"Red", "Blue", "Green"};
    char Volstr[7][15] = {"1", "2", "3", "3.5", "4", "4.5", "5"};
    char Sndstr[4][15] = {"lo", "med", "hi", "vhi"};
    int n[3] = {3, 7, 4};
    int i, j;

    char (*a[])[15] = {Colstr, Volstr, Sndstr};

    for (i = 0; i < length(a); i++) {
        for (j = 0; j < n[i]; j++) {
            printf("'%s'\t", a[i][j]);
        }

        putchar('\n');
    }

    return 0;
}

But that's awkward. I'd recommend using a typedef for your string instead:

#include <stdio.h>

#define length(a) (sizeof (a) / sizeof *(a))

typedef char char15[15];

int main(void)
{
    char15 Colstr[3] = {"Red", "Blue", "Green"};
    char15 Volstr[7] = {"1", "2", "3", "3.5", "4", "4.5", "5"};
    char15 Sndstr[4] = {"lo", "med", "hi", "vhi"};
    int n[3] = {3, 7, 4};
    int i, j;

    char15 *a[] = {Colstr, Volstr, Sndstr};

    for (i = 0; i < length(a); i++) {
        for (j = 0; j < n[i]; j++) {
            printf("'%s'\t", a[i][j]);
        }

        putchar('\n');
    }

    return 0;
}

This greatly simplifies the syntax and also more clearly shows your intentions. It's also easier to understand for folks who aren't intimately familiar with the dark corners of C's declaration syntax.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

While you are in the development phase you can specify the connection string but when the application is on the client server you cannot determine the connection string there as you do not know the server name or ip address of the server.

For a desktop application you can put the connection strings in your app.config file. For a web application you can put connection strings in the web.config file. If you don't like the automatic awesomeness of .NET's configuration framework, you can store connection strings in a number of external locations that are retrievable at runtime.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What is your best high school achievement(s)?

I tore down then rebuilt an automatic transmission...and it worked.

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

Right now I am trying to build up and collect all manga books of Hana Kimi.

One of my favorites, and I'm still waiting with baited breath for a decent anime adaptation (the live action was awful). If you like Hana Kimi then you'll also probably like W Juliet, Princess Princess, and Day of Revolution. Sadly, there's not much in the gender bender genre with substance, but there are a few gems. The three I mentioned along with Hana Kimi get top spots on my manga bookcase. ;)

p.s. Be warned that the the last volume of Hana Kimi in English ends in chapter 144 when the series actually ends with an epilogue chapter 145. You'll probably need to read a scanlated version of the last chapter online, but it's a good ending.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I might be wrong, but more female names end in a vowel (not always). Male names sometimes end in a consonant moreso than vowels.

Not to such a statistically significant extent that using it as a heuristic would do more than muddy the waters. You also need to take frequency into account. If a very common male name ends in a vowel, it greatly skews the results: Joe, George, Mike, Luke, Charlie, Danny, Kyle, Dale, Lee, Lawrence, Joshua, Jamie, Dane, Shane, Blake, Leo, Jay...hmm. ;)

Think Alex (male)/Alexandra (female)

Yet Alex is a shortening of both Alexander and Alexandra. Males and females go by Alex, so you're not much better off unless they give you the full name. And it gets worse. Alex can be a full name in and of itself for both genders.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I did Google search on this, but could not find any algorithm/code by which I can do it.

I imagine the best approach would be a lookup from a database of names and gender probability. At its simplest the gender neutral names would be 50% confident and the strongly gendered names 100%. It could be improved by including birth year along with probabilities based on that name's popularity for certain genders in that year. Another approach would be to collect the name and gender of as many people as possible in census collections and base your probability off of the difference between the two counts for a name. So if you have 100,000 Jamie(M) and 76,000 Jamie(F), then the confidence of Jamie being male is about 57%.

Ultimately it's quite difficult, if not impossible, to heuristically guess gender with any confidence based on a name without a great deal of empirical data behind the selection.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The main purpose is to show "test" in output

Presumably the purpose is to show 'this is a "test"' as the output. Unfortunately, the code is wrong even if you exclude the syntax error in your return statement. You must escape double quotes in a string:

printf("this is a %s", "\"test\"");