Salem 5,265 Posting Sage

> what you consider is the best tool for a developer to achieve more and best payed works?
None of them.

a) the going rate for a particular skill depends on geography (where are you?)
b) it depends on the economic cycle.
c) it depends on whether it's been made obsolete by something newer and better.

One minute you're flying high and the next, your skills in codegrubber 4 aren't worth spit.

Picking what is hot now is WAY WAY too late.
a) there's already plenty of people with plenty of experience.
b) by the time you get to their level, the party will be over.

Salem 5,265 Posting Sage

> if (s == 'a'||'A'||'e'||'E'||'i'||'I'||'o'||'O'||'u'||'U')
I explained why this was wrong in your previous thread :@
http://www.daniweb.com/forums/thread262721.html

Salem 5,265 Posting Sage

> Need immediate responses plz with references
Sure, anything else you would like?

This perhaps ?


Governments spend millions trying to answer that question, and generally end up making a pig's ear out of it.

Did you expect you could just roll into a forum and get an answer just like that?

This answer fits into the "fast / cheap / good - pick two" framework.
You chose "fast and cheap".

jonsca commented: Plzz, plzz sir is this like artificial passenger?? (er, well it looks like it's a bit different) :D +2
Salem 5,265 Posting Sage

LOL@Dave :)

http://cboard.cprogramming.com/c-programming/124248-variable-dynamic-paths-c.html
Now go there and recommend a Daniweb FAQ for completeness :D

Dave Sinkula commented: D'oh! +13
Salem 5,265 Posting Sage

> What's the simplest way to write a Prime Factorization program in C++?
The simplest (for you) is to post your homework on a forum.
Which you've just done, so congratulations!

Now the bad news:
This is our standard reply -> http://www.daniweb.com/forums/announcement8-2.html

Salem 5,265 Posting Sage
Majestics commented: Idiot, don't you see that search bar is open for all and i can see utorrent in them directly , all i need a experience programmer help for a good start not little snort like you. Go to hell. +0
kvprajapati commented: Necessary steps! +7
masijade commented: Sorry about the name-calling. ;-) +9
Salem 5,265 Posting Sage

> Mr. Walt there are 24 different errors how would you like me to list them.
http://cboard.cprogramming.com/c-programming/88495-development-process.html
Start small and compile(*) often.

Whilst you're learning, you have to accept that most of the time the compiler will just spit your latest effort out.

It works like this:
= If you add only 5 lines and get a new error message, you've got a nicely contained problem you can probably figure out.
= Write hundreds of lines, you WILL get errors by the page and you're reaching for the forum post button.

If you don't understand a single error message, that's fine. We can help you understand.

But this isn't a dumping ground for a "code fix it service". We might humour you on the first post, but it's not a strategy that will work long term.

(*) this also extends to testing.
Crafting a masterpiece over several days only to find out that it crashes at the first function. As you finish a small useful bit, test it.

Salem 5,265 Posting Sage

Get visual studio express -> http://www.microsoft.com/express/Downloads/

and leave the stone tools to the archaeologists.

jonsca commented: But I want a 1939 air conditioning system in my brand new 2010 car. That's what I was taught to use. +2
Salem 5,265 Posting Sage

> I still need the function to figure out the length of the array.
Pass the length as another parameter.

Or, consider the alternatives that std::vector offers.

The sizeof thing you posted only works when the actual array definition is in scope. As soon as you call a function, you're just left with a pointer.

Salem 5,265 Posting Sage

What's the difference?

void foo ( ) {
  int a; // uninitialised :(
}

vs.

void foo ( ) {
  int a = 0; // initialised :)
}

> warning C4700: uninitialized local variable 'third' used
So initialise them then!

Salem 5,265 Posting Sage

Personally, I regard SE as being a superset skill of programming.

Programming in it's narrow sense is just turning detailed design into code.

SE in it's broadest sense covers the whole software development life cycle.

