Search Results

Search found 55281 results on 2212 pages for 'set'.

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

  • How to set background color of a View

    - by Peter vdL
    I'm trying to set the background color of a View (in this case a Button). I use this code: // set the background to green v.setBackgroundColor(0x0000FF00 ); v.invalidate(); It causes the Button to disappear from the screen. What am I doing wrong, and what is the correct way to change the background color on any View? Thanks.

    Read the article

  • Capturing Set Behavior with Mutating Elements

    - by Carl
    Using the Guava library, I have the following situation: SetMultimap<ImmutableFoo, Set<Foo>> setMM = HashMultimap.create(); Set<Foo> mask = Sets.newHashSet(); // ... some iteration construct { setMM.put(ImmutableFoo1, Sets.difference(SomeSetFoo1,mask)); setMM.put(ImmutableFoo1, Sets.difference(SomeSetFoo2,mask)); mask.add(someFoo); } that is, the same iteration to create the setMM is also used to create the mask - this can of course result in changes to hashCode()s and create duplicates within the SetMultimap backing. Ideally, I'd like the duplicates to drop without me having to make it happen, and avoid repeating the iteration to separately construct the multimap and mask. Any easy libraries/Set implementations to make that happen? Alternatively, can you identify a better way to drop the duplicates than: for (ImmutableFoo f : setMM.keySet()) setMM.putAll(f,setMM.removeAll(f)); revisiting the elements is probably not a performance problem, since I could combine a separate filter operation that needs to visit all the elements anyway.

    Read the article

  • CMD For Loop does not hold set /a value

    - by Bob Hope
    Didn't know how to explain this well, so here is the code @echo off set test=0 for /f %%a in (textfile.txt) do ( rem loops five times(5 lines in textfile.txt) set /a test=test+1 rem Adds 1 to Test echo %%a rem Echo's correct line in file echo %test% rem Echo's whatever X was before the loop ) echo %test% rem Displays the correct value of X pause this is just an example of where I am finding the problem, txtfile.txt has 5 lines, so the for loop goes 5 times, each time, test gets +1 to it, and the /a displays the correct value of X, but the last echo on the for loop displays 0, which is what test is set to before the loop. The value of test is not changing until the loop is finished... is there any way to fix this? Here is what I want to accomplish, as there may be an easier way: I want to run a for loop that findstr's all rtf's in a series of sub folders, and copies them all to a all directory with a new name, 1.rtf,2.rtf,3.rtf, etc. The reason I need to rename them on the transfer is they all have the same name.

    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

  • determine if intersection of a set with conjunction of two other sets is empty

    - by koen
    For any three given sets A, B and C: is there a way to determine (programmatically) whether there is an element of A that is part of the conjunction of B and C? example: A: all numbers greater than 3 B: all numbers lesser than 7 C: all numbers that equal 5 In this case there is an element in set A, being the number 5, that fits. I'm implementing this as specifications, so this numerical range is just an example. A, B, C could be anything.

    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

  • 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

  • How to expose a Delphi set type via Soap

    - by Wouter van Nifterick
    I'm currently creating soap wrappers for some Delphi functions so that we can easily use them from PHP, C# and Delphi. I wonder what's the best way to expose sets. type TCountry = (countryUnknown,countryNL,countryD,countryB,countryS,countryFIN,countryF,countryE,countryP,countryPl,countryL); TCountrySet = set of TCountry; function GetValidCountrySet(const LicensePlate:string; const PossibleCountriesSet:TCountrySet):TCountrySet; I'm currently wrapping it like this for the soap server: type TCountryArray = array of TCountry; function TVehicleInfo.GetValidCountrySet(const LicensePlate:string; const PossibleCountriesSet:TCountryArray):TCountryArray; It works, but I need to write a lot of useless and ugly code to convert sets--arrays and arrays--sets. Is there an easier, more elegant, or more generic way to do this?

    Read the article

  • alternative to check, whether a value is in a set

    - by stanleyxu2005
    Hi All, I have the following code. It looks ugly, if the value equals to one of the following value then do something. var Value: Word; begin Value := 30000; if (Value = 30000) or (Value = 40000) or (Value = 1) then do_something; end; I want to refactor the code as follows: var Value: Word; begin Value := 30000; if (Value in [1, 30000, 40000]) then // Does not work do_something; end; However, the refactored code does not work. I assume that a valid set in Delphi accepts only elements with type byte. If there any good alternative to refactor my original code (besides using case)?

    Read the article

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