jwenting 1,905 duckman Team Colleague

you wait 3 seconds total for 10 threads then you have a completely different effect from when you wait 3 seconds for each thread.
Remember that those threads will NOT all execute at the same time so if you wait the proper time for one thread you will AT MOST have one thread completed during that time.

That is, unless you are running on a multi-CPU machine with enough CPUs to run each thread in its own and have a JVM that will actually do that.

Start places a thread in runnable mode, it does NOT actually cause the thread to run.
It just tells the JVM that "yes, this thread is now ready to run, please see that it gets some CPU time when it pleases you".
The JVM will then at some point in the future schedule that thread for execution. Depending on JVM implementation and the actual code of your program and the OS you're running on this may happen immediately, only after there are no other threads, or at some point in between.

jwenting 1,905 duckman Team Colleague

have you ever taken any course in highschool mathematics (most of the stuff you're asking is primary school math even)?

If not start there. If yes practice what they taught you.

If you can't see the code in your head, do the calculations on paper and determine an algorithm from that.

Someone writing the code for you (and most of these are one or two lines so giving you any code without writing it all becomes rather difficult) won't help you at all in the end as you learn exactly nothing at all.

jwenting 1,905 duckman Team Colleague

If you don't know what debugging is you should look up about that first and start to practice it...

jwenting 1,905 duckman Team Colleague

int main() {} should work fine.
void main() {} should also be accepted even though it's not good practice.

Your initial code is either posted incomplete or is way wrong.

jwenting 1,905 duckman Team Colleague

The idea of those problems is that you solve them yourself so you'll learn something in the process, it's not that you get others to solve them for you so you can show your teacher you've done your homework.

jwenting 1,905 duckman Team Colleague

so what have you actually done to read the data?
You've declared the file, but that doesn't read the data...

Show some initiative first, try it yourself.

jwenting 1,905 duckman Team Colleague

you can in your javascript (which is triggered on onclick in your case) do a submit of the form by simply calling the submit() function on the form.

jwenting 1,905 duckman Team Colleague

it could be argued that the original intent of BASIC was to have a language that could more or less work on pseudocode.

As to conditional and assignment operators, it's all what you're used to.
I've been using C and Java for so long I find myself using == outside sourcecode to indicate comparison as well.

jwenting 1,905 duckman Team Colleague
jwenting 1,905 duckman Team Colleague

A piece of JavaScript on one of our pages gives an access denied error.
In itself nothing strange, it's a reasonably well defined error after all :)

What is strange is that the error ONLY happens on that page (despite identical calls to the JavaScript function appearing on several other pages) and that the error ONLY appears if the page is loaded in a fresh browser instance. If I reload the page before executing the script (which is triggered in the onblur event of a formfield) the error does not appear and the script is executed successfully.

The function of this script is to download some data from the application server and pipe that data into an HTML element (in this case a td, in other pages it may be a div).

Can anyone shed some light as to where to look for the cause of this?

Here's the relevant JavaScript and HTML (fragments of course):

var myFrames = new Array();
function frameObj(index) {
    this.busy = true;
    this.index = index;
    obj = document.createElement("iframe");
    obj.style.height = "0px";
    obj.style.width = "0px";
    this.frame = document.body.appendChild(obj);
    if (this.frame.contentWindow)
	this.frameDoc = obj.contentWindow.document;
    else if (this.frame.contentDocument)
	this.frameDoc = obj.contentDocument;
    else
	this.frameDoc = null;
}
function findFrame() {
    for (i = 0; i < myFrames.length; i++) {
	if (!myFrames[i].busy) {
	    myFrames[i].busy = true;
	    break;
	}
    }
    if (i >= myFrames.length)
	myFrames[i] = new frameObj(i);
    return myFrames[i];
}
function getHTML2(oElement, form, data) {
	dataElement = oElement;
    if (!(frame = findFrame()))
	return;
    if …
jwenting 1,905 duckman Team Colleague

don't start a new thread when dealing with your old problem...

http://www.daniweb.com/techtalkforums/thread13701.html

and use code tags and hopefully indentation to make your code somewhat readable.
Have you tested what the value of your "enter_operator" actually is after the input?
Should it even go into one of your if-statements?

jwenting 1,905 duckman Team Colleague

Do you have Google desktop installed?
That will eat up harddisk space rapidly as it caches everything it recognises even somewhat (effectively doubling your storage requirements).

jwenting 1,905 duckman Team Colleague

If that's the extend of your C++ knowledge I wonder how you've come so far in your course to get an assigment like the one you posted.

Or have you been chased away from another site for once too often asking people to do your homework for you?

Every programming course I've ever taken had one or more books as required (or sometimes strongly suggested but take that as required) reading.
I suggest you read your courseware as it should help you along no small bit.

Then break up your assignment into discrete parts and solve each of those.
Then glue the pieces together.

jwenting 1,905 duckman Team Colleague

If the main thread has to wait 3 seconds on each thread it starts it will wait 30 seconds, period.
Remember it's not guaranteed that any of those other threads will run...

It might be better to have a thread set some flag to indicate it's completed and have the main thread poll those flags in a loop (with a sleep of say 0.1 second in each iteration) to determine whether all child threads are done.

jwenting 1,905 duckman Team Colleague

so you've already described the system.
Now "all" you need to do is turn that into code.

If you have problems with specific areas of that post what you have and maybe someone can help you overcome those problems but please don't think we're going to write your entire program for you.

jwenting 1,905 duckman Team Colleague

You know what a factorial is I hope?
Then you know you need multiplication to calculate it.

The simplest program would use a for loop, something like

long fact = 1;
// request is the number of which the factorial is requested
for (int i=1; i<=request; fact *= i++);

I'm not sure why you'd want to use overloaded operators, I guess you have to make a class Factorial.
If that's so the operator seems simple, with a body like "return f*i;" where f is a class member and i the parameter to the operator.

jwenting 1,905 duckman Team Colleague

We've been through this before.
1) look at the answers you got elsewhere
2) crossposting and repeat posting the same question is not appreciated.
3) we're not here to do your homework for you. If you have specific questions about specific parts of your assignment we may be able to help with specific answers to help you along in your work though.

