Search Results

Search found 4133 results on 166 pages for 'boost graph'.

Page 15/166 | < Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >

  • How to serialize a graph ?

    - by Michael
    This is an interview question: How to serialize a graph ? I saw this answer but I am not sure if this is enough. It looks like a very confusing "open question" and the candidates are probably expected to ask more questions about the requirements: what the nodes and edges are, how they are serialized themselves, is this graph weighted, directed, etc., how many nodes/edges are in the graph.What about the infrastructure ? Is it a plain file system or we should/can use a database ? So, how would you answer this question ?

    Read the article

  • Plotting a cumulative graph of python datetimes

    - by ventolin
    Say I have a list of datetimes, and we know each datetime to be the recorded time of an event happening. Is it possible in matplotlib to graph the frequency of this event occuring over time, showing this data in a cumulative graph (so that each point is greater or equal to all of the points that went before it), without preprocessing this list? (e.g. passing datetime objects directly to some wonderful matplotlib function) Or do I need to turn this list of datetimes into a list of dictionary items, such as: {"year": 1998, "month": 12, "date": 15, "events": 92} and then generate a graph from this list? Sorry if this seems like a silly question - I'm not all too familiar with matplotlib, and would like to save myself the effort of doing this the latter way if matplotlib can already deal with datetime objects itself.

    Read the article

  • Storing parameters from a graph and applying to other graphs

    - by Braden
    I would like to store the xmin and xmax parameters from one geom_histogram and apply them to a second geom_histogram. I am putting both graphs on the same page using grid.arrange and would like them to have the same x range, while allowing the first graph to establish the range based on its data. The second graph is produced from a subset of the first graphs data, so it will not have data that falls outside of the x-range established by the first. But I don't want the range to shrink to fit the second graph.

    Read the article

  • How to create a simple server/client application using boost.asio?

    - by the_drow
    I was going over the examples of boost.asio and I am wondering why there isn't an example of a simple server/client example that prints a string on the server and then returns a response to the client. I tried to modify the echo server but I can't really figure out what I'm doing at all. Can anyone find me a template of a client and a template of a server? I would like to eventually create a server/client application that receives binary data and just returns an acknowledgment back to the client that the data is received.

    Read the article

  • Using Boost statechart, how can I transition to a state unconditionally?

    - by nickb
    I have a state A that I would like to transition to its next state B unconditionally, once the constructor of A has completed. Is this possible? I tried posting an event from the constructor, which does not work, even though it compiles. Thanks. Edit: Here is what I've tried so far: struct A : sc::simple_state< A, Active > { public: typedef sc::custom_reaction< EventDoneA > reactions; A() { std::cout << "Inside of A()" << std::endl; post_event( EventDoneA() ); } sc::result react( const EventDoneA & ) { return transit< B >(); } }; This yields the following runtime assertion failure: Assertion failed: get_pointer( pContext_ ) != 0, file /includ e/boost/statechart/simple_state.hpp, line 459

    Read the article

  • Boost in Visual Studio 2010, IntelliSense error

    - by Peretz
    Hello, I would like to see if you could orient me. It happens that I compiled and referenced the boost libraries in order to use them with Visual Studio 2010. When building my test project I get these two IntelliSense errors 1 IntelliSense: #error directive: "Macro BOOST_LIB_NAME not set (internal error)" c:\boost_1_43_0\boost\config\auto_link.hpp 2 IntelliSense: #error directive: "some required macros where not defined (internal logic error)." c:\boost_1_43_0\boost\config\auto_link.hpp Checking the auto_link.hpp header file the first error is in this line #ifndef BOOST_LIB_NAME # error "Macro BOOST_LIB_NAME not set (internal error)" #endif Tracing the definition of BOOST_LIB_NAME, it seems that is defined in config.hpp by boost_regex, which code I am including below #if !defined(BOOST_REGEX_NO_LIB) && !defined(BOOST_REGEX_SOURCE) && !defined(BOOST_ALL_NO_LIB) && defined(__cplusplus) # define BOOST_LIB_NAME boost_regex # if defined(BOOST_REGEX_DYN_LINK) || defined(BOOST_ALL_DYN_LINK) # define BOOST_DYN_LINK ... more code and strangely when I point to BOOST_LIB_NAME it defines BOOST_LIB_NAME and the IntelliSense errors disappear. My program builds and executes fine using the Boost:Regex library -- with or without the Intellisense errors; however, I do not understand why these IntelliSense errors appear in the first place, and second why pointing the macro in the config.hpp defines BOOST_LIB_NAME. Any guidance will be greatly appreciated. Thanks, Jaime

    Read the article

  • boost::lambda bind expressions can't get bind to string's empty() to work

    - by navigator
    Hi, I am trying to get the below code snippet to compile. But it fails with: error C2665: 'boost::lambda::function_adaptor::apply' : none of the 8 overloads could convert all the argument types. Sepcifying the return type when calling bind does not help. Any idea what I am doing wrong? Thanks. #include <boost/lambda/lambda.hpp> #include <boost/lambda/bind.hpp> #include <string> #include <map> int main() { namespace bl = boost::lambda; typedef std::map<int, std::string> types; types keys_and_values; keys_and_values[ 0 ] = "zero"; keys_and_values[ 1 ] = "one"; keys_and_values[ 2 ] = "Two"; std::for_each( keys_and_values.begin(), keys_and_values.end(), std::cout << bl::constant("Value empty?: ") << std::boolalpha << bl::bind(&std::string::empty, bl::bind(&types::value_type::second, _1)) << "\n"); return 0; }

    Read the article

  • getting boost::gregorian dates from a string

    - by Chris H
    I asked a related question yesterday http://stackoverflow.com/questions/2612343/basic-boost-date-time-input-format-question It worked great for posix_time ptime objects. I'm have trouble adapting it to get Gregorian date objects. try { stringstream ss; ss << dateNode->GetText(); using boost::local_time::local_time_input_facet; //using boost::gregorian; ss.imbue(locale(locale::classic(), new local_time_input_facet("%a, %d %b %Y "))); ss.exceptions(ios::failbit); ss>>dayTime; } catch (...) { cout<<"Failed to get a date..."<<endl; //cout<<e.what()<<endl; throw; } The dateNode-GetText() function returns a pointer to a string of the form Sat, 10 Apr 2010 19:30:00 The problem is I keep getting an exception. So concretely the question is, how do I go from const char * of the given format, to a boost::gregorian::date object? Thanks again.

    Read the article

  • Mac OS X and static boost libs -> std::string fail

    - by Ionic
    Hi all, I'm experiencing some very weird problems with static boost libraries under Mac OS X 10.6.6. The error message is main(78485) malloc: *** error for object 0x1000e0b20: pointer being freed was not allocated *** set a breakpoint in malloc_error_break to debug [1] 78485 abort (core dumped) and a tiny bit of example code which will trigger this problem: #define BOOST_FILESYSTEM_VERSION 3 #include <boost/filesystem.hpp> #include <iostream> int main (int argc, char **argv) { std::cout << boost::filesystem::current_path ().string () << '\n'; } This problem always occurs when linking the static boost libraries into the binary. Linking dynamically will work fine, though. I've seen various reports for quite a similar OS X bug with GCC 4.2 and the _GLIBCXX_DEBUG macro set, but this one seems even more generic, as I'm neither using XCode, nor setting the macro (even undefining it does not help. I tried it just to make sure it's really not related to this problem.) Does anybody have any pointers to why this is happening or even maybe a solution (rather than using the dynamic library workaround)? Best regards, Mihai

    Read the article

  • Boost Asio UDP retrieve last packet in socket buffer

    - by Alberto Toglia
    I have been messing around Boost Asio for some days now but I got stuck with this weird behavior. Please let me explain. Computer A is sending continuos udp packets every 500 ms to computer B, computer B desires to read A's packets with it own velocity but only wants A's last packet, obviously the most updated one. It has come to my attention that when I do a: mSocket.receive_from(boost::asio::buffer(mBuffer), mEndPoint); I can get OLD packets that were not processed (almost everytime). Does this make any sense? A friend of mine told me that sockets maintain a buffer of packets and therefore If I read with a lower frequency than the sender this could happen. ¡? So, the first question is how is it possible to receive the last packet and discard the ones I missed? Later I tried using the async example of the Boost documentation but found it did not do what I wanted. http://www.boost.org/doc/libs/1_36_0/doc/html/boost_asio/tutorial/tutdaytime6.html From what I could tell the async_receive_from should call the method "handle_receive" when a packet arrives, and that works for the first packet after the service was "run". If I wanted to keep listening the port I should call the async_receive_from again in the handle code. right? BUT what I found is that I start an infinite loop, it doesn't wait till the next packet, it just enters "handle_receive" again and again. I'm not doing a server application, a lot of things are going on (its a game), so my second question is, do I have to use threads to use the async receive method properly, is there some example with threads and async receive? Thanks for you attention.

    Read the article

  • Increasing time resolution of BOOST::progress timer

    - by feelfree
    BOOST::progress_timer is a very useful class to measure the running time of a function. However, the default implementation of progress_timer is not accurate enough and a possible way of increasing time resolution is to reconstruct a new class as the following codes show: #include <boost/progress.hpp> #include <boost/static_assert.hpp> template<int N=2> class new_progress_timer:public boost::timer { public: new_progress_timer(std::ostream &os=std::cout):m_os(os) { BOOST_STATIC_ASSERT(N>=0 &&N<=10); } ~new_progress_timer(void) { try { std::istream::fmtflags old_flags = m_os.setf(std::istream::fixed,std::istream::floatfield); std::streamsize old_prec = m_os.precision(N); m_os<<elapsed()<<"s\n" <<std::endl; m_os.flags(old_flags); m_os.precison(old_prec); } catch(...) { } } private: std::ostream &m_os; }; However, when I compile the codes with VC10, the following error appear: 'precison' : is not a member of 'std::basic_ostream<_Elem,_Traits>' Any ideas? Thanks.

    Read the article

  • 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

  • PHP mtChart (new pChart): how do i control the angle of x-axis labels?

    - by gsquare567
    i am trying to graph the results of a survey, where the question is multiple choice. eg. How would you describe this website? format: option | number of times selected | percentage of users who selected that option Informative 1 50% All of the above 1 50% Interesting 0 0% Intelligent 0 0% Cool 0 0% Incredible 0 0% Sleek 0 0% Amazing the graph is a bar graph, where each bar represents one of those options, and the height of the bar depends on the number of times selected. however, the labels are slanted at a 45 degree angle and are barely readable! here is my code: <?php require_once ("includes/common.php"); require_once ("graph/mtChart.min.php"); // type must be specified $type = $_GET['type']; if($type == "surveys_report_MC_or_CB") { // PARAMS $surveyID = $_GET['surveyID']; $questionID = $_GET['questionID']; // END PARAMS $question = SurveyQuestions::getSingle($questionID); $answers = SurveyAnswers::getAll($questionID); $options = SurveyQuestionOptions::getAll($question[SurveyQuestions::surveyQuestionID]); $others = SurveyAnswers::setOptionCounts($options, $answers); $printedOthers = false; // set graph $values = array(); $axisLabels = array(); foreach($options as $option) { $values[$option[SurveyQuestionOptions::optionText]] = $option['count']; $axisLabels[] = $option[SurveyQuestionOptions::optionText]; } $graphs = array(); $graphs[0] = $values; $xName = "Option"; $yName = "Number of Times Selected"; $graphTitle = $question[SurveyQuestions::question]; $series = array("Total"); $showLegend = false; $tall = false; } drawGraph($graphs, $axisLabels, $xName, $yName, $graphTitle, $series, $showLegend, $tall); function drawGraph($graphs, $axisLabels, $xName, $yName, $graphTitle, $series, $showLegend, $tall) { $Graph = ($tall) ? new mtChart(575,375) : new mtChart(575,275); // Dataset definition $avg = 0; $i = 0; foreach ($graphs as $key => $value) { $Graph->AddPoint($value,"series" . $key); $Graph->SetSerieName($series[$key],"series" . $key); // Get average $avg += array_sum($value); $size = sizeof($value); $i += $size; // Calculate x-axis tick interval $step = ceil($size / 25); } $Graph->AddPoint($axisLabels,"XLabel"); $Graph->AddAllSeries(); $Graph->RemoveSerie("XLabel"); $Graph->SetAbsciseLabelSerie("XLabel"); $Graph->SetXAxisName($xName); $Graph->SetYAxisName($yName); // Get from cache if it exists $Graph->enableCaching(NULL, 'graph/cache/'); $Graph->GetFromCache(); // Initialize the graph $Graph->setInterval($step); $Graph->setFontProperties("graph/tahoma.ttf",8); ($showLegend) ? $Graph->setGraphArea(45,30,475,200) : $Graph->setGraphArea(75,30,505,200); $Graph->drawGraphArea(255,255,255,TRUE); $Graph->drawScale(SCALE_START0,100,100,100,TRUE,55,1,TRUE); $Graph->drawGrid(4,TRUE,230,230,230,50); // Draw the 0 line $Graph->setFontProperties("graph/tahoma.ttf",6); $Graph->drawTreshold(0,143,55,72,TRUE,TRUE); // Draw the bar graph $Graph->drawBarGraph(); // Draw average line $Graph->drawTreshold($avg/$i, 0, 0, 0, FALSE, FALSE, 5); // Finish the graph $Graph->setFontProperties("graph/tahoma.ttf",8); if ($showLegend) { $Graph->drawLegend(482,30,255,255,255,255,255,255,100,100,100); } $Graph->setFontProperties("graph/tahoma.ttf",10); $Graph->drawTitle(0,22,$graphTitle,100,100,100,555); // Draw Graph $Graph->Stroke(); } and here is where i use it on the page: <div class="graph_container"> <img src="drawGraph.php?type=surveys_report_MC_or_CB&surveyID=<?php echo $survey[Surveys::surveyID] ?>&questionID=<?php echo $question[SurveyQuestions::surveyQuestionID] ?>" /> is there a setting i can apply to the graph which will make the text look nicer, or at least let me set the angle to 90 degrees so people can read it if they cock their head to the left? thanks! btw, mtchart is located here: http://code.google.com/p/mtchart/ and pchart (the original, which has mainly the same code) is here: http://pchart.sourceforge.net/documentation.php

    Read the article

  • Facebook Graph API: user gender

    - by Mark
    The old Facebook API provided the user sex/gender as part of the default user data. Apparently the new Graph API does not provide that information, even though the documentation says that it does. I've heard people say that you need to request special permissions to get it and other pieces of data, but I have not been successful in getting it to work. Does anyone have an example, using the Facebook Graph API, of how to get the user's gender and/or location (city/state/country/whatever)?

    Read the article

  • How to draw a graph in LaTeX?

    - by Amir Rachum
    First of all, let me say I'm using LyX, though I have no problem using ERT. Secondly, what is the most simplest way to draw a simple graph like this in Latex? I've seen some documents with graphs and I've seen some examples, but I couldn't figure out how to just draw a simple graph - what packages do I need, etc?

    Read the article

  • jQuery Graph from a PHP page

    - by Francesc
    Hi. I'm looking for a jQuery Plugin to create a graph like that http://www.panic.com/blog/2010/03/the-panic-status-board/. To update the graph every x miliseconds from a PHP page and the numbers that are on the top. Is it possible? Do you know any plugin that does that? Thanks!

    Read the article

  • Drawing a Web Graph

    - by Kenn
    I'm trying to draw a graph on an ASP webpage. I'm hoping an API can be helpful, but so far I have not been able to find one. The graph contains labeled nodes and unlabeled directional edges. The ideal output would be something like this. Anybody know of anything pre-built than can help?

    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

  • Boost.Python tutorial in Ubuntu 10.04

    - by Doughy
    I downloaded the latest version of Boost and I'm trying to get the Boost.python tutorial up and running on Ubuntu 10.04: http://www.boost.org/doc/libs/1_43_0/libs/python/doc/tutorial/doc/html/python/hello.html I navigated to the correct directory, ran "bjam" and it compiled using default settings. I did not yet create a bjam config file. The compilation appears to have worked, but now I have no idea how to include the files in my python script. When I try to run the python hello world script, it gives me this error: Traceback (most recent call last): File "./hello.py", line 6, in <module> import hello_ext ImportError: libboost_python.so.1.43.0: cannot open shared object file: No such file or directory Anyone know what is going on?

    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

< Previous Page | 11 12 13 14 15 16 17 18 19 20 21 22  | Next Page >