set

search&replace array key using PHP and CakePHP Set Class

hi, i need to write function that searches & replaces key in multi-dimensional array in following manner: input array: [0] => Array ( [Foo] => sometext [Foo2] => Array ( [lorem] => 1 [Avatar2] => Array ( [meta_key] => avatar2 [...

Actionscript 3 setting multiple variables of an object in an array possible?

Right now, I have many MovieClips's in my array. I want to update all the alpha values of the MovieClips in my array. Right now, I am using a for loop but this is not the fastest way to do it. Is there a way to set values for all the items in my array? Thanks! ...

How to solve XML to XML problem using Exslt - set:distinct

This extends from http://stackoverflow.com/questions/2133459/xml-to-xml-using-xsl-problem I managed to import exslt and modified my codes according to the solution (thanks to Kyle Butt) given as follows: <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:func="http://exslt....

Strange Python set and hash behaviour - how does this work?

I have a class called GraphEdge which I would like to be uniquely defined within a set (the built-in set type) by its tail and head members, which are set via __init__. If I do not define __hash__, I see the following behaviour: >>> E = GraphEdge('A', 'B') >>> H = GraphEdge('A', 'B') >>> hash(E) 139731804758160 >>> hash(H) 139731804760...

Divide a list of numbers into smaller list with "sum" approximately same.

I execute around 2000 tests on grid, each test being run as separate task on grid. The tests do have rather big startup time. Total execution takes 500 hours, finishes in less than 10 hours on 60 node SunGridEngine. Runtime of tests vary from 5 minutes to 90 minutes. Combining tests without much intelligence gave some performance gain....

How to set background color of a View

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. ...

Why isn't there a "set" interface in the .NET framework?

I'm thinking specifically about the generic class HashSet<T>. It implements several interfaces, but none exposes the correct semantics of a set. Specifically, none supports an Add method returning bool. (ICollection<T> supports void Add, which can be used in a pinch.) Also unsupported by these interfaces are common set operations like un...

C++ STL set update is tedious

I find the update operation on set tedious since there's no such an API on cplusplus. So what I currently do is sth like this: //find element in set by iterator Element copy = *iterator; ... // update member value on copy, varies Set.erase(iterator); Set.insert(copy); Basically the iterator return by Set is a const_iterator and you ca...

AutoResetEvent object , waits 60 secs OR event

Im using AutoResetEvent object to block a thread for 60 secs ,, but I would like to block it for 60 secs or AutoResetEvent.set() event CODE : global: private readonly AutoResetEvent _signal = new AutoResetEvent(false); blocking: _signal.WaitOne(60000, true); event to give signal _signal.Set(); but it alwayas waits the whole 60 se...

Convert Scala Set into Java (java.util.Set)?

I have a Set in Scala (I can choose any implementation as I am creating the Set. The Java library I am using is expecting a java.util.Set[String]. Is the following the correct way to do this in Scala (using scala.collection.jcl.HashSet#underlying): import com.javalibrary.Animals var classes = new scala.collection.jcl.HashSet[String] c...

Wix Web Installer: Set homepage in internet explorer and firefox

hello, i created a web setup by using wix, now i want to set internet explorer homepage and want to add my webpage as favourite with my webinstaller. can any one tell me how to do this in wix (3.0-3.5), i google this but can't find any thing. ...

iPhone: Update All address (Home, Work, Other) of contact

hi all, i am creating a new contact programmatically. it work well except address. following is the code to add a contact ABAddressBookRef libroDirec = ABAddressBookCreate(); ABRecordRef persona = ABPersonCreate(); ABRecordSetValue(persona, kABPersonFirstNameProperty, tempSingle.firstName , nil); ABRecordSetValue(persona, kABPer...

Property Set Overload Array vs. Non-Array

I'm trying to create a property that will allow the setting of a last name based on a variety of inputs. The code that calls this is parsing a name field. In some instances it will have a single last name, in others, a array of last names that need to be concatenated. I want to keep my concatenation code in a single place to make mainten...

set map implementation in C++

Hi I find that both set and map are implemented as a tree. set is a binary search tree, map is a self-balancing binary search tree, such as red-black tree? I am confused about the difference about the implementation. The difference I can image are as follow 1) element in set has only one value(key), element in map has two values. 2) se...

Determine who/what called Set Property

I am trying to determine what control called a Set property. Say textbox Pet is bound to a Property. I am using INotifyPropertyChanged but I am wondering if there is a way to get the actual control. The sender in my PropertyChanged Event is the Class containing the properties and not the control that originally kicked of the chain of ...

How can I get and set pixel data in XNA?

I have a texture2D where I want to get the color of a specified pixel. Do something with it and put a new color in an other texture2D. I will need to do this with all the pixels in the texture. How can I do this. No pixel shader's please. It need to be in C# ...

Can you abort a set procedure of a property

I am programming in C#.NET. It is possible to abort the set procedure of a class property without throwing an exception? Here is what I want to do... public int RandomProperty { set { DialogResult answer = new DialogResult(); answer = MessageBox.Show("This process could take up to 5 min. Are you sure you want to conti...

How to check if a table contains an element in Lua ?

Is there a method for checking if a table contains a value ? I have my own (naive) function, but I was wondering if something "official" exists for that ? Or something more efficient... function table.contains(table, element) for _, value in pairs(table) do if value == element then return true end end return false en...

Symmetric Difference of Two Arrays

I have two NSArrays of Movie objects called DVD and VHS. I'd like to find the symmetric difference of these arrays. I want to know which Movies are in VHS buy not in DVD, and which Movies are in DVD but not VHS. Can anyone tell me if there is a fast algorithm to solve it (preferably in C or Objective-C)? Is it faster/easier to solve if...

Is this problem NP, and does it have a name?

This problem came up in the real world, but I've translated it into a more generic "textbook-like" formulation. I suspect it is NP, but I'm particularly interested in knowing if it has a name or is well known since I think I can't be the first one to encounter it. ;-) Imagine there is a potluck party with N guests. Each guest may bring ...