map

Map and Sort in one iteration in Javascript?

Is it possible to map an array to a new array and to sort it at the same time without iterating twice (once for the map on the first array and once for the sort on the second array)? I've been trying to sort it with an anonymous function when using the map method like this: var arr=[4,2,20,44,6]; var arr2=arr.map(function(item, index, a...

INSTALL_FAILED_MISSING_SHARED_LIBRARY an android emulator proplem

[2010-03-04 11:50:15 - AndroidSamples]Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY when i uses the .. please do reply me ...

Converting map in MapInfo format

Hello. I have a map in Mapinfo format. To open it I use trial version of Mapinfo, but in several days trial period will pass. Are there some free viewers for mapinfo files, or may be there are some coverters? ...

Is there a standard way for representing Maps in SOAP WS

By maps I mean lists of unique key-value pairs. Is there a language-independent recommended architecture? ...

Accesing hidden getEntry(Object key) in HashMap

I have similar problem to one discussed here, but with stronger practical usage. For example, I have a Map<String, Integer>, and I have some function, which is given a key and in case the mapped integer value is negative, puts NULL to the map: Map<String, Integer> map = new HashMap<String, Integer>(); public void nullifyIfNegative(Str...

PHP library with Countries, States and Cities

I am currently working on a PHP application that puts me in the desperate need of all the Countries, States and Cities in the world. In the application, when you select a Country from the drop down menu, it loads up all the States in the selected Country into another drop down menu. When you then select a State from the newly generated ...

Can anyone explain why Dictionary<> in C# doesn't work like map<T,U> in STL?

When I first started to program in C# last year, I immediately looked for the equivalent to STL's map, and learned about Dictionary. UPDATE crossed out this garbage below, I was completely wrong. My experience with STL's map was that I hated when I requested it for a value, and if the key wasn't in the map, it would automatically creat...

Anybody know of a collection of country outline maps?

I've been in doubt whether to ask this here, but I don't know where else to go and I think any answers can be useful to other developers... What I want to do in the community site that I am building is to have a map outline graphic on the header of the user profile. So if the user indicates he is from Brazil, there will an small outline...

Crystal XI - How to display tooltips on a geographic map

When a geographic map is inserted it shows me the distribution of our members however is there a way of getting it to display the town name and the number alongside the dot instead of needing to hover over the dot to display the information. This means I can refer to these values when printing. Does anyone know of any mapping controls t...

basic json > struct question ( using 'Go')

I'm working with twitter's api, trying to get the json data from http://search.twitter.com/trends/current.json which looks like: {"as_of":1268069036,"trends":{"2010-03-08 17:23:56":[{"name":"Happy Women's Day","query":"\"Happy Women's Day\" OR \"Women's Day\""},{"name":"#MusicMonday","query":"#MusicMonday"},{"name":"#MM","query":"#MM...

LinkedHashMap vs HashMap != LinkedList vs ArrayList

I have read that LinkedHashMap has faster iteration speed than HashMap because its elements are doubly linked to each other. Additionally, because of this, LinkedHashMap is slower when inserting or deleting elements. Presumably because these links also need to be updated. Although I can see an analogy to LinkedList vs ArrayList, in that...

Memory allocation while insertion into a map

#include <stdio.h> #include <stdlib.h> #include <memory.h> #include <vector> #include <string> #include <iostream> #include <map> #include <utility> #include <algorithm> void * GetMemory(size_t n) { void *ptr = malloc(n); printf("getMem n %d ptr 0x%x\n", n, reinterpret_cast<unsigned int> (ptr)); return ptr; } void FreeMemory(vo...

dual map structure implementation?

Hey, I'm looking for a standard dual-map structure - is there one implemented in std/boost/another standard C++ library? When I say "dual-map" I mean a map which can be indexed efficiently both by the key and the "value" (it actually has two key types instead of one key type and one value type). for example: dualmap<int,string> m; m[1...

How should I go about generating every possible map<char, char> combination from map<char, vector<char> > ?

I am looking to take a map<char, vector<char> > and generate each possible map<char, char> from it. I understand this may use a sizeable amount of memory and take a bit of time. Each map<char, char> needs to contain every letter a-z, and be mapped to a unique a-z character. ie. ak bj cp dy ev fh ga hb ir jq kn li mx nc oo pz qs rl sd t...

How to iterate map in a list best way

The spring JDBC template returns me a list which looks like below: [{CODE_C=CSC, DESC_C=CSC}, {CODE_C=PG1, DESC_C=PG1}] I want the above list to printed in jsp as below: CSC-CSC PG1-PG1 Can you tell me the best way to do this? ...

quick check on use of map api (android)

When you use the Google map api, it is not part of the Android SDK, and you have to mention it in your manifest xml file. Do you have to do anything to access the jar file containing the map api code? Or is that automatically present on the device or emulator, the way the SDK code is? Do you need put the map api jar file in your class...

When does it make sense to use a map?

I am trying to round up cases when it makes sense to use a map (set of key-value entries). So far I have two categories (see below). Assuming more exist, what are they? Please limit each answer to one unique category and put up an example. Property values (like a bean) age -> 30 sex -> male loc -> calgary Presence, with O(1) pe...

Level Creator for iPhone Game

I'm making an iPhone game that has several maps with graphics attached. The graphics may allow the player to pass through them or block them. Is there an application for OS X that will allow me to pass some of this work off to a designer without having to reinvent the wheel and develop a map creator. ...

Attempting to calculate width of Map Overlays on the fly

Hey all- I am working on an Android app that utilizes the Google Maps API MapView, MapController, MapActivity, and ItemizedOverlay. I am basically trying to recreate certain functionalities of the Maps app (damn Google for not providing speech bubbles—for lack of a better name—for items!), particularly those speech bubbles. I have an i...

Accessing Class Variables from a List in a nice way in Python

Suppose I have a list X = [a, b, c] where a, b, c are instances of the same class C. Now, all these instances a,b,c, have a variable called v, a.v, b.v, c.v ... I simply want a list Y = [a.v, b.v, c.v] Is there a nice command to do this? The best way I can think of is: Y = [] for i in X Y.append(i.v) But it doesn't seem ...