But, you will be able to find:
- SE courses which are little more than tarted up programming courses.
- Programming courses that aim to teach you something about SE as well.

> And , i heard that India is the top country in programming , is that true ?
Well it isn't true for all those schools that still use fossil Turbo C as the "reference" implementation for C.

But "top" implies a sort, which implies a relative test of some kind.
I bet India is top, if you go by numerical number of programmers.

jonsca commented: Way to work in the Turbo C +2
Salem 5,265 Posting Sage

> I am trying to convert this C code to C++.
So rewrite it then.

What you have at the moment is C/C++ road-kill.

If you really want to make a good C++ program out of this, then you would be using std::string in place of all those char arrays, and std::iostream for all the file I/O.

Salem 5,265 Posting Sage

> But can you please give me any other idea which is more involved and a bit high in degree of difficulty?
And thus the Goldilocks problem is revealed, and why it is futile to ever attempt getting involved in "plz suggest a project" threads.

Any answer we come up with is either:
- too easy (30%)
- too hard (60%)
- just right (10%)
It's already a crap shoot with losing odds.

But that's not the end of it. No sirreee, not by a long shot.
Having failed miserably at thinking of a topic, they're going to be just as clueless on the implementation side as well.

Natural next questions being:
- can you explain it in more detail
- can you help me do it
- can you ....
IOW, nothing but an open ended time sink

@adcodingmaster
To even come close to answering this kind of question with any degree of accuracy, you would need to post details of the courses you have taken, the grades you got and your general level of interest in each subject.
Picking a decent project based on your first post would be an extraordinary feat of extrapolation

Salem 5,265 Posting Sage

http://support.microsoft.com/kb/282793
Found by an astonishingly simple google search....

Salem 5,265 Posting Sage

First, you need a better approach to indentation.

/* File: account.c
*     * Date: February 2, 2010 */

/* This program calculates the accumulated value of a given initial investment and annual interest, given the options of either annual, monthly, or daily
* compounding */

#include <stdio.h>

/* Function declaration */
float calc_acc_amt(int x, float acc_amount, float annual_interest, int y);

