Search Results

Search found 19928 results on 798 pages for 'multiple constructors'.

Page 19/798 | < Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >

  • Managing multiple references of the same game entity in different places using IDs

    - by vargonian
    I've seen great questions on similar topics, but none that addressed this particular method: Given that I have multiple collections of game entities in my [XNA Game Studio] game, with many entities belonging to multiple lists, I'm considering ways I could keep track of whenever an entity is destroyed and remove it from the lists it belongs to. A lot of potential methods seem sloppy/convoluted, but I'm reminded of a way I've seen before in which, instead of having multiple collections of game entities, you have collections of game entity IDs instead. These IDs map to game entities via a central "database" (perhaps just a hash table). So, whenever any bit of code wants to access a game entity's members, it first checks to see if it's even in the database still. If not, it can react accordingly. Is this a sound approach? It seems that it would eliminate many of the risks/hassles of storing multiple lists, with the tradeoff being the cost of the lookup every time you want to access an object.

    Read the article

  • Dealing with multiple animation state in one sprite sheet image using html5 canvas

    - by Sora
    I am recently creating a Game using html5 canvas .The player have multiple state it can walk jump kick and push and multiple other states my question is simple but after some deep research i couldn't find the best way to deal with those multiple states this is my jsfiddle : http://jsfiddle.net/Z7a5h/5/ i managed to do one animation but i started my code in a messy way ,can anyone show me a way to deal with multiple state animation for one sprite image or just give a useful link to follow and understand the concept of it please .I appreciate your help if (!this.IsWaiting) { this.IsWaiting = true; this.lastRenderTime = now; this.Pos = 1 + (this.Pos + 1) % 3; } else { if (now - this.lastRenderTime >= this.RenderRate) this.IsWaiting = false; }

    Read the article

  • Is it possible to run multiple instances/windows of Finder in Mac OS X?

    - by sunpech
    Mac OS X's Finder seems to be the equivalent to Windows Explorer. In Windows, I enjoy having multiple instances of Explorer open to move/copy files from one folder in a window, to another folder in another window. How can I achieve this in Snow Leopard? I'd like to have shortcut key, as well as a dock icon solution. Or maybe there's a better program than Finder out there that does this?

    Read the article

  • Instance where embedded C++ compilers don't support multiple inheritance?

    - by Nathan
    I read a bit about a previous attempt to make a C++ standard for embedded platforms where they specifically said multiple inheritance was bad and thus not supported. From what I understand, this was never implemented as a mainstream thing and most embedded C++ compilers support most standard C++ constructs. Are there cases where a compiler on a current embedded platform (i.e. something not more than a few years old) absolutely does not support multiple inheritance? I don't really want to do multiple inheritance in a sense where I have a child with two full implementations of a class. What I am most interested in is inheriting from a single implementation of a class and then also inheriting one or more pure virtual classes as interfaces only. This is roughly equivalent to Java/.Net where I can extend only one class but implement as many interfaces as I need. In C++ this is all done through multiple inheritance rather than being able to specifically define an interface and declare a class implements it.

    Read the article

  • What is the best multiple monitors app for Windows 7?

    - by AndyMcKenna
    What is the best app for supporting multiple monitors in Windows 7? Ultra mon was perfect in Vista and XP but I don't think it works with Windows 7 yet. The main features I'm looking for are: Taskbar for each monitor with only the apps that are running there. This might not be doable based on how the Windows 7 taskbar works now. A button next to Minimize to send the window to the other monitor Separate wallpapers for each monitor

    Read the article

  • In SharePoint, why can I "multiple document upload" a 47,297 byte file, but not a 47,298 byte file?

    - by Jim
    It's strange. I can upload a document named 47k.txt that is 47,297 bytes using the "Multiple Document Upload" feature. However, if I add a single character to the end of the text file, the upload fails. Also, if I rename the file to 47k*x*.txt and try to upload it, it fails. This is the error I get in the SharePoint logs: Category: General Event ID: 8jzm Level: High Message: #90012: An error was encountered while processing files on the server. Try uploading one file at a time by using the single upload page. The same error is reported in a message box on the client side. Does anybody know why this would happen?

    Read the article

  • Higher-order type constructors and functors in Ocaml

    - by sdcvvc
    Can the following polymorphic functions let id x = x;; let compose f g x = f (g x);; let rec fix f = f (fix f);; (*laziness aside*) be written for types/type constructors or modules/functors? I tried type 'x id = Id of 'x;; type 'f 'g 'x compose = Compose of ('f ('g 'x));; type 'f fix = Fix of ('f (Fix 'f));; for types but it doesn't work. Here's a Haskell version for types: data Id x = Id x data Compose f g x = Compose (f (g x)) data Fix f = Fix (f (Fix f)) -- examples: l = Compose [Just 'a'] :: Compose [] Maybe Char type Natural = Fix Maybe -- natural numbers are fixpoint of Maybe n = Fix (Just (Fix (Just (Fix Nothing)))) :: Natural -- n is 2 -- up to isomorphism composition of identity and f is f: iso :: Compose Id f x -> f x iso (Compose (Id a)) = a

    Read the article

  • what possible workarounds are there for "only parameterless constructors are support in Linq to Enti

    - by Ralph Shillington
    In my query I need to return instances of a class that doesn't have a default constructor (specifically this is in a custom Membership provider, and MembershipUser is the culprit) var users = from l in context.Logins select new MembershipUser( Name, l.Username, // username l.Id, // provider key l.MailTo, l.PasswordQuestion, l.Notes.FirstOrDefault().NoteText, l.IsApproved, l.IsLockedOut, l.CreatedOn, l.LastLoginOn.HasValue ? l.LastLoginOn.Value : DateTime.MinValue, l.LastActivityOn.HasValue ? l.LastActivityOn.Value : DateTime.MinValue, DateTime.MinValue, l.LastLockedOutOn.HasValue ? l.LastLockedOutOn.Value : DateTime.MinValue ); is syntacitally correct, but results in a runtime error as Only parameterless constructors and initializers are supported in LINQ to Entities.

    Read the article

  • By-Name-Parameters for Constructors

    - by hotzen
    Hello, coming from my other question is there a way to get by-name-parameters for constructors working? I need a way to provide a code-block which is executed on-demand/lazy/by-name inside an object and this code-block must be able to access the class-methods as if the code-block were part of the class. Following Testcase fails: package test class ByNameCons(code: => Unit) { def exec() = { println("pre-code") code println("post-code") } def meth() = println("method") def exec2(code2: => Unit) = { println("pre-code") code2 println("post-code") } } object ByNameCons { def main(args: Array[String]): Unit = { val tst = new ByNameCons { println("foo") meth() // knows meth() as code is part of ByNameCons } tst.exec() // ByName fails (executed right as constructor) println("--------") tst.exec2 { // ByName works println("foo") //meth() // does not know meth() as code is NOT part of ByNameCons } } } Output: foo method pre-code post-code -------- pre-code foo post-code

    Read the article

  • Use of Java constructors in persistent entities

    - by Mr Morgan
    Hello I'm new to JPA and using persistence in Java anyway and I have two questions I can't quite work out: I have generated tags as: @JoinColumn(name = "UserName", referencedColumnName = "UserName") @ManyToOne(optional = false) private User userName; @JoinColumn(name = "DatasetNo", referencedColumnName = "DatasetNo") @ManyToOne(optional = false) private Dataset datasetNo; But in one of the constructors for the class, no reference is made to columns UserName or DatasetNo whereas all other columns in the class are referenced in the constructor. Can anyone tell me why this is? Both columns UserName and DatasetNo are 'foreign keys' on the entity Visualisation which corresponds to a database table of the same name. I can't quite work out the ORM. And when using entity classes, or POJO, is it better to have class variables like: private User userName; Where an instance of a class is specified or simply the key of that class instance like: private String userName; Thanks Mr Morgan.

    Read the article

  • Using free function as pseudo-constructors to exploit template parameter deduction

    - by Poita_
    Is it a common pattern/idiom to use free functions as pseudo-constructors to avoid having to explicitly specify template parameters? For example, everyone knows about std::make_pair, which uses its parameters to deduce the pair types: template <class A, class B> std::pair<A, B> make_pair(A a, B b) { return std::pair<A, B>(a, b); } // This allows you to call make_pair(1, 2), // instead of having to type pair<int, int>(1, 2) // as you can't get type deduction from the constructor. I find myself using this quite often, so I was just wondering if many other people use it, and if there is a name for this pattern?

    Read the article

  • Designing constructors around type erasure in Java

    - by Internet Friend
    Yesterday, I was designing a Java class which I wanted to be initalized with Lists of various generic types: TheClass(List<String> list) { ... } TheClass(List<OtherType> list) { ... } This will not compile, as the constructors have the same erasure. I just went with factory methods differentiated by their names instead: public static TheClass createWithStrings(List<String> list) public static TheClass createWithOtherTypes(List<OtherType> list) This is less than optimal, as there isn't a single obvious location where all the different options for creating instances are available. I tried to search for better design ideas, but found surprisingly few results. What other patterns exist for designing around this problem?

    Read the article

  • prevent using functions before initialization, constructors-like in C

    - by Hernán Eche
    This is the way I get to prevent funA,funB,funC, etc.. for being used before init #define INIT_KEY 0xC0DE //any number except 0, is ok static int initialized=0; int Init() { //many init task initialized=INIT_KEY; } int funA() { if (initialized!=INIT_KEY) return 1 //.. } int funB() { if (initialized!=INIT_KEY) return 1 //.. } int funC() { if (initialized!=INIT_KEY) return 1 //.. } The problem with this approach is that if some of those function is called within a loop so "if (initialized!=INIT_KEY)" is called again, and again, although it's not necessary. It's a good example of why constructors are useful haha, If it were an object I would be sure that when was created initialization was called, but in C, I don't know how to do it. Any other ideas are welcome!

    Read the article

  • Can C++ Constructors be templates?

    - by Gokul
    Hi, I have non-template class with a templatized constructor. This code compiles for me. But i remember that somewhere i have referred that constructors cannot be templates. Can someone explain whether this is a valid usage? typedef double Vector; //enum Method {A, B, C, D, E, F}; struct A {}; class Butcher { public: template <class Method> Butcher(Method); private: Vector a, b, c; }; template <> Butcher::Butcher(struct A) : a(2), b(4), c(2) { // a = 0.5, 1; // b = -1, 1, 3, 2; // c = 0, 1; } Thanks, Gokul.

    Read the article

  • variadic constructors

    - by FredOverflow
    Are variadic constructors supposed to hide the implicitly generated ones, i.e. the default constructor and the copy constructor? struct Foo { template<typename... Args> Foo(Args&&... x) { std::cout << "inside the variadic constructor\n"; } }; int main() { Foo a; Foo b(a); } Somehow I was expecting this to print nothing after reading this answer, but it prints inside the variadic constructor twice on g++ 4.5.0 :( Is this behavior correct?

    Read the article

  • Question About NerdDinner Controller Constructors

    - by Gavin Draper
    I've been looking at the Nerd Dinner app, more specifically how it handles its unit tests. The following constructors for the RSVPController are confusing my slightly public RSVPController() : this(new DinnerRepository()) { } public RSVPController(IDinnerRepository repository) { dinnerRepository = repository; } From what I can tell the second one is used by the unit tests so it can use Fake repositories. What I cant work out is what the first constructor does. It doesn't seem to ever set the dinnerRepository variable, it seems to imply its inheriting from something but I really don't get it. Can anyone explain? Thanks

    Read the article

  • Constructors + Dependency Injection

    - by Sunny
    If I am writing up a class with more than 1 constructor parameter like: class A{ public A(Dependency1 d1, Dependency2 d2, ...){} } I usually create a "argument holder"-type of class like: class AArgs{ public Dependency1 d1 { get; private set; } public Dependency2 d2 { get; private set; } ... } and then: class A{ public A(AArgs args){} } Typically, using a DI-container I can configure the constructor for dependencies & resolve them & so there is minimum impact when the constructors need to change. Is this considered an anti-pattern and/or any arguments against doing this?

    Read the article

  • Constructors and method chaining in JavaScript

    - by Sethen Maleno
    I am trying to make method chaining work in conjunction with my constructors, but I am not exactly sure how to go about it. Here is my code thus far: function Points(one, two, three) { this.one = one; this.two = two; this.three = three; } Points.prototype = { add: function() { return this.result = this.one + this.two + this.three; }, multiply: function() { return this.result * 30; } } var some = new Points(1, 1, 1); console.log(some.add().multiply()); I am trying to call the multiply method on the return value of the add method. I know there is something obvious that I am not doing, but I am just not sure what it is. Any thoughts?

    Read the article

  • Synergy - easy share of keyboard and mouse between multiple computers

    Did you ever have the urge to share one set of keyboard and mouse between multiple machines? If so, please read on... Using multiple machines Honestly, as a software craftsman it is my daily business to run multiple machines - either physical or virtual - to be able to solve my customers' requirements. Recent hardware equipment allows this very easily. For laptops it's a no-brainer to attach a second or even a third screen in order to extend your native display. This works quite handy and in my case I used to attached two additional screens - one via HD15 connector, the other via HDMI. But... as it's a laptop and therefore a mobile unit there are slight restrictions. Detaching and re-attaching all cables when changing locations is one of them but hardware limitations, too. After all, it's a laptop and not a workstation. I guess, that anyone working in IT (or ICT) has more than one machine at their workplace or their home office and at least I find it quite annoying to have multiple sets of keyboard and mouse conquering my remaining space on my desk. Despite the ugly looks of all those cables and whatsoever 'chaos of distraction' I prefer a more clean solution and working environment. This allows me to actually focus on my work and tasks to do rather than to worry about choosing the right combination of keyboard/mouse. My current workplace is a patch work of various pieces of hardware (approx. 2-3 years): DIY desktop on Ubuntu 12.04 64-bit, Core2 Duo (E7400, 2.8GHz), 4GB RAM, 2x 250GB HDD, nVidia GPU 512MB Dell Inspiron 1525 on Windows 8 64-bit, 4GB RAM, 200GB HDD HP Compaq 6720s on Windows Vista 32-bit, Core2 Duo (T5670, 1.8GHz), 2GB RAM, 160GB HDD Mac mini on Mac OS X 10.7, Core i5 (2.3 GHz), 2GB RAM, 500GB HDD I know... Not the latest and greatest but a decent combination to work with. New system(s) is/are already on the shopping list but I live in the 'wrong' country to buy computer hardware. So, the next trip abroad will provide me with some new stuff. Using multiple operating systems The list of hardware above already names different operating systems, and actually I have only one preference: Linux. But still my job as a software craftsman for Visual FoxPro and .NET development requires other OSes, too. Not a big deal, it's just like this. Additionally to those physical machines, there are a bunch of virtual machines around. Most of them running either Windows XP or Windows 7. Since years I have the practice that each development for one customer is isolated into its own virtual machine and environment. This keeps it clean and version-safe. But as you can easily imagine with that setup there are a couple of constraints referring to keyboard and mouse. Usually, those systems require their own pieces of hardware attached. As stated, I don't like clutter on my desk's surface, so a cross-platform solution has to come in here. In the past, I tried it with various applications, hardware or network protocols like X11, RDP, NX, TeamViewer, RAdmin, KVM switch, etc. but the problem in this case is that they either allow you to remotely connect to the other system or exclusively 'bind' your peripherals to the active system. Not optimal after all. Synergy to the rescue Quote from their website: "Synergy lets you easily share your mouse and keyboard between multiple computers on your desk, and it's Free and Open Source. Just move your mouse off the edge of one computer's screen on to another. You can even share all of your clipboards. All you need is a network connection. Synergy is cross-platform (works on Windows, Mac OS X and Linux)." Yep, that's it! All I need for my setup here... Actually, I couldn't believe it myself that I didn't stumble over synergy earlier but 'Get over it' and there we go. And despite the fact that it is Open Source, no, it's also for free. Donations for the developers are very welcome and recently they introduced Synergy Premium. A possibility to buy so-called premium votes that can be used to put more weight / importance on specific issues or bugs that you would like the developers to look into. Installation and configuration Simply download the installation packages for your systems of choice, run the installer and enter some minor information about your network setup. I chose my desktop machine for the role of the Synergy server and configured my screen setup as follows: The screen setup allows you currently to build or connect up to 15 machines. The number of screens can be higher as those machine might have multiple screens physically attached. Synergy takes this into the overall calculations and simply works as expected. I tried it for fun with a second monitor each connected to both laptops to have a total number of 6 active screens. No flaws after all - stunning! All the other machines are configured as clients like so: Side note: The screenshot was taken on Windows 8 and pasted via clipboard into Gimp running on Ubuntu. Resume Synergy is now definitely in my box of tools for my daily work, and amongst the first pieces of software I install after the operating system. It just simplifies my life and cleans my desk. Never again without Synergy!Now, only waiting for an Android version to integrate my Galaxy Tab 10.1, too. ;-) Please, check out that superb product and enjoy sharing one keyboard, one mouse and one clipboard between your various machines and operating systems.

    Read the article

  • separate domains vs subdomains [duplicate]

    - by Sharon
    This question already has an answer here: Registering multiple domains vs. subdomains 5 answers We manufacture a very versatile product used in a wide variety of products using multiple brands. In order to market these brands, should we create a separate domain for each brand/market or use subdomains from our well established main domain? What would be best for SEO without breaking the bank?

    Read the article

< Previous Page | 15 16 17 18 19 20 21 22 23 24 25 26  | Next Page >