1,177 Posted Topics

Member Avatar for daviddoria

I have recently taken over as a volunteer webmaster for this website: [url]http://www.ewh.ieee.org/r1/schenectady/newsletter.html[/url] Under the "Schenectady Section News" heading, you can see that there are a bunch of simple pages that all look the same. The current process to add a new one is to copy and paste an old …

Member Avatar for daviddoria
0
120
Member Avatar for daviddoria

I put a simple script: [code] <? php print "Hello world"; ?> [/code] here: [url]http://ewh.ieee.org/r1/schenectady/HelloWorld.php[/url] When I go to the page, I don't see "Hello world" displayed. Does that mean PHP is not enabled on the server? Thanks, David

Member Avatar for daviddoria
0
267
Member Avatar for yoyo59

This is a pretty standard "first assignment". Please show us that you have tried. You won't get any help until you post some code and show us where you are stuck. David

Member Avatar for WaltP
0
109
Member Avatar for jae5086

Here are some observations 1) You should definitely use an std::vector<double> instead of a fixed length array. There is no reason to arbitrarily restrict the user to 75 inputs. If you don't change this, you should certainly check if the counter goes above 75 and throw an error if it …

Member Avatar for jae5086
0
98
Member Avatar for amishosh

That is definitely the best way, I agree! You can go to github.com, gitorious.org or [url]http://code.google.com/[/url] and search for projects (they are just like sourceforge). I'm sure people would be happy to have some help. Good luck, David

Member Avatar for daviddoria
0
105
Member Avatar for Krysis
Member Avatar for CrazyDieter

You had me pretty confused on this one. It seems like qApp is a macro or something (reserved word). I changed it to: [code] QApplication a(argc, argv); return a.exec(); [/code] and then it worked fine. David

Member Avatar for gerard4143
0
173
Member Avatar for CPT

Here is the fix for your error - you have to dereference the value: [code] if(*(CGraf::matr_adi[C[p],i])==1) [/code] But yikes, you really really really should consider using more descriptive variable names, and COMMENT COMMENT COMMENT! There is some personal preference involved, but here is what I would change: matr_adi -> AdjacencyMatrix …

Member Avatar for Tellalca
0
133
Member Avatar for terabyte

Definitely no need to wait. 0x will just make some things easier for you, but probably not until you've got at least a couple of years of experience with the "old" c++. Definitely continue with your book for the concepts, but there are some good examples of how to do …

Member Avatar for Bench
0
147
Member Avatar for fannunziata1