main()
{
    /* Variable declarations */
    float initial;              /* Input initial value of investment */
    float interest;             /* Input annual interest */
    float input;                /* User input of initial value and annual interest */
    int type;                   /* Input type of compounding */
    int start = 1;              /* Used for start of loop in function */
    float acc_amt;              /* Accumulated amount of investment invoked by function */
    float monthly_interest;     /* Modified interest due to chosen input of monthly compounding */
    float daily_interest;       /* Modified interest due to chosen input of daily compounding */
    int length;                 /* Length of compounding */

    /* Program intro */
    printf
        ("This program will calculate the accumulated value of your investment at an annual, monthly, or daily compounding\n");

    /* Obtain input from user */
    printf("Please enter the following data, seperated by spaces.\n");
    printf("Initial value, annual interest: ");
    input = scanf("%f %f", &initial, &interest);

    printf("Type of compounding: (1) annually, (2) monthly, (3) daily: ");
    input = scanf("%d", &type);

    printf("Length of compounding: ");
    scanf("%d", &length);

    while (input != EOF) {      /* Initialize loop */
        if (type = 1) {         /* Invoke function */
            acc_amt = calc_acc_amt(start, initial, interest, …
Salem 5,265 Posting Sage

> so basically "screen.h" would contain all the different codes that I need?
No, screen.h is the INTERFACE.

Just like stdio.h is an INTERFACE to the standard C library. What you see (from an application point of view) remains the same. Every compiler has a different implementation of LibC, but that detail is hidden from you.

Salem 5,265 Posting Sage

A better question is what of any use are you going to learn from this teacher stuck in the stone age?

You already seem to know more than they do.

All those ifdef's are messy!!!

// screen.h
void ColorPrint (const int ColTxtnum,const char *text);

// screen_borland.c
#include <conio.h>
#include "screen.h"
void ColorPrint (const int ColTxtnum,const char *text) {
}


// screen_win.c
#include <windows.h>
#include "screen.h"
void ColorPrint (const int ColTxtnum,const char *text) {
}

// main.c
#include <stdio.h>
#include "screen.h"

int main ( ) {
  ColorPrint(RED_COL,"hello world");
  return 0;
}

All the configuration happens in the project.
Both projects are essentially identical, except for the appropriate choice of screen_borland.c or screen_win.c

And if you wanted to add screen_linux.c in future, you can see how easy that could be :)

And not a single #if anywhere in the portable code - woo hoo!

Dave Sinkula commented: Big picture stuff --more attention than I gave this. +13
Salem 5,265 Posting Sage

My guess is your #define WHITE
has a ; in it.

Nick Evan commented: Almost as if you use a crystal ball :) +12
Salem 5,265 Posting Sage

Or, since you appear to be using C++, use std::getline and std::string instead of those messy C-style char arrays.

Salem 5,265 Posting Sage

Well it would display a UNICODE string, were a UNICODE string actually passed as a parameter.

> (LPCTSTR)"Test1"
Would be stored in memory as 54 65 73 74 31 00
Now whilst 0x6554 is in the UNICODE space, it isn't going to be anything resembling Latin text.

Now saying L"Test1" would result in 54 00 65 00 73 00 74 00 31 00 00 00
These too are valid UNICODE characters, but 0x0054 is going to display a 'T' for you.

Better still (which seems to have been lost altogether by the OP) would be to say _TEXT("Test1") Then no matter how much you mess with the "turn it on or turn it off options" in the compiler, it will do "the right thing".

Further, if the OP has any ambitions of a career, then knowing about UNICODE is pretty much a given (well knowing more than how to turn it off at any rate).

pspwxp fan commented: thnx :) +2
Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

> MessageBox(NULL, (LPCTSTR)"Test1", (LPCTSTR)"Test1", MB_OK);
Indiscriminate casting to get the compiler to STFU is a common problem.

Just because you muffled the compiler doesn't make your code good.

Take out the casts, then pay really close attention to the error messages.
http://msdn.microsoft.com/en-us/library/c426s321%28VS.71%29.aspx

Salem 5,265 Posting Sage

> It is true that I have finished my C++ course two years ago.
And it looks like you forgot everything since.

> gets(s1);
This is just AWFUL

> sprintf(s2,"START %s",s1);
So what happened to using std::string (since this is C++ - right?)

> const char* prgm=s2;
And this does what exactly, that system(s2) can't?

Not to mention, it's only 5 lines long and already the lack of indentation is making it look messy.

Q8iEnG commented: Thank you man. +2
Salem 5,265 Posting Sage

You mean there's a brain somewhere?
http://www.daniweb.com/forums/thread259990.html
http://www.daniweb.com/forums/thread259551.html

So have you figured anything out in the past week?

As far as I can tell (which is already perhaps more than you can tell), this field is pretty much at the cutting edge.

Either big businesses are interested, in which case NDA's abound, and the only way you get to know is by being employed to work on that project, or hand over $$$ and sign legal papers.

Or university research departments, who when they do publish will do so in specialist publications.

In short, you're NOT going to get a handy 1-page synopsis or a few lines of code giving you "the answer".

Salem 5,265 Posting Sage

Are these libraries built for dev-c++ (or MinGW).

You can't take take libraries originally aimed at say Visual Studio and use them "as is" with your compiler.
Options
- there is a library conversion tool somewhere to alter the format of libraries
- ask whoever gave you the libraries to sent MinGW/Dev-C++ compatible ones
- get the axutil source code and build the libraries yourself.


Can you post the complete compile and link log as well.

Salem 5,265 Posting Sage

Well why aren't YOU looking around the VLC website, the VLC code base and the VLC forums, instead of trying to get us to do your reading for you.

We could spend hours or days trying to figure out what you want, only for you to dismiss it in a few lines with "nope, try again".

Salem 5,265 Posting Sage

http://www.opengroup.org/onlinepubs/009695399/functions/fdopen.html
Use this to associate a file descriptor with a stream.

Salem 5,265 Posting Sage

Did you tell the linker
- where to find the axutil library
- to actually use the axutil library.

The #include in your source code just tells the compiler that something exists (like say cout). But you also need a library for the actual implementation, and that's where the linker comes in.

Standard things like the library containing cout are automatically linked for you, so you don't tend to notice what is going on.

Salem 5,265 Posting Sage

We need you to read this:
http://www.daniweb.com/forums/announcement14-2.html

That means actually read it, don't simulate reading it.

jonsca commented: Priceless +2
Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

> Why is this?
Pure dumb luck on your part.

Your compiler just happened to make B[0] follow A[2], but there is no reason why it should have done.

Salem 5,265 Posting Sage

> Did you start by searching?
Of course not, they started by cross-posting

Salem 5,265 Posting Sage

math.h trig functions work on radians, not degrees.

90' = PI/2 radians.

Salem 5,265 Posting Sage

> std::cout<<"Connection successful!\n\n";
> printf(">>Client: %s\n",text);
First you decide whether you're a C programmer or a C++ programmer.

> memset( buf, 0, sizeof(buf) );
> puts (buf);
Huh?

> recv(kSock, buf, sizeof(buf), 0);
> printf("<<Server: %s\n",buf);
Many things wrong here
1. recv() returns a result, which you're ignoring.
2. recv() does NOT automatically append a \0 to make buf a proper string.
3. There isn't space in the buffer to append a \0 either.

n = recv(kSock, buf, sizeof(buf)-1, 0); 
    if ( n > 0 ) {
        buf[n] = '\0';  // make it printable
        printf("<<Server: %s\n",buf);
    } else {
        // do other things with n == 0 and n < 0
    }

4. recv() does not guarantee to receive the whole message in one call (neither does send for that matter).
The server might send "HELLO WORLD" in a single send() call, but you might only get as far as "HELLO WO". You would need to call recv() again to get "RLD".

Both send() and recv() need to pay close attention to the return results, and if necessary be called again to ensure all the data is transferred.

iamthwee commented: please have my babies? +11
Salem 5,265 Posting Sage

> i am a Management Information System student in my last year
And what have you been doing all this time?

Surely you knew this was coming right from the start of year 1.
Did nothing along the way inspire you to think "I could do a project on that"?

> can suggest me an idea that i can implement plz.
Why?

It's just the start of a string of further failure points on your part.

Fail: we suggest a project, and you're back here again a few days later asking how implement it (or worse, actually DO it for you).

Fail: you're in a job interview shortly after graduating, and the interviewer asks you "what in particular inspired you to choose this project?". The answer "Some dude on a web site..." isn't good. Some bullshit lie would be worse.

Fail: your manager at work asks you to come up with new project ideas that can be marketed. Are you going to post another "help deciding a work project" post?

This is it!
Here you make a choice about your future career.
Try really hard and think of a project ON YOUR OWN and you go one way (up).
Sit on your ass and wait for others to tell you what to do and you go another way.
Choose now.

kvprajapati commented: The best advice I ever heard. +7
Salem 5,265 Posting Sage

It seems to me your compiler writing friend is a writer of broken compilers. Please tell us the names of some of the products they have worked on, so we can avoid them in future.

Negation is well defined, so applying it twice isn't going to make it suddenly undefined.

If a compiler generates anything other that 0 or 1 from !!x, then it's broken.

Salem 5,265 Posting Sage

p_bIsolated != 0 would seem to be a lot less obscure, whilst meaning about the same thing to the compiler.

Salem 5,265 Posting Sage

> //Is this correct if I want to copy the 100 values in myspace to array?
Had you tried it, you would have gotten a compilation error.

The answer to the other question is yes.

> *(pmyspace+i);
You can even write pmyspace[i];

Salem 5,265 Posting Sage

> Basicly this source code is for making application that will crash the application that Im using atm.
And this is where you lost all credibility, and any chance of getting any help on this forum.

We're simply not interested in helping people like you, who download someone else's malware crap, and attempt to get it working for themselves.

Salem 5,265 Posting Sage

> in a single loop without any conditional statement.
But a loop without any conditional statement either runs zero times, or forever.

Anyway, here's one answer - have fun explaining it ;)
Or learn something, by trying to unravel it :)

