102 Solved Topics

Remove Filter
Member Avatar for daviddoria

Is there a library that has a function that will take (theta,phi) and return (x,y,z)? Thanks, Dave

Member Avatar for Ratan_2
0
6K
Member Avatar for daviddoria

Does anyone use boost program_options? What I'm trying to do is this: [code] --Files 1.jpg 2.jpg 3.jpg [/code] The only thing I know how to do is [code] --File1 1.jpg --File2 2.jpg --File3 3.jpg [/code] Does anyone know how to do this, and maybe store them in a vector<string>? Thanks, …

Member Avatar for maxgerlach
0
4K
Member Avatar for daviddoria

Should I use cmath to use PI and trig functions? I dont think math.h has it - and cmath and math seem like redefine alot of the same things. What is standard practice? Thanks, Dave

Member Avatar for duskoKoscica
0
2K
Member Avatar for daviddoria

For a while now I've been doing this when I want to check the input of a function (in this example, to make sure they are not equal). [code] void foo(int a, int b) { assert(a != b); } [/code] But when the assert fails, I always find my self …

Member Avatar for vibhor48
0
293
Member Avatar for daviddoria

I read that using a policy class for a function that will be called in a tight loop is much faster than using a polymorphic function. However, I setup this demo and the timing indicates that it is exactly the opposite!? The policy version takes between 2-3x longer than the …

Member Avatar for mike_2000_17
0
84
Member Avatar for daviddoria

I was under the impression that you could completely gaurd anything you wanted with an [icode]#if 0 [/icode]. Apparently this is not the case? I found some code that has opening /* comments but no matching closing */, and the /* seems to comment out the [icode]#endif[/icode], resulting in everything …

Member Avatar for daviddoria
0
135
Member Avatar for daviddoria

Is there a way to make a string variable in "normal" html (that is, not inside of a <script> tag)? I want to do something like [CODE] Number='005' <a href="http://domain.com/"+Number+".html">my link</a>[/CODE] Is this possible? Thanks, David

Member Avatar for daviddoria
0
103
Member Avatar for daviddoria

I have been using a [icode]Image<Node>[/icode] as the main object to store the data for my program. It is a 2D grid of Node objects. The nodes have properties like [icode]bool Visited[/icode], [icode] float Priority[/icode], etc. I often want to modify these nodes, put some of them in a vector …

Member Avatar for daviddoria
0
166
Member Avatar for daviddoria

I realize this question may be impossible, but I'm pretty confused so I'm drawing at straws. I'm trying to use a class from a big library. If I do this: [code] TheClass imageIterator(image, region); [/code] everything works fine. However, if I do this: [code] TheClass imageIterator; imageIterator = TheClass(image, region); …

Member Avatar for daviddoria
0
251
Member Avatar for daviddoria

I have a class that has a function called Update(). I have written several different update methods, so I now have: [code] class MyClass { double Update1(); double Update2(); double Update3(); private: float Data1; ... float DataN; }; [/code] All of these functions need access to all of the data …

Member Avatar for mike_2000_17
0
110
Member Avatar for daviddoria

I'm having trouble with this "strict weak ordering". Consider a class Point with members x and y. I tried to make the comparison "If both the x values are less than each other and the y values are less than each other, the Point's are less than each other". However, …

Member Avatar for daviddoria
0
228
Member Avatar for daviddoria

On this page: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] I have a <ul> element (the menu bar) followed by a <p> element (the main body text). Shouldn't the <p> be below the <ul> since it is a block element by default (instead of on the same line as it, as it is now)? Thanks, David

Member Avatar for johnsteve.bravo
0
614
Member Avatar for daviddoria

