Search Results

Search found 4593 results on 184 pages for 'operator equal'.

Page 39/184 | < Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >

  • Is there a jQuery widget equal to DOJO's TitlePane?

    - by Bill Caswell
    I like the visual behavior of the DOJO TitlePane widget, but it has too much other bunk for my purpose. http://dojotoolkit.org/reference-guide/dijit/TitlePane.html#dijit-titlepane Is anyone aware of a jQuery widget that provides the same ability to expose and hide content in a stacked manner with the little flippy-arrow, pane highlighting on mouse over, etc? An accordion does not accomplish my goal being able to have multiple panes open at the same time. Thanks in advance.

    Read the article

  • Simple Scala syntax - trying to define "==" operator - what am I missing?

    - by Alex R
    While experimenting with some stuff on the REPL, I got to a point where I needed something like this: scala class A(x:Int) { println(x); def ==(a:A) : Boolean = { this.x == a.x; } } Just a simple class with an "==" operator. Why doesn't it work??? Here's the result: :10: error: type mismatch; found : A required: ?{val x: ?} Note that implicit conversions are not applicable because they are ambiguous: both method any2ArrowAssoc in object Predef of type [A](x: A)ArrowAssoc[A] and method any2Ensuring in object Predef of type [A](x: A)Ensuring[A] are possible conversion functions from A to ?{val x: ?} class A(x:Int) { println(x); def ==(a:A) : Boolean = { this.x == a.x; } } ^ This is scala 2.8 RC1. Thanks

    Read the article

  • how to keep the height of the div equal to the union of the height of elements inside it

    - by Idlecool
    I have been making a wordpress template. i got stuck at some place... the problem is, how to maintain the size of a div = the size of p tags and img tags... i have seen that the div only able to contain the p tag but the img tag over flows... i have my code in this following order: <div> <p> some contents <img src="an_image"/> some morecontent</p> <div> what i basically want is: div height = <p> height U(union) <img> height but, what actually i am getting is: div height = <p> height; while <img> over flows i have already checked for similar questions on Stack Overflow but was not able to find one which solves a similar problem.. please give me some idea..

    Read the article

  • Why can I set an anonymous enum equal to another in C but not C++?

    - by samoz
    I have the following code snippet: enum { one } x; enum { two } y; x = y; That will compile in C, but in C++, I get the following error: test.c:6: error: cannot convert ‘main()::<anonymous enum>’ to ‘main()::<anonymous enum>’ in assignment Can someone explain to me why this is happening? I would prefer an answer with some specifics about why the compiler behaves this way, rather than just "You can't do that"

    Read the article

  • netbeans autocompletion when using singleton to retrieve object instead of new operator?

    - by fayer
    when i use the 'new' operator to instantiate a class, netbeans has no problem to autocomplete the members of the object. $instance = new Singleton(); $instance-> // shows test() method but when i use a singleton to retrieve an object it cannot autocomplete the members in the object retrieved. the getInstance code looks like this: public function test() { echo "hello"; } public static function getInstance() { if ( ! is_object(self::$_instance)) { self::$_instance = new self(); self::$_instance->initialize(); } return self::$_instance; } so i use: $instance = Singleton::getInstance(); $instance-> // no autocompletion! does anyone have the same problem? how do i work around it? thanks!

    Read the article

  • C# Bug or Brain Teaser? Cast working only with Coalesce (??) Operator

    - by Alex
    This is very strange, maybe someone can explain what's happening, or this is a bug (though I tend to think that this is probably just something intricate about C#). The following code throws the error "Cannot implicitly convert type 'uint?' to 'uint'.": public void Test(UInt32? p) { UInt32 x = p; } However, this code works without error: public void Test(UInt32? p) { UInt32 x = p ?? 1; } Huh? Why does this work? Why would the coalesce operator cause implicit conversion of UInt32? (nullable) to UInt32 (non-nullable), while the first error message says that there is no implicit conversion between those types?

    Read the article

  • C# string equality operator returns false, but I'm pretty sure it should be true... What?!

    - by Daniel Schaffer
    I'm trying to write a unit test for a piece of code that generates a large amount of text. I've run into an issue where the "expected" and "actual" strings appear to be equal, but Assert.AreEqual throws, and both the equality operator and Equals() return false. The result of GetHashCode() is different for both values as well. However, putting both strings into text files and comparing with DiffMerge tells me they're the same. Additionally, using Encoding.ASCII.GetBytes() on both values and then using SequenceEquals to compare the resulting byte arrays returns true. The values are 34KB each, so I'll hold off putting them here for now. Any ideas? I'm completely stumped.

    Read the article

  • Why cast null before checking if object is equal to null?

    - by jacerhea
    I was looking through the "Domain Oriented N-Layered .NET 4.0 Sample App" project and ran across some code that I do not understand. In this project they often use syntax like the following to check arguments for null: public GenericRepository(IQueryableContext context,ITraceManager traceManager) { if (context == (IQueryableContext)null) throw new ArgumentNullException("context", Resources.Messages.exception_ContainerCannotBeNull); Why would you cast null to the type of the object you are checking for null?

    Read the article

  • set the height and width of div element equal to img elemet's height and width?

    - by Syom
    i have an img element <img src="some.jpg" style="position:absolute;"> i don't know the height and width of the image, because it loads dinamicaly, but i need to create a div element with position absolute, which must have the same width and height than the image. i.e <div style="position:absolute;height:'img->height';width:'img->width'"> is it possible to do with just css? if no, maybe jquery? Thanks

    Read the article

  • Is there a work-around that allows missing data to equal NULL for LOAD DATA INFILE in MySQL?

    - by richardh
    I have a lot of large csv files with NULL values stored as ,, (i.e., no entry). After a lot of searching I found that this is a known "bug", although it may be a feature for some users. Is there a way that I can fix this on the fly without pre-processing? These data are all numeric, so a zero value is very different from NULL. Or if I have to do pre-processing, is there one that is most promising for dealing with tens of csv files of 100mb to 1gb? Thanks!

    Read the article

  • Why does ElapsedTicks X 10 000 not equal ElapsedMilliseconds for .Net's Stopwatch?

    - by uriDium
    I am trying to performance test some code. I am using a stopwatch. When I output the number of milliseconds it always tells me 0 so I thought that I would try the number of ticks. I am seeing that the number of ticks is about 20 000 to 30 000. Looking at the MSDN at TimeSpan.TicksPerMillisecond it says that is 10 000 ticks per millisecond. In that case why are the elapsed milliseconds on my stopwatch not appearing as 2 or 3? What am I missing? I have even outputed the result on the same line. This is what I get. Time taken: 26856 ticks, 0 ms And it is constant.

    Read the article

  • All things equal what is the fastest way to output data to disk in C++?

    - by user260197
    I am running simulation code that is largely bound by CPU speed. I am not interested in pushing data in/out to a user interface, simply saving it to disk as it is computed. What would be the fastest solution that would reduce overhead? iostreams? printf? I have previously read that printf is faster. Will this depend on my code and is it impossible to get an answer without profiling? Edit: Output data needs to be in text format, whether tab or comma separated. This will require formatting, precision, etc. Running in Windows.

    Read the article

  • Is there a way to split the results of a select query into two equal halfs?

    - by Matthias
    I'd like to have a query returning two ResultSets each of which holding exactly half of all records matching a certain criteria. I tried using TOP 50 PERCENT in conjunction with an Order By but if the number of records in the table is odd, one record will show up in both resultsets. Example: I've got a simple table with TheID (PK) and TheValue fields (varchar(10)) and 5 records. Skip the where clause for now. SELECT TOP 50 PERCENT * FROM TheTable ORDER BY TheID asc results in the selected id's 1,2,3 SELECT TOP 50 PERCENT * FROM TheTable ORDER BY TheID desc results in the selected id's 3,4,5 3 is a dup. In real life of course the queries are fairly complicated with a ton of where clauses and subqueries.

    Read the article

  • Open generic interface types of open implementation don't equal interface type?

    - by George Mauer
    Here's a test that should, in my opinion be passing but is not. [TestMethod] public void can_get_open_generic_interface_off_of_implementor() { typeof(OpenGenericWithOpenService<>).GetInterfaces().First() .ShouldEqual(typeof(IGenericService<>)); } public interface IGenericService<T> { } public class OpenGenericWithOpenService<T> : IGenericService<T> { } Why does this not pass? Given Type t = typeof(OpenGenericWithOpenService<>) how do I get typeof(IGenericService<)? I'm generally curious, but if you're wondering what I'm doing, I'm writing a Structuremap convention that forwards all interfaces implemented by a class to the implementation (as a singleton).

    Read the article

  • How does C++ free the memory when a constructor throws an exception and a custom new is used

    - by Joshua
    I see the following constructs: new X will free the memory if X constructor throws. operator new() can be overloaded. The canonical definition of an operator new overload is void *operator new(heap h) and the corrisponding operator delete. The most common operator new overload is pacement new, which is void *operator new(void *p) { return p; } You almost always cannot call delete on the pointer given to placement new. This leads to a single question. How is memory cleaned up when X constructor throws and an overloaded new is used?

    Read the article

  • DB2 increase bufferpool size and compressed tables not equal better performance. Why?

    - by Mestika
    Hi, I’m working on tuning and increasing the performance of my IBM DB2 version 9.7 database. I’ve been searching around the net for the last couple of days and learned that if I created my tables in COMPRESS mode and created one more bufferpool and set both of them to access 1024mb, then the performance in my queries should increase because of the less I/Os to the disks. However, when I run my time analysis, the performance Decrease. I added the new additions to my regular database with the indexes I’ve used all the time. Each time I search google I come up with the statement that: Increased bufferpool size and several bufferpools AND a table compression SHOULD prove to get better performance. I’m very puzzled about the total unexpected result. Are there some tuning mechanisms I’ve forgot or does anyone have a explanation for this odd behavior? Sincerely Mestika

    Read the article

  • getting a combo box that has a row source equal to a query - and the query takes data from a form -

    - by primus285
    I have a combo box with a row source based on an SQL query about like SELECT DISTINCT Database_New.ASEC FROM Database_New WHERE Database_New.Date= DateSerial([cboYear], 1, 1) And Database_New.Date<= DateSerial([cboYear], 12, 31); the trouble is that if I change the value of cboYear, the values in the drop down cboASEC do not update. I have to open the query, save it and close it to get the thing to update while I have the form open. Is there a way to get the cboASEC to update somehow? maybe a little tidbit of code in the cboYear - afterupdate?

    Read the article

  • Template class + virtual function = must implement?

    - by sold
    This code: template <typename T> struct A { T t; void DoSomething() { t.SomeFunction(); } }; struct B { }; A<B> a; is easily compiled without any complaints, as long as I never call a.DoSomething(). However, if I define DoSomething as a virtual function, I will get a compile error saying that B doesn't declare SomeFunction. I can somewhat see why it happens (DoSomething should now have an entry in the vtable), but I can't help feeling that it's not really obligated. Plus it sucks. Is there any way to overcome this? EDIT 2: Okay. I hope this time it makes sence: Let's say I am doing intrusive ref count, so all entities must inherit from base class Object. How can I suuport primitive types too? I can define: template <typename T> class Primitive : public Object { T value; public: Primitive(const T &value=T()); operator T() const; Primitive<T> &operator =(const T &value); Primitive<T> &operator +=(const T &value); Primitive<T> &operator %=(const T &value); // And so on... }; so I can use Primitive<int>, Primitive<char>... But how about Primitive<float>? It seems like a problem, because floats don't have a %= operator. But actually, it isn't, since I'll never call operator %= on Primitive<float>. That's one of the deliberate features of templates. If, for some reason, I would define operator %= as virtual. Or, if i'll pre-export Primitive<float> from a dll to avoid link errors, the compiler will complain even if I never call operator %= on a Primitive<float>. If it would just have fill in a dummy value for operator %= in Primitive<float>'s vtable (that raises an exception?), everything would have been fine.

    Read the article

  • Java Instance of: Supertypes and Subtypes seem to be equal? How to test exactly for Type?

    - by jens
    I need to test, if an instance is exactly of a given type. But it seems that instanceof returns true also if the subtype is tested for the supertype (case 3). I never knew this before and I am quite surprised. Am I doing something wrong here? How do I exactly test for a given type? //.. class DataSourceEmailAttachment extends EmailAttachment //... EmailAttachment emailAttachment = new EmailAttachment(); DataSourceEmailAttachment emailAttachmentDS = new DataSourceEmailAttachment(); if (emailAttachment instanceof EmailAttachment){ System.out.println(" 1"); } if (emailAttachment instanceof DataSourceEmailAttachment){ System.out.println(" 2"); } if (emailAttachmentDS instanceof EmailAttachment){ System.out.println(" 3 "); } if (emailAttachmentDS instanceof DataSourceEmailAttachment){ System.out.println(" 4"); } RESULT: 1 3 4 I want to avoid case 3, I only want "exact matches" (case 1 and 4) how do I test for them?

    Read the article

  • How to call operator<< on "this" in a descendant of std::stringstream?

    - by romkyns
    class mystream : public std::stringstream { public: void write_something() { this << "something"; } }; This results in the following two compile errors on VC++10: error C2297: '<<' : illegal, right operand has type 'const char [10]' error C2296: '<<' : illegal, left operand has type 'mystream *const ' Judging from the second one, this is because what this points at can't be changed, but the << operator does (or at least is declared as if it does). Correct? Is there some other way I can still use the << and >> operators on this?

    Read the article

  • C++ volatile required when spinning on boost::shared_ptr operator bool()?

    - by JaredC
    I have two threads referencing the same boost::shared_ptr: boost::shared_ptr<Widget> shared; On thread is spinning, waiting for the other thread to reset the boost::shared_ptr: while(shared) boost::thread::yield(); And at some point the other thread will call: shared.reset(); My question is whether or not I need to declare the shared pointer as volatile to prevent the compiler from optimizing the call to shared.operator bool() out of the loop and never detecting the change? I know that if I were simply looping on a variable, waiting for it to reach 0 I would need volatile, but I'm not sure if boost::shared_ptr is implemented in such a way that it is not necessary here.

    Read the article

  • Shortcut to get all private field names combined with && operator as a generated line of code?

    - by burak ozdogan
    Hi, Is it possible to use reflection when we write a code-template? I was just thinking if it is possible to write a piece of code-template that will return me a list of all private field in the class separated by && operator in Visual Stuudio? Let's say, I will enter "getAllPrivates&&" (or press a shortcut key) in the VS editor and it will return me something like this: private bool _privateFiel1 = false; private bool _privateFiel2 = true; private bool _privateFiel3 = false; private bool _privateFiel4 = false; private bool _privateFiel5 = true; // Here I press the shortcut or call the code-template and get his: _privateFiel1 && _privateFiel2 && _privateFiel3 && _privateFiel4 && _privateFiel5

    Read the article

< Previous Page | 35 36 37 38 39 40 41 42 43 44 45 46  | Next Page >