#include <stdio.h>
int main ( ) {
  int num = 5;
  int i = 1, j = 1;
  while ( i > 0 ) {
    putchar(i|(0x60>>(i/i)));
    i+=i/i-((i<<(i/i))/i)*(j++-num>=0);
  }
  return 0;
}

I know I did, obfuscating it :twisted:

Salem 5,265 Posting Sage

grep by itself just matches strings. It doesn't care what comes before or after.

Try something like df -g | egrep '/oracle/BP1/sapdata1$' That is, the line ends with sapdata1, not just contains sapdata1 (like sapdata10 contains sapdata1)

Salem 5,265 Posting Sage

You need to post an actual example code which crashes.

Deleting a bunch of stuff, then saying "something like this code crashes" isn't good enough. You've almost certainly deleted the true cause of the problem and just posted where you think the symptom is.

Dave Sinkula commented: This is all too common these days and posts like yours here need wider distribution. +13
Salem 5,265 Posting Sage

+18?

You're not even close!
http://www.tomshardware.com/reviews/5-ghz-project,731.html

However, one core stuck at a specific temperature doesn't look good.
Can you see it doing things in task manager -> performance (select 1 graph per CPU)?

Salem 5,265 Posting Sage

I spent as much time thinking about my first answer, as you obviously spent thinking about your first question - in other words, a few seconds at best.

