265 Topics
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, … | |
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 | |
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 … | |
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 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 … | |
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 … | |
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 … | |
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: … | |
(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 … | |
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 … | |
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 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 … | |
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, … | |
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 … | |
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, … | |
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() … | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 | |
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 | |
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 … | |
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, … | |
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: … | |
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 | |
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 … | |
[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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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'] . ' | ' … | |
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 … | |
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 … | |
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? … | |
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. … |
The End.