HashMap get/put complexity
We are used to saying that `HashMap` `get/put` operations are O(1). However it depends on the hash implementation. The default object hash is actually the internal address in the JVM heap. Are we sure...
- Modified
- 30 Aug at 11:47
Java default constructor
What exactly is a default constructor — can you tell me which one of the following is a default constructor and what differentiates it from any other constructor? ``` public Module() { this.name =...
- Modified
- 2 Oct at 08:44
How can I get a resource content from a static context?
I want to read strings from an `xml` file before I do much of anything else like `setText` on widgets, so how can I do that without an activity object to call `getResources()` on?
- Modified
- 23 Mar at 08:48
How to make/get a multi size .ico file?
I simply want to have an .ico file that has multiple sizes of the icon image contained within it. I'd like it for use in a cross-platform desktop application (so that, e.g. on Windows, the 16x16 size...
- Modified
- 21 Sep at 14:9
.NET: Simplest way to send POST with data and read response
To my surprise, I can't do anything nearly as simple as this, from what I can tell, in the .NET BCL: ``` byte[] response = Http.Post ( url: "http://dork.com/service", contentType: "applicatio...
- Modified
- 25 Mar at 11:33
Exception thrown in catch and finally clause
On a question for Java at the university, there was this snippet of code: ``` class MyExc1 extends Exception {} class MyExc2 extends Exception {} class MyExc3 extends MyExc2 {} public class C1 { ...
PHP calculate age
I'm looking for a way to calculate the age of a person, given their DOB in the format dd/mm/yyyy. I was using the following function which worked fine for several months until some kind of glitch ca...
- Modified
- 23 Sep at 08:49
javax.faces.application.ViewExpiredException: View could not be restored
I have written simple application with container-managed security. The problem is when I log in and open another page on which I logout, then I come back to first page and I click on any link etc or r...
- Modified
- 14 Nov at 12:32
ActionController::InvalidAuthenticityToken
Below is an error, caused by a form in my Rails application: ``` Processing UsersController#update (for **ip** at 2010-07-29 10:52:27) [PUT] Parameters: {"commit"=>"Update", "action"=>"update", "_m...
- Modified
- 17 Nov at 10:54
How to get multiple select box values using jQuery?
How to get multiple select box values using jQuery?
- Modified
- 14 Feb at 14:33
Add zero-padding to a string
How do I add "0" padding to a string so that my string length is always 4? Example ``` If input "1", 3 padding is added = 0001 If input "25", 2 padding is added = 0025 If input "301", 1 padding is a...
How to start an application without waiting in a batch file?
Is there any way to execute an application without waiting in batch file? I have tried the `start` command but it just creates a new command window.
- Modified
- 12 Jun at 03:51
Vertical line using XML drawable
I'm trying to figure out how to define a vertical line (1dp thick) to be used as a drawable. To make a horizontal one, it's pretty straightforward: ``` <shape xmlns:android="http://schemas.android.c...
- Modified
- 30 Dec at 13:51
jQuery hasClass() - check for more than one class
With: ``` if(element.hasClass("class")) ``` I can check for one class, but is there an easy way to check whether "element" has any of many classes? I am using: ``` if(element.hasClass("class") ||...
- Modified
- 31 Jul at 21:56
EC2 Instance Cloning
Is it possible to clone a EC2 instance data and all?
- Modified
- 3 Apr at 19:50
Peak-finding algorithm for Python/SciPy
I can write something myself by finding zero-crossings of the first derivative or something, but it seems like a common-enough function to be included in standard libraries. Anyone know of one? My p...
- Modified
- 29 Mar at 18:41
Redirect to external URI from ASP.NET MVC controller
I'm trying to redirect to external url from an action method but can't get it to work. Can anybody shed some light on my error? ``` public void ID(string id) { string url = string.Empty; ...
- Modified
- 21 Oct at 10:51
How to Rotate a UIImage 90 degrees?
I have a `UIImage` that is `UIImageOrientationUp` (portrait) that I would like to rotate counter-clockwise by 90 degrees (to landscape). I don't want to use a `CGAffineTransform`. I want the pixels of...
- Modified
- 8 Jun at 16:0
Set the selected index of a Dropdown using jQuery
How do I set the index of a dropdown in jQuery if the way I'm finding the control is as follows: ``` $("*[id$='" + originalId + "']") ``` I do it this way because I'm creating controls dynamically ...
- Modified
- 25 May at 14:19
How to get the body's content of an iframe in Javascript?
``` <iframe id="id_description_iframe" class="rte-zone" height="200" frameborder="0" title="description"> <html> <head></head> <body class="frameBody"> test<br/> </body> </html> ...
- Modified
- 16 Nov at 08:37
Static extension methods
Is there any way I can add a static extension method to a class. specifically I want to overload `Boolean.Parse` to allow an `int` argument.
- Modified
- 18 Nov at 00:13
Secure Web Services: REST over HTTPS vs SOAP + WS-Security. Which is better?
I'm not a security expert by any means, but I favor creating REST-style web services. In creating a new service which needs to have the data it transmits secure. We've entered a debate over which ...
- Modified
- 12 May at 16:14
What is the C++ function to raise a number to a power?
How do I raise a number to a power? ``` 2^1 2^2 2^3 ``` etc...
What is the default scope of a method in Java?
If I type: ``` void doThis(){ System.out.println("Hello Stackoverflow."); } ``` what is the default scope of `doThis()`? Public? Protected? Private?
Using Case/Switch and GetType to determine the object
> [C# - Is there a better alternative than this to ‘switch on type’?](https://stackoverflow.com/questions/298976/c-sharp-is-there-a-better-alternative-than-this-to-switch-on-type) If you want to `sw...
- Modified
- 20 Jun at 09:12