Salem 5,265 Posting Sage

> You know you are a geek when ....
You post "You know you are a geek when ...." threads :)
And also reply to "You know you are a geek when ...." threads ;)

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

For a C++ program, there is precious little C++ in the code at all.

Apart from a few reference parameters (some for no good reason I can see), and the for loop declarations, this could so easily pass for being a C program.

If you want it to be more like C++, then do these things:
1. Replace all printf with cout
2. Replace all char arrays with std::string; for one thing, it reduces strAddChar() to one line of code.
3. Replace all other arrays with std::vector

Somewhere in the code there should be at least one 'class' with suitable member variables and methods.

But then again, you've had only 30 hours, so perhaps making classes is beyond you.

If you've been taught all these things (OK, assuming a level of competence in the teacher here, but what the heck, it might be true), then your tutor is going to be expecting to see some real C++.

So you took someone else's old C and made it make a couple of noises - whoop-ee-doo.

Actually, I don't really care, since we still can't tell what it is you're ACTUALLY capable of doing yourself.

What is for sure is that no one here is interested in helping some wannabe get a grade they don't deserve, which might lead them to getting a job which they are incapable of doing. Unlike student homework, the answers to job assignments CANNOT be found …

Salem 5,265 Posting Sage

Typical - first post is "Hey, I'm a programmer who needs a bit of help".

When they get "found out" for posting someone else's work, it's out with all the sob stories of "I didn't want to do this course; the teacher is an idiot; I really need to pass this course; my dog ate my mouse;" and so on.

Yours is somehow no different.

But since you understand "80 to 90%" of it, how about you begin by explaining that much of it, so we only have to do 10% of the work rather than 100% of the work.

Salem 5,265 Posting Sage

Why would someone want explanation for code they've written?

But then again, why bother pretending you can program when you can lift code off the net?
http://cboard.cprogramming.com/cplusplus-programming/132084-cplusplus-snake.html

It's mostly the same code, with a few additions and renames, and some comments in your native language.

jens123 commented: dont want to help, just offend +0
Salem 5,265 Posting Sage

Bible threads are just as long and pointless as the so-called book itself.

Face it, all it has ever done is given the terminally lazy an opportunity to stand up and say "YOU SUCK, GIVE ME MONEY TO REPENT". The "Prophet for profit" business has been going a long time. Why work your fingers to the bone all week, when you can just spout off some "fire and brimstone" crap for a couple of hours a week, and get lots of tax-free money.

Go around pretty much any town and village in Europe, and the oldest stone building will be a church (or monument to folly). A lot will date back to when the average peon could barely scrape together enough timber and mud to build a 1-room shack. How much money and time was sucked out of the community to build something so utterly useless.

Faith, in it's most extreme manifestations, is indistinguishable from mental illness.

If you manage to get to your teens without being exposed to it, chances are you are immune to it. It only takes hold when it is indoctrinated into you by your parents from a very early age. This I regard as being child abuse of the highest order. You don't need magic invisible space pixies to teach children right from wrong.

In the meantime, enjoy your weiners

Salem 5,265 Posting Sage

I'd hate to watch anything greater than O(nlogn) though.

Salem 5,265 Posting Sage

Facebook IS the scam.

http://www.mattmckeon.com/facebook-privacy/
Click through the years, see how the blue "privacy" (joke) spreads with the passing of years. Between their screw-ups, and your ignorance, you may as well just jump in a tar pit, run through a quilt factory and have a big "kick my ass" sign tattooed on your arse. You deserve to be ridiculed and kicked at every opportunity.

The rest is just decoration for the cake.

jwenting commented: well said +0
Salem 5,265 Posting Sage

since my last post

At least it's stopped flashing, but it's still too large where it doesn't matter, and too small and faint where it does.

What hasn't changed is the #1 spot at the top of the reputation ranks.
A whole year without posting, and AD/Narue still couldn't catch up. Gotta admire the volume though AD, well done. Shame it goes under appreciated.
Geez, there's time for the world to end (again) before that changes.

