map

How to query distinct values from map with given key in Hibernate?

I have following Hibernate 3 mapping for User class: <class name="org.test.User" table="users"> ... some other mapping... <map name="metadata" table="user_metadata"> <cache usage="transactional"/> <key column="user_id" not-null="true" foreign-key="FK_USERMETADATA_USER_ID"/> <map-key type="string" column="da...

C++ map object not growing when members added

Below the map 'widgets' is always size of 1 for some reason. There should be 4 when it's done. Output: Widget: widget_ram_label:layout_bar:0 1 Widget: widget_ram_active:layout_bar:0 1 Widget: widget_ram_total:layout_bar:0 1 Widget: widget_wlan0_label:layout_bar:0 1 Here's widgets: std::map<const char *, Widget *> widgets; And here...

Travel Time Between Zip codes

Hi All Hope someone can advice but looking for an API service that can provide traveling times between 2 zip codes. These would be driving time. Cant seem to find a service for such a thing. Can anyone help provide links to any good services they have found? ...

How to map file path from different folder location easily?

how to map the path to the file easily? public_html/api/function.php <?php function writetologfile($content) { $filename = 'logfile/testing_randomstring.txt'; if (!$handle = fopen($filename, 'a')) { echo "Cannot open file ($filename)"; exit; } fclose($handle); } ?> the actual path of the text file i...

std::map::iterator crashes program on increment

What could cause this? Here's the stack trace: #0 0x0645c0f5 in std::_Rb_tree_increment (__x=0x83ee5b0) at ../../../../libstdc++-v3/src/tree.cc:69 #1 0x0805409a in std::_Rb_tree_iterator<std::pair<std::string const, Widget*> >::operator++ ( this=0xbffff144) at /usr/lib/gcc/i586-redhat-linux/4.4.1/../../../../include/c++/4...

std::map difference between index and insert calls.

What is the difference between the index overloaded operator and the insert method call for std::map? ie: some_map["x"] = 500; vs. some_map.insert(pair<std::string, int>("x", 500)); ...

How can I display custom icon and two hyperlinks in model pop up on Blackberry map?

I need to display a custom icon and two hyperlinks in model pop up on Blackberry map. How can I do this? ...

dynamic map managment in google earth

Hi, My goal is to display various shapes(polygons, points, linestring) on google maps by using data entered into a Postgis database dynamically(i mean by that we can see modifications in the map in real time). I was looking for a way to do this that used the spatial structure already provided in postgis(already designating if shape is ...

How do I use map() to apply an operation to each element of a hash in Perl?

I've got a piece of code that works fine. It basically loops through each element of a hash using foreach() and applies a transformation to it using a regular expression, like so : foreach my $key ( keys( %{$results} ) ) { $results->{$key}{uri} =~ s/\".*\/(.*\.*(gif|jpe?g|png))\"/\/resources\/uploads\/$1/gi; } $results is a hashref...

I have a site where I will be manually changing street addresses. I want to include a map link but I want it to update itself automatically when I change addresses...

I have a site where I will be manually changing street addresses. I want to include a map link but I want it to update itself automatically when I change addresses... Also, I'd like the link to send the address field to google maps or mapquest and return with that info in a small popup window that features the map. What's the best way...

How to print a Map in Scala

Okay, this question seems to be really stupid one, but my point is that if you take a look on Scala 2.7.6 API, they had made mappingToString method deprecated. Therefore, there should be more elegant alternative for printing custom-formatted Map. Since for nearly any purpose, having equivalence method of mkString in Map is really handy. ...

Map List<Int32> using Fluent Nhibernate

Hello there, I need to map List<Int32> using Fluent Nhibernate. Sample code: public class ReportRequest { public List<Int32> EntityIds { get { return entityIds; } set { entityIds = value; } } } Please guide. Thank you! ...

BlackBerry and map based apps like Yelp and Google Map

This is a question-loaded post from someone who is just getting started with BB development. Any guidance is much appreciated. How are map based BlackBerry apps such as Yelp and Google Map implemented? As with the web based version. Yelp for the BB allows you to search for restaurants & etc. based on on the current or specified loca...

Selectively counting delimited field values and creating a hash using map

I have a pipe delimited text file containing, among other things, a date and a number indicating the lines sequence elsewhere in the program. What I'm hoping to do is from that file create a hash using the year as the key and the value being the maximum sequence for that year (I essentially need to implement an auto-incremented key per y...

In Java/Spring, how do you setup the hashmap to append the query string?

in spring-config/applicationContext-mapping.xml: I have this code fragment: <bean id="unused-url-quick" class="java.util.HashMap"> <constructor-arg> <map> <entry key="/page.html" value="/otherpage.html"/> ... </map> I can an add an entry key to redirect from one page to another. Using this same method...

When do I have to use initializer lists for initializing C++ class members?

let's say I have std::map< std::string, std::string > m_someMap as a private member variable of class A Two questions: (and the only reason I'm asking is because I came across code like that) What's the purpose of this line: A::A() : m_someMap() Now I know that this is intialization, but do you have to do this like that? I'm c...

C++ STL:map search by iterator to another map

I'm trying to jump through some hoops to organize data in a special way. I'm including a simplified piece of code that demonstrates my pain. I can't use boost. I'm using the latest version of g++ in cygwin. #include <iostream> #include <map> using namespace std; int main () { map< int,int > genmap; map< int,int >::iterator g...

Clojure: How do I apply a function to a subset of the entries in a hash-map?

I am not to Clojure and attempting to figure out how to do this. I want to create a new hash-map that for a subset of the keys in the hash-map applies a function to the elements. What is the best way to do this? (let [my-map {:hello "World" :try "This" :foo "bar"}] (println (doToMap my-map [:hello :foo] (fn [k] (.toUpperCase k))...

Calling a function on STL map element without inserting it first

Is the following code OK? class A { public: A(); void foo(); }; map<int,A> m; m[0].foo(); Or do I have to do the following: map<int,A> m; m[0] = A(); m[0].foo(); And also, can I do this: map<int,A> m; A a = m[5]; And how about access by reference: void foo(A & a); map<int,A> m; foo(m[5]); ...

How to use ReadWriteLock ?

Hello, I'm the following situation. At web application startup I need to load a Map which is thereafter used by multiple incoming threads. That is, requests comes in and the Map is used to find out whether it contains a particular key and if so the value (the object) is retrieved and associated to another object. Now, at times the co...