map

std::map, references, pointers and memory allocation

I am having a lil hard time with map and the valuetype allocation. consider this simple class: class Column { private: char *m_Name; public: // Overrides const char *Name(){ return this->m_Name; } // Ctors Column(const char *NewName){ this->m_Name = new char[strlen(NewName) + 1]; strcpy(this->m_N...

C++ operator[] syntax.

Just a quick syntax question. I'm writing a map class (for school). If I define the following operator overload: template<typename Key, typename Val> class Map {... Val* operator[](Key k); What happens when a user writes: Map<int,int> myMap; map[10] = 3; Doing something like that will only overwrite a temporary copy of the [null]...

Development license for Google Maps

We are a software company developing a system using Google Maps for our customer internal use (commercial, with GPS device). I know that our customer need to have Google Maps premier license. My question is: Does my company need to pay Google any license fee for development purposes? ...

C++ How to find the biggest key in a std::map?

At the moment my solution is to iterate through the map to solve this. I see there is a upper_bound method which can make this loop faster, but is there a quicker or more succinct way? ...

help on integrating google map in iphone app

Hi, developer friends. I am going to develop an app based on google map. In that locations will be displayed with markers or points near current location (point of interest). I have lattitude, longitude of different places and I am also able to find the distance from current location. I just want some help working on google map. Display...

Does Java have a HashMap with reverse lookup?

I have data that is organized in kind of a "key-key" format, rather than "key-value". It's like a HashMap, but I will need O(1) lookup in both directions. Is there a name for this type of data structure, and is anything like this included in Java's standard libraries? (or maybe Apache Commons?) I could write my own class that basicall...

Adding elements to an STL Map in a constructors Initialization List?

I was wondering if this was possible, and if so how I'd go about doing so. If it's not possible I'll just have to add the elements during the constructor body. Ideally I would like the map immutable after construction. What I'm trying to achieve is adding two pairs to the map that are created from constructor parameters. ...

Boost Serializing of Object containing Map (with object values) and Multimap (with std::string values): what is needed?

See below a main() and two very simple classes. Then per Boost serialization (and what is shown) my questions are: 1) Does class B need the normal overloaded stream insertion operators '<<' and '>>' to be defined? Currently in my real code it doesn't have these. 2) Does class A in the store() and load() methods need to iterate thro...

Java key - key map

Hi, I need a kind of map which is accessible in two directions, so with a key-key structure instead of key-value. Does this exist in Java? If not, what is the best way to create it? So example: mySpecialHashMap.put("key1", "key2"); mySpecialMap.getL2R("key1") returns "key2"; mySpecialMap.getR2L("key2") returns "key1"; ...

Can I use Perl's map with an array slice?

I'm just trying to shorten a line of code that assigns HTML::Element->as_trimmed_text from an array of HTML::Elements to some variables - pretty standard stuff like: my ($var1, var2) = ($columns[1]->as_trimmed_text, $columns[2]->as_trimmed_text); ..except that there's a few more columns so it continues on over a few more lines. I had ...

How can I convert a LazySeq of Characters to a String in Clojure?

Let's say I have a LazySeq of java.lang.Character like (\b \ \! \/ \b \ \% \1 \9 \/ \. \i \% \$ \i \space \^@) How can I convert this to a String? I've tried the obvious (String. my-char-seq) but it throws java.lang.IllegalArgumentException: No matching ctor found for class java.lang.String (NO_SOURCE_FILE:0) [Thrown class clojure...

Reduce a set of functions over a value?

Hi, I'm looking for a clean, idiomatic way to do a "backwards reduce" in Clojure. I've got (def fns '(fn1 fn2 fn3)) (def val 42) I'd like to obtain (fn3 (fn2 (fn1 val))), and I'm not picky about the order. So I'd like to consecutively apply a sequence of functions to a value, rather than consecutively a sequence of values to a fu...

Search MKMapView annotations

I've got several MKAnnotationView red push pins on a MKMapView in my iPhone application on several locations. I'd like to implement a search bar that can move the map region to show these pins. How can I do this? Alternatively, the area I'm concerned about already has text labels built into the google map, so I'm wondering if there's a ...

NHibernate lazy loading part of a map

Hi all, I was wondering if there is any way to lazy load part of map in NH? Here is my mapping: <map name="Resources" table="COUNTRY_TL" fetch="subselect"> <cache region="CountryCache" usage="read-write" include="all"/> <key column="COUNTRY_ID"/> <index column="LANGUAGE_CODE" type="System.String"></index> <composite-element cl...

Consume Google Map API from VB .NET windows APP

Hi, 1. I have a VB .NET windows App I have two locations: StartPoint = "Minneapolis MN US" EndPoint = "Dallas TX US" I want to call Google Map API's GDirections.load(xxx) and GDirections.getDistance() and get (Expecting) some XML formatted data that will give me the Distance between the two locations. I can probably use VB .NET web...

How does this work in computing the depth map?

From this site: http://www.catalinzima.com/?page%5Fid=14 I've always been confused about how the depth map is calculated. The vertex shader function calculates position as follows: VertexShaderOutput VertexShaderFunction(VertexShaderInput input) { VertexShaderOutput output; float4 worldPosition = mul(input.Position, World)...

Why is this variable appearing as undefined?

I have this code: FOR %%d IN (c d e f g h i j k l m n o p q r s t u v w x y z) do ( IF NOT EXIST %%d:\ ( echo Free drive %%d set D=%%d: ) ) echo d=%D% echo Using %D% to map remote drive subst %D% /d subst %D% \\path_to_drive and after this I'm using the D variable to map a free drive. The thing is, when I first ...

NHibernate IDictionary mapping with link table

I am a newbie to NHibernate and trying to create a XML mapping for this scenario: public class Catalog { public virtual Guid ID { get; set; } public virtual string Name { get; set; } public virtual IDictionary<string, Product> Products { get; set; } } The key in the IDictionary is the name of the Product. public class Pro...

Is there 'multimap' implementation in python?

hi i am a newbie to Python I need to use multi-map to store my data, i.e., a = multidict() a[1] = 'a' a[1] = 'b' a[2] = 'c' print(a[1]) # prints: ['a', 'b'] print(a[2]) # prints: ['c'] is there any suggestions? can anyone provide some keywords so that i can google? ...

referencing java objects on a sorted map by index?

I have a sorted map and want to reference its ordered objects by their index position. Is this possible? How would I convert a sorted map to an array list while maintaining the ordering, so I can retrieve an object by its index (order). Is this the only way to do it? Ideally I could have this structure, and would know the index of an ob...