265 Topics

Member Avatar for daviddoria

I am trying to use wxPython (the version that ships with Fedora 11 - I'm not building it from source). I am seeing: [code] from wxPython.wx import * File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/__init__.py", line 15, in <module> import _wx File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/_wx.py", line 3, in <module> from _core import * File "/usr/lib/python2.6/site-packages/wx-2.8-gtk2-unicode/wxPython/_core.py", line 15, …

Member Avatar for Reverend Jim
0
2K
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

I would like to take a screenshot of a region of my screen programmatically (so I can do it every time through a loop, for example.) Does anyone know how to do this? I guess it would involve the win32api - I've not used this before so any hints would …

Member Avatar for dougy83
0
3K
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 am trying to make a simple demo of a DataGridView bound to a database table. I want to add a row, delete a row, and save the table. I used the IDE to do just about everything. It created the BindingSource when I set the datasource of the DataGridView …

Member Avatar for tenorjazz
0
146
Member Avatar for daviddoria

Would it be possible to integrate something like codepad.org or ideone.com into Daniweb? It would be really nice to see the compiler output of code snippets automatically. Consider the difference between "Help something is wrong!" [code] #include <iostream> int main() { cout << hi; return 0; } [/code] and "Help …

Member Avatar for JackieBolinsky
0
218
Member Avatar for daviddoria

Every once in a while there is a thread with 0 replies that has been marked as "Solved": [url]http://www.daniweb.com/software-development/cpp/threads/398278[/url] When you sort by "Unanswered", I don't think these threads should be displayed (they currently are: [url]http://www.daniweb.com/software-development/cpp/unanswered/list/8[/url]). Going through "unanswered" threads is surely in an attempt to answer some, and you …

Member Avatar for Dani
0
136
Member Avatar for daviddoria

There are two classes, ImageBase, and template <T> Image in a library I'm using. I want to store many of these images in a container, and then pass them to a function templates that expect an Image<T>. The only thing I knew to do was store ImageBase* in the container: …

Member Avatar for vijayan121
0
207
Member Avatar for daviddoria

(Following up on this discussion : [url]http://www.daniweb.com/software-development/cpp/threads/405285/1732795#post1732795[/url] ) Is it ok to store data in a Visitor class? In the case below, I have a Visitor named PixelWisePatchPairVisitor that internally needs to itself use a visitor. At some point the Image to visit needs to come into the picture. In …

Member Avatar for daviddoria
0
121
Member Avatar for daviddoria

I have been working with this code for quite a long time now, and I continually refactor and refactor and just keep running into different forms of the same problem. In the last couple of weeks I've tried to take a step back and really think about the design, motivated …

Member Avatar for rubberman
0
573
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 have a feeling that I can come up with a much better title for this thread once I know the answer to this question :). Say I have a function template template <typename T> void MyFunction(). Now I want to specialize MyFunction for a templated type. That is, say …

Member Avatar for daviddoria
0
171
Member Avatar for daviddoria

Can anyone explain why I can't sort this vector: [code] #include <iostream> #include <vector> #include <algorithm> #include <memory> struct Test { public: Test(const unsigned int input) : a(input){} int a; }; struct SortFunctor { bool operator()(std::shared_ptr<Test>& object1, std::shared_ptr<Test>& object2) { return(object1->a < object2->a); } }; ////////////////////////// int main (int argc, …

Member Avatar for vijayan121
0
4K
Member Avatar for daviddoria

I know there is an "assignable and copy constructable" requirement for objects in an STL container. For example, you cannot place an object with a const member into a vector. [code] #include <vector> // /home/doriad/Test/Test.cxx:3:8: error: non-static const member ‘const int MyClass::x’, can’t use default assignment operator // struct MyClass …

Member Avatar for mike_2000_17
0
169
Member Avatar for daviddoria

If I want to expose an iterator to a class member container, I can do so like this: [code] class PatchCollection { public: // Iterator interface typedef std::set<Patch>::iterator iterator; typedef std::set<Patch>::const_iterator const_iterator; iterator begin() { return SourcePatches.begin(); } iterator end() { return SourcePatches.end(); } private: std::set<Patch> Patches; }; [/code] However, …

Member Avatar for mike_2000_17
0
212
Member Avatar for daviddoria

I have a class called PatchCollection. It is in charge of creating a bunch of Patch objects. It stores them in a member variable of type std::set. Now I want to loop over all of the patches from outside the class. That is: [code] MyClass { PatchCollection Patches; void DoSomething() …

Member Avatar for ravenous
0
135
Member Avatar for daviddoria

I typically make a Types.h to define all of my types in and then include that in all of my project files. I haven't ever seen this anywhere though, so I assume it is "bad/wrong". The situation is often like this: Consider a class Gardener that needs to know type …

Member Avatar for mike_2000_17
0
134
Member Avatar for daviddoria

I just watched this webcast: [url]http://videos.webpronews.com/2011/05/31/daniweb-speaks-out-on-recovering-from-google-panda/[/url] I'd like to follow up on the idea of no-indexing threads with zero replies. During the webcast it was stated that the idea was to not have people find a thread that has their exact question but no answer. In some cases, they will …

Member Avatar for Dani
0
227
Member Avatar for daviddoria

n windows I used GDI+ to capture a region of the screen. Is there something similar for linux? I want to do ScreenCapture(Top, Left, Width, Height); and save it to a file (png or something). What's the easiest way to do this? Thanks, Dave

Member Avatar for Mual
0
1K
Member Avatar for daviddoria

Hi all, I am trying to write a function to solve an equation for one of its variables. E.g. X + Y + Z = 0 This equation would be represented by its parameters: parameters[0] is X, parameters[1] is Y, parameters[2] is Z. If the user wants to solve for …

Member Avatar for mrnutty
0
742
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

If I want to generate all combinations of a set of numbers 0-max, I can do so with for loops. The following code will output all two-number pairs: [code] for(unsigned int i = 0; i <= max; i++) { for(unsigned int j = 0; j <= max; j++) { cout …

Member Avatar for nezachem
0
211
Member Avatar for daviddoria

I was wondering if I partially specialize a class (which I'm understanding to mean hardcode some of the template parameters?) if I have to implement all functions or if I can just implement some functions. I put together a demo: [url]http://programmingexamples.net/index.php?title=CPP/Templates/PartialClassSpecialization[/url] Where in the main class definition there are two …

Member Avatar for mike_2000_17
0
587
Member Avatar for daviddoria

This was just a goof on my part, but it was quite annoying and maybe it could be handled a bit better. I was on a different machine than normal, so I was not logged into daniweb but I didn't realize it. I found an interesting post and spent quite …

Member Avatar for Dani
1
162
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

If I have this structure: [code] class Parent { public: virtual void MyFunction() {// do something} }; class Child { public: virtual void MyFunction() {// do something else} }; [/code] The Parent::MyFunction() seems to always be called, even with: [code] Child MyChild; MyChild.MyFunction(); [/code] Is this expected? David

Member Avatar for mike_2000_17
0
150
Member Avatar for daviddoria

I am working on some code (not written by be, and too big to fundamentally change the structure of) where a pure virtual Image class is implemented. The user is expected to implement a function of their derived Image class with signature: [code] virtual Rgb* GetRgb(); [/code] Where the Rgb …

Member Avatar for mike_2000_17
0
278
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

I am trying to return a vector of some of the elements in a vector. I wish to modify one of the elements in this new vector and have it automatically update the value in the original vector. I tried this: [code] #include <iostream> #include <vector> class TestClass { public: …

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

What I really wanted was a single class, ImageSegmentation<T> that operates on images of type T. The problem was that this object needed to be a member of my Qt form object (called Form), but I didn't know T until runtime (the user selects which type of image to operate …

Member Avatar for mike_2000_17
0
242
Member Avatar for daviddoria

[QUOTE]Ov course you don't, but many people here feel that vectors are the only solution to using arrays. They love suggesting things obviously beyond your level.[/QUOTE] This is not beyond his level. There is no reason to learn arrays before vectors. Novices should learn vectors because they convey the same …

Member Avatar for vijayan121
0
83
Member Avatar for daviddoria

There are lots of stand alone programs (sqlitespy, sqlitestudio, etc) that give you nice spread-sheet style access to tables: [url]http://www.yunqa.de/delphi/lib/exe/detail.php/products/sqlitespy/sqlitespy.png?id=products:sqlitespy:index&DokuWiki=2oa8egb90q7fck3t3q2uk9nv61[/url] but does anyone know of a web based way to do this? Thanks, David

Member Avatar for drjohn
0
130
Member Avatar for daviddoria

I finally got my navigation drop down menu working! [url]http://ewh.ieee.org/r1/schenectady/[/url] I had been testing in Chrome, Firefox, and IE8. Before my celebration even really started, a user pointed out (correctly) that it doesn't work in IE7 :( The menus drop down on hover, but they aren't aligned, and you can't …

Member Avatar for maryparker
0
181
Member Avatar for daviddoria

On this page: [url]http://ewh.ieee.org/r1/schenectady/New/[/url] it seems like the gray background object is larger than the screen - i.e. scroll bars appear even though the content is not long enough to warrant them. I have the following properties: [code] body { height: 100%; } html { height: 100%; } [/code] Shouldn't …

Member Avatar for Arkinder
0
114
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

I have a database, test.db, with a table called Events. I tried this: [code] <?php try { // open the database $database = new PDO('sqlite:test.db'); $result = $db->query('SELECT * FROM Events'); foreach($result as $row) { // both of these lines produce a blank page //echo $row['EventName'] . ' | ' …

Member Avatar for daviddoria
0
108
Member Avatar for daviddoria

Hi all, I am transitioning a bunch of data from html (yuck!) to some sort of separated schema. I was going to use xml: [code] <events> <event> <title> <date> <speaker> <description> </event> </events> [/code] but now I am wondering if I should use a real database instead. Can anyone comment …

Member Avatar for d5e5
0
113
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

When I get an email notification of a second+ reply to a thread, GMail collapses way too much of the email. [url]http://www.rpi.edu/~doriad/daniweb.jpg[/url] The main thing that is missing is the link to the thread! (Of course I find it if I click "show quoted text". Is this a gmail setting? …

Member Avatar for webstax
0
182
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

The End.