Search Results

Search found 4206 results on 169 pages for 'equals operator'.

Page 92/169 | < Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >

  • Why is T() = T() allowed in C++?

    - by Rimo
    I believe the expression T() creates an rvalue (by the Standard) However the following code compiles (at least on gcc4.0) class T {... }; int main() { T() = T(); } I know technically this is possible because member functions can be invoked on temporaries and the above is just invoking the operator= on the r-value temporary created from T(). But conceptually this is like assigning a new value to an r-value. Is there a good reason why this is allowed?

    Read the article

  • How to differenciate two tables

    - by Nemat
    Hi friends.... I have two tables.I want to get all records from one table that are different from the records in second table. For eg. if we have four records in first table like A,B,C,D and three records in second table thats A,B,C then the answer of query should be D. I have tried "EXCEPT" operator but it doesnt work fine.Kindly help me in writing correct query for the given problem. Any help is appreciated.... Thanks in Advance Nemat

    Read the article

  • [C#] How to do a search from a list with non-prefix keywords

    - by aNui
    First of all, sorry if my english or my post got any mistakes. I am programming a program to search the name from the list and I need to find them if the keyword is not in front of the names (that's what I mean non-prefix) e.g. if I my list is the music instruments and I type "guit" to the search textbox. It should find the names "Guitar, Guitarrón, Acoustic Guitar, Bass Guitar, ..." or something like this Longdo Dictionary's search suggestion. here is my simple and stupid algorithm (that's all I can do) const int SEARCHROWLIMIT = 30; private string[] DoSearch(string Input, string[] ListToSearch) { List<string> FoundNames = new List<string>(); int max = 0; bool over = false; for (int k = 0; !over; k++) { foreach (string item in ListToSearch) { max = (max > item.Length) ? max : item.Length; if (k > item.Length) continue; if (k >= max) { over = true; break; } if (!Input.Equals("Search") && item.Substring(k, item.Length - k).StartsWith(Input, StringComparison.OrdinalIgnoreCase)) { bool exist = false; int i = 0; while (!exist && i < FoundNames.Count) { if (item.Equals(FoundNames[i])) { exist = true; break; } i++; } if (!exist && FoundNames.Count < SEARCHROWLIMIT) FoundNames.Add(item); else if (FoundNames.Count >= SEARCHROWLIMIT) over = true; } } } return FoundNames.ToArray(); } I think this algorithm is too slow for a large number of names and after several trial-and-error, I decided to add SEARCHROWLIMIT to breaks the operation And I also think there're some readymade methods that can do that. And another problem is I need to search music instruments by a category like strings, percussions, ... and by the country of origins. So I need to search them with filter by type and country. please help me. P.S. Me and my friends are just student from Thailand and developing the project to compete in Microsoft Imagine Cup 2010 and please become fan on our facebook page [KRATIB][3]. And we're so sorry we don't have much information in English but you can talk to us in English.

    Read the article

  • Shift Operators in C++

    - by Codeguru
    If the value after the shift operator is greater than the number of bits in the left-hand operand, the result is undefined. If the left-hand operand is unsigned, the right shift is a logical shift so the upper bits will be filled with zeros. If the left-hand operand is signed, the right shift may or may not be a logical shift (that is, the behavior is undefined). Can somebody explain me what the above lines mean??

    Read the article

  • Beginner Android Dev question navigating through intents, getting errors not sure how to fix it. I've tried rearranging and everything even tabbing.

    - by user554786
    /*I created this Sign-In page. I start by declaring variables for username/password & buttons. If user enters "test" as username & "test" as password and hits the login button, its supposed to go to the DrinksTwitter.class activity, else throw error message I created. To me the code and login makes perfect sense. I'm not sure why it wont go to the next activity I want it to go to */ package com.android.drinksonme; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; public class Screen2 extends Activity { // Declare our Views, so we can access them later private EditText etUsername; private EditText etPassword; private Button btnLogin; private Button btnSignUp; private TextView lblResult; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); // Get the EditText and Button References etUsername = (EditText)findViewById(R.id.username); etPassword = (EditText)findViewById(R.id.password); btnLogin = (Button)findViewById(R.id.login_button); btnSignUp = (Button)findViewById(R.id.signup_button); lblResult = (TextView)findViewById(R.id.result); // Check Login String username = etUsername.getText().toString(); String password = etPassword.getText().toString(); if(username.equals("test") && password.equals("test")){ final Intent i = new Intent(Screen2.this, DrinksTwitter.class); btnLogin.setOnClickListener(new OnClickListener() { public void onClick(View v) { startActivity(i); } // lblResult.setText("Login successful."); else { /* ERROR- Syntax error on token "else", { expected */ lblResult.setText("Invalid username or password."); } } }); final Intent k = new Intent(Screen2.this, SignUp.class); btnSignUp.setOnClickListener(new OnClickListener() { public void onClick(View v) { startActivity(k); } }); /* ERROR- Syntax error, insert "}" to complete Statement*/ } }

    Read the article

  • Creating an instance within the Class itself

    - by didxga
    What's going on when the assignment statement executed at Line 4, does compiler ignore the new operator and keep the foo variable being null or something else happen to handle this awkward moment? public class Foo { // creating an instance before its constructor has been invoked, suppose the "initializing" // gets printed in constructor as a result of the next line, of course it will not print it private Foo foo = new Foo();//Line 4 public Foo() { System.out.println("initializing"); } }

    Read the article

  • C++ Why isn't call by reference needed for strcpy()

    - by Ribbs
    I have a homework assignment with a number of questions. One is asking why the strcpy() function doesn't need the call by reference operator for CStrings. I've looked through the book numerous times and I can't, for the life of me, find the answer. Can anyone help explain this to me? It is an array of sorts so I would think you would need the call by reference.

    Read the article

  • Haskell lists difference

    - by user559354
    I'm trying make a lists difference. Found directly prelude operator \\\\ that makes lists difference. But errors Not in scope: '\\\\' occurs. Here is my simple from command line interpreter: Prelude> ([1,2,3] ++ [5,6]) -- works like expected [1,2,3,4,5,6] prelude> ([1,2,3] \\\\ [1,2]) -- erros occurs <interactive>:1:11: Not in scope: "\\\\" Thanks for explanation where I make a mistake.

    Read the article

  • Circular increment: Which is "better"?

    - by Helper Method
    When you have a circular buffer represented as an array, and you need the index to wraparound (i.e., when you reach the highest possible index and increment it), is it "better" to: return (i++ == buffer.length) ? 0: i; Or return i++ % buffer.length; Has using the modulo operator any drawbacks? Is it less readable than the first solution?

    Read the article

  • sizeof, size_t and dtddef.h

    - by yCalleecharan
    Hi, if I'm using the sizeof operator and making use of size_t in my code, do I have necessarily have to include the preprocessor directive stddef.h ? I haven't included the stddef.h and my code compiles without warning with both MVS2008 and with Borland C++ BuilderX. Thanks a lot...

    Read the article

  • Censoring selected words (replacing them with ****) using a single replaceAll?

    - by aioobe
    I'd like to censor some words in a string by replacing each character in the word with a "*". Basically I would want to do String s = "lorem ipsum dolor sit"; s = s.replaceAll("ipsum|sit", $0.length() number of *)); so that the resulting s equals "lorem ***** dolor ***". I know how to do this with repeated replaceAll invokations, but I'm wondering, is this possible to do with a single replaceAll?

    Read the article

  • avoid NullPointerException at the first cycle

    - by user1508419
    I have this piece of code: EventSnapshot snapshotEvent = new EventSnapshot(); EventSnapshot currentEvent = new EventSnapshot(); do { ... currentEvent.setContent(in_stats); ... if(!snapshotEvent.equals(currentEvent)) snapshotEvent.setContent(in_stats); } while(true); At the first cycle I get a NullPointerException because obviously the object snapshotEvent is empty. At the second cycle this doesn't happen.how can avoid this problem?

    Read the article

  • Operation precedence on postgress

    - by user24691
    I have set new division on postgress pg_operator table because i want tath when is division by zero return 0. i have write this: create operator / ( procedure = zero_division, leftarg = double precision, rightarg = double precision); where zero_division is: CREATE OR REPLACE FUNCTION zero_division(double precision, double precision) RETURNS double precision AS 'select case when $2 = 0 then 0 else $1 / $2::real end;' LANGUAGE sql IMMUTABLE COST 100; when i run value/ 0 i get error of division.

    Read the article

  • When To Use IEquatable And Why

    - by ChloeRadshaw
    I just dont understand this - What does IEuqtable buy you exactly?? The only reason I can see it being useful is when creating a generic type and forcing users to implement and write a good equals method. What am I missing

    Read the article

  • How to get number of entries in a Lua table?

    - by romkyns
    Sounds like a "let me google it for you" question, but somehow I can't find an answer. The Lua # operator only counts entries with integer keys, and so does table.getn: tbl = {} tbl["test"] = 47 tbl[1] = 48 print(#tbl, table.getn(tbl)) -- prints "1 1" count = 0 for _ in pairs(tbl) do count = count + 1 end print count -- prints "2" How do I get the number of all entries?

    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

  • Comparison of IPEndPoint objects not working

    - by Martin Mizzell
    I have an IPEndPoint a and b, whose IPAddress and Port are exactly the same, but the == operator is on the IPEndPoint not returning true. To make things even stranger, I tried to circumvent the problem by simply comparing the IPAddress and Port individually and it is STILL not returning true. Has anyone encountered this before? If so, I am all ears to performant solutions. We have collections of as many as 10k IPEndPoints and are querying into them via LINQ (PLINQ pretty soon).

    Read the article

  • From Now() to Current_timestamp in Postgresql

    - by xRobot
    In mysql I am able to do this: SELECT * FROM table WHERE auth_user.lastactivity > NOW() - 100 now in postgresql I am using this query: SELECT * FROM table WHERE auth_user.lastactivity > CURRENT_TIMESTAMP - 100 but I get this error: operator does not exist: timestamp with time zone - integer How can I resolve ?

    Read the article

  • How do I define my own operators in the Io programming language?

    - by klep
    I'm trying to define my own operator in Io, and I'm having a hard time. I have an object: MyObject := Object clone do( lst := list() !! := method(n, lst at(n)) ) But when I call it, like this: x := MyObject clone do(lst appendSeq(list(1, 2, 3))) x !! 2 But I get an exception that argument 0 to at must not be nil. How can I fix?

    Read the article

  • returning aligned memory with new?

    - by Steve
    I currently allocate my memory for arrays using the MS specific mm_malloc. I align the memory, as I'm doing some heavy duty math and the vectorization takes advantage of the alignment. I was wondering if anyone knows how to overload the new operator to do the same thing, as I feel dirty malloc'ing everywhere (and would eventually like to also compile on Linux)? Thanks for any help

    Read the article

< Previous Page | 88 89 90 91 92 93 94 95 96 97 98 99  | Next Page >