Please start a new thread when you have a new question. What you have done here (posting a new question at the bottom of an existing thread) is called "thread hijacking" and is very frowned upon :(

Member Avatar for TrustyTony
0
157
Member Avatar for parth27987

What is the error? What is the expected output? What is the current output?

Member Avatar for parth27987
0
211
Member Avatar for qvyhnl
Member Avatar for chiwawa10
0
220
Member Avatar for cmb2thim

I'm assuming this is for a course (if it is not, use a library (VNL, Eigen, etc)). It if is, I'd imagine you need a Matrix class and overload the * operator for it. Internally you could store an array[9] or an array[3][3].

Member Avatar for daviddoria
0
61
Member Avatar for Nathaniel10

I have no idea what is going on there, but if it is in an infinite loop then flag is never getting set to 1. I STRONGLY suggest breaking a lot of this code out into functions. I.e. [code] void GenerateRandomNumbers(int rands[][]) { rands[i][0] = 600.0 * rand()/RAND_MAX; // for …

Member Avatar for Nathaniel10
0
164
Member Avatar for Jake1905

I would do two things to start debugging. First, get rid of the user input and hardcode some values. Once it works with the hardcoded values, you can put the user input back in. Second, write out the steps of the algorithm for the same values you have hard coded. …

Member Avatar for ixmike88
0
101
Member Avatar for jvibez

Look up "iostream", "cin", "conditionals" ("if"), and "mod" ("%"). David

Member Avatar for daviddoria
0
49
Member Avatar for mogaka

You could use Qt. It is nice and also cross platform :) Here are some examples: [url]http://programmingexamples.net/index.php?title=Qt[/url]

Member Avatar for daviddoria
0
222
Member Avatar for tKc

Here is an example of the nested vectors that Nick Evan mentioned: [url]http://programmingexamples.net/index.php?title=CPP/2DVector[/url] Also, what is going on here? [code] array[n][n]>>board[i][j]; [/code]

Member Avatar for daviddoria
0
170
Member Avatar for iarkey

You may want to ask on the OpenSSL mailing list: [url]http://www.openssl.org/support/community.html[/url]

Member Avatar for daviddoria
0
92
Member Avatar for enkidu75

I think "code snippets" are intended to be "here is my working code, I thought it may help others". In your case, with a question, you should just make a normal "thread".

Member Avatar for StuXYZ
0
170
Member Avatar for brandonrunyon

The templated sum() function tries to add a to b. Your + overload adds a.time to b.time. It should work if you call: [code] int total = sum<int> (hw.time, hw2.time); [/code] David

Member Avatar for brandonrunyon
0
268
Member Avatar for lochnessmonster

If it is a complicated structure, there is probably not a better way than to require the user to use multiple of your classes (the classes inside (composing) the big class). Sounds fine to me.

Member Avatar for mike_2000_17
0
192
Member Avatar for jmcorpse

I strongly suggest you add many comments to your code. At the very least, there should be one or two sentences at beginning of every function telling the reader what the function is supposed to do. You can also give us a sense of what the entire program is supposed …

Member Avatar for daviddoria
0
99
Member Avatar for ade161

Your choice of those two functions seems fine, you just have to implement them! Here is a good place to start: [url]http://programmingexamples.net/index.php?title=CPP[/url] Particularly: [url]http://programmingexamples.net/index.php?title=CPP/IO/FileInput[/url] and [url]http://programmingexamples.net/index.php?title=CPP/IO/ReadingLines[/url] . Also, please use code tags when posting code. David

Member Avatar for daviddoria
-1
156
Member Avatar for georgy9002

Sure, just keep the files on the usb drive! VC won't care whether they are on the C drive or some other (F, perhaps) drive.

Member Avatar for daviddoria
0
68
Member Avatar for smoothe19

Yikes that is a lot of code. Can you try to simplify it down to < 40 lines or so? Also can you explain exactly what is wrong? Is it crashing? Is it giving an incorrect result? Dave

Member Avatar for akgh2010
0
180
Member Avatar for Sohelp

I believe the idea of inline functions is that it will make small functions run faster. It seems like an "old school" concept - can someone testify that it still makes a significant difference on modern compilers? Maybe provide a short example program and some timings? This seems like a …

Member Avatar for Sohelp
0
250
Member Avatar for daviddoria

When trying to pass a template parameter to another template, I am getting an 'invalid template parameter' error. I even tried to force it with 'typename' with no success. Can anyone see what's wrong with this? [code] #include <itkImage.h> #include <itkImageFileWriter.h> #include <itkRescaleIntensityImageFilter.h> template <class T> void WriteImage(typename T::Pointer image, …

Member Avatar for Fbody
0
4K
Member Avatar for Leppie

It seems like you are explaining two things. The first is that the program opens, reads a file, updates the file, then closes. The second is that you are doing this read/write in a while loop? fstream is definitely the way to go for the file IO. Then you should …

Member Avatar for Fbody
0
211
Member Avatar for dorien

Search sounds like a good way to go. I don't know what you mean by it uses "an array to search", but this shouldn't use any extra memory, it looks you just specify a range of indices which is your search patter, and a range of indices in which to …

Member Avatar for dorien
0
2K
Member Avatar for cortez716

1) First, you should include cstdlib: [code] #include <cstdlib> [/code] Not doing so causes compiler errors on many systems. 2) Another, more serious error is: [code] cout<< count << " is located at col " << countNum(ar,10,col)<<" row " <<countNum(ar,10,row)<<endl; [/code] 'col' and 'row' are not defined! You need to …

Member Avatar for daviddoria
0
122
Member Avatar for mushahidh
Member Avatar for IMJS

I think even though you have include guards, you can't declare a function in the header, you can only define it. That is, you need to change the header to: [code] #ifndef GENERALFUNCTIONS_H #define GENERALFUNCTIONS_H bool IsFiniteNumber(double x); #endif /* GENERALFUNCTIONS_H */ [/code] And then in the implementation (.cpp file), …

Member Avatar for IMJS
0
329
Member Avatar for daviddoria

If I use a template function with T where T = itk::Image<unsigned char>::Pointer, everything is fine: [code] #include <itkImage.h> class Test { public: template <class T> void Add(T patch); }; template <class T> void Test::Add(T patch) { } int main(int, char*[]) { Test a; itk::Image<unsigned char>::Pointer image; a.Add(image); return EXIT_SUCCESS; …

Member Avatar for daviddoria
0
3K
Member Avatar for rahul_galgali