4) I've reported this post as others have reported your previous crossposting as well.

jwenting 1,905 duckman Team Colleague

DirectX is what's used in most Windows games nowadays, though OpenGL is also an option.

If I were you I'd spend a lot of time learning C++ properly before dabbling in DX coding as DX is a mess (I know, I've looked into it).
It's a mix of C++ and C using a lot of COM components with the typical weird Microsoft naming conventions.

jwenting 1,905 duckman Team Colleague

Are you talking the runtime or the SDK, and what OS are you working on (there are different requirements for either)?

I've installed both without problems on Windows 2000, except for the SDK installer crashing once (it worked fine after I started it again).

jwenting 1,905 duckman Team Colleague

You need FTP server software. There's several of them available, check Tucows for example.
Yes, there's some risk involved. If you're not careful people will start to use your harddisk to store illegal content (child porn, pirated software, etc. etc.) that they don't want on their own machines.
So you'd better be careful about how you set permissions on your server.

Your ISP may also not allow you to host an ftp server (or any server) on your connection, in which case doing what you want can get your account suspended.

As to how to get the laptop seen outside the LAN, that's a question of DNS record propagation which I'm not familiar with (not being a network admin). Not even sure you can do that yourself without the help of your ISP.

jwenting 1,905 duckman Team Colleague

one letter variables can be helpful, for example as loop iterators where they really have no meaning except as a simple counter and have a very limited lifespan (when you use for (int i=0;i<10;i++) everyone knows what i does, when you declare int i asa a global and first use it 100 lines later it get hard to read).

jwenting 1,905 duckman Team Colleague

if you have 3 threads, you can have #1 join on #2 and #2 join on #3. #1 now won't complete until #2 completes but that one won't complete until #3 completes so #1 won't complete until #3 completes.

Like I said it's risky because you could join #3 on #1 and everything would wait forever.

jwenting 1,905 duckman Team Colleague

Games aren't written in VBScript. Most of them these days are writting in C++ with a scattering of other languages taking the scraps (Delphi, Java, being the largest of those).

Of the C++ compilers used VC++ has by far the largest market share.

VBScript may be used by some game designers as an internal scripting language for some things but it won't be the core of the game (at most something like scripting the behaviour of NPCs and for that Python is probably more common).

jwenting 1,905 duckman Team Colleague

Variable names make a difference in how easy your program is to maintain and how many bugs you'll introduce writing it.
They'll also affect the way your colleagues will treat you, whether you'll get a pizza or a one way trip out the 3rd floor window during the next crunch session :eek:

They won't matter a thing after the compiler is through with it.

jwenting 1,905 duckman Team Colleague