Ohh, activity points - something else to measure quantity as opposed to quality. Figures, most of the top of that list just spam away in posting games. Seriously, saying "me too" 100 times a day is not that impressive.
Do the drive-by spammers hit the top spot on the daily list?

I wonder if anything has been done on the code tags front, or is reporting endless posts for code violations something to look forward to. I suppose we shall see, otherwise this could be a real short trip.

Ezzaral commented: Welcome back +0
vegaseat commented: you are the best then +0
Portgas D. Ace commented: Perhaps grow a pair. +0
debasisdas commented: happy to see you back. +0
kvprajapati commented: Welcome back! :) +0
Ancient Dragon commented: Glad you are back :) +0
jonsca commented: WB +0
~s.o.s~ commented: A bit late to the party, but welcome back. :-) +0
Salem 5,265 Posting Sage

I'm with jephthah - I'm outa here!

The site is an unreadable mess - it's a student summer assignment gone horribly wrong.

The only thing which should actually matter (the stuff people actually contribute) is relegated to the bottom of the pile.

But you all know all this already, so I'll just ...

jephthah commented: i dont know what i regret more: seeing you leave, or having lost my credibility by coming back. :( i'm really torn, because i hate all of the changes to this site. it's gruesome. +0
Nick Evan commented: I'd hate to see you leave, but the choice is yours +0
Salem 5,265 Posting Sage

http://www.daniweb.com/forums/announcement9-2.html

Not that it will do much good, but
http://www.catb.org/~esr/faqs/smart-questions.html

Homework builds on previous homework. If you've been getting by by getting others to do all your assignments, then you well and truly deserve to fail.

Otherwise, go over your previous assignments (like putting anything at all on screen). It is not "all new", so read carefully for bits you've done before.

Then post some kind of effort.

Salem 5,265 Posting Sage

Most people RTFM and post an attempt.

http://www.catb.org/~esr/faqs/smart-questions.html

vbx_wx commented: If you leave a retart reply and then a retard reputation comment, than good look to you, you need al the sucking bla bla what you said +0
Salem 5,265 Posting Sage

> What type of developer creates audio plugins for digital audio workstations like pro tools and cubase
Those that need to.
Those that can.

http://www.catb.org/~esr/faqs/smart-questions.html

Salem 5,265 Posting Sage

For an easy intro, try http://www.arduino.cc/

For hardcore programming down on the "bare metal", http://www.avrfreaks.net/

All I can suggest is you read around and follow some links to board manufacturer sites to see what meets your needs. There are a lot of variations to choose from.

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

Re: the above 5 tards

About Maashleni
Location
Islamabad, Pakistan

About maggiemartine
Location
Islamabad, Pakistan

About Rogerbunny
Location
Islamabad, Pakistan

About BrytonTaylor
Location
Islamabad, Pakistan

About Victorlewer
Location
Islamabad, Pakistan

Salem 5,265 Posting Sage

1.) Describe your current job / job title.
Santa Claus

2.) What do you like most about your job?
Sleigh rides by moonlight

3.) What do you dislike most about your job?
Getting stuck in chimneys

4.) Overall, do you enjoy your job?
Awesome

5.) What kind of education do you have? From what university?
A BA in BS

6.) Any tips for people looking to enter your profession?
Eat a lot and grow facial hair.

7.) (If you don't mind sharing) How much do you make per year?
Nothing - it all goes on elves and reindeer food.

Salem 5,265 Posting Sage

1.) Describe your current job / job title.
Webmaster

2.) What do you like most about your job?
clicks = money baby!

3.) What do you dislike most about your job?
Spammers

4.) Overall, do you enjoy your job?
Awesome

5.) What kind of education do you have? From what university?
A BA in BS

6.) Any tips for people looking to enter your profession?
Regular exercise for your mouse clicking finger

7.) (If you don't mind sharing) How much do you make per year?
$0 per year - then wooohooo at IPO

Salem 5,265 Posting Sage

1.) Describe your current job / job title.
Movie producer.

2.) What do you like most about your job?
Taking tired old 70's and 80's flicks and slapping some CGI on them and making an absolute mint from it.

