Search Results

Search found 2659 results on 107 pages for 'vector drawings'.

Page 75/107 | < Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >

  • C/C++ efficient bit array

    - by aaa
    hi. Can you recommend efficient/clean way to manipulate arbitrary length bit array? right now I am using regular int/char bitmask, but those are not very clean when array length is greater than datatype length. std vector<bool> is not available for me. thanks

    Read the article

  • C++ Class Construction and Member Initialization

    - by anachoret
    The first print shows the member value to be false, and the other two prints show it as true. Why does the first output differ from the last two? #include #include using namespace std; class MyClass { public: bool value; bool stuff; }; class Container { public: vector my_classes; Container() { MyClass c; cout

    Read the article

  • Access Voilation in std::pair

    - by sameer karjatkar
    I have an application which is trying to populate a pair . Out of no where the application crashes . The Windbg analysis on the crash dump suggest PRIMARY_PROBLEM_CLASS: INVALID_POINTER_READ DEFAULT_BUCKET_ID: INVALID_POINTER_READ STACK_TEXT: 0389f1dc EPFilter32!std::vector,std::allocator ::size+0xc INVALID_POINTER_READ_c0000005_Test.DLL!std::vector_std::pair_unsigned_int, unsigned_int_,std::allocator_std::pair_unsigned_int,unsigned_int___::size Following is the statement in the code where it fails const branch_info& b1 = en1.m_branches[i1]; where branch_info is std::pair and the en1.m_branches[i1] fetches me a pair value

    Read the article

  • What tool to use to draw file tree diagram

    - by Michael
    Given a file tree - a directory with directories in it etc, what software would you recommend to create a diagram of the file-tree as a graphic file that I can embed in a word processor document I prefer vector (SVG, EPS, EMF...) files. The tool must run on Windows, but preferably cross-platform. The tool may be commercial but preferably free.

    Read the article

  • AddDays() not working within a while loop

    - by r0bb077
    Is there anything that stops the DateTime AddDays() method that doesn't run within a while loop. I have this simple bit of code; DateTime last_day = monthCalendar2.SelectionRange.End; DateTime first_day = new DateTime(year, month, day); //Insert dates into vector while (first_day != last_day) { dates.Add(first_day); first_day.AddDays(1); } I step through the program and first_day never changes, anyone know why?!

    Read the article

  • Weighted random numbers in MATLAB

    - by yuk
    How to randomly pick up N numbers from a vector a with weight assigned to each number? Let's say: a = 1:3; % possible numbers weight = [0.3 0.1 0.2]; % corresponding weights In this case probability to pick up 1 should be 3 times higher than to pick up 2. Sum of all weights can be anything.

    Read the article

  • c++ program debugged well with Cygwin4 (under Netbeans 7.2) but not with MinGW (under QT 4.8.1)

    - by GoldenAxe
    I have a c++ program which take a map text file and output it to a graph data structure I have made, I am using QT as I needed cross-platform program and GUI as well as visual representation of the map. I have several maps in different sizes (8x8 to 4096x4096). I am using unordered_map with a vector as key and vertex as value, I'm sending hash(1) and equal functions which I wrote to the unordered_map in creation. Under QT I am debugging my program with QT 4.8.1 for desktop MinGW (QT SDK), the program works and debug well until I try the largest map of 4096x4096, then the program stuck with the following error: "the inferior stopped because it received a signal from operating system", when debugging, the program halt at the hash function which used inside the unordered_map and not as part of the insertion state, but at a getter(2). Under Netbeans IDE 7.2 and Cygwin4 all works fine (debug and run). some code info: typedef std::vector<double> coordinate; typedef std::unordered_map<coordinate const*, Vertex<Element>*, container_hash, container_equal> vertexsContainer; vertexsContainer *m_vertexes (1) hash function: struct container_hash { size_t operator()(coordinate const *cord) const { size_t sum = 0; std::ostringstream ss; for ( auto it = cord->begin() ; it != cord->end() ; ++it ) { ss << *it; } sum = std::hash<std::string>()(ss.str()); return sum; } }; (2) the getter: template <class Element> Vertex<Element> *Graph<Element>::getVertex(const coordinate &cord) { try { Vertex<Element> *v = m_vertexes->at(&cord); return v; } catch (std::exception& e) { return NULL; } } I was thinking maybe it was some memory issue at the beginning, so before I was thinking of trying Netbeans I checked it with QT on my friend pc with a 16GB RAM and got the same error. Thanks.

    Read the article

  • C++ struct sorting

    - by Betamoo
    I have a vector of custom Struct that needs to be sorted on different criteria each time Implementing operator < will allow only one criteria But I want to be able to specify sorting criteria each time I call C++ standard sort. How to do that? Please note it is better to be efficient in running time.. Thanks

    Read the article

  • Setting XTick or XLabels for a plot containing millisecond data

    - by Dave
    I am trying to set the X-Axis labels on a plot. I have a vector of times, these go down to the millisecond level. I have tried setting both XTick and XTickLabel properties but things are not working correctly (labels are not valid). Any suggestions on what one needs to do to get datetick to work when working with times that go down to the second/millisecond level? Are there any alternatives to using datetick? Any suggestions are appreciated.

    Read the article

  • Difference between a Deprecated and an Legacy API?

    - by Vaibhav Bajpai
    I was studying the legacy API's in the Java's Collection Framework and I learnt that classes such as Vector and HashTable have been superseded by ArrayList and HashMap. However still they are NOT deprecated, and deemed as legacy when essentially, deprecation is applied to software features that are superseded and should be avoided, so, I am not sure when is a API deemed legacy and when it is deprecated.

    Read the article

  • C++, class as parameter to a method, not template.

    - by ra170
    So, I came across an interesting method signature that I don't quite understand, it went along the lines of: void Initialize(std::vector< std::string > & param1, class SomeClassName * p); what I don't understand is the "class" keyword being used as the parameter, why is it there? Is it necessary to specify or it is purely superficial?

    Read the article

  • [C++] Converting Integer to a Byte Representation

    - by bobber205
    How can I convert a integer to it's byte representation. I want to take an integer and return a vector that has contains 1's and 0's of the integers byte representation. I'm having a heck of a time trying to do this myself so I'd thought I would ask to see if there was a built in library function that could help. Thanks!

    Read the article

  • QT List of Callbacks

    - by Talguy
    I am trying to make a real-time data collection application that has timed task. Each task can have a different or the same update period. I would like to store the task with the common update period in a list where I can iterate through it and call the function that I registered in the list. How would I go about adding callbacks to a data structure like a list or vector? Can I store slots in them?

    Read the article

  • Weird seg fault problem

    - by bluedaemon
    Greetings, I'm having a weird seg fault problem. My application dumps a core file at runtime. After digging into it I found it died in this block: #include <lib1/c.h> ... x::c obj; obj.func1(); I defined class c in a library lib1: namespace x { struct c { c(); ~c(); void fun1(); vector<char *> _data; }; } x::c::c() { } x::c::~c() { for ( int i = 0; i < _data.size(); ++i ) delete _data[i]; } I could not figure it out for some time till I ran nm on the lib1.so file: there are more function definitions than I defined: x::c::c() x::c::c() x::c::~c() x::c::~c() x::c::func1() x::c::func2() After searching in code base I found someone else defined a class with same name in same namespace, but in another library lib2 as follows: namespace x { struct c { c(); ~c(); void func2(); vector<string> strs_; }; } x::c::c() { } x::c::~c() { } My application links to lib2, which has dependency on lib1. This interesting behavior brings several questions: Why would it even work? I would expect a "multiple definitions" error while linking against lib2 (which depends upon lib1) but never had such. The application seems to be doing what's defined in func1 except it dumps a core at runtime. After attaching debugger, I found my application calls the ctor of class c in lib2, then calls func1 (defined in lib1). When going out of scope it calls dtor of class c in lib2, where the seg fault occurs. Can anybody teach me how this could even occur? How can I prevent such problems from happening again? Is there any C++ syntax I can use? Forgot to mention I'm using g++ 4.1 on RHEL4, thank you very much!

    Read the article

  • draw a curve Sketchup using ruby

    - by David
    Below are some point 3d 15.733798,20.019757,23.006311 15.733798,19.847666,23.006311 15.723798,19.847666,23.006311 15.723798,20.019757,23.006311 15.733798,20.019757,23.006311 and this is a vector 0.0,0.0,-0.1 Is it possible to draw a curve from the information above in sketchup? Thank you

    Read the article

  • Can I Have Polymorphic Containers With Value Semantics in C++11?

    - by John Dibling
    This is a sequel to a related post which asked the eternal question: Can I have polymorphic containers with value semantics in C++? The question was asked slightly incorrectly. It should have been more like: Can I have STL containers of a base type stored by-value in which the elements exhibit polymorphic behavior? If you are asking the question in terms of C++, the answer is "no." At some point, you will slice objects stored by-value. Now I ask the question again, but strictly in terms of C++11. With the changes to the language and the standard libraries, is it now possible to store polymorphic objects by value in an STL container? I'm well aware of the possibility of storing a smart pointer to the base class in the container -- this is not what I'm looking for, as I'm trying to construct objects on the stack without using new. Consider if you will (from the linked post) as basic C++ example: #include <iostream> using namespace std; class Parent { public: Parent() : parent_mem(1) {} virtual void write() { cout << "Parent: " << parent_mem << endl; } int parent_mem; }; class Child : public Parent { public: Child() : child_mem(2) { parent_mem = 2; } void write() { cout << "Child: " << parent_mem << ", " << child_mem << endl; } int child_mem; }; int main(int, char**) { // I can have a polymorphic container with pointer semantics vector<Parent*> pointerVec; pointerVec.push_back(new Parent()); pointerVec.push_back(new Child()); pointerVec[0]->write(); pointerVec[1]->write(); // Output: // // Parent: 1 // Child: 2, 2 // But I can't do it with value semantics vector<Parent> valueVec; valueVec.push_back(Parent()); valueVec.push_back(Child()); // gets turned into a Parent object :( valueVec[0].write(); valueVec[1].write(); // Output: // // Parent: 1 // Parent: 2 }

    Read the article

  • R: optimal way of computing the "product" of two vectors

    - by Musa
    Hi, Let's assume that I have a vector r <- rnorm(4) and a matrix W of dimension 20000*200 for example: W <- matrix(rnorm(20000*200),20000,200) I want to compute a new matrix M of dimension 5000*200 such that m11 <- r%*%W[1:4,1], m21 <- r%*%W[5:8,1], m12 <- r%*%W[1:4,2] etc. (i.e. grouping rows 4-by-4 and computing the product). What's the optimal (speed,memory) way of doing this? Thanks in advance.

    Read the article

  • in R, how can i save the value of "print"

    - by alex
    in R , when i use "print", i can see all the values, but how can i save this as a vector for example, in for loop, for (i in 1:10), i want the value of A , when i= 1,2,3,4..... but if i use the x=A, it only have the final value of A which is the value when i = 10. so , how can i save the vaule in print(A)

    Read the article

  • C++ return object

    - by Pauff
    I have a class that has a vector of objects. What do I need to do to return one of this objects and change it outside the class, keeping the changings? Is it possible to do with regular pointers? Is there a standard procedure? (And yes, my background is in Java.)

    Read the article

  • R: How to replace elements of a data.frame?

    - by John
    I'm trying to replace elements of a data.frame containing "#N/A" with "NULL", and I'm running into problems: foo <- data.frame("day"= c(1, 3, 5, 7), "od" = c(0.1, "#N/A", 0.4, 0.8)) indices_of_NAs <- which(foo == "#N/A") replace(foo, indices_of_NAs, "NULL") Error in [<-.data.frame(*tmp*, list, value = "NULL") : new columns would leave holes after existing columns I think that the problem is that my index is treating the data.frame as a vector, but that the replace function is treating it differently somehow, but I'm not sure what the issue is?

    Read the article

< Previous Page | 71 72 73 74 75 76 77 78 79 80 81 82  | Next Page >