Search Results

Search found 15187 results on 608 pages for 'boost python'.

Page 29/608 | < Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >

  • C++ member template for boost ptr_vector

    - by Ivan
    Hi there, I'm trying to write a container class using boost::ptr_vector. Inside the ptr_vector I would like to include different classes. I'm trying to achieve that using static templates, but so far I'm not able to do that. For example, the container class is class model { private: boost::ptr_vector<elem_type> elements; public: void insert_element(elem_type *a) { element_list.push_back(a); } }; and what I'm trying to achieve is be able to use different elem_type classes. The code below doesn't satisfy my requirements: template <typename T>class model { private: boost::ptr_vector<T> elements; public: void insert_element(T *a) { element_list.push_back(a); } }; because when I initialize the container class I can only use one class as template: model <elem_type_1> model_thing; model_thing.insert_element(new elem_type_1) but not elem_type_2: model_thing.insert_element(new elem_type_2)//error, of course It is possible to do something like using templates only on the member? class model { private: template <typename T> boost::ptr_vector<T> elements; public: void insert_element(T *a) { element_list.push_back(a); } }; //wrong So I can call the insert_element on the specific class that I want to insert? Note that I do not want to use virtual members. Thanks!

    Read the article

  • how to find and filter blobs from segment image using python?

    - by Python Team
    Am trying to detect number plate from an image.I have converted an image to grayscale and segment image. Now i have to find and filter blobs from an image and to detect number plate from an image. I will explain what i did.. I jus read segment image license_plate = cv2.imread('license1_segmented.png',cv2.CV_LOAD_IMAGE_COLOR) license_plate_size = (license_plate.shape[1], license_plate.shape[0]) mask = cv2.cv.CreateImage (license_plate_size, 8, 1) cv2.cv.Set(mask, 1) thresh_image_ipl = cv2.cv.CreateImage(license_plate_size, cv2.cv.IPL_DEPTH_8U, 1) cv2.cv.SetData(thresh_image_ipl,thresh_image.tostring(),thresh_image.dtype.itemsize * 1 * thresh_image.shape[1]) min_blob_size = 100 # Blob must be 30 px by 30 px max_blob_size = 10000 threshold = 100 **myblobs = CBlobResult(thresh_image_ipl,mask, threshold, True)** myblobs.filter_blobs(min_blob_size, max_blob_size) blob_count = myblobs.GetNumBlobs() trying to find and filter blobs from an image.But am getting error while passing the parameters to CBlobResult which i highlighted above code.I mentioned the error below what i get while passing. Traceback (most recent call last): File "rectdetect1.py", line 110, in <module> myblobs = CBlobResult(thresh_image_ipl,image_area, threshold, True) File "/home/oomsys/pyblobs-read-only/blobs/BlobResult.py", line 92, in __init__ this = _BlobResult.new_CBlobResult(*args) NotImplementedError: Wrong number or type of arguments for overloaded function 'new_CBlobResult'. Possible C/C++ prototypes are: CBlobResult::CBlobResult() CBlobResult::CBlobResult(IplImage *,IplImage *,int,bool) CBlobResult::CBlobResult(CBlobResult const &) Anyone help me to find out the erros and to solve this and all... Thanks in advance...

    Read the article

  • How could there still not be a mysqldb module for Python 3?

    - by itsadok
    This SO question is now more than two years old. MySQL is an incredibly popular database engine, Python is an incredibly popular programming language, and Python 3 has been officially released two years ago, and was available even before that. What's more, the whole mysqldb module is just a layer translating Python's db-api to MySQL's API. It's not that big of a library. I must be missing something here. How come almost* nobody in the entire open source community has spent the (I'm guessing) two weeks it takes to port this lib? Is Python 3 that unpopular? Is the combination of python and mysql not as common as I assume? Or maybe it's just a lot harder to port mysqldb than I assume? Anyone know the inside story on this? * Now I see that this guy has done it, which takes some of the wind out of my question, but it still seems to little and too late to make sense.

    Read the article

  • For what types of applications is Python a bad choice?

    - by Casey Patton
    I just started learning Python, and I'd like to get some more context on the language. I realize that Python is a slow language relative to C or C++, etc. Thus, Python is probably not the best choice for applications that need to run quickly. Outside of this, it seems like Python is a great general purpose language that is easy to read and write. The available libraries give it a huge amount of functionality. Outside of performance critical applications, where is it a bad choice to use Python (and why)?

    Read the article

  • Why isn't there a python compiler to native machine code?

    - by user2986898
    As I understand, the cause of the speed difference between compiled languages and python is, that the first compiles code all way to the native machine's code, whereas python compiles to python bytecode, to be interpreted by the PVM. I see that this way python codes can be used on multiple operation system (at least in most cases), however I do not understand, why is not there an additional (and optional) compiler for python, which compiles the same way as traditional compilers. This would leave to the programmer to chose, which is more important to them; multiplatform executability or performance on native machine. In general; why are not there any languages which could be behave both as compiled and interpreted?

    Read the article

  • Java dev learning Python: what concepts do I need to wrap my head around?

    - by LRE
    I've run through a few tutorials and written some small projects. I'm right in the middle of a small project now infact. All is going well enough thanks in no small part to Uncle Google (who usually points me to Stackoverflow ;-) Several times in the last few days I've found myself wondering "what am I missing?" - I feel that I'm still thinking in Java as I write in Python. This question over at StackOverflow is full of tips about what resources to read up on for learning Python, but I still feel that I'm a Java dev with a dictionary (pun unintended) to translate into Python. What I really want to do is refactor my head to be able to write Pythonic Python instead of Java disguised as Python (not that I want to loose my Java skills). So, the crux of my question is: what concepts does a Java dev really need to learn to think Pythonic? This includes anything that needs to be un-learnt. ps: I consider language syntax to not be particularly relevant to this question.

    Read the article

  • Java dev learning Python: what concepts do I need to wrap my head around?

    - by LRE
    I've run through a few tutorials and written some small projects. I'm right in the middle of a small project now infact. All is going well enough thanks in no small part to Uncle Google (who usually points me to Stackoverflow ;-) Several times in the last few days I've found myself wondering "what am I missing?" - I feel that I'm still thinking in Java as I write in Python. This question over at StackOverflow is full of tips about what resources to read up on for learning Python, but I still feel that I'm a Java dev with a dictionary (no pun intended) to translate into Python. What I really want to do is refactor my head to be able to write Pythonic Python instead of Java disguised as Python (not that I want to loose my Java skills). So, the crux of my question is: what concepts does a Java dev really need to learn to think Pythonic? This includes anything that needs to be un-learnt. ps: I consider language syntax to not be particularly relevant to this question.

    Read the article

  • Why is not there a python compiler to native machine's code?

    - by user2986898
    As I understand, the cause of the speed difference between compiled languages and python is, that the first compiles code all way to the native machine's code, whereas python compiles to python bytecode, to be interpreted by the PVM. I see that this way python codes can be used on multiple operation system (at least in most cases), however I do not understand, why is not there an additional (and optional) compiler for python, which compiles the same way as traditional compilers. This would leave to the programmer to chose, which is more important to them; multiplatform executability or performance on native machine. In general; why are not there any languages which could be behave both as compiled and interpreted?

    Read the article

  • Downloading Python 2.5.4 (from official website) in order to install it

    - by brilliant
    I was quite hesitant about whether I should post this question here on "StackOverflow" or on "SuperUser", but finally decided to post it here as Python is more a programming language rather than a piece of software. I've been recently using Python 2.5.4 that is installed on my computer, but at the moment I am not at home (and won't be for about two weeks from now), so I need to install the same version of Python on another computer. This computer has Windows XP installed – just like the one that I have at home. The reason why I need Python 2.5.4 is because I am using “Google App Engine”, and I was told that it only supports Python 2.5 However, when I went to the official Python page for the download, I discovered that certain things have changed, and I don’t quite remember where exactly from that site I had downloaded Python 2.5.4 on my computer at home. I found this page: http://www.python.org/download/releases/2.5.4/ Here is how it looks: (If you can’t see it here, please check it out at this address: http://brad.cwahi.net/some_pictures/python_page.jpg ) A few things here are not clear to me. It says: “For x86 processors: python-2.5.4.msi For Win64-Itanium users: python-2.5.4.ia64.msi For Win64-AMD64 users: python-2.5.4.amd64.msi” First of all, I don’t know what processor I am using – whether mine is “x86” or not; and also, I don’t know whether I am an “Win64-Itanium” or an “Win64-AMD64” user. Are Itanium and AMD64 also processors? Later it says: “Windows XP and later already have MSI; many older machines will already have MSI installed.” I guess, it is my case, but then I am totally puzzled as to which link I should click as it seems now that I don’t need those three previous links (as MSI is already installed on Windows XP), but there is no fourth link provided for those who use “Windows XP” or older machines. Of course, there are these words after that: “Windows users may also be interested in Mark Hammond's win32all package, available from Sourceforge.” but it seems to me that it is something additional rather than the main file. So, my question is simple: Where in the official Python website I can download Python 2.5.4, precisely, which link I should click?

    Read the article

  • Invoke Python modules from Java

    - by user36813
    I have a Python interface of a graph library written in C - igraph (the name of library). My need is to invoke the python modules pertaining to this graph library from Java code. It goes like this, the core of library is in c. This core has been imported into Python and interfaces to the functions embedded in core are available in Python. My project's rest of the code is in Java and hence I would like to call the graph functions by Java as well. Jython - which lets you invoke python modules with in Java was an option.I went on trying Jython to discover that it will not work in my case as the core code is in C and Jython wont support anything that is imported as a c dll in python code.I also thought of opting for the approach of calling graph routines directly in c. That is without passing through Python code. I am assuming there must be something which lets you call c code from Java, how ever I am not good in C hence I did not go for it. My last resort seems to execute Python interpreter from command line using Java. But that is a dirty and shameless. Also to deal with the results produced by Python code I will have to write the results in a file and read it back in java. Again dirty way. Is there something that any one can suggest me? Thanks to every one giving time. Thanks Igal for answering. I had a look at it. At first glance it appears as if it is simply calling the python script. Jep jep = new Jep(false, SCRIPT_PATH, cl); jep.set("query", query); jep.runScript(SCRIPT_PATH + file); jep.close(); Isnt it very similar to what we would do if called the python interpreter from command line through a Java code. Runtime runtime = Runtime.getRuntime(); Process proc = runtime.exec("python test.py"); Concern is how do I use the results generated by Python script. The naive way is to write them to file and read it back in Java. I am searching for a smarter approach.Thanks for suggestion anyway.

    Read the article

  • BOOST.IOstreams: trouble to write to bzip2.

    - by Arman
    Hello I am would like to store my data in to bzip2 file using Boost.IOstreams. void test_bzip() { namespace BI = boost::iostreams; { string fname="test.bz2"; { BI::filtering_stream<BI::bidirectional> my_filter; my_filter.push(BI::combine(BI::bzip2_decompressor(), BI::bzip2_compressor())) ; my_filter.push(std::fstream(fname.c_str(), std::ios::binary|std::ios::out)) ; my_filter << "test" ; }//when my_filter is destroyed it is trowing an assertion. } }; What I am doing wrong? I am using boost 1.42.0. kind regards Arman.

    Read the article

  • Concatenate boost::dynamic_bitset or std::bitset

    - by MOnsDaR
    Hey, what is the best way to concatenate 2 bitsets? For example i've got boost::dynamic_bitset<> test1( std::string("1111") ); boost::dynamic_bitset<> test2( std::string("00") ); they should be concatenated into a thrid Bitset test3 which then holds 111100 Solutions should use boost::dynamic_bitset. If the solution works with std::bitset, it would be nice too. There should be a focus on performance when concatenating the bits.

    Read the article

  • Help with C++ Boost::regex

    - by Youssef
    Hello everybody, I'm trying to get all words inside a string using Boost::regex in C++. Here's my input : "Hello there | network - bla bla hoho" using this code : regex rgx("[a-z]+",boost::regex::perl|boost::regex::icase); regex_search(input, result, rgx); for(unsigned int j=0; j I only get the first word "Hello".. whats wrong with my code ? result.size() returns 1. thank you.

    Read the article

  • Using boost unordered map

    - by Amrish
    Guys, I am using dynamic programming approach to solve a problem. Here is a brief overview of the approach Each value generated is identified using 25 unique keys. I use the boost::hash_combine to generate the seed for the hash table using these 25 keys. I store the values in a hash table declared as boost::unordered_map<Key_Object, Data_Object, HashFunction> hashState; I did a time profiling on my algorithm and found that nearly 95% of the run time is spent towards retrieving/inserting data into the hash table. These were the details of my hash table hashState.size() 1880 hashState.load_factor() 0.610588 hashState.bucket_count() 3079 hashState.max_size() 805306456 hashState.max_load_factor() 1 hashState.max_bucket_count() 805306457 I have the following two questions Is there anything which I can do to improve the performance of the Hash Table's insert/retrieve operations? C++ STL has hash_multimap which would also suit my requirement. How does boost libraries unordered_map compare with hash_multimap in terms of insert/retrieve performance.

    Read the article

  • VC++ 2010 wants to link boost libararies i didn't even specify

    - by Philipp
    Hi there, I'm trying to build my application with MSVC 2010 instead of GCC. With GCC everything works fine. My app uses boost_system and boost_thread libraries. I built boost with VC2010 in "system" layout, that means the libraries are named just libboost_system.lib (and not libboost_system_compiler_threading_version_wtf_snafu.lib) The libs reside in C:\Boost\lib, the Makefile specifies LFLAGS = /NOLOGO /INCREMENTAL:NO /SUBSYSTEM:CONSOLE LIBS = /LIBPATH:C:/Boost/lib libboost_system.lib libboost_thread.lib Ws2_32.lib when invoking nmake it compiles, but when trying to link it quits with LINK : fatal error LNK1104: cannot open file 'libboost_date_time-vc100-mt-1_43.lib I mean seriously, WTF? I told it to link libboost_systen.lib and libboost_thread.lib how come it tries to link libboost_data_time and why does it assume I built the libs in "tagged" layout?? How can I stop MSVC trying to be smart and guess what I might have wanted to link? Thanks, Philipp

    Read the article

  • typedef boost::shared_ptr<MyJob> Ptr; or #define Ptr boost::shared_ptr

    - by danio
    I've just started wrking on a new codebase where each class contains a shared_ptr typedef (similar to this) like: typedef boost::shared_ptr<MyClass> Ptr; Is the only purpose to save typing boost::shared_ptr? If that is the case why not do #define Ptr boost::shared_ptr in one common header? Then you can do: Ptr<MyClass> myClass(new MyClass); which is no more typing than MyClass::Ptr myClass(new MyClass); and saves the Ptr definition in each class.

    Read the article

  • How to use boost::fusion::transform on heterogeneous containers?

    - by Kyle
    Boost.org's example given for fusion::transform is as follows: struct triple { typedef int result_type; int operator()(int t) const { return t * 3; }; }; // ... assert(transform(make_vector(1,2,3), triple()) == make_vector(3,6,9)); Yet I'm not "getting it." The vector in their example contains elements all of the same type, but a major point of using fusion is containers of heterogeneous types. What if they had used make_vector(1, 'a', "howdy") instead? int operator()(int t) would need to become template<typename T> T& operator()(T& const t) But how would I write the result_type? template<typename T> typedef T& result_type certainly isn't valid syntax, and it wouldn't make sense even if it was, because it's not tied to the function.

    Read the article

  • Simple and efficient distribution of C++/Boost source code (amalgamation)

    - by Arrieta
    Hello: My job mostly consists of engineering analysis, but I find myself distributing code more and more frequently among my colleagues. A big pain is that not every user is proficient in the intricacies of compiling source code, and I cannot distribute executables. I've been working with C++ using Boost, and the problem is that I cannot request every sysadmin of every network to install the libraries. Instead, I want to distribute a single source file (or as few as possible) so that the user can g++ source.c -o program. So, the question is: can you pack the Boost libraries with your code, and end up with a single file? I am talking about the Boost libraries which are "headers only" or "templates only". As an inspiration, please look at the distribution of SQlite or the Lemon Parser Generator; the author amalgamates the stuff into a single source file which is trivial to compile. Thank you.

    Read the article

  • HowTo parse numbers from string with BOOST methods?

    - by mosg
    Problem: Visual C++ 10 project (using MFC and Boost libraries). In one of my methods I'm reading simple test.txt file. Here is what inside of the file (std::string): 12 asdf789, 54,19 1000 nsfewer:22!13 Then I'm reading it and I have to convert all digits to int only with boost methods. For example, I have a list of different characters which I have to parse: ( ’ ' ) ( [ ], ( ), { }, ? ? ) ( : ) ( , ) ( ! ) ( . ) ( - ) ( ? ) ( ‘ ’, “ ”, « » ) ( ; ) ( / ) And after conversation I must have some kind of a massive of int's values, like this one: 12,789,54,19,1000,22,13 Maybe some one already did this job? PS. I'm new for boost. Thanks!

    Read the article

  • C++ Boost bind value type

    - by aaa
    hello. I look in documentation and source code but cannot figure out how to get return value type of boost bind functor. I am trying to accomplish following: 35 template<typename T,size_t N, class F> 36 boost::array<typename F::value_type, N> make_array(T (&input)[N], F unary) { 37 boost::array<typename F::value_type, N> array; 38 std::transform(input, input + N, array.begin(), unary); 39 return array; 40 } where F can be bind functor. the above does not work because functor does not have value_type. for that matter, is there standard interface for unary/binary functor as far as return value. Thanks

    Read the article

  • Problem with basic program using Boost Threads in c++

    - by Eternal Learner
    I have a simple program which creates and executes as thread using boost threads in c++. #include<boost/thread/thread.hpp> #include<iostream> void hello() { std::cout<<"Hello, i am a thread"<<std::endl; } int main() { boost::thread th1(&hello); th1.join(); } The compiler throws an error against the th1.join() line. It says " Multiple markers at this line - undefined reference to `boost::thread::join()' - undefined reference to `boost::thread::~thread()' "

    Read the article

  • thread destructors in C++0x vs boost

    - by Abruzzo Forte e Gentile
    Hi All These days I am reading the pdf Designing MT programs . It explains that the user MUST explicitly call detach() on an object of class std::thread in C++0x before that object gets out of scope. If you don't call it std::terminate() will be called and the application will die. I usually use boost::thread for threading in C++. Correct me if I am wrong but a boost::thread object detaches automatically when it get out of scope. Is seems to me that the boost approach follow a RAII principle and the std doesn't. Do you know if there is some particular reason for this? Kind Regards AFG

    Read the article

  • Linking error in OMNeT++ using Boost serialization library

    - by astriffe
    I'm very new to OMNeT++ and I'd like to use the serialization-library contained in the boost framework. However, when trying to use it, I get quite many errors such as: Description Resource Path Location Type undefined reference to `boost::archive::archive_exception::~archive_exception()' OmCCN line 36, external location: /home/alexander/UniBE/BT/simulator/boost-compiledLibs /include/boost/serialization/throw_exception.hpp C/C++ Problem . I guess the problem is that I didn't yet link the compiled library in OMNeT. I've had a look at the makefile but any changes there are worthless since it is generated automatically by makemake. Furthermore, trying to access the menu item 'makemake' in project properties OMNeT++ IDE throws an error (The currently displayed page contains invalid values). Can anyone give me a hint concerning what the error could cause or how to link the compiled library correctly? Any hints are very appreciated! cheers alex

    Read the article

  • Boost Shared Pointers and Memory Management

    - by Izza
    I began using boost rather recently and am impressed by the functionality and APIs provided. In using boost::shared_ptr, when I check the program with Valgrind, I found a considerable number of "Still reachable" memory leaks. As per the documentation of Valgrind, these are not a problem. However, since I used to use the standard C++ library only, I always made sure that any program written is completely free from memory leaks. My question is, are these memory leaks something to worry about? I tried using reset(), however it only decrements the reference count, doesn't deallocate memory. Can I safely ignore these, or any way to forcibly deallocate the memory allocated by boost::shared_ptr? Thank you.

    Read the article

  • C++ Boost bind value type {solved}

    - by aaa
    hello. I look in documentation and source code but cannot figure out how to get return value type of boost bind functor. I am trying to accomplish following: 35 template<typename T,size_t N, class F> 36 boost::array<typename F::value_type, N> make_array(T (&input)[N], F unary) { 37 boost::array<typename F::value_type, N> array; 38 std::transform(input, input + N, array.begin(), unary); 39 return array; 40 } where F can be bind functor. the above does not work because functor does not have value_type. for that matter, is there standard interface for unary/binary functor as far as return value. solution: it should be result_type. also equivalent defined are argument_type and first/second_argument_type for binary functions Thanks

    Read the article

< Previous Page | 25 26 27 28 29 30 31 32 33 34 35 36  | Next Page >