What are CArray and CString? To set a member of a struct, you first have to instantiate it: [code] student myStudent; [/code] Then you just use a '.' : [code] myStudent.Struct_Name = "David"; [/code]

Member Avatar for daviddoria
0
94
Member Avatar for Shawneal
Member Avatar for aasadi
0
261
Member Avatar for Obelisk4

You could ask here or here: [url]http://old.nabble.com/SDL-f14250.html[/url] [url]http://forums.libsdl.org/viewforum.php?f=1&sid=16b16a0f4004197730c6fc82a9ebc3fd[/url] Dave

Member Avatar for shijobaby
0
225
Member Avatar for radmaker3

changing to release mode just tells it not to run the assert commands. that is a TERRIBLE idea because now something is going wrong, its just not telling you! It will come back to bite you for sure! Use step through in debug mode to see which line the assert …

Member Avatar for shijobaby
0
357
Member Avatar for aree

1)I have to include [code] #include <cstdlib> // for srand [/code] to define the srand() symbol. 2) There is no reason for all of this: [code] random_integer = rand() % (HIGH - LOW + 1) + LOW; [/code] Since you just want a number from 0 to 1, you can …

Member Avatar for aree
0
2K
Member Avatar for jessekoegler

You just need to change [code] variance(arraym[299][299], minl, minw, rlm, rwm); [/code] to [code] variance(arraym, minl, minw, rlm, rwm); [/code] This compiles for me: [code] #include <cstdlib> #include <iostream> #include <string> //mean function double mean(int arraym[299][299], int minl, int minw, int rlm, int rwm) { double sum(0); int n(0); for …

Member Avatar for daviddoria
0
829
Member Avatar for giftalp

I would try to simplify the problem down to < 50 compilable lines that you can post directly to daniweb (using code tags). It is much easier for people to review than having to download your files.

Member Avatar for giftalp
0
194
Member Avatar for doolali

FYI the terminology is "passing a 2d array to a function". Here are multiple solutions: [url]http://www.programmersheaven.com/mb/CandCPP/315619/315619/how-to-pass-a-two-dimensional-array-by-ref/[/url] I would opt for the "use a vector of vectors rather than a 2D array" option. David

Member Avatar for doolali
0
127
Member Avatar for Bigbrain99

Your DUTY class does not have a getName() function, hence you have to first get the instance of a class (a FLATMATE) which does have a getName() function (WashDutyList.at(j)).getResident()) and then call getName() on it.

Member Avatar for Bigbrain99
0
118
Member Avatar for snivek

You cannot replace a line in a plain text file like this. You'd have to either 1) Read the whole file into memory, replace the line in memory, then rewrite the whole file or 2) Use an actual database (SQL or similar)

Member Avatar for daviddoria
0
167
Member Avatar for heidik

Here is my initial feedback: 1) You should make variable names and class names as descriptive as possible. What is a "Pred"? What is 'vPred'? What is 'x' and 'y'? Why are they strings? 2) (1) is also aided significantly by the heavy use of comments! 3) What is your …

Member Avatar for heidik
0
112
Member Avatar for gpjacks

I have a few comments/suggestions. 1) [icode]user_guess[/icode] is unused. You should setup your compiler to tell you about this - mine gave me a warning when I compiled your code. 2) There is no reason to use defines here - it is bad "c++ style". At the least, change the …

Member Avatar for gpjacks
0
167
Member Avatar for Beancounter5

I would actually imagine they are assuming the computations take 0 time. So you just need to make a function wait(2) that pauses for 2 seconds.

Member Avatar for mike_2000_17
0
102
Member Avatar for mandm911

If possible, please post a reasonable compilable length of code using code tags. You will likely get many more responses if people can look at your code directly in the browser versus having to download and open it.

Member Avatar for daviddoria
0
1K
Member Avatar for demigodz24

I agree with Kontained. To generate the numbers ("call" them in Bingo), I would make a vector of all possible numbers and then shuffle it: [url]http://programmingexamples.net/index.php?title=CPP/STL/RandomShuffle[/url]

Member Avatar for daviddoria
0
109
Member Avatar for daviddoria

I have a line like this: [code] <EMBED SRC="ObtainingAndBuilding_Linux.swf" WIDTH=200 HEIGHT=300</EMBED> [/code] that I want to replace 200 and 300 by the browser window width and height. I found some code like this which correctly gets and displays the width and height: [code] <HTML> <head> <script> function showWH(){ if (document.all){ …

Member Avatar for daviddoria
0
141

The End.