On this page: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] I have two elements, "bluegradient" and "whitebox". The bluegradient height is 80% (of the page, right?). The whitebox height is 80% (I think this "80% of the height of the bluegradient" since it is nested, right?). The whitebox has top and bottom margins of 10% (this …

Member Avatar for daviddoria
0
850
Member Avatar for daviddoria

On this page: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] I have the title image and title text: [code] <center> <a href="index.php"><img style="vertical-align:middle;" src="/r1/schenectady/images/IEEE.gif"></a> <span id="lightblue" style="vertical-align:middle; font-size: 40pt;" >Schenectady Section</span> </center> [/code] then a paragraph break: [code] <p/> [/code] then a row of drop down lists, then another [icode]<p/>[/icode] then some text. The problem is …

Member Avatar for daviddoria
0
7K
Member Avatar for daviddoria

This is my page with only the header row of the table: [url]http://ewh.ieee.org/r1/schenectady/New/test2.html[/url] When I start adding rows, everything looks good, until I add row 13. Here is an example: [url]http://ewh.ieee.org/r1/schenectady/New/test.html[/url] You can see the header (the grey box) "wiggles" just a little bit. I thought there may have been …

Member Avatar for daviddoria
0
84
Member Avatar for daviddoria

I have a drop down box like this: [code] <select name="DateDropDown"> <option value="2010 selected">2010</option> <option value="2009">2009</option> <option value="2008">2008</option> </select> [/code] I use the value that the user selects to refresh the page and perform a query on a database. Is there a better way than the following to keep the …

Member Avatar for daviddoria
0
7K
Member Avatar for daviddoria

Please excuse my newness. Currently I know how to execute a php script by simply naming the script [filename].php and browsing to that file on my webserver. I have also learned how to parse and display an xml file using php. What I want to do is have a .xml …

Member Avatar for P0lT10n
0
1K
Member Avatar for daviddoria

I want to have files like this: File1.xml [code] <titletag> Title1 goes here </titletag> <contenttag> Content1 goes here </contenttag> [/code] and then use this data with something like: [code] <html> <body> ... Place <contents of titletag from File1.xml> here </html> [/code] Is this a reasonable request? How would I do …

Member Avatar for Kraai
0
121
Member Avatar for daviddoria

I want to have a template function like this: [code] template <class T> void CreateBlankPatch(typename T::Pointer patch, unsigned int sideLength) { CreateConstantPatch(patch, typename T::PixelType::Zero(), sideLength); } [/code] It works fine as long as Zero() is defined for the class T. However, with POD types, this is clearly not the case. …

Member Avatar for daviddoria
0
169
Member Avatar for daviddoria

I have a sidebar.php which contains: [code] <a href="page.html"><src="images/MyImage.gif"></a> [/code] If I do: [code] <?php include 'sidebar.php';?> [/code] from a file that is in '/', everything works properly (because it looks in /images for the gif). However, if I do: [code] <?php include '../sidebar.php';?> [/code] from a file in, say, …

Member Avatar for Arkinder
0
152
Member Avatar for daviddoria

This page works fine in Firefox and Chrome: [url]http://ewh.ieee.org/r1/schenectady/events.php[/url] but in IE, the maincontent appears way at the bottom (below the sidebar) instead of to the right of the sidebar as it should. Google convinced me that IE has trouble with CSS, but this is such a basic thing I …

Member Avatar for Arkinder
0
159
Member Avatar for daviddoria