Most tutorials on multithreading in Java use this scenario (or a similar one) as an example.

jwenting 1,905 duckman Team Colleague

This book will suck ur brain out.

Only if it wasn't properly attached to the common sense.

jwenting 1,905 duckman Team Colleague

yes, visual studio is all the languages packaged together with some extras.

might be because it's a beta. I use Visual Studio .NET 2002 here and it's pretty fast apart from sometimes taking a while to load a project (which I suspect is my virusscanner holding things up rather than VS itself).

jwenting 1,905 duckman Team Colleague

You probably made a typo somewhere in the return type of a function.
If you define 2 functions of the same name (overloaded functions) in the same namespace (or class) they are required to have different argument lists else the compiler and runtime don't know which function to call.

jwenting 1,905 duckman Team Colleague

Visual Studio includes not only VC++ but also C#, J# and Visual BASIC.
VBScript is included in MS Office, maybe in Visual Studio as well (it's pretty generic in MS products as a macro language).

Depending on the version of VS you purchase it may also include things like Interdev, Visual Source Safe, MSSQL Server (development license) and other tools.

Check out http://msdn.microsoft.com/vstudio/ for details.

There IS a difference between the C++ compilers in the standard and Pro (included with VS) products. The compiler in VC++ Standard is not an optimising compiler meaning that optimisation options aren't available.
This is no problem for learning and small applications (unless performance critical) but for larger and performance critical applications you will want the optimising compiler from the full VS at least for your final (deployment) build.

jwenting 1,905 duckman Team Colleague

Now in the us, they are implanting tiny chips in peoples hands that they use to buy and sell! :eek:

They're doing that in Europe too now. Problem is there's no single system so if you frequent several places that do this you end up with quite a few implanted chips.
Luckily it's just a few widely spaced bars and discos experimenting with it at the moment, but I think it won't be long before supermarket chains catch on and start using it for their customer incentive programs.

It's already been proposed the government start chipping all people to make them easier to identify if they're murdered or die in an accident without ID on them.
After all it works for dogs (it's now mandatory for dogs here or soon will be...).
That's of course a chilling thought, especially given the idea that these be made highpower RFID chips which can be tracked over long distances. Using those the police would just need to drive through an area and they can detect who is where and in which building. Big Brother coming to life in the name of victim identification...

jwenting 1,905 duckman Team Colleague

Sounds yummy! Say, what type of sauces would you recommend with that?

Sauce? Sauce is advanced cooking, not introductory stuff :mrgreen:

I must admit I've not done much real cooking lately. Living alone and getting home quite late from work most days doesn't invite cooking, so I just slap some stuff in the frying pan or in the oven and hope most days :rolleyes:

But most days I do manage to avoid the microwave...

jwenting 1,905 duckman Team Colleague

I've no experience with Java2D but I know something of JPEG :)

JPEG uses lossy compression which can lead to poor results if you get the image compressed too much.
Try finding a command to set the compression ratio and select the lowest compression (largest file) it supports. That should improve image quality.

If it doesn't, try to save to another file format and check if that does look good. If it does your encoder class may have a problem.

jwenting 1,905 duckman Team Colleague

Have you looked at the API docs for List and Map?
You can do what you did in 1 line of code (or 2 if you write it out in a rather verbose syntax which teachers might want).

jwenting 1,905 duckman Team Colleague

Step 1: what do you have?
Step 2: what do you want to have?
Step 3: how do you get from the data in step 1 to the data in step 2?

It's really really simple, you have a set of data and want to transform that into another set containing the same data.

Look at the API docs of Map. You'll find a method there that helps you a lot.
That's all I'll tell you, because it's all the help one can give you without writing the actual code which I'm definitely not going to do.

jwenting 1,905 duckman Team Colleague

something like

public class MyHomeWork
{
  public static void main(String[] args)
  {
    System.out.println("Someone else did my homework for me, I'm a lazy no-good idiot!");
  } 
}

???

Because that's what I'd send people who ask me to do their homework for them (maybe scrambled so it's not so blatantly obvious what it does)...

The only way you're ever going to lear to program is by doing it yourself. If you have a bad teacher that should be an incentive to do more yourself to learn anyway, not an incentive to become as bad at the subject matter as you claim your teacher to be by being a lazy idiot who lets others do his homework for him.

Anyone who helps people like you does a disservice to the entire community of software developers worldwide by lowering the quality of those in the industry and therefore the value placed on our work by those willing to pay for that work.

jwenting 1,905 duckman Team Colleague

To add: you can get information on just about any fileformat you want at http://www.wotsit.org
Sometimes complete C or other code is included.

jwenting 1,905 duckman Team Colleague

According to her profile she's a gal. Either that or the photo shows someone else :)

jwenting 1,905 duckman Team Colleague

Do you have the bible?
The C++ Programming Language 3rd edition (Stroustrup)? That's pretty much required fodder for everyone who's into C++.
I don't know any of the books you mention, but the titles sound like fun :)

I've ordered "C ++ for Game Programmers" last week which should arrive in a few days, got good reviews at gamedev.net. Some reviewers on Amazon complained there's not enough DX and graphics specific code in there but IMO that's a good thing as there's tons of books about that. Instead it focusses on things like performance and other generic stuff with applications in (among other things) games.

If you want a good intro on 3D mathematics on a 2D screen I can recommend "Flights of Fantasy" by Christopher Lampton. It's certainly been out of print for over a decade though, it still deals with DOS and 640x480x256 resolution but the explanations of the math involved are good. ISBN 1878739182 Waite Group, 1993. Maybe a second-hand bookstore or library clearout sale can turn it up.
I've also learned quite a bit from another oldie, a book on writing graphics drivers for DOS in Assembly and C (and in fact I've once written a partial functionality driver for Turbo Pascal, sadly never completed as the project was cancelled)...

For the rest I'm afraid most of my recent (say last 5 years) library has been Java books as that's what I mainly use professionally.

jwenting 1,905 duckman Team Colleague

paste your code inside code tags instead of attaching the sourcefiles. M
Makes it a lot easier for everyone to see what you're talking about.

And posting your assignment verbatim doesn't help either (but at least you're honest stating it's a school assignment ;)).

Now for a bit of help to get you started.
I've yesterday for fun and training (I've been more or less out of C++ for years, starting to get pretty rusty) created a class that does addition and subtraction of complex numbers.
The rest you can easily think up to do yourself, they work similarly.

I'll not post the full implementation (which is pretty trivial) nor the test application (which is even more trivial), but the headerfile giving all function prototypes.
That should give you enough hints to get started implementing the system yourself.

#include <iostream>

using namespace std;

class complexNumber
{
private:
	float real; // real part
	float imag; // imaginary part

public:
	complexNumber();
	complexNumber(float rPart, float iPart);
	~complexNumber(); // for form's sake, not really needed

	complexNumber operator+(const complexNumber& c); // addition, so you can call 'c = a + b' where a,b, and c are complexNum objects
	complexNumber operator-(const complexNumber& c); // same for subtraction
	friend ostream& operator<<(ostream& s,  const complexNumber& c); // so you can do for example 'cout << a' where a is a complexNumber object
};

you can of course include far more functionality than this, but this should be a good start.

jwenting 1,905 duckman Team Colleague

And of course the cost of electricity, the computer(s) you host on (and money set aside to replace/repair them), backup tapes/CDs/DVDs, etc. etc.

jwenting 1,905 duckman Team Colleague

Go to the nearest bookstore selling computer books. If they're halfway decent they'll have a shelf of books related to C including tutorials.
Also pick up a copy of the standard work "the C programming language" by Kernighan and Richie

jwenting 1,905 duckman Team Colleague

For a corporate website intend on bringing customers to the company I'd say any 3rd party advertising should be avoided like the plague.

If the site doesn't bring income to the company, maybe it should not exist. It's that simple.

I understand that income can be hard to gauge if the site doesn't sell anything directly, but it is there.
Think of increased numbers of people contacting the company for information, and as a result (if the site portrays the company and its product/service correctly) increased sales.
The businessplan for the site should contain predictions of this extra income (and they'd better be realistic) as well as predictions of the cost of building and later running and maintaining the site.

Many hosting solutions are nowadays rather cheap, especially if you don't require dynamic content and online payment processing.
50MB (or even more) can be had for $10 or so a month, a drop in the ocean compared to the cost of the people needed to build and maintain the site let alone the entire operating cost of the company.

If the manager doesn't want to pay that small amount, I wonder whether he will be willing to pay for the people (that means you!) who are going to create and maintain the site.
Compare the cost:
hosting: $150 a year
domain name registration: $75 for 2 years (maybe less now)
webmaster/coder: $50 per hour minimum for any decently proficient …

jwenting 1,905 duckman Team Colleague

you were lucky.
Happens here sometimes that the power fails in a store and almost invariably they'll be unable to accept even cash.
The cash registers use electricity, so do the barcode scanners.
And since the cashiers are all highschool dropouts who can't even add up and in many stores the items aren't priced anymore so without the barcode scanner (and/or the database server of product codes) they can't know the price they can't help you...

But then we don't get earthquakes and less brownouts than SoCal so maybe we're just less prepared for emergencies ;)

jwenting 1,905 duckman Team Colleague

As Dani notices the revenue from each individual ad has plumetted in recent years. This is a global phenomenon that all sites have to deal with.
Many ads that used to bring 10 cents per view now bring only 0.1 cent per clickthrough or worse 1 cent or less per successful transaction resulting from a clickthrough.

As the rate of views to clickthroughs is something like a thousand to one at best and the rate of transactions to clickthroughs is several hundred to one at best you can calculate for yourself what this does to ad revenue.

As to paying for sites. I currently have paid subscriptions to 2 sites, each costing me about $50 a year. In addition I do volunteer work for several more (effectively paying with time I spend to help them so they don't have to hire someone).

There's some more sites I would donate to if only they had a payment mechanism that doesn't rely on PayPal or IMOs.

jwenting 1,905 duckman Team Colleague

There's little that can not be done in Java, mainly things very close to the hardware (and with the right hardware you can do even those).

jwenting 1,905 duckman Team Colleague

Now that is strange, we're being teached this way of programming and you say that it's the old way, can you explain this a bit more

It's been that way since the introduction of C in the 1970s and only (relatively) recently been replaced (2000 or so) by the new system as default.
Many books still use the old system only, as do older compilers.
And newer compilers still accept the old way as an alternative to remain compatible with old code. Many teachers just haven't caught on yet (if they even know, many teachers create their course at some point and never bother to keep it (and their own knowledge) up to date after that.

So, if I understand correctly, it's better to start writing main with 'int main()' can you explain why because I'm not asking a return from main

Because the language standard asks for it would be a good enough reason. It's not strictly required I think (the compiler won't complain after all) but it's good practice.
Every program needs to have a return code, with 0 meaning (on most operating systems) there was no error.

Well, we we're told to use ASCII, so I'll have to do it with ASCII, I understand that in certain circumstances it is better to use another way. But for this program, do you think it is good enough

Always code for the future. In real projects you'd be told to code for ASCII and …

jwenting 1,905 duckman Team Colleague

If the code contains as many spelling errors as your username I'm not surprised.

jwenting 1,905 duckman Team Colleague

Can you try to have non-animated banners only?
More than a bit distracting (which is the purpose of the animation I know, to the annoyance of the reader ;) ...).

