map

Java + readLine with BufferedReader

I'm trying to read a line of text from a text file and put each line into a Map so that I can delete duplicate words (e.g. test test) and print out the lines without the duplicate words. I must be doing something wrong though because I basically get just one line as my key, vs each line being read one at a time. Any thoughts? Thanks. ...

Iterating over a map.

In this question I'm not asking how to do it but HOW IS IT DONE. I'm trying (as an excersise) implement simple map and although I do not have problems with implementing links and they behavior (how to find next place to insert new link etc.) I'm stuck with the problem how to implement iterating over a map. When you think about it and loo...

[SOLVED] Perl's tr/// is not doing what I want...

EDIT: tr/// does not support variable interpolation, so I went with s/\Q$_\E//g; instead Or, more likely, I'm not doing something right... I have the following code: #!/usr/bin/perl use strict; use warnings; use utf8; sub strip_invalid { my ($str, @chars) = @_; map { $str =~ tr/$_//; } @chars; return $str; } my @invalid = q...

Android - how to get more accurate location?

I'm trying to get my current location and show it on a map. Class com.google.android.maps.MyLocationOverlay.MyLocationOverlay does most of the work for you. But it's coming back with a very coarse result that's off by a couple of clicks. I'm listening for onAccuracyChanged() but that never gets called. How can I get a more accurate...

Is Map directions supported in Android SDK?

Hi Friends, Is there any way to find the direction between two locations in Android? ...

converting a variable name to a string in C++

Hi, I'd like to output some data to a file. For example assume I have two vectors of doubles: vector<double> data1(10); vector<double> data2(10); is there an easy way to output this to a file so that the first row contains the headings 'data1' and 'data2' followed by the actual contents. The function which outputs the data will b...

What are R's equivalents to Perl's map and grep?

I am interested in (functional) vector manipulation in R. Specifically, what are R's equivalents to Perl's map and grep? The following Perl script greps the even array elements and multiplies them by 2: @a1=(1..8); @a2 = map {$_ * 2} grep {$_ % 2 == 0} @a1; print join(" ", @a2) # 4 8 12 16 How can I do that in R? I got this far, us...

Function that returns iterator from a map

I have a class with a map<K,V> variable which gets its value in the c'tor like so: class Foo { map<K,V> m; Foo (map<K,V>& newM) : m(newM) {} map<K,V>::iterator bar () { ... } } the function bar iterates through the map m, and return some an iterator to some element. I'm calling the function like this: std::map<K,V> map; /...

F# FSharpMap vs Dictionary performance

I was wondering how does the F# immutable Map perform against the standard Dictionary. I am writing a count function (for each line lookup increment set) to use on large files with millions of lines and thousands of elements. What about the memory usage? Thanks ...

Styling google map marker when using markerManager

I have a big list of markers (pinpoints) stored in an XML file and am using markerManager to load these on a google map. I'm having some difficulty understanding how I style to marker. I understand that you can add some simple css to a marker like: <div style="width: 200px; height: 100px;"></div> but don't know how to integrate that ...

Downloading route details from google map.

I want to draw a route in google map with desites A & B directions specidied,I am able to do this through google directs ,thanks to goole..No i want to create a static map with only that route and hence i need to get all the latitude and longitude details into CSV for 100M distance of this route. Is there any possible way as currently ...

Copy map to vector

I have to copy certain elements from a std::map into a vector. It should work like in this loop: typedef int First; typedef void* Second; std::map<First, Second> map; // fill map std::vector<Second> mVec; for (std::map<First, Second>::const_iterator it = map.begin(); it != map.end(); ++it) { if (it->first % 2 == 0) { mVec.pu...

How do I create an elegant for_each() in C++ inside a member function where the operating function is another member function in the same class?

Here is what I'm trying to do: //ImageCache.h: #include <map> #include <SDL.h> typedef pair<const wchar_t*, SDL_Surface*> ImageNameAndSurface; class ImageCache { // Functions public: ImageCache(); ~ImageCache(); SDL_Surface* getImage(const wchar_t* imageFilename); // Variables private: map<const ...

Google Map invalid argument on IE6/7/8

Dear all, After hours of debugging, I have to ask some help... I try to make this work on IE : http://ferc.noisy.ch/professionnels-plan.html (user and pwd : ferc) It works fine with FF, but with IE6/7/8 I have the following message : Line:133 Character: 18 Error : invalid argument After some investigation, I found that the problem ...

How do I draw 2D Map with plot() in MATLAB

I am trying to create a 2D map of some place. I get a 181x1 vector of laser sensor readings from a robot. All the values in this vector corresponds to a distance from that single angle like 1°,2°..180°. The problem here is I need to create a map by plotting these distances as dots with plot() or a similar function to it. ...

Javascript: Checking if an object has no properties or if a map/associative-array is empty

Possible Duplicate: How do I test for an empty Javascript object from JSON? Is there an easy way to check if an object has no properties, in Javascript? Or in other words, an easy way to check if a map/associative array is empty? For example, let's say you had the following: var nothingHere = {}; var somethingHere = {foo: "ba...

Using jQuery to assign an active class to an area tag (image map)

Is there a way, through jQuery, to assign an active class to an area tag within an a map? I have a bunch of areas defined like this: <map name="mappy"> <area shape="rect" coords="162,105,179,136" href="#" title="Unique Title 1" alt="Unique Title 1" /> <area shape="rect" coords="205,72,222,101" href="#" title="Unique Title 2" ...

Scala Immutable MultiMap

In Scala I would like to be able to write val petMap = ImmutableMultiMap(Alice->Cat, Bob->Dog, Alice->Hamster) The underlying Map[Owner,Set[Pet]] should have both Map and Set immutable. Here's a first draft for ImmutibleMultiMap with companion object: import collection.{mutable,immutable} class ImmutableMultiMap[K,V] extends immutab...

Can you load dynamic maps in the phonegap framework?

Currently I've been using google's static maps to display maps in a phonegap app I'm developing. But I'm wondering if there's any way to load a google map that the user could scroll into and out of? I would want similar functionality as the maps app in most mobile environments. Is there any way to incorporate that type of service into my...

I can't run my android maps aplication on phone

I developed an android maps application on Google API 2.1 update-1 platform. And it is the simplest code to show a map on the screen, there is no other things. However, map doesn't shown on phone. The problem is, the same program runs on my android emulator right but it is not working on my android phone properly, I mean program starts ...