map

Is it safe to use C++ STL containers on multiple threads if no insertions and only .find()?

In C++, is it safe to use an std::map or std::vector concurrently in different threads if you are NOT inserting, just doing .find() operations on it? ...

JavaScript to submit form plus a value from map area?

Hi, I'm trying to create a simple search function where a user selects an option from a drop down and clicks on a map to see results for those 2 parameters I have this php at the top of my doc: <?php if ((isset($_POST["MM_search"])) && ($_POST["MM_search"] == "yes")){ $lang = $_POST['lang']; $salerent = $_POST['salerent']; $zone = ...

Skipping exceptions when using map in Haskell

Hi I have the following code to return the length of a cycle in a string: module Main where import Data.List detec ys n | 2*n > (length ys) = error "no cycle" | t == h = (2*n - n) | otherwise = detec ys (n+1) where t = ys !! n h = if n == 0 then ys !! 1 else ys !! (n*2...

Automatically Sharding a Java Map across multiple nodes

I have a problem where I need to assemble a Map whose eventual size is in the GBs (going on past 64GB) and I cannot assume that a user of the program will have this kind of monster machine hanging around. A nice solution would be to distribute this map across a number of machines to make a far more modest memory footprint per instance. ...

Map rendering : from data to image tile :Good practice/Sample codes/Tutorial

Hi folks, I'm working on a iPhone offline map project. So i would like to generate the tiles directly in the iPhone, and I need to build a fast and efficient algorithm to render the tiles. Do you know some resources for that ? (I know some frameworks exist, like mapnik, but i need something as simple as possible, and i'll implement the...

Haskell Ambiguous Occurrences -- how to avoid?

I do the following in GHCI: :m + Data.Map let map = fromList [(1, 2)] lookup 1 map GHCI knows that map is a (Map Integer Integer). So why does it claim an ambiguity between Prelude.lookup and Data.Map.lookup when the type is clear and can I avoid? <interactive>:1:0: Ambiguous occurrence `lookup' It could refer to either `Prel...

How to map CAPS LOCK key in VIM?

I'm using GVIM under Windows. And want to map CAPSLOCK to Ctrl+^ Any way to do this? Btw, I see tons of samples over the web how to swap CAPS and Esc using registry hack, but none of them use VIM map command, instead external tools and registry changes. ...

Draw World Map [WGS84] with OpenGL in a wide Range

hi I've got a quite specific problem. I want to draw a Map, consisting of 256x256 pixle Tiles (a lot of them). These cover a big area. The transformation to convert lat|lon(from the globe) to x|y (map) spawns quite big values. With these big values goes accurcy and so, if I go far away from the 0/0 Point, I get inaccuracies of multiple...

Erlang map reduce library?

Does anyone have expereince with erldmr, a map reduce library for Erlang? http://code.google.com/p/erldmr/wiki/Paper ...

map vs. hash_map in C++

Hi, I have a question with hash_map and map in C++. I understand that map is in STL but hash_map is not a standard. What's the difference of them two? Any insights are strongly welcomed. Thanks! ...

In Scala, is there a way to take convert two lists into a Map?

I have a two lists, a List[A] and a List[B]. What I want is a Map[A,B] but I want the semantics of zip. So started out like so: var tuplesOfAB = listOfA zip listOfB Now I'm not sure how to construct a Map from my tuplesOfAB. As a follow-up question, I also want to invert my map so that from a Map[A,B] I can create a Map[B,A]. Can an...

Is there any advantage of using map over unordered_map in case of trivial keys?

A recent talk about unordered_map in C++ made me realize, that I should use unordered_map for most cases where I used map before, because of the efficiency of lookup ( amortized O(1) vs. O(log n) ). Most times I use a map I use either int's or std::strings as keys, hence I've got no problems with the definition of the hash function. The ...

Problem counting in Map<String, Integer>

Hi, I asked a question about counting the number of times a word is in ArrayList: ACU ACU ACU ACU ACY ACY AER AER AER AGC So for ACU we will get 4, ACY we will get 2, AER we will get 3, AGC we will get 1. I got some help but I cannot make it work. Darren gave me a very important answer: Map<String, Integer>wordCount = new HashMap<...

Web Map API needed for displaying multiple locations to user.

What is a good map API that can display not just a static image, but the ability for the user to interact, zoom in and out. Additionally, what is a map API that can accept a street address and not a geo code? update: Is it possible to get driving directions from an embedded map API? Such that the user can click onto a node and bring up ...

Transform items from iterable with a sequence of unary functions

I frequently find myself needing to apply a sequence of unary functions to a sequence of of the same length. My first thought is to go with map(), however this only takes a single function to be applied to all items in the sequence. In the following code for example, I wish to apply str.upper() to the first item, and int to the second i...

how to change state of any overlayItem on googlemap?

I am able to display multiple overlayItems on Googlemap, now I want to change icon of any specific overlayItem (to show it is currently selected event). I want to do it through navigation buttons (next, previous) as on Google maps. I am using StateListDrawable to display icons for OverlayItems. Icon file is <?xml version="1.0" encodi...

How can I use map and receive an index as well in Scala?

Is there any List/Sequence built-in that behaves like map and provides the element's index as well? ...

Is it impossible to use stl map with struct ?

struct Node { int a; int b; }; Node node; node.a = 2; node.b = 3; map<int, int> aa; aa[1]=1; //O.K. map<Node, int> bb; bb[node]=1; //Compile Error When I tried to map a struct into int, it gave me a compile error. Why? Thank you! ...

Google Maps API not letting go of the mouse click

I'm using the Google maps API to place a map onto a web page, just like millions of other sites have done. However, once I click on the map (and let go), the map then acts if the mouse button is still being held and drags the map all over the page. The only way to get free of this drag action is to hit F5 and reload the page. I've spen...

How to fill countries in a world map using ASP.NET?

Hi, My client has customers in 100 countries in which a customer can have access to more than a country. So, to show visual appearance to the customer, our client want to show world map and fill each country with a different color where the customer has access to. Is there anyway to do this in ASP.NET? If not ASP.NET, Is their any thi...