Search Results

Search found 3861 results on 155 pages for 'assignment operator'.

Page 83/155 | < Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >

  • Android/Java Append String + int

    - by xger86x
    Hi, i have a question, what is the best way to append ints and Strings to build a new String? In the allocation debug tool i see too much allocations if i use the operator +. But i have tried also with StringBuffer and there are still too much allocations. Anyone can help me? Thanks

    Read the article

  • How do you make cin typesafe?

    - by cactusbin
    It is well known that cin is not typesafe (e.g. cin integer; and entering "fifty five" will cause it to flip out). I have seen many not-so-elegant ways to hand this, such as getlining a string and using sstream to convert it to a number, or looping with cin.fail() and clearing the stream and reentering it, etc. Is there any library or anyway to overload the inserter operator to make cin automatically typesafe?

    Read the article

  • using CSS to center FLOATED input elements wrapped in a DIV

    - by Tim
    There's no shortage of questions and answers about centering but I've not been able to get it to work given my specific circumstances, which involve floating. I want to center a container DIV that contains three floated input elements (split-button, text, checkbox), so that when my page is resized wider, they go from this: ||.....[ ][v] [ ] [ ] label .....|| to this ||......................[ ][v] [ ] [ ] label.......................|| They float fine, but when the page is made wider, they stay to the left: ||.....[ ][v] [ ] [ ] label .......................................|| If I remove the float so that the input elements are stacked rather than side-by-side: [ ][v] [ ] [ ] label then they DO center correctly when the page is resized. SO it is the float being applied to the elements of the DIV#hbox inside the container that is messing up the centering. Is what I want to do impossible because of the way float is designed to work? Here is my DOCTYPE, and the markup does validate at w3c: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> Here is my markup: <div id="term1-container"> <div class="hbox"> <div> <button id="operator1" class="operator-split-button">equals</button> <button id="operator1drop">show all operators</button> </div> <div><input type="text" id="term1"></input></div> <div><input type="checkbox" id="meta2"></input><label for="meta2" class="tinylabel">meta</label></div> </div> </div> And here's the (not-working) CSS: #term1-container {text-align: center} .hbox {margin: 0 auto;} .hbox div {float:left; } I have also tried applying display: inline-block to the floated button, text-input, and checkbox; and even though I think it applies only to text, I've also tried applying white-space: nowrap to the #term1-container DIV, based on posts I've seen here on SO. And just to be a little more complete, here's the jQuery that creates the split-button: $(".operator-split-button").button().click( function() { alert( "foo" ); }).next().button( { text: false, icons: { primary: "ui-icon-triangle-1-s" } }).click( function(){positionOperatorsMenu();} ) })

    Read the article

  • What is this conversion called?

    - by LoudNPossiblyRight
    Is there a name or a term for this type of conversion in the c++ community? Has anyone seen this conversion be referred to as "implicit conversion"? class ALPHA{}; class BETA{ public: operator ALPHA(){return alpha;} private: ALPHA alpha; }; void func(ALPHA alpha){} int main(){ BETA beta; func(beta); return 0; }

    Read the article

  • Problem with computed column with NDBUnit

    - by jess
    Hi, I am loading data for tests in tables using xml and ndbunit.But,for a table having computed column,I am having problem.I get this error The column "xyz" cannot be modified because it is either a computed column or is the result of a UNION operator. I have modified the INSERT and UPDATE commands(removed the computed column) of sqladapter in xsd file,but still face the issue. thanks

    Read the article

  • Accessing a namespace containing .base in its name from F#

    - by emaster70
    As the title says, I'm trying to use a class declared in a namespace which contains "base" in its name. Think of a situation like the following: open Foo.base.Bar In C# I'd just use @ before base but F# seems to ignore that and to think that @ is the infix operator used for list concatenation. Since the namespace belongs to a third-party library which I cannot modify, is there a way I can still access it from F#?

    Read the article

  • Bad_alloc exception when using new for a struct c++

    - by bsg
    Hi, I am writing a query processor which allocates large amounts of memory and tries to find matching documents. Whenever I find a match, I create a structure to hold two variables describing the document and add it to a priority queue. Since there is no way of knowing how many times I will do this, I tried creating my structs dynamically using new. When I pop a struct off the priority queue, the queue (STL priority queue implementation) is supposed to call the object's destructor. My struct code has no destructor, so I assume a default destructor is called in that case. However, the very first time that I try to create a DOC struct, I get the following error: Unhandled exception at 0x7c812afb in QueryProcessor.exe: Microsoft C++ exception: std::bad_alloc at memory location 0x0012f5dc.. I don't understand what's happening - have I used up so much memory that the heap is full? It doesn't seem likely. And it's not as if I've even used that pointer before. So: first of all, what am I doing that's causing the error, and secondly, will the following code work more than once? Do I need to have a separate pointer for each struct created, or can I re-use the same temporary pointer and assume that the queue will keep a pointer to each struct? Here is my code: struct DOC{ int docid; double rank; public: DOC() { docid = 0; rank = 0.0; } DOC(int num, double ranking) { docid = num; rank = ranking; } bool operator>( const DOC & d ) const { return rank > d.rank; } bool operator<( const DOC & d ) const { return rank < d.rank; } }; //a lot of processing goes on here; when a matching document is found, I do this: rank = calculateRanking(table, num); //if the heap is not full, create a DOC struct with the docid and rank and add it to the heap if(q.size() < 20) { doc = new DOC(num, rank); q.push(*doc); doc = NULL; } //if the heap is full, but the new rank is greater than the //smallest element in the min heap, remove the current smallest element //and add the new one to the heap else if(rank > q.top().rank) { q.pop(); cout << "pushing doc on to queue" << endl; doc = new DOC(num, rank); q.push(*doc); } Thank you very much, bsg.

    Read the article

  • Size of abstract class

    - by webgenius
    How can I find the size of an abstract class? class A { virtual void PureVirtualFunction() = 0; }; Since this is an abstract class, I can't create objects of this class. How will I be able to find the size of the abstract class A using the 'sizeof' operator?

    Read the article

  • In MSAcess Database, Insert query to insert the character with apostrophe

    - by Suryakavitha
    In MSAcess Database Insert query to insert the character------ N'tetarnyl i have a insert query OleDbCommand cmd = new OleDbCommand("insert into checking values('" + dsGetData.Tables[0].Rows[i][0].ToString() + "','" + dsGetData.Tables[0].Rows[i][1].ToString()+ "')", con); but it is showing me error... syntax error (missing operator) in query expression any idea??? how to write insert query to insert the N'tetarnyl (including apostrophe)

    Read the article

  • How can I perform an idiomatic non-recursive flatten in ruby?

    - by nasmorn
    I have a method that returns an array of arrays. For convenience I use collect on a collection to gather them together. arr = collection.collect {|item| item.get_array_of_arrays} Now I would like to have a single array that contains all the arrays. Of course I can loop over the array and use the + operator to do that. newarr = [] arr.each {|item| newarr += item} But this is kind of ugly, is there a better way?

    Read the article

  • Filter tweets by client name

    - by Ido Shilon
    I'm trying to filter tweets results by client name like - using source operator. I'm trying to do it with a a client named "single platform" , to get tweets like http://twitter.com/#!/phoenixparknyc/status/43340419475570688 but the search doesn't seems to work (tried with quotes as well) http://twitter.com/#!/search/source%3Asingle%20platform%20Specials%2FEvents%20 Any idea how to make the search works ?

    Read the article

  • K/APL style programming in C++?

    - by anon
    I'm writing code in C++, but I really like K/APL's array-oriented style. Does anyone know of a good set of operator overloading tricks / macros / ... to allow some K/APL -style programming in C++? Thanks!

    Read the article

  • Is there a way to combine IN and LIKE in MySQL?

    - by abeger
    I'm currently running a query like this: SELECT * FROM email WHERE email_address LIKE 'ajones@%' OR email_address LIKE 'bsmith@%' OR email_address LIKE 'cjohnson@%' The large number of OR's bothers me. Is there a way to condense this up with something akin to an IN operator, e.g.: SELECT * FROM email WHERE email_address LIKE ('ajones@%', 'bsmith@%', 'cjohnson@%') Or is this just wishful thinking?

    Read the article

  • How to implement == or >= operators for generic type

    - by momsd
    I have a generic type Foo which has a internal generic class Boo. Boo class a property Value of type K. In a method inside Foo i want to do a boo.Value >= value Note that second operand value is of type T. while compiling i am getting following error: Operator '=' cannot be applied to operands of type 'T' and 'T' Can anyone please tell me whats the problem here?

    Read the article

  • [game] How to write ::: in cpp and ??? in c#?

    - by daveny
    These questions are a kind of game, and I did not find the solution for them. It is possible to write ::: in Cpp without using "" or anything like this and the compiler will accept it. (macro-s are prohibited too) And the same is true for C# too, but in C#, you have to write ???. I think Cpp will use the :: scope operator and C# will use '? :' , but I do not know the answers to them. Any idea?

    Read the article

  • extract/slice/reorder lists in (emacs) lisp?

    - by Stephen
    In python, you might do something like i = (0, 3, 2) x = [x+1 for x in range(0,5)] operator.itemgetter(*i)(x) to get (1, 4, 3). In (emacs) lisp, I wrote this function called extract which does something similar, (defun extract (elems seq) (mapcar (lambda (x) (nth x seq)) elems)) (extract '(0 3 2) (number-sequence 1 5)) but I feel like there should be something built in? All I know is first, last, rest, nth, car, cdr... What's the way to go? ~ Thanks in advance ~

    Read the article

  • Which is clearer form: if(!value) or if(flag == value) ?

    - by CodexArcanum
    I understand this is a subjective question, so I apologize if it needs to be closed, but I feel like it comes up often enough for me to wonder if there is a general preference for one form over the other. Obviously, the best answer is "refactor the code so you don't need to test for falsehood" but sometimes there's no easy way to do so and the "else" branch is simply to continue processing. So when you must have an "if not false" construct, which is the preferred standard: The not operator if(!value) Or the test for false if(value == false)

    Read the article

  • why inner class doesn't compile..?

    - by Vincenzo
    This is my code: #include <algorithm> class A { void f() { struct CompareMe { bool operator() (int i, int j) { return i < j; } } comp; int a[] = {1, 2, 3, 4}; int found = std::min_element(a[0], a[3], comp); } } Error message: no matching function for call to ‘min_element(int&, int&, A::f()::CompareMe&) What am I doing wrong?

    Read the article

< Previous Page | 79 80 81 82 83 84 85 86 87 88 89 90  | Next Page >