Your effort (asking a decent question, and showing some background in trying to solve it yourself) is rewarded by a reasonable amount of attention on our part. If it looks like you just typed the first thing that came into your head, then don't expect hours of research and detailed posts from us. Most of us have got far better things to do than be your personal search engine interface.

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

verruckt24 commented: Agreed +2
Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

What is a search engine?

verruckt24 commented: I like that +2
Salem 5,265 Posting Sage
Salem 5,265 Posting Sage

> I am interviewing for a company tomorrow
Actually, you can just read all the messages on this forum, and see how you manage at solving the various questions asked here.

But keep the answers to yourself, ESPECIALLY where the original poster has made NO effort.

kvprajapati commented: Good suggestion. +7
Salem 5,265 Posting Sage

> uint32_t fatsz = htffs.fatsz;
Well that's the whole POINT of handles, and that is to be opaque for external users.

It's basically the same as the 'this' pointer if you had a C++ class. It's just a magic token you pass to each "member" function of the public interface so it can distinguish between various instances.

It is no more wise to try and smash your way through an anonymous struct to get at the data behind it, than it is to smash your way through a class to rummage around with the private variables.

nkinar commented: Thank you for pointing this out! +0
Salem 5,265 Posting Sage

> So I thought if I can handle it directly, then I can tune it more easily
Do you imagine that the compiler writers' made this hopelessly inefficient just to annoy you?

Have you finished the program - no? then optimisation is a waste of your time.
Do you have real-world data / use cases - no? then optimisation is a waste of your time.

If you have both of those, have you compiled the code with profiling enabled? Again, if the answer is no, you're wasting your time.

Guessing where the performance problems are is a crap-shoot (and most of the time, people miss by a country mile).

Profile data, with real-world examples on a complete program is what it takes to figure out where the performance problems REALLY are.
That means you don't waste time optimising things which are nowhere near the critical path.

It also means (and this is very important), that you have a known working program to benchmark against (both in terms of features and performance). If your latest hack breaks the program (or makes it worse), you still have a known good example to work with.

Random optimisation hacks before you're done have a nasty habit of introducing hidden bugs which are really hard to figure out (mostly just before the product is due to ship).