3.) What do you dislike most about your job?
Groupies old enough to remember the films from the first time around.

4.) Overall, do you enjoy your job?
Awesome

5.) What kind of education do you have? From what university?
A BA in BS

6.) Any tips for people looking to enter your profession?
A camera and a loud voice.

7.) (If you don't mind sharing) How much do you make per year?
Pay is crap, but merchandising is fantastic.

jephthah commented: LOL, you must've just seen "Clash of the Titans" +0
Salem 5,265 Posting Sage

1.) Describe your current job / job title.
Prime minister of GB - unless those other muppets get their act together.
Dunno then, ask my mate Tone for lecture gigs.

2.) What do you like most about your job?
Spending lots and lots and lots of other peoples money.

3.) What do you dislike most about your job?
Voters

4.) Overall, do you enjoy your job?
Awesome

5.) What kind of education do you have? From what university?
A BA in BS

6.) Any tips for people looking to enter your profession?
Keep talking until people stop listening.
Then start shouting.

7.) (If you don't mind sharing) How much do you make per year?
Salary is crap, but the expenses and benefits are top-notch.

Salem 5,265 Posting Sage

1.) Describe your current job / job title.
Hedge fund manager

2.) What do you like most about your job?
The moolah, and lots of sheep to fleece.

3.) What do you dislike most about your job?
Gold-digging wimmin tryin ta get ma wedge...

4.) Overall, do you enjoy your job?
Awesome

5.) What kind of education do you have? From what university?
A BA in BS

6.) Any tips for people looking to enter your profession?
Stay out of my pond, there's only so much room for the ones here. Any more would just dilute the benefits for the rest.

7.) (If you don't mind sharing) How much do you make per year?
I paid more in tax in one year than you're likely to earn in a lifetime.
And that's even with the creative accounting

> Thank you a bunch for your time!
That would normally be $50,000

Salem 5,265 Posting Sage

You buy space and time from a hosting provider.

There's plenty of ads for them over here
http://www.daniweb.com/forums/forum154.html

A shell account might be more appropriate
http://clusty.com/search?query=shell+accounts&sourceid=Mozilla-search

Salem 5,265 Posting Sage

Right...
Because both use exec() badly to call "ls" and various mentions of "capturing the output for later use"

No similarity at all.

But since you're spamming the board with duplicate questions, AND ignoring attempts to engage you in discussion about alternatives - good luck with that.

Salem 5,265 Posting Sage

http://lxr.linux.no/+trees
Make sure you have a comfy chair and a lot of coffee on hand - you'll be a while :)

JasonHippy commented: Nice, not seen that site before...bookmarked! +3
Salem 5,265 Posting Sage

When you do this

if [ $DIFF -gt 30 ]
                then
                        COLOR="red"

Add this line

if [ $DIFF -gt 30 ]
                then
                        COLOR="red"
                        needToSendEmail=1

Test that flag when you're about to send email.

Salem 5,265 Posting Sage

I'm guessing that since the page says "usually", then the answer to "always" is going to be no.

It's a good idea to join the actual discussion group which discusses OpenCV every day, rather than pick a random forum based solely on some web search stats.
http://tech.groups.yahoo.com/group/OpenCV/

Salem 5,265 Posting Sage

A simple RTFM would have answered your questions (all of them)
http://msdn.microsoft.com/en-us/library/dd162938%28VS.85%29.aspx

Salem 5,265 Posting Sage

Reposting your demands doesn't count as extra effort.
http://www.daniweb.com/forums/thread282291.html

Can you
- read a number from a memory location
- read a series of numbers from consecutive locations (aka, an array)
- compare a number with another number.

There must be some fraction of the problem you're actually capable of doing - so do it.

Salem 5,265 Posting Sage

http://www.daniweb.com/forums/thread282297.html
Starts the same question rather than continuing the same discussion on the previous thread.
I lost interest.

Salem 5,265 Posting Sage

Found on several pages after a brief search...
"The most common "C" error code is "0xC000013A: The application terminated as a result of a CTRL+C"

> cin >> junk;
Your "junk" is an int, which means you have to enter something like "0\n" to succeed.
Just pressing return endlessly won't get you past it.
Use say cin.get(); if you just want to wait for a character.

Salem 5,265 Posting Sage

I see no reason to believe that copy/pasting an answer from one of the many web pages to here would be any better than you going and reading them yourself.

Go and read some of them, then come back with something like
"On the foo page (insert link), it says bar but I don't get why bar is important".

Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

I wonder if you anticipated this kind of response?
http://clusty.com/search?query=virtual+function&sourceid=Mozilla-search

Salem 5,265 Posting Sage

> please answer me the following questions.
What is your name?
What is your quest?
What is the airspeed of an unladen swallow?

Salem 5,265 Posting Sage

*shrug*
Yet another "please help me with..." not so cunningly disguised as a "please do this for me..." post.

Where's your EFFORT?

Salem 5,265 Posting Sage

Is this some "fresh out of college, lowest rung of the ladder, lot's of training required type of position"?
If it is, then enthusiasm and a little research might get you in.

If it's a more senior role, and they're expecting you to be useful from day 1, then you're gonna come unstuck.

> hopefully someone can shed some light on this vague scenario for a test to get an interview for a company
And then what?

Your ideal scenario seems to be that if you can give a smart answer provided by someone else, you'll get the job.

This may well be true, but then what?

"We'd liked your answer so much, we'd like you to implement it".
What's your next move?

Running back to the forum asking for help to keep a job you're not qualified for, which you got on the basis of false pretences (knowing something you didn't).

