Search Results

Search found 61241 results on 2450 pages for 'empty set'.

Page 5/2450 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Can You Have "Empty" Abstract/Classes?

    - by ShrimpCrackers
    Of course you can, I'm just wondering if it's rational to design in such a way. I'm making a breakout clone and was doing some class design. I wanted to use inheritance, even though I don't have to, to apply what I've learned in C++. I was thinking about class design and came up with something like this: GameObject - base class (consists of data members like x and y offsets, and a vector of SDL_Surface* MovableObject : GameObject - abstract class + derived class of GameObject (one method void move() = 0; ) NonMovableObject : GameObject - empty class...no methods or data members other than constructor and destructor(at least for now?). Later I was planning to derive a class from NonMovableObject, like Tileset : NonMovableObject. I was just wondering if "empty" abstract classes or just empty classes are often used...I notice that the way I'm doing this, I'm just creating the class NonMovableObject just for sake of categorization. I know I'm overthinking things just to make a breakout clone, but my focus is less on the game and more on using inheritance and designing some sort of game framework.

    Read the article

  • How to remove empty tables from a MySQL backup file.

    - by user280708
    I have multiple large MySQL backup files all from different DBs and having different schemas. I want to load the backups into our EDW but I don't want to load the empty tables. Right now I'm cutting out the empty tables using AWK on the backup files, but I'm wondering if there's a better way to do this. If anyone is interested, this is my AWK script: EDIT: I noticed today that this script has some problems, please beware if you want to actually try to use it. Your output may be WRONG... I will post my changes as I make them. # File: remove_empty_tables.awk # Copyright (c) Northwestern University, 2010 # http://edw.northwestern.edu /^--$/ { i = 0; line[++i] = $0; getline if ($0 ~ /-- Definition/) { inserts = 0; while ($0 !~ / ALTER TABLE .* ENABLE KEYS /) { # If we already have an insert: if (inserts > 0) print else { # If we found an INSERT statement, the table is NOT empty: if ($0 ~ /^INSERT /) { ++inserts # Dump the lines before the INSERT and then the INSERT: for (j = 1; j <= i; ++j) print line[j] i = 0 print $0 } # Otherwise we may yet find an insert, so save the line: else line[++i] = $0 } getline # go to the next line } line[++i] = $0; getline line[++i] = $0; getline if (inserts > 0) { for (j = 1; j <= i; ++j) print line[j] print $0 } next } else { print "--" } } { print }

    Read the article

  • How to use java.Set

    - by owca
    I'm trying to make it working for quite some time,but just can't seem to get it. I have object Tower built of Block's. I've already made it working using arrays, but I wanted to learn Set's. I'd like to get similar functionality to this: public class Tower { public Tower(){ } public Tower add(Block k1){ //(...) //if block already in tower, return "Block already in tower" } public Tower delete(Block k1){ //(...) //if block already dleted, show "No such block in tower" } } Someone gave me some code, but I constantly get errors when trying to use it : Set<Block> tower = new HashSet<Block>(); boolean added = tower.add( k1 ); if( added ) { System.out.println("Added 1 block."); } else { System.out.println("Tower already contains this block."); } How to implement it ?

    Read the article

  • Adjacency List Tree Using Recursive WITH (Postgres 8.4) instead of Nested Set

    - by Koobz
    I'm looking for a Django tree library and doing my best to avoid Nested Sets (they're a nightmare to maintain). The cons of the adjacency list model have always been an inability to fetch descendants without resorting to multiple queries. The WITH clause in Postgres seems like a solid solution to this problem. Has anyone seen any performance reports regarding WITH vs. Nested Set? I assume the Nested set will still be faster but as long as they're in the same complexity class, I could swallow a 2x performance discrepancy. Django-Treebeard interests me. Does anyone know if they've implemented the WITH clause when running under Postgres? Has anyone here made the switch away from Nested Sets in light of the WITH clause?

    Read the article

  • How to SET ARITHABORT ON for connections in Linq To SQL

    - by Laurence
    By default, the SQL connection option ARITHABORT is OFF for OLEDB connections, which I assume Linq To SQL is using. However I need it to be ON. The reason is that my DB contains some indexed views, and any insert/update/delete operations against tables that are part of an indexed view fail if the connection does not have ARITHABORT ON. Even selects against the indexed view itself fail if the WITH(NOEXPAND) hint is used (which you have to use in SQL Standard Edition to get the performance benefit of the indexed view). Is there somewhere in the data context I can specify I want this option ON? Or somewhere in code I can do it?? I have managed a clumsy workaround, but I don't like it .... I have to create a stored procedure for every select/insert/update/delete operation, and in this proc first run SET ARITHABORT ON, then exec another proc which contains the actual select/insert/update/delete. In other words the first proc is just a wrapper for the second. It doesn't work to just put SET ARITHABORT ON above the select/insert/update/delete code.

    Read the article

  • Java creation of new set too slow

    - by Mgccl
    I have this program where it have some recursive function similar to this: lambda(HashSet<Integer> s){ for(int i=0;i<w;i++){ HashSet<Integer> p = (HashSet) s.clone(); p.addAll(get_next_set()); lambda(p); } } What I'm doing is union every set with the set s. And run lambda on each one of the union. I run a profiler and found the c.clone() operation took 100% of the time of my code. Are there any way to speed this up considerably?

    Read the article

  • Nested Set - for CMS with two versions (edit / publish) mode

    - by Rick
    Hi! I'm looking for a solution (PHP/Symfony/Doctrine) for the following problem. I'm creating a table called 'pages'. This table is a nested set. I also want to create a table called 'pages_published' which has ofcourse also a nested set. Once i create a record in table 'pages' at some point i want to publish this to the 'pages_published)-table. How do make sure the sort order and the level in the structure keeps ok. Is there some standard solution for my approach?

    Read the article

  • How to SET tiggers 0 in MySQL?

    - by Grijesh Chauhan
    In my MySQL database I have some Triggers ON DELETE and ON INSERT. Some time I need to switched-off my some Triggers, And I have to DROP e.g. DROP TRIGGER IF EXISTS hostgroup_before_insert // and reinstall. Is there any shortcut to SET triggers hostgroup_before_insert = 0 like we have for foreign keys mysql> SELECT version(); +-------------------------+ | version() | +-------------------------+ | 5.1.61-0ubuntu0.10.10.1 | +-------------------------+ 1 row in set (0.00 sec) I am new learner and I could not find regarding this on web.

    Read the article

  • Why doesn't the F# Set implement ISet<T>?

    - by Sean Devlin
    The .NET Framework is adding an ISet<T> interface with the 4.0 release. In the same release, F# is being added as a first-class language. F# provides an immutable Set<'T> class. It would seem logical to me that the immutable set provided would implement the ISet<T> interface, but it doesn't. Does anyone know why? My guess is that they didn't want to implement an interface intended to be mutable, but I don't think this explanation holds up. After all, their Map<'Key, 'Value> class implements IDictionary, which is mutable. And there are examples elsewhere in the framework of classes implementing interfaces that are only partially appropriate. My other thought is that ISet<T> is new, so maybe they didn't get around to it. But that seems kind of thin. Does the fact that ISet<T> is generic (v. IDictionary, which is not) have anything to do with it? Any thoughts on the matter would be appreciated.

    Read the article

  • Should xml represent a set or a list?

    - by sixtyfootersdude
    I always think of xml like a set data structure. Ie: <class> <person>john</person> <person>sarah</person> </class> Is equivalent to: <class> <person>sarah</person> <person>john</person> </class> Question One: Are these two things logicly equivalant? Are you allowed to make things like this in xml? <methodCall> <param>happy</param> <param>sad</param> </methodCall> Or do you need to do it like this: <methodCall> <param arg="1">happy</param> <param arg="2">sad</param> </methodCall> Question Two: Are these two things logically equivalent? Question Three: Is xml usually treated like a set or a list?

    Read the article

  • NHibernate MySQL Mapping Set Column Type

    - by LnDCobra
    In my MySQL database, I have the following column type. Field | Type | Null | ---------------------------------- Column_priv | set('Select','Insert','Update','References') | No | And I cannot figure out what to map this to. Can anyone tell me how I can map this to something?

    Read the article

  • Java - easily convert array to set

    - by Peter
    Hey, I'd like to convert an array to a set in Java. There are some obvious ways of doing this (i.e. with a loop) but I would like something a bit neater, something like: java.util.Arrays.asList(Object[] a); Any ideas? Cheers, Pete

    Read the article

  • NSFormatter problem: not getting called for the empty string

    - by Enchilada
    I have created a custom formatter for my (read-only) table column. It looks like this: - (NSString *)stringForObjectValue:(id)anObject { NSAssert([anObject isKindOfClass:[NSString class]] && anObject != nil, @"invalid object"); if ([anObject isEqualToString:@""]) return @"EMPTY"; else return [anObject stringByAppendingString:@"++"]; } Very simple. The corresponding objects are just strings, so it's an string-to-string formatter. All non-empty string objects are returned with @"++" appended to them. Empty string objects should be turned into the @"EMPTY" string. The @"++" gets appended to non-empty strings just fine. The problem is, @"EMPTY" never gets shown! My formatter is never called by Cocoa when the underlying object is the empty string. The corresponding row just keeps being empty, instead of showing my requested @"EMPTY". Any ideas?

    Read the article

  • how to set the name of the node using userobjects

    - by apoorva
    How to set the node text.Here is the code am using public TreeCreation(final ArrayList houseList){ Apartment= new DefaultMutableTreeNode("Apartment"); for(int i=0;i by passing the userObject the name of the object is being displayed on the node ,how do i change the code to display h.HouseName when am using userObjects node.getUserObject(hs.HouseName);

    Read the article

  • Data Structures for hashMap, List and Set

    - by harigm
    Can any one please guide me to look in depth about the Data Structures used and how is it implemented in the List, Set and Maps of Util Collection page. In Interviews most of the questions will be on the Algorithms, but I never saw anywhere the implementation details, Can any one please share the information.

    Read the article

  • Generate set/get methods for a c++ class

    - by Narek
    Is there any tool that generates set and get methods for a class. Just I create classes very frequently and would like to have a tool which for each class-member wil generate following functions: Member_Type getMemberName() const; void setMemberName(const Member_Type & val);

    Read the article

  • Apache redirect when users home directory is completely empty.

    - by Scott M
    I work for an ISP and I have a server with thousands of users 10MB of free storage. They get this free storage with every e-mail account they have with us. An example of a users storage address: http://users.example.com/~username/ One problem I can see is scanning the server for user names to see what accounts are available, basically getting a list of all our customers valid e-mail addresses. This would be very, very bad. So I'm wanting to redirect to our homepage if someone comes across a users account that is empty (I'd say 90% of them are completely empty). I also do not want to simply -Indexes them and use a custom 403 because the few customers that do use them, want +Indexes. I know I can always just tell the customers to put a htaccess file in their directory with Options +indexes if they want directory listing, but that's a last resort. How can I make it pretty much impossible to tell what accounts are on the server but not in use at all?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >