DavidB 44 Junior Poster

Did you want this action for only one of the forms on the page?
If not, perhaps just have the default setting to be checked or unchecked; then reload the page when you want the checkboxes to return to their default state.

Alternately, you might have to write a custom function that checks or unchecks the particular form you want affected.

DavidB 44 Junior Poster

Have you received an orientation package from the university? That might offer some suggestions as to what kind of technical specs they recommend when purchasing a computer for student use. Myself, I think any computer running Windows is okay (I don’t think you’ll need a dual-boot Linux machine). Programming, AutoCAD, report-writing, spreadsheets, etc. are the main applications you’ll use, so as long as you are on Windows you should be fine.

Unless you want to put together a new computer now for fun, I wouldn’t rush it; wait as long as possible. The longer you wait, the more you’ll get for your money.

A few other factors to consider:

Most stores (Best Buy, Future Shop, etc.) have back-to-school sales in late August and early September. If you wait until then, you should find some really good deals. I happen to like NCIX (ncix.ca). They, too, usually have great deals at the beginning of school term

University bookstores usually have a computer department. They should have several systems configured specifically for the university students. And they usually have huge discounts for their students at this time--another reason to wait until beginning of term.

Your professors might have their own ideas as to what kind of computer to use. You might want to wait until you are actually in school to get a system. That way, you are not buying a computer now, and then learning later that your computer science professor recommends something else. Or perhaps reach out and try to …

DavidB 44 Junior Poster

You mean Visual Studio 11 Beta?