And yes, the banner placement is fine. Far better than some sites I (used to) frequent where there's banners galore down all sides of the page as well as spread all over the text.

jwenting 1,905 duckman Team Colleague

it is indeed sad, and even sadder if you become aware that today we couldn't repeat the journey to the moon NASA completed in the 1960s.
The technology was lost (deliberately for a large part, all the drawings and tools were ordered destroyed for some reason), we couldn't today build another Apollo capsule and Saturn V rocket if we wanted to.
And of course with the current state of NASA even if enough money could be gotten together they'd never get the program off the ground (much like the Soviets failed for political reasons even though having the technology in the 1960s).

jwenting 1,905 duckman Team Colleague

Kaspersky is an excellent product. I switched to it (corporate license, sometimes it pays to work for a reseller ;)) when my license for Panda expired and their support department were completely deaf to support requests getting my account reactivated (after paying of course, they still didn't respond...).

Use it in conjunction with ZoneAlarm (beware of ZA5 though, it blocks some things it shouldn't even when you specifically tell it not to, I stick with ZA4.5 for now).

Ditching IE isn't necessary at all unless you want to be politically correct and show how much you hate Microsoft.
If you turn off automatic execution of ActiveX you're safe (and don't just click OK to everything that wants to run of course).
1) don't visit warez sites, they're hothouses for all kinds of nastiness (plus using warez hurts the software development community badly as well as being illegal...)
2) don't install anything you don't know in advance what it will do
3) don't open email attachments you didn't expect you'd get (even from people you know!)
4) ditch those p2p programs, run legal software and play legal music and movies
5) be careful visiting porn sites :mrgreen:

dlh6213 commented: Great advice! -- dlh +1