102 Solved Topics
Remove Filter Is there a library that has a function that will take (theta,phi) and return (x,y,z)? Thanks, Dave | |
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, … | |
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 | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
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); … | |
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 … | |
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, … | |
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 | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … ![]() | |
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 … | |
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. … | |
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, … | |
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 … | |
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) … | |
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... … | |
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 … | |
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 … | |
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 … | |
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 | |
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, … | |
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; … | |
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 … | |
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 == … | |
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 … | |
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; … | |
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 | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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. … | |
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 | |
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 | |
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] … | |
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 | |
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 … | |
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 | |
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 … | |
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 … | |
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 |
The End.