Here's how it works - you post what you think the answers should be, then we might provide some critique on your analysis and perhaps ask some more questions to help you think your way through the problem.

The problems presented in job interviews are pale shadows of the problems the companies deal with on a daily basis. So unless you can pretty much 'ace the test' on your own (today), you're going to be hopelessly equipped to deal with what comes afterwards.

Salem 5,265 Posting Sage

Obvious!?
There's a dog gnawing your leg off, and all you can think is "where's the itch?".

Yes it's obvious - especially since I've already told you what the answer is.

Regard this as your own personal "D'oh!!!" moment when you figure it out.
Some things just have to be experienced rather than explained, and this is one of them :icon_twisted:

Salem 5,265 Posting Sage

> double array [2][10];
You read 20 later on
for (j=0;j <20 ; j++)

Also, limit your initial loop to how many rows in your array. while (i < 2 && fgets(line, sizeof line, file) != NULL) {

Salem 5,265 Posting Sage

And what pray tell gave you the impression they're using windows?

Salem 5,265 Posting Sage

http://msdn.microsoft.com/en-us/library/dd144871%28VS.85%29.aspx

hWnd [in]

A handle to the window whose DC is to be retrieved. If this value is NULL, GetDC retrieves the DC for the entire screen.

Salem 5,265 Posting Sage

> if ( fgets(line, sizeof line, file) == NULL )
line is a pointer, so sizeof is going to give you 4 (the size of the pointer), not 80 (the amount of memory it points at)

> line+=read;
Make a copy of the pointer before you start modifying it.

> sscanf(line, "%lf,",&array[j],&read );
Try "%lf,%n" as the format, to update read with the number of characters processed.

> so instead of '2' it should predicet number of lines !
You can't predict the number of lines.
Normally, I do

char buff[BUFSIZ];
while ( fgets( buff, BUFSIZ, fp ) != NULL ) {
  // stuff
}

then allocate what I need as the true extent of the file becomes apparent.

Salem 5,265 Posting Sage

*shrug*

#include <stdio.h>
int main ( ) {
    int mat[3][3] = {
        { 1, 2, 3, },
        { 4, 5, 6, },
        { 7, 8, 9, },
    };
    int i, r, c;
    for ( i = 0 ; i < 9 ; i++ ) {
        if ( (i+1) % 2 == 1 ) {
            r = i / 3;
            c = i % 3;
            printf( "%d ", mat[r][c] );
        }
    }
    printf("\n");

    for ( i = 0 ; i < 9 ; i += 2 ) {
        r = i / 3;
        c = i % 3;
        printf( "%d ", mat[r][c] );
    }
    printf("\n");

    for ( r = 0 ; r < 3 ; r++ ) {
        for ( c = 0 ; c < 3 ; c++ ) {
            if ( mat[r][c] % 2 == 1 ) {
                printf( "%d ", mat[r][c] );
            }
        }
    }
    printf("\n");
    return 0;
}

$ gcc -std=c99 foo.c
$ ./a.out 
1 3 5 7 9 
1 3 5 7 9 
1 3 5 7 9
Salem 5,265 Posting Sage

> I have a client on a big-endian machine and a server on a little-endian machine.
And that's the least of your worries.

struct myPacket {
	int a; // 1
	// 2
	double b; // 3
	double c;
	int d;
	char e[80];
};

1. As well as endian-ess, how big are integers on both machines?
The standard only states minimum sizes for types.
Saying "short int" or "long int" is an improvement, since most machines which are network capable and have implemented htons() and these are generally understood to be 16 and 32 bits respectively.

2. Padding and alignment.
The compiler is free to insert padding anywhere in a struct (except before the first element) to enable efficient access to the struct members. For example, if your source machine needs a double to be on an 8-byte boundary, then you might have
- 4 byte integer
- 4 byte hole
- 8 byte double
- 8 byte double
- 4 byte integer
- 80 characters.

Your destination machine might not care about alignment of doubles (or 4 is good enough) and have
- 4 byte integer
- 8 byte double
- 8 byte double
- 4 byte integer
- 80 characters.

Copying one structure over the other results in garbage.


3. Representation of floats.
The really horrible news is there are a plethora

Salem 5,265 Posting Sage

opendir() / readdir() / closedir() would seem to be a lot simpler, if all you're after is a list of names.

Salem 5,265 Posting Sage

> #include<malloc.h> /* You need this if on UNIX or LINUX */
This is all wrong.
malloc is prototyped in stdlib.h

> p = (char *)malloc(sizeof(words));
You don't need to cast malloc in C programs.

Have you tried it without the cast? Did you get any error messages?

These perhaps?
"implicit conversion of int to char*" -> you didn't include stdlib.h
"conversion of void* to char*" -> you're using a C++ compiler to compile C code.

> 4. sizeof() ; function says it all . It means size of the "data" in this case "words".
sizeof is an operator, not a function.
Passing an array to a function yields a pointer to the first element of that array.

The parentheses are optional when applying sizeof to a variable.
p = malloc(sizeof words );

Other issues:
- you didn't check malloc for success
- you didn't describe free(), the essential complement to using malloc.

Salem 5,265 Posting Sage

So what is your question?

Because it looks like a zero-effort homework dump from here
http://www.daniweb.com/forums/announcement125-2.html

Salem 5,265 Posting Sage

C'mon - it tells you the line, how many identifiers are on that line?

Do a search for each one of them, and figure out which isn't present.

Hint: identifiers are case sensitive.

kvprajapati commented: Sharp! +9
Salem 5,265 Posting Sage

Eclipse doesn't make sound - it's an editor wrapped around a compiler.

What matters is what your OS is, what API's you have access to and the kind of programs you're creating.

Eclipse runs on many platforms, and can generate project types for many different programs.

So explaining say "sound for a Linux console" wouldn't make a damn bit of use to you if you're interested in "windows GUI programs".

Salem 5,265 Posting Sage

But all your odd values are not on odd rows/columns are they.

Count from 1 to 9, then work out a row/col from that value (this is a hint).

Salem 5,265 Posting Sage
char buff[] = "My dog ate my homework";
char *p = buff;
int n;
while ( sscanf( p, "%s%n", word, &n ) == 1 ) {
  p += n;  // advance through the buffer
}

> PS: Does anyone know why firefox is showing "behavior" as a wrong spelling while I am typing here in this text area?
You install the dictionary for your flavour of English.
So things like colour are spelled correctly ;)

tux4life commented: Then my science project ate my dog :P +8
kvprajapati commented: I've added [code]s after five days (below). Bad colour scheme. +9