The MSDN site (http://msdn.microsoft.com/en-US/vstudio) mentions some Visual Studio 11 Beta Forums. Here is the direct link:

http://social.msdn.microsoft.com/Forums/en-US/category/vsvnext

Hope this helps.

Ancient Dragon commented: Thanks +14
DavidB 44 Junior Poster

It only lists the files in the present working directory.

help gives a lot of useful information: ls --help

Here are the relevant lines output when I ran this command:

-l                               use a long listing format
-t                               sort by modification time, newest first
-r, --reverse                    reverse order while sorting
DavidB 44 Junior Poster

Thanks for the help everybody.

Uptime is apparently the command I want.

Thanks.

DavidB 44 Junior Poster

I use Firefox 12.0 on a Windows 7 computer. No plug-ins or add-ons.
It does seem to crash once per session, although I had not made the connection to either Javascript or ads. In fact, it just crashed 2 minutes ago, so now I am using IE.

DavidB 44 Junior Poster

Either one of those options could be put in a form.

If a single string only is going to be input, a text box would be the simplest approach.

"g0dzuki99" has suggested one way.

Myself, I usually put everything in a form and name all the variables.
For example, in the HTML form I might put something like the following:

Type of food you like to eat?: <input type = "text" name = "fav_food">

Then in the Javascript routine, which accepts the form (which I have named "dataForm"), assign the input string to the variable, say str1

function getString(dataForm){
. . .

var str1 = dataForm.fav_food.value;

. . .

} // End of function getString

Option 2: A textarea box

In the HTML form put something like the following:

<textarea name="inputData" rows="10" cols="75"></textarea>

Then in the Javascript routine, which accepts the form (which I have named "dataForm"), assign the input string to the variable, say textareaString:

function getString(dataForm){
 . . .

 var dataFormElements = dataForm.elements; // Reference to the form elements array.
 var textareaIndex = 0;  // The form array index for the textarea element--MIGHT NOT BE 0
 var textareaString = "";
  . . .
 textareaString = textareaString + dataFormElements[textareaIndex].value;

 . . .
 } // End of function getString 

Note that ANYTHING might be in a textarea box: text, numbers, multiple strings, etc. However, it gets passed to the function as one big long string.
If you only have a …

DavidB 44 Junior Poster

You seem to be mixing up two different types of input: a textbox and a textarea box. Which one do you want to use?

You could do it both ways. The textbox allows for input of one variable at a time. "g0dzuki99" has suggested one way.

A textarea box could do it too. But it would be a little more complicated. If more than one entry was in the box, the default string would have to be broken up into its individual entries.

DavidB 44 Junior Poster

Hi all.

I am just beginning to play with Linux, so I have some very noob-ish questions.

I am using the Cygwin console on a Windows 7 computer, connecting to a server running a Gentoo kernel. At the moment, I am exploring some of the real basic commands: cp, pwd, ls, mkdir, less, du, etc. So far, so good.

However, I would also like to determine the last time the server was shut down. This task has me puzzled.

The “w” command gives:

12:07:49 up 52 days,  2:32,  1 user,  load average: 0.06, 0.15, 0.17
USER     TTY        LOGIN@   IDLE   JCPU   PCPU WHAT
supportM pts/0     09:47    0.00s  0.44s  0.29s sshd: supportManager_ [priv]

which seems to indicate the last reboot of the Gentoo box was 52 days ago.
'uptime' gives the same.

'ps -fp 1' gives:

UID        PID  PPID  C STIME TTY          TIME       CMD
root         1     0         0  Mar23   ?           00:00:01   init [3]

'who -b' gives the same.

'last reboot' gives

wtmp begins Wed May  9 15:23:19 2012

cat /proc/uptime gives:

4502253.15 4205946.16

On the other hand, if I read /boot/status/boot.log with the 'less' command, it gives:

Fri Jan 7 20:05:22 UTC 2000 - . Reason for previous shutdown/reboot: 10

So far, I have seen three different dates.

Shouldn’t the boot.log file confirm the last reboot as output by 'uptime' (March 26)?

And 'last reboot' gives yet another date (May 9)!?

Am I misinterpreting these values?

Which one is the correct one for the last time …

DavidB 44 Junior Poster

Hello, "jakezcop".

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here.

It is a great place for learning and sharing ideas. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

Could the dimensions of the matrix not be included in the file itself? That is what I usually do. The very first entries of the file are the dimensions of the matrix, say, 8 10
The rest of the file contains the matrix entries themselves.
However you do it, you are going to end up using dynamic arrays to size the arrays during program execution.

DavidB 44 Junior Poster

"nitinmbhanu" has given you some code for a 3x3 matrix--assuming it is correct. However, I don't know if it will do you much good for a matrix of another size.

To set a row or a column of the matrix to a certain value should be easy enough, just use the assignment statement for the appropriate value.

To calculate the performance (time and memory) of the algorithm, is a little more difficult. One way to test the performance is to time program execution.

Have you done software timing yet?

DavidB 44 Junior Poster

One feature I missed with the previous version of Daniweb was the ability to do an Advanced Search. In other forums using vBulletin, I was able to search for posts by, say, username, in a particular forum, in the past month, etc.

The present incarnation of Daniweb doesn't seem to have this capability either.

Are these capabilities going to be available in the near future?

DavidB 44 Junior Poster

Hi, Dani.

May I ask why it is important to you to not show your signature within just some of your posts?

It is not that important.
However, if I am interacting with someone in the same thread for a while, I usually uncheck "show signature" after the first post; I assume the other member has already seen it and doesn't need to see it with every other reply I make in the same thread.

DavidB 44 Junior Poster

I haven't had time to explore thoroughly, but I don't see an option to NOT have my signature included with a post. Even though I have a signature created in my Profile, I previously would uncheck the option to have it displayed with most posts. Now I don't see that option. Or am I overlooking something simple?

DavidB 44 Junior Poster

Hello, "Nimrod7676".

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here.

It is a great place for the sharing of ideas. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

I recently started a new job and have been asked to install and configure an IRC client so that everybody in the department can stay in touch--even when some people are working from home. This is totally new to me. Apparently MSN Messenger is only good for one-to-one communication, but we want to be able to have multiple people stay in touch all at the same time (I wasn't into MSN Messenger anyhow).

In any case, I am looking for suggestions as to what IRC client I should get. Doing a Google search, mIRC seems popular, but it comes with a 30-day trial. My co-workers suggested trying to find an older version of mIRC, that doesn't expire. It is good enough for our simple purposes--just texting each other back and forth. However, I am now wondering if it is worth the trouble--perhaps a completely different software might do the job. Chatzilla comes up in a lot of searches. Is that any good?

Any advice? I use Windows 7 and need just a simple IRC client.

DavidB 44 Junior Poster

. . . Code::Blocks is distributed with a greate compiler. when you download CB get the distribution that contains MinGW compiler.

Not to hijack the thread (though the OP hasn't posted here since 2009), but I am presently looking around for a free C++ IDE/compiler myself. Would you recommend Code::Blocks over Visual C++ 2010 Express, or even something else?

DavidB 44 Junior Poster

I had an old version of Mathcad (version 7) running on an old computer (running Windows 2000). That computer recently died, but I have several .mcd files saved.

I doubt there is an upgrade path for me; my version was too old.
And 95% of the time, I used it to graph data that came from elsewhere, so I don't need a full version of Mathcad. I would just need a simple graphing software.

My question is:
Is there some way to extract the data from those old .mcd files without getting another copy of Mathcad?

(I haven't tried Octave or any of the other free packages, but am wondering if Octave, or others, offers the option to open .mcd files?). I need just the data. The graphs can be re-made easily.

Any suggestions?

DavidB 44 Junior Poster

You are using the exact same form element name for the checkbox and the textboxes:

if (theForm.DigRacing.checked) {
   total += parseFloat(theForm.DigRacing.value);
}
if (theForm.AtariJoystick.checked) {
   total += parseFloat(theForm.AtariJoystick.value);
}
if (theForm.FXLightsaber.checked){
   total += parseFloat(theForm.FXLightsaber.value); 
}

Shouldn't they be different?

What kind of errors are you getting?

DavidB 44 Junior Poster

Hello, Remi.

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

So you are dynamically changing the number of parameters passed to a function?

Hmmnn. . . I have not seen that before. But that doesn't mean it is not possible. (I am not the world's best Javascript programmer.)

Off the top of my head, perhaps you could create a struct with all the parameters added before the function call. Then, in the function, extract the relevant data as required. Since only the address of a struct is passed into a function, its size doesn't have to be defined before program execution.

Or could you pass tree into the function and split it there?

Hopefully, somebody more knowledgeable than I with regards to Javascipt can suggest a more elegant solution.

DavidB 44 Junior Poster

Does your existing code work? What does fn do?

Troy III's method should work.

I usually go with something less fancy (a plain old for-loop):

for (var i = 0; i < l; i++) {
   fn(p[i]);
 }
DavidB 44 Junior Poster

You might also want to check out node.js.

There seems to be a bit of buzz about this too.

DavidB 44 Junior Poster

Newton's Method works exactly the same for an equation with complex coefficients as it does for an equation with only real coefficients. The only difference is the extra bit of algebra involved for manipulating complex numbers.

For example, dividing real numbers is as simple as doing a/b.

However, dividing complex numbers involves a little more:

z1 = x + iy
z2 = u + iv

z1/z2 = (x + iy)/(u + iv)

= {(x + iy)/(u + iv)}*{(u - iv)/(u - iv)}

= {(x + iy)*(u - iv)}/{u^2 + v^2)}

It is a bit more hassle, but doable.

One suggestion I can make:
the starting point of the algorithm MUST BE OFF THE REAL AXIS. If you start the algorithm with an initial guess for the zero of the equation as a real-only number, Newton's Method will never leave the real axis. If the root is complex, it will never be found. So always ensure that your initial guess for a root is complex.

DavidB 44 Junior Poster

To be thorough, you should also test for exceptions--in case memory can not be allocated.

I have posted three versions of a program that dynamically allocates memory for a 2D matrix on my website (see my sig, near the bottom of the page: "Dynamic Arrays in C++").

Maybe these code samples will help you too.

DavidB 44 Junior Poster

Is the error during compilation, or during execution?
What is the error message?

Taking a quick look at the code--and maybe I am mistaken--but the closing brace on line 28 seems to match the opening brace for the for loop on line 24. Or is that for the if statement on line 22?

As a first step, double-check to see all your closing braces are where they should be.

DavidB 44 Junior Poster

Hello, "canniemar".

Welcome to the DaniWeb forums. Good to have you here.

Looking forward to your participation.

DavidB 44 Junior Poster

Hello, Sandrine.

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here.

It is a great place for the sharing of ideas. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

I am doing some pre- Spring Cleaning and want to get out of my home a bunch of old cassettes. They still work, and I bought them properly (since piracy wasn’t as popular several years ago), so I hate to just throw them in the garbage. But I’d like the space on my bookshelf for books instead of cassettes.

However, I don’t know how to get the music off the cassettes and convert it to an MP3 format, so I can get it on to my MP3 player and iPod.

Suggestions?

DavidB 44 Junior Poster

I don’t know about the memory- and time-efficiency aspects, but using const is supposed to be best practice.

I suggest getting in the habit of favouring the compiler instead of the preprocessor, or getting the compiler to do as much of your work as possible.

As has been indicated already:

- if you use a const variable, and then somehow change the value of that variable later in the program, the compiler will complain (in other words, the compiler will catch your mistake and help you out)

- if you use const, and there is a problem with the variable during compilation, the compiler will let you know there is a problem with it by name. On the other hand, if you use a macro, the symbolic name may never be seen by the compiler and entered in the symbol table. If that variable causes an error during compilation, the error message might refer to 1, 2, 3, 4, etc. -- or whatever number is assigned to the symbolic name by the define statement. If you receive a message like “Error with 1”, tracking down that error is a lot harder than an error message like “Error with EnumTypeOne”.

Get the compiler working for you; not against you.

DavidB 44 Junior Poster

I see from your other posts that you know how to use do-loops and for-loops, and how to define and use variables.

So what is the hold-up on this problem?

How far have you got on this program?
Post the code you have so far. It would give us at least a starting point with which to help you.

DavidB 44 Junior Poster

Hello, "christiankrell".

Welcome to the DaniWeb forums.
Maligayang pagdating.

We are glad you joined us.
This is a good group of people, and there is a lot of good information and many knowledgeable members in these forums. I think you'll like it here.

See you around the forums.

DavidB 44 Junior Poster

Hi, everybody.

I am reviewing some old code and two questions came to mind.

1) Is it better to use “\n” or endl?
"\n" seems to be working just fine, but most code samples I see in books nowadays use endl. What is the difference?

2) For multi-line output statements, is it better to avoid repeating the cout part of the statement?

