map

Getting coordinates of an image map with a mouse click

I have an html image map and I want to get the coordinates when a user clicks on the map. Is there a way to retrieve the map coordinates with a mouse click on the map? ...

Showing points on my image map.

This is my scenario in brief: I am making a restaurant's website. The restaurant owner will upload his restaurant's plan view image.(example: http://cache.smartdraw.com/examples/content/Examples/SmartDraw/Floor_Plans/Restaurant_Plans/Family_Restaurant_Plan_L.jpg) Then he will mark on the image were the tables available for booking are....

YAML: dictionary with empty value

How do I write in YAML a dictionary (map) where one key has the empty string as its value? ...

How to insert a "Pair" or n-size into a list collection instead of composing HashMaps?

So, I have a situation where I need to pass in three values into a serial BlockingQueue queue: (SelectableChannel, ComponentSocketBasis, Integer). They don't actually need to be hash mapped at all, and to use a HashMap is ridiculous as there will always be only one key for each entry; it'd be fine if they were just in some sort of o...

Need to store string as id for objects in some fast data structure

I'm implementing a session store for a web-server. Keys are string and stored objects are pointers. I tried using map but need something faster. I will look up an object 5-20 times as frequent than insert. I tried using hash-map but failed. I felt like I got more constraints than more free time. I'm coding c/c++ under Linux. I don't...

How to use Google Maps "auto-load" functionality ?

I began reading about Auto-loading a google map at: http://code.google.com/apis/ajax/documentation/#AutoLoading What's unclear to me is how to actually load the google map. I have tried: <script src="http://www.google.com/jsapi?autoload=%7B%22modules%22%3A %5B%7B%22name%22%3A%22search%22%2C%22version%22%3A%221.0%22%2C %22language%22%...

Which method does Set.removeAll() use underneath: equals or compareTo?

Consider the code: class A { private int i; boolean equals( Object t) { if (this == t) return true; if (!( t instanceof A)) return false; if (this.i == t.i); } } Map<String,A> orig; Map<String,B> dup; I am trying to do this orig.entrySet().removeAll(dup.entrySet()); I see that the equ...

How to have markers on a map cluster instead of stack

Hello, my team is trying to resolve an issue with limited time. We have developed a fairly complex map interface on our site to display content (trips, social content, etc). when a user runs a search for "Kayaking San Francisco" for example, the map shows all the kayaking trips in SF, but since they are all geotagged (using geonames.or...

How to modify map element key

I have a container that holds map of elements. class MyContainer{ ..... Map<String,MyElement> elements = new ... ... } Each element has name property. The key in the map is the element's name. i.e. the method insert is as follows: void addElement(MyElement elem){ elements.put(elem.getName,elem); } I need to use the map data s...

STL map doesn't add a pair after removing the first pairs

In this chunk of code I add a pair on a map and everything is fine but when I delete a pair that isn't the last one the map doesn't add any more pairs. What I'm Doing wrong?? SomeClass::add(Object object) if (!object.empty()) { ObjectList::iterator result = find(object.name()); if (result == ObjectList.end()) { object.orde...

Ruby - Map characters to integers in 2d array

Hi everyone, I have a problem I can't for the life of me solve. I'm writing a Ruby app (I've been a PHP developer for 8 years, just starting with Ruby) that sells tickets for a concert hall. Each seat has a row (a...z) and a number (1...x). The database model has row (string) and num (int) for each seat. How can I convert my array of s...

Optimized implementations of java.util.Map and java.util.Set?

I am writing an application where memory, and to a lesser extent speed, are vital. I have found from profiling that I spend a great deal of time in Map and Set operations. While I look at ways to call these methods less, I am wondering whether anyone out there has written, or come across, implementations that significantly improve on acc...

Java Generics putting on Map<String, ? extends List<String>>

Is there a way to make the following implementation in a type safe manner? public void myMethod( Map<String, ? extends List<String>> map ) { map.put("foo", Collections.singletonList("bar"); } The above implementation doesn't work. It requires a Map<String, ? super List<String>> to compile the method map.put() correctly. But myMetho...

BizTalk testing maps with multiple input xml or is it Inline C# that is the problem?

Can anyone explain how to get unit tests of BizTalk maps with multiple inputs to work? I've been happily using the examples on Michael Stephenson blog to test my maps, but I've just tried my first multiple input map and it's failing :-( I've used the VS2005 "Test Map" to first generate an input instance with the two input messages, th...

Is there a value in using map() vs for?

Does map() iterate through the list like "for" would? Is there a value in using map vs for? If so, right now my code looks like this: for item in items: item.my_func() If it makes sense, I would like to make it map(). Is that possible? What is an example like? ...

Looking a data structure that is a Map but in which keys can be values, values can be keys

A Map maps from keys to values and provides quick access based on the knowledge of the key. Does there exist a data structure like Maps which supports both key to value and value to key access? Sometimes I may want to derefence the Map via the value, while other times by the key. ...

Is it possible to use a custom class in place of std::pair in an STL map?

Is this possible? #include <map> class Example { private: std::map<std::string, std::string, less<std::string>, std::allocator< CustomPair<std::string, std::string> > > myMap; }; In the example above, CustomPair would be a template class holding a key and value. If this is possible, is it that simple or is there anything I s...

How do I turn a conditional chain into faster less ugly code?

I have 9 different grammars. One of these will be loaded depending on what the first line of txt is on the file it is parsing. I was thinking about deriving the lexer/parser spawning into sep. classes and then instantiating them as soon as I get a match -- not sure whether that would slow me down or not though. I guess some benchmarkin...

Java iterator

I am a newbie, I have a question. I have a map. I have to loop through the map and build the iterator. Example: public Iterable<Test> getTests(Map<String, Test> testMap, Set<String> strings) { //loop tru the set of strings and build iterator. for(final String test1 : strings) { Test test = testMap.get(test1); ...

Map Navigation Control Approach - .NET

Hi, I'd like to know what could be the best approach to develop a Windows desktop application that has a map navigability control - very similar to those in Google Maps and Live Maps, with drag and drop support and so on. Initially, due to time restrictions, I was thinking about a WinForms solution - I think one future solution using W...