set

Using a Set Iterator in C++

When I try to use a set iterator in debug mode in C++, I get an error that says "map/set iterator not dereferencable". I don't understand because I thought dereferincing was how you are supposed to use an iterator. The code looks like this: set<int>::iterator myIterator; for(myIterator = mySet.begin(); myIterator != mySet.end(); ...

Which STL container to use if I want it to ignore duplicated elements?

I am looking for some STL (but not boost) container, which after the following operations will contain 2 elements: "abc" and "xyz": std::XContainer<string> string_XContainer; string_XContainer.push_back("abc"); string_XContainer.push_back("abc"); string_XContainer.push_back("xyz"); By the way, I need it just in order to call string_XC...

Constructing a python set from a numpy matrix

I'm trying to execute the following >> from numpy import * >> x = array([[3,2,3],[4,4,4]]) >> y = set(x) TypeError: unhashable type: 'numpy.ndarray' How can I easily and efficiently create a set from a numpy array? ...

How to get the elements in a set in C++?

I am confused as to how to get the elements in the set. I think I have to use the iterator but how do I step through it? ...

How do I use a class as a value to be used on set::find()? - C++

So I'm working on a project and I have to use the set library on class objects. Those objects have many attributes, ID being one of them. What I wanted to do was search for an object inside a "set" by its ID. The problem is set only has find and I don't know how to search for an ID this way since I'd have to use find(class object) and n...

batch file fails to set variable in IF clause

The following code is not updating Run to equal N even though the match occurs. this means I'm not dropping into the CALL code. Am i missing something here? SET Run=Y REM Check current files date/time information and establish if the file has been present too long in the directory REM Skip first 4 lines as header information not requir...

Why am I getting an error using 'set' in Python?

s = set('ABC') s.add('z') s.update('BCD') s.remove('DEF') # error here s -= set('DEFG') ...

Why was Set left out of .NET Collections?

Possible Duplicates: Why doesnt .Net have a Set data structure? C# Set collection? Just curious as to why Sets were left out of .NET collections. It seems like a pretty big omission, and I wondered what the reason might be. BTW I know that there is HashSet in .NET 3.5, but it did take Microsoft a long time to get around to p...

Why does set -e cause my script to exit when it encounters the following?

Hi All, I have a bash script that checks some log files created by a cron job that have time stamps in the filename (down to the second). It uses the following code: CRON_LOG=$(ls -1 $LOGS_DIR/fetch_cron_{true,false}_$CRON_DATE*.log 2> /dev/null | sed 's/^[^0-9][^0-9]*\([0-9][0-9]*\).*/\1 &/' | sort -n | cut -d ' ' -f2- | tail -1 ) if ...

How to set sound volume to 0 in IFrame ?

I have the following line in my Html file, which displays a video feed, how do I set sound volume to 0 in IFrame ? So that when the page is first loaded, there is no sound. <iframe src="http://onionz.co.cc/ain.php?psid=1626397" id="player" scrolling="no" frameborder="no" align="center" Width=588 Height=351></iframe> Is there a paremet...

How can I make a property "Write Once Read Many" in VB.NET?

What is the best way to make a class property "Write Once, Read Many" such that you can only set the property once? I know that I could pass all the properties in the constructor and make them ReadOnly, but in cases with a lot of properties I don't want a constructor that has 20+ arguments. Also, I realize I can "roll my own" setters, ...

Is there the equivent of a Java Set in php?

Is there the equivalent of a Java Set in php? (meaning a collection that can't contain the same element twice) ...

How to set the Content-Type header using JavaScript

Hey, How can you set the Content-Type header to "application/x-www-form-urlencoded; charset=UTF-8" using JavaScript? I need to do this so I can view a form with french characters without generating errors. Thanks ...

Mandelbrot Set implementation in Common Lisp.

I've been working on an implementation of the Mandelbrot Set in several different languages. I have a working implementation in C++, C#, Java, and Python, but the Common Lisp implementation has some bugs that I just can't figure out. It generates the set but somewhere in the pipeline the set gets distorted. I've tested and know with n...

Sort a nested set tree by a nearest leaf

Hello, I'm looking for a SQL example to sort a tree, ordered by nearest node, using nested set tree method or a low ressource method. The tree I want to sort : A /\ B C /\ D E /\ F G The sort result I'd like to have if I choose for example the E node : E-B-F-G-A-D-C for a "father priority" or E-F-G-B-D-A-C...

how to remove all even integers from set<int> in c++

I'm new to C++. I'd like to know how experienced coders do this. what I have: set<int> s; s.insert(1); s.insert(2); s.insert(3); s.insert(4); s.insert(5); for(set<int>::iterator itr = s.begin(); itr != s.end(); ++itr){ if (!(*itr % 2)) s.erase(itr); } and of course, it doesn't work. because itr is incremented after it is erased....

Maintaining a std::set<boost::shared_ptr>

I'm writing a game and an accompanying engine in C++. The engine relies heavily on automation using a simple embedded scripting language. Scripts can create object classes, define event listeners on them, and produce instances from them. At present, an instance must be bound to a script-global identifier in order to preserve its existenc...

why is php's ini_set function switched off on shared hosts

I am using hosting on VPS and they've not allowed me to use php's ini_set function to set configuration at runtime, on a script by script basis. Instead I must change the settings directly in the php.ini file which is a mission to access via SSH. Why is this? This, although fine, is slightly annoying as I have 12 domains on the shared...

android - save image from web server and set it as wallpaper

Hi, Can anyone please provide me some idea/guidance on how to save an image from a webserver and set it as wallpaper? i am developing an android application which needs to do that and i am new in android. Thanks a lot. I had tried writing my own code but it doesn't work as i can't find my images after download but the wallpaper has cha...

Is it possible to set a cookie from a browser plug-in?

Do browser plug-ins, such as the Yahoo toolbar or others, have the ability to set cookies on multiple domains as the user browses the web? Does the browser expose the necessary access to do this to a plug-in? If this varies across browsers, that would be helpful to know as well. Thanks! ...