All Questions

2763
votes
44answers
986060 views

How to merge two dictionaries in a single expression?

I have two Python dictionaries, and I want to write a single expression that returns these two dictionaries, merged. The update() method would be what I need, if it returned its result instead of mod...
407
votes
3answers
402379 views

Server.MapPath("."), Server.MapPath("~"), Server.MapPath(@"\"), Server.MapPath("/"). What is the difference?

Can anyone explain the difference between Server.MapPath("."), Server.MapPath("~"), Server.MapPath(@"\") and Server.MapPath("/")?
168
votes
20answers
78578 views

What is the best way to implement nested dictionaries?

I have a data structure which essentially amounts to a nested dictionary. Let's say it looks like this: {'new jersey': {'mercer county': {'plumbers': 3, 'programmers...
374
votes
26answers
202646 views

Python reverse / invert a mapping

Given a dictionary like so: my_map = { 'a': 1, 'b':2 } How can one invert this map to get: inv_map = { 1: 'a', 2: 'b' } EDITOR NOTE: map changed to my_map to avoid conflicts with the built-in fu...
14
votes
5answers
25185 views

java.lang.IllegalArgumentException: The servlets named [X] and [Y] are both mapped to the url-pattern [/url] which is not permitted

I tried to add this servlet package com.classmgt.servlet; @WebServlet("/ControllerServlet") public class ControllerServlet extends HttpServlet {} to my Eclipse project, by editing the web.xml as ...
359
votes
18answers
247710 views

What is the ideal data type to use when storing latitude / longitudes in a MySQL database?

Bearing in mind that I'll be performing calculations on lat / long pairs, what datatype is best suited for use with a MySQL database?
186
votes
10answers
114415 views

any tool for java object to object mapping?

I am trying to convert DO to DTO using java and looking for automated tool before start writing my own. I just wanted to know if there any free tool available for the same.
176
votes
14answers
69314 views

Mapping two integers to one, in a unique and deterministic way

Imagine two positive integers A and B. I want to combine these two into a single integer C. There can be no other integers D and E which combine to C. So combining them with the addition operator do...
75
votes
7answers
180580 views

Converting from longitude\latitude to Cartesian coordinates

I have some earth-centered coordinate points given as latitude and longitude (WGS-84). How can i convert them to Cartesian coordinates (x,y,z) with the origin at the center of the earth?
116
votes
3answers
97434 views

Mapping many-to-many association table with extra column(s)

My database contains 3 tables: User and Service entities have many-to-many relationship and are joined with the SERVICE_USER table as follows: USERS - SERVICE_USER - SERVICES SERVICE_USER table cont...

Previous Next