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

Cantor pairing function is really one of the better ones out there considering its simple, fast and space efficient, but there is something even better published at Wolfram by Matthew Szudzik, here. The limitation of Cantor pairing function (relatively) is that the range of encoded results doesn’t always stay within the limits of a 2N … Read more

any tool for java object to object mapping? [closed]

There are some libraries around there: Commons-BeanUtils: ConvertUtils -> Utility methods for converting String scalar values to objects of the specified Class, String arrays to arrays of the specified Class. Commons-Lang: ArrayUtils -> Operations on arrays, primitive arrays (like int[]) and primitive wrapper arrays (like Integer[]). Spring framework: Spring has an excellent support for PropertyEditors, … Read more

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

Caused by: java.lang.IllegalArgumentException: The servlets named [ControllerServlet] and [com.classmgt.servlet.ControllerServlet] are both mapped to the url-pattern [/ControllerServlet] which is not permitted It seems that you have mixed @WebServlet annotation based and web.xml based configuration. I doubt that you created a Servlet using the “Create Servlet” wizard which creates web.xml entry with url-pattern and then , added … Read more

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

Server.MapPath specifies the relative or virtual path to map to a physical directory. Server.MapPath(“.”)1 returns the current physical directory of the file (e.g. aspx) being executed Server.MapPath(“..”) returns the parent directory Server.MapPath(“~”) returns the physical path to the root of the application Server.MapPath(“https://stackoverflow.com/”) returns the physical path to the root of the domain name (is … Read more

vim remove non existing mapping [closed]

It fails because do_map returns 2 for unknown mapping and this code throws error for this case. Not very helpful, I guess. Annotate says that this code did not change from the very first version of vim found in the mercurial repository (7.0001). There may be different answers: I can guess of three: vi compatibility: … Read more