For example, at the beginning of the program, some instructions are output to the user; a sample block follows:

cout << "\nThe first entry of this file must be the degree, N, of the polynomial for\n";
cout << "which the roots are to be calculated.\n";
cout << "Entries for the coefficients of the polynomial should follow, starting with\n";
cout << "the coefficient for the highest power of x and working down to the coefficient\n";

Is it better to write this block as follows (one big long single cout statement)?

cout << "\nThe first entry of this file must be the degree, N, of the polynomial for\n"
        << "which the roots are to be calculated.\n"
        << "Entries for the coefficients of the polynomial should follow, starting with\n"
        << "the coefficient for the highest power of x and working down to the coefficient\n";
DavidB 44 Junior Poster

Hello, Sara.

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here.

It is a great place for the sharing of ideas. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

Hello, Jimakos.

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here.

It is a great place for the sharing of ideas. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

Why not just send an email to the blogger and ask him what he uses on his blog. If you ask politely, most webmasters and bloggers willingly share their information.

While you are waiting for a reply (assuming it comes) browse around the Wordpress site and investigate all their plug-ins and add-ons. Perhaps you will find what you are looking for on your own. You might also want to visit some forums specifically about blogging; they have many resources relevant to blogging.

DavidB 44 Junior Poster

I think articles are better for establishing a person's authority and gaining them quality backlinks.