I have this: [code] int serialInt = 40000359; [/code] but what I really need is this: [code] int serialHex = (int)0x40000359; [/code] What can I do to turn serialInt into serialHex? I found some code that claimed to do this: [code] int IntToHex(int input) { std::stringstream ss; for (int i=2*sizeof(int) …

Member Avatar for daviddoria
0
177
Member Avatar for daviddoria

I have a style: [code] .title1 { color: #0000BB; font-size: 25pt; text-align: center; } [/code] but when I use it with: [code] <span class="title1">Schenectady Section of the IEEE More Words</span> [/code] it doesn't center the text! You can see this behavior here: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] Surely I am just doing something silly... …

Member Avatar for daviddoria
0
148
Member Avatar for daviddoria

I have two pages, header.php and sidebar.php which I want to include on several pages using: [code] <?php include 'header.php'; ?> <?php include 'sidebar.php'; ?> [/code] However, there are two different issues. On this page [url]http://ewh.ieee.org/r1/schenectady/New/index.php[/url] , the included text is put BELOW the text on index.php, even thought it …

Member Avatar for daviddoria
0
89
Member Avatar for daviddoria

Currently at the top of every page I have this: [code] <HTML> <HEAD> <TITLE>Schenectady Section of the IEEE</TITLE> <META NAME='url' CONTENT='http://www.ewh.ieee.org/r1/schenectady/'> <META NAME='author' CONTENT='Authorname'> <META NAME='email' CONTENT='author email'> <META NAME='expires' CONTENT=''> <META NAME='revision-date' CONTENT='6-Sep-1999'> <META NAME='keywords' CONTENT='Schenectady Section'> <META NAME='description' CONTENT='Schenectady Section of the IEEE'> </HEAD> [/code] If I move …

Member Avatar for hielo
0
107
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 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 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 daviddoria

I have a folder A with files 001.jpg, 002.jpg, etc I also have a folder B with different files but with the same names; 001.jpg, 002.jpg, etc I want to put all the files in the same directory - is there something that will automatically rename them or something so …

Member Avatar for MaroBey
0
170
Member Avatar for daviddoria

In the past when I've done this: [code] int function(int a) { if(a == 2) { return true; } else { return false; } } [/code] the compiler has complained that the function may not return a value. I've fixed this by adding: [code] int function(int a) { if(a == …

Member Avatar for mrnutty
0
220
Member Avatar for daviddoria

I just learned about heaps today. It looks like STL wants you to create a heap by first creating a vector, then using make_heap from <algorithm>: [code] std::vector<SimpleClass> Numbers(8); // ... populate ... // convert Numbers into a heap make_heap(Numbers.begin(), Numbers.end()) ; [/code] Why is there not a <heap> just …

Member Avatar for Narue
0
106
Member Avatar for daviddoria

Can anyone explain why the last line works? It seems like it is trying to cast a CRectangle as a CTriangle (which I imagine should fail?) but it outputs "5" as the function should. [code] // virtual members #include <iostream> using namespace std; class CPolygon { protected: int width, height; …

Member Avatar for mitrmkar
0
118
Member Avatar for daviddoria

Can anyone explain why this would fail: [code] assert(cap >= 0); [/code] But this passes? [code] if(cap < 0) { exit(-1); } [/code] That is, the assert is triggered, but if I replace it with conditional, the exit() function is never called. Thoughts? Thanks, David

Member Avatar for daviddoria
0
88
Member Avatar for daviddoria

With std::queue I've been using this: [code] std::queue<int>::iterator pos = std::find( q.begin(), q.end(), 5); [/code] But when I try that with std::stack : [code] std::stack<int>::iterator pos = std::find( s.begin(), s.end(), 5); [/code] I get [code] error: ‘iterator’ is not a member of ‘std::stack<int, std::deque<int, std::allocator<int> > >’ [/code] Anyone know …

Member Avatar for AuburnMathTutor
0
5K
Member Avatar for daviddoria

I hear perl is the way to go for string parsing, so here is the test! I have a file like this: [code] ... <li><a href="DSC_9866.JPG"> DSC_9866.JPG</a></li> <li><a href="DSC_9867.JPG"> DSC_9867.JPG</a></li> ... [/code] and I want to get a list of the file names. That is, the result I want is …

Member Avatar for daviddoria
0
90
Member Avatar for daviddoria

I saw a post today that I said "hm I'd like to have a closer look at that tonight". Is there anyway to "mark" or "flag" a thread to put it in your "favorites" or something like that? Dave

Member Avatar for daviddoria
0
97
Member Avatar for daviddoria

I have some white text I am putting over a very light background. Is there anyway to outline the text in black? After some googling it looks like there are some pretty complicated solutions, but I am looking for something like a check box that says "outline". Is there such …

Member Avatar for daviddoria
0
1K
Member Avatar for daviddoria

I am trying to parse the content of a wiki page. In a string like this: [code] ==Heading1== <test> some text here </test> ==Heading2== <test> even more text </test> [/code] I need to obtain "Heading1", "some text here", "Heading2" and "even more text". I got this to work: [code] import …

Member Avatar for daviddoria
0
15K
Member Avatar for daviddoria

I am trying to strip a prefix from a string, e.g. turn [code] VTK/Examples/Test [/code] Into [code] Test [/code] Sometimes the string does not contain the prefix, in which case I would expect nothing to happen. However, [code] >>> S="Main Page" >>> S.strip("VTK/Examples/") 'Main Pag' [/code] You can see that …

Member Avatar for woooee
0
155
Member Avatar for daviddoria

Is there a data structure that lets me push and pop things onto/off of a queue, but also doesn't allow duplicates? E.g. I want [code] queue a; a.push(1); a.push(2); a.push(2); a.push(3); [/code] to only have 3 elements, because 2 was added twice so the second time it is just ignored. …

Member Avatar for mattjbond
0
168
Member Avatar for daviddoria

After reading a few tutorials, it looks like this: [url]http://www.rpi.edu/~doriad/Examples/Table/[/url] should make a full (100%) width table. However, the width is actually very small and the table is on the left of the page. Does anyone see what is wrong here? Thanks, Dave

Member Avatar for almostbob
0
102
Member Avatar for daviddoria

I have some code that uses _finite (I think from float.h) that my linker complains is not declared. I think this might be a "windows only" function. Is there an equivalent function that I can call that will work cross platform? Thanks, Dave

Member Avatar for daviddoria
0
216
Member Avatar for daviddoria

Is there a way to see what a macro gets expanded to? I tried to put it in quotes and use printf, but of course printf just printed exactly the string. The result of: [code] #define SetMacro(name,type) \ virtual void Set##name (type _arg) int main() { printf("SetMacro(Test, int)"); } [/code] …

Member Avatar for daviddoria
0
138
Member Avatar for daviddoria

I have some sections like: [code] <h3>EngineeringNotes.net</h3> <br>I have never .... [/code] (see this page: [url]http://www.rpi.edu/~doriad/Personal.html[/url]) Why is there such an enormous space between the header and the text? I thought <br> should just insert a single line break? Thanks, Dave

Member Avatar for daviddoria
0
67
Member Avatar for daviddoria

Consider two classes, PersonClass and LawyerClass. If LawyerClass derives from PersonClass, you can create a PersonClass* as a LawyerClass, like [code] PersonClass* Person = new LawyerClass; [/code] then you can convert it to a LawyerClass* with [code] LawyerClass* Lawyer = static_cast<LawyerClass*>(Person); [/code] However, if you don't know that the person …

Member Avatar for daviddoria
0
5K
Member Avatar for daviddoria

Is there anyway to get images to be the "correct" size - i.e. fit the width of the text? This is what currently happens: [url]http://engineeringnotes.net/personal/pictures.shtml[/url] Thanks, Dave

Member Avatar for Troy III
0
134
Member Avatar for daviddoria

I made 2 classes, Point and Point3D: Point.h: [code] #ifndef POINT_H #define POINT_H #include <iostream> template <typename T> class Point { protected: T X,Y,Z; public: Point(const T x, const T y, const T z) : X(x), Y(y), Z(z) {} T getX() {return X;}; T getY() {return Y;}; T getZ() {return …

Member Avatar for DdoubleD
0
540
Member Avatar for daviddoria

I know you can't usually define things in the class like this: [code] class MyClass { double DefaultForward[3] = {0.0, 1.0, 0.0}; }; [/code] but I have some values that don't really make sense to set in the constructor - they are more "deeply connected" as THIS SHOULD ALWAYS BE …

Member Avatar for daviddoria
0
152
Member Avatar for daviddoria

I frequent the c++ forum, and I've seen quite a number of posts that are about windows api/MFC stuff. This seems to be quite a separate thing than just "c++". Would it make sense to add a new forum to separate it? Dave

Member Avatar for NicAx64
0
203

The End.