Search Results

Search found 2896 results on 116 pages for 'comparison operators'.

Page 22/116 | < Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >

  • C++ Operator Ambiguity

    - by Scott
    Forgive me, for I am fairly new to C++, but I am having some trouble regarding operator ambiguity. I think it is compiler-specific, for the code compiled on my desktop. However, it fails to compile on my laptop. I think I know what's going wrong, but I don't see an elegant way around it. Please let me know if I am making an obvious mistake. Anyhow, here's what I'm trying to do: I have made my own vector class called Vector4 which looks something like this: class Vector4 { private: GLfloat vector[4]; ... } Then I have these operators, which are causing the problem: operator GLfloat* () { return vector; } operator const GLfloat* () const { return vector; } GLfloat& operator [] (const size_t i) { return vector[i]; } const GLfloat& operator [] (const size_t i) const { return vector[i]; } I have the conversion operator so that I can pass an instance of my Vector4 class to glVertex3fv, and I have subscripting for obvious reasons. However, calls that involve subscripting the Vector4 become ambiguous to the compiler: enum {x, y, z, w} Vector4 v(1.0, 2.0, 3.0, 4.0); glTranslatef(v[x], v[y], v[z]); Here are the candidates: candidate 1: const GLfloat& Vector4:: operator[](size_t) const candidate 2: operator[](const GLfloat*, int) <built-in> Why would it try to convert my Vector4 to a GLfloat* first when the subscript operator is already defined on Vector4? Is there a simple way around this that doesn't involve typecasting? Am I just making a silly mistake? Thanks for any help in advance.

    Read the article

  • How can I override list methods to do vector addition and subtraction in python?

    - by Bobble
    I originally implemented this as a wrapper class around a list, but I was annoyed by the number of operator() methods I needed to provide, so I had a go at simply subclassing list. This is my test code: class CleverList(list): def __add__(self, other): copy = self[:] for i in range(len(self)): copy[i] += other[i] return copy def __sub__(self, other): copy = self[:] for i in range(len(self)): copy[i] -= other[i] return copy def __iadd__(self, other): for i in range(len(self)): self[i] += other[i] return self def __isub__(self, other): for i in range(len(self)): self[i] -= other[i] return self a = CleverList([0, 1]) b = CleverList([3, 4]) print('CleverList does vector arith: a, b, a+b, a-b = ', a, b, a+b, a-b) c = a[:] print('clone test: e = a[:]: a, e = ', a, c) c += a print('OOPS: augmented addition: c += a: a, c = ', a, c) c -= b print('OOPS: augmented subtraction: c -= b: b, c, a = ', b, c, a) Normal addition and subtraction work in the expected manner, but there are problems with the augmented addition and subtraction. Here is the output: >>> CleverList does vector arith: a, b, a+b, a-b = [0, 1] [3, 4] [3, 5] [-3, -3] clone test: e = a[:]: a, e = [0, 1] [0, 1] OOPS: augmented addition: c += a: a, c = [0, 1] [0, 1, 0, 1] Traceback (most recent call last): File "/home/bob/Documents/Python/listTest.py", line 35, in <module> c -= b TypeError: unsupported operand type(s) for -=: 'list' and 'CleverList' >>> Is there a neat and simple way to get augmented operators working in this example?

    Read the article

  • Dilemma with two types and operator +

    - by user35443
    I have small problem with operators. I have this code: public class A { public string Name { get; set; } public A() { } public A(string Name) { this.Name = Name; } public static implicit operator B(A a) { return new B(a.Name); } public static A operator+(A a, A b) { return new A(a.Name + " " + b.Name); } } public class B { public string Name { get; set; } public B() { } public B(string Name) { this.Name = Name; } public static implicit operator A(B b) { return new A(b.Name); } public static B operator +(B b, B a) { return new B(b.Name + " " + a.Name); } } Now I want to know, which's conversion operator will be called and which's addition operator will be called in this operation: new A("a") + new B("b"); Will it be operator of A, or of B? (Or both?) Thanks....

    Read the article

  • Comparing floating point values

    - by Sauron
    I just read a statement about the floating point value comparison Floating point values shall not be compared using either the == or != operators. Most floating point values have no exact binary representation and have a limited precision. If so what is the best method for comparing two floating point values?

    Read the article

  • What is the most effective way to test for combined keyboard arrow direction in ActionScript 3.0?

    - by Relee
    I need to monitor the direction a user is indicating using the four directional arrow keys on a keyboard in ActionScript 3.0 and I want to know the most efficient and effective way to do this. I've got several ideas of how to do it, and I'm not sure which would be best. I've found that when tracking Keyboard.KEY_DOWN events, the event repeats as long as the key is down, so the event function is repeated as well. This broke the method I had originally chosen to use, and the methods I've been able to think of require a lot of comparison operators. The best way I've been able to think of would be to use bitwise operators on a uint variable. Here's what I'm thinking var _direction:uint = 0x0; // The Current Direction That's the current direction variable. In the Keyboard.KEY_DOWN event handler I'll have it check what key is down, and use a bitwise AND operation to see if it's already toggled on, and if it's not, I'll add it in using basic addition. So, up would be 0x1 and down would be 0x2 and both up and down would be 0x3, for example. It would look something like this: private function keyDownHandler(e:KeyboardEvent):void { switch(e.keyCode) { case Keyboard.UP: if(!(_direction & 0x1)) _direction += 0x1; break; case Keyboard.DOWN: if(!(_direction & 0x2)) _direction += 0x2; break; // And So On... } } The keyUpHandler wouldn't need the if operation since it only triggers once when the key goes up, instead of repeating. I'll be able to test the current direction by using a switch statement labeled with numbers from 0 to 15 for the sixteen possible combinations. That should work, but it doesn't seem terribly elegant to me, given all of the if statements in the repeating keyDown event handler, and the huge switch. private function checkDirection():void { switch(_direction) { case 0: // Center break; case 1: // Up break; case 2: // Down break; case 3: // Up and Down break; case 4: // Left break; // And So On... } } Is there a better way to do this?

    Read the article

  • Jackson Vs. Gson

    - by Null Pointer
    After searching through some existing libraries for JSON, I have finally ended up with these two: Jackson Google GSon I am a bit partial towards GSON, but word on the net is that GSon suffers from certain celestial performance issue. I am continuing my comparison, in the meanwhile I was looking for help to make up my mind.

    Read the article

  • Prestashop compared to Zen-Cart and osCommerce

    - by Viet
    I'm considering Prestashop for a new project. It seems to be younger than Zen-Cart and osCommerce. Since I just found it by Google, I'd like to gather comments and experience and comparison of Prestashop to established "brands" like Zen-Cart and osCommerce

    Read the article

  • actionscript 2.0:Check TextField in flash

    - by RedsDevils
    I have some problem in check two textfield.text comparison. One TextField.text value is come from calculation and the other textField is from user input. When I check those two text, the TextField.text value didn't show and I can't compare those two. How can I compare in actionscript 2.0. Please Help me! Thanks in advance!

    Read the article

  • Delphi - Differences between CompareStr and CompareString

    - by Bourgui
    Hi all, I'm hoping someone can shed some light on this for me What are the differences, in Delphi 2009, between the CompareStr (defined in SysUtils) and CompareString (from Windows API) functions? Both let you specify the locale to be used, is the Windows one simply more "complete", due to the available comparison flags? Is one consequently faster than the other? Thanks!

    Read the article

  • How do I compare two complex data structures?

    - by Phil H
    I have some nested datastructures, each something like: [ ('foo', [ {'a':1, 'b':2}, {'a':3.3, 'b':7} ]), ('bar', [ {'a':4, 'd':'efg', 'e':False} ]) ] I need to compare these structures, to see if there are any differences. Short of writing a function to explicitly walk the structure, is there an existing library or method of doing this kind of recursive comparison?

    Read the article

  • microsoft access query speed...

    - by V.S.
    Hello everyone! I am now writing a report about MS Access and I can't find any information about its performance speed in comparison to other alternatives such as Micorsoft SQL Server, MySQL, Oracle, etc... It's obvious that MS Access is going to be the slowest among the rest, but there is no solid documents confirming this other than forums threads, and I don't have the time and resources to do the research myself :( Hoping for your help, V.S.

    Read the article

  • Confluence vs Sharepoint

    - by FerranB
    We use Confluence mainly for documentation and want to make an step forward moving all the files (pdfs, etc) to Confluence but we want to determine if it's the best option. As far as I know Confluence is a wiki and Sharepoint is not. How compare confluence and Sharepoint as file containers? Which benefits have Sharepoint over Confluence and vice-versa? Pros and Cons?

    Read the article

  • Dell Optiplex 980 vs. Dell Studio XPS 9000?

    - by Dave
    My company is allowing me to upgrade to either the XPS 9000 or the Optiplex 980. I haven't bought an Optiplex in over a decade, and the only thing I can remember is that the Optiplex is really meant for corporate IT environments, and we're not even close being large enough to have IT issues. I think the components might be of higher quality as well, like the motherboard and power supply. The XPS 9000 is about $150 cheaper than the Optiplex, but the Optiplex has 4GB more RAM, a 2nd video card, and an extra year of service. Seems like the Optiplex is a better deal overall, but since I haven't ever used one, I wanted to see what everyone else here thought.

    Read the article

  • MDaemon vs Exchange (2007-2010). Which one should we choose ?

    - by Deniz
    We are at the verge of a mail server decision. We do currently use 2 mail servers : MDaemon 10 and Exchange 2003. We are planning to use a company and customer wide one point solution. Our main candidates are MDaemon 11 and Exchange 2007 or 2010. We would like to learn other users experiences on those solutions. The server-side experiences, the user-side experiences, feature set, TCO, support options etc. And if there were other solutions (like MDaemon 11 + Exchange or anything else) what would you suggest ?

    Read the article

  • How to compare old laptop to new laptop?

    - by Lasse V. Karlsen
    I hope this question doesn't get closed at once :) I have an old laptop, a Compaq NC4200, which is going its final laps around the track these days. Battery is dead, and everything kinda runs slow. It also has only 1GB of memory, and even though I don't know if it can take more, I probably wouldn't be able to get hold of any that matches without having to special order it. The size, however, has been ideal for my usage pattern, so I'm looking to replace it with a similarly sized laptop, at least in the same size category. However, it's been a while since I tried keeping track of CPUs, so I have a question. The old laptop has a Intel Pentium M 760 1.86GHz processor. One laptop I found online has a Intel Pentium SU4100 1.3GHz dual-core. This type of processor seems to be quite common in the price and size-range I've been looking. What kind of relative performance boost could I expect from the old one to the new one? I am not expecting a "about 7.45x speed", but some indication would be nice. For instance, dual-core tells me it might be akin to 2.6GHz, but I assume I can't simply compare 1.86GHz to 2.6GHz and expect the new one to run about 1.4x as fast, I expect more these days. Or is that unrealistic for this kind of processor? Do I need to up my price range and go for a 2+ GHz processor?

    Read the article

  • Unlimited and multi-computer online storage solutions with automatic backup

    - by JRL
    As the title says, what are the existing online storage solutions that provide: unlimited storage automatic backup and allow for an unlimited number of computers (use not tied to a single computer)? There are several existing questions on this site related to online storage solutions, but none that is specifically targeted to what I want, so I thought I'd ask the question. This wikipedia article lists some of them, are there others? How do they compare in terms of price, feature set and ease of use? Update: Kinda disappointed no one has any answers to this so far. JungleDisk looks promising, anyone have experience with it? Update 2: To answer the comments, what I'm looking for definitely DOES exist. These solutions all seem to fit the bill: BackMii CrashPlan DataPreserve Humyo JungleDisk KeepVault SpiderOak And some of them are quite cheap (CrashPlan is $100 a year). For unlimited space and computers, I'd say that's pretty good. Does anyone have experience with CrashPlan or any other of the above solutions?

    Read the article

  • Which Linux is the most efficient?

    - by quandary
    Simple question: There is a gazillion Linux distributions out there. Which one (distribution/incl. window manager) makes (technically) the most efficient use of my (aging) computer ? I have appx. 1 GB RAM and a 1.6 GHz processor, 120 GB hd. I develop applications (C++/.NET/mono/ASP/PostGre SQL/). Usually, I prefer distros with apt-get. Anybody knows which one takes the most care of my limited RAM, and wich one is the fastest/slimmest of them all, that has a decent repo and is damn fast)

    Read the article

  • Pros/Cons of switching from Exchange to GMail

    - by Brent
    We are a medium-large non-profit company, with around 1000 staff and volunteers, and have been using MS Exchange (currently 2003) for our mail system for years. I recently attended a Google conference where they were positing that "Cloud computing is the way of the future", and encouraging us to switch from doing our own email with Exchange, to using GMail and Google Apps for everything. Additionally, one of our departments has been pushing from inside to do this transition within their own department, if not throughout the entire organization. I can definitely see some benefits - such as: Archive space - we never seem to have the space our users want, and of course, the more we get, the more we have to back up OS Agnostic - Exchange is definitely built for windows, and with mac and linux users on the rise, these users increasingly demand better tools / support. Google offers this. Better archiving - potential of e-discovery, that doesn't exist in a practical way with our current setup. Switching would relieve us of a fair bit of server administration, give more options to our end users, and free up the server resources we are now using for Exchange. Our IT department wants to be perceived as providing up-to-date solutions to technical problems, and this change would definitely provide such an image. Google's infrastructure is obviously much more robust than ours, and they employ some of the world's best security and network experts. However, there are also some serious drawbacks: We would be essentially outsourcing one of our mission-critical systems to a 3rd party The switch would inevitably involve Google Apps and perhaps more as well. That means we would have a-lot more at the mercy of a single (potentially weak) password. (is there a way to make this more secure using a password plus physical key of some sort??) Our data would not remain under our roof - or even in our country (Canada). This obviously has plusses on the Disaster Recovery side, but I think there are potential negatives on the legal side. I can't imagine that somebody as large as Google would be as responsive as we would want with regard to non-critical issues such as tracing missing emails, etc. (not sure how much access we would have to basic mail logs - for instance) Can anyone help me evaluate this decision? What issues am I overlooking? What experiences have you had with this transition (or the opposite - gmail to Exchange) Can you add to the points I have already outlined?

    Read the article

  • CentOS vs. Ubuntu

    - by DLH
    I had a web server that ran Ubuntu, but the hard drive failed recently and everything was erased. I decided to try CentOS on the machine instead of Ubuntu, since it's based on Red Hat. That association meant a lot to me because Red Hat is a commercial server product and is officially supported by my server's manufacturer. However, after a few days I'm starting to miss Ubuntu. I have trouble finding some of the packages I want in the CentOS repositories, and the third-party packages I've tried have been a hassle to deal with. My question is, what are the advantages of using CentOS as a server over Ubuntu? CentOS is ostensibly designed for this purpose, but so far I would prefer to use a desktop edition of Ubuntu over CentOS. Are there any killer features of CentOS which make it a better server OS? Is there any reason I shouldn't switch back to Ubuntu Server or Xubuntu?

    Read the article

  • Laptop choice for development: MacBook Pro 17 vs Dell Studio XPS 16 vs HP Envy 15

    - by Shalan
    Hey! First things first - let me state that I am not intending to play games on this - I have narrowed down to these 3 purely based on specs and its individual brand reliability in the market. I intend to primarily use: Visual Studio 2008 Pro a lot (develop and deploy on Windows platforms) SQL Server 2005 Oracle 10g Adobe Photoshop CS4 Microsoft Expression Studio Google Sketchup I currently use a desktop PC (Core2Duo 2.66Ghz with 3GB DDRII memory) running Vista Business 32-bit - and I have to admit that, especially for Visual Studio, its quite sluggish to a point where it affects productivity. Furthermore, I intend to only use the notebook on a table - with a cooled surface, like granite :) - so I would appreciate people's input with regard to heat issues. Im aware that the Dell's primary exhaust gets blocked by the lid when open, but some reviews don't seem to place extraordinary emphasis on heat issues resulting from this. My options for the Dell/Alienware: Core i7 720QM 4GB DDRIII memory ATI mobility 3670 (512) 128GB Solid State Drive 16-inch Full HD RGB-LED LCD display (1080p) 3-year next-business-day support My configuration for the Apple MBP: Core2Duo 2.8Ghz (Im assuming the T9600) 4GB DDRIII memory 128GB Solid State Drive standard 1 year support The one advantage I think of with the MBP is that I can have the addition of OSX (though Im unsure what I would use it for, but purely to play around with a much-boasted-about OS) What are your thoughts on this, especially regarding build-quality, heat, performance and battery-life? Much thanks! ~shalan

    Read the article

  • Practical differences between OpenBSD and FreeBSD?

    - by simon
    I have OpenBSD installed as a router/firewall, and have been thinking about trying either OpenBSD or FreeBSD out as a desktop system, as well. What kind of practical differences (not philosophical, like "OpenBSD's focus is security" [those are well explained at wikipedia ) are there between FreeBSD and OpenBSD? E.g. default shell, different commands or ways of configuring things etc.?

    Read the article

< Previous Page | 18 19 20 21 22 23 24 25 26 27 28 29  | Next Page >