Writing an article is harder than writing a blog post. It takes more time, it has to be well-written, it has to go through an editor, the benefits do not appear immediately, and results are harder to gauge. But I think it is worthwhile.

Writing a blog post does not have to go through another person (an editor), so that removes one level of quality control. Let's be honest, there are many blogs out there that are terribly written, poor grammar, bad spelling, the writer obviously does not know how to speak English, and his/her ideas are not original anyhow--those blogs are a waste of time. However, traffic from a blog is certainly easier to gauge; you just have to check your analytics software, observe how many visitors you are getting, and feel happy with the traffic. But that doesn't say anything about the quality of a post, the writer's ideas, or writing skill. For feedback like that, you have to go through another person.

DavidB 44 Junior Poster

>>"Actually what I wanted to do is to declare 2 variable bRow1 abd bRow2."

You declared other variables properly (i.e. - i, lastRow, etc.). Why don't you declare bRow1 and bRow2 the same way:

var bRow2, bRow2;

Then, make your assignments.

DavidB 44 Junior Poster

I took a very quick look through your code, so did not make sure all braces matched up.

However, I think one error might be on line 16:

if(wh[j].amt[i]>0 && quantity<=wh[j].amt[i])

The very first time through the loop, j is 0. But you checked wh[0] in the previous test block; it was the very first warehouse you checked. So this test condition fails the first time through the loop.
So the program jumps to the else block:

cout<<"Order Unfilled\n";
quantityamount1[i]=1;
break;

The program outputs "Order Unfilled" and then breaks out of the loop.

I don't think there is a need to use a break here. You want to cycle through the rest of the wh[j] warehouses don't you? So remove the break, and let the for loop continue going through the rest of the warehouses. You only need a break if you find a non-empty warehouse and then want to avoid searching the rest of the warehouses.

It would probably be best if that block was not in the for loop at all, because it only applies after looping through all the warehouses. Maybe you could use a flag variable to keep track if a warehouse is eventually found, or you could use the j variable.

DavidB 44 Junior Poster

Well, there may be other errors in your code, but that line right after your comment, "I am getting error here" doesn't make sense to me.

Are you trying to declare a variable named bRow? But then you don't use it.
And that is not the proper way to define a variable.
And you cannot do an addition operation on the left side of an assignment statement (unless you are trying to access an array element by offset x, but that is still not the way to do it).

Just out of curiuosity, does the very first line in that function work?

var lastRow = oTBL.rows.length - 1;

If so, what value does lastRow have just before the program enters the for loop?

DavidB 44 Junior Poster

Hi, folks.

I recently started posting photos on Flickr and a pretty simple question just came to mind. I didn't see it mentioned in the FAQs, but maybe somebody in these forums is more familiar with the service than I am.

How long do photos remain accessible through my account?

For example, say I upload some photos to my account, share them with my family, and then walk away for a few months. Does Flickr delete them after a month or so?

DavidB 44 Junior Poster

Hello, John.

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here.

It is a great place for the sharing of ideas. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

What does your code do now?

Does it compile? Are any errors created when you run the program?

I have posted three small sample programs off the following page:

Dynamic Arrays in C++ - Some Basic Examples

They use dynamic arrays and take in numbers of type double.

Hope this helps.

DavidB 44 Junior Poster

Hello, Michael.

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here.

It is a great place for the sharing of ideas. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

That forum list linked to by "cwarn23" is pretty big.
I haven't heard of most of them.

I have probably only come across five of them in my web travels: vBulletin, Invision, phpBB, Simple Machines, and Yet Another Forum.

phpBB is popular because it is free and it is actually pretty good.

vBulletin and Invision are probably the biggest and best commercial products.
Personally, I think vBulletin is the best. It seems to offer the best spam control, user management features, and most features--period.
In fact, I think Daniweb uses vBulletin.

Just take a look at YOUR favorite forums and figure out what forum software they use. That should give you a good idea what each software product offers and which ones are the most popular.

DavidB 44 Junior Poster

Hello, Lucas.

Welcome to the DaniWeb forums. We are glad you joined us.

These forums are an excellent resource: lots of good information and many knowledgeable members here.

It is a great place for the sharing of ideas. I am sure you will learn a lot here.

See you around the forums.

DavidB 44 Junior Poster

You could just pass it by name.

Say you want to change the second entry of arrA (remember that array indexing begins at 0).

In the main program, just feed arrA into the sub-routine "display":

display(arrA);
   
   document.writeln(arrA[1]);

Remember that arrays are considered a reference type, not a primitive type, so they are passed by reference into sub-routines. In other words, the changed arrA array will be returned to the main program after it has been passed into "display". If you intend to use original values of arrA later in the program, you should copy those values first.

DavidB 44 Junior Poster

Hmmnn...

I thought I was pretty good at math, but I don't understand this question.
It almost looks more like a mathematics question than a computer science question.

Just out of curiousity: what are you studying? And what level are you?

DavidB 44 Junior Poster

I agree too.
Answer 4 is the best.

This product cannot be calculated.

Matrix A is 3 x 2 and Matrix B is 3 x 1.
To be able to form the product AB, the number of columns of A has to be the same as the number of rows of B.