Questions

Best way to Format a Double value to 2 Decimal places

I am dealing with lot of double values in my application, is there is any easy way to handle the formatting of decimal values in Java? Is there any other better way of doing it than ``` DecimalForm...

23 May at 12:18

Difference between maven scope compile and provided for JAR packaging

What is the difference between the maven scope `compile` and `provided` when artifact is built as a JAR? If it was WAR, I'd understand - the artifact would be included or not in WEB-INF/lib. But in ca...

27 Apr at 03:47

How to run Maven from another directory (without cd to project dir)?

Supposing my maven project is located in `/some/location/project` and my current location is `/another/location/` how can I run maven build without changing to project location `cd /some/location/proj...

7 Sep at 21:44

Undefined symbols for architecture armv7

This problem has been driving me crazy, and I can't work out how to fix it... ``` Undefined symbols for architecture armv7: "_deflateEnd", referenced from: -[ASIDataCompressor closeStream] in...

30 Jun at 20:44

Best way to initialize (empty) array in PHP

In certain other languages (AS3 for example), it has been noted that initializing a new array is faster if done like this `var foo = []` rather than `var foo = new Array()` for reasons of object creat...

11 May at 15:28

Convert string to variable name in JavaScript

I’ve looked for solutions, but couldn’t find any that work. I have a variable called `onlyVideo`. `"onlyVideo"` the string gets passed into a function. I want to set the variable `onlyVideo` inside ...

1 Sep at 16:27

Turning a Comma Separated string into individual rows

I have a SQL Table like this: | SomeID | OtherID | Data | | ------ | ------- | ---- | | abcdef-..... | cdef123-... | 18,20,22 | | abcdef-..... | 4554a24-... | 17,19 | | 987654-..... | 12324a2-......

28 Feb at 09:48

How can I expand/collapse a diff sections in Vimdiff?

I've started using vimdiff today, and wanted to do some of the things that I've taken for granted on Windows based diff editors (like expand/collapse a diff section, have full file expansion/only diff...

How to run a function when the page is loaded?

I want to run a function when the page is loaded, but I don’t want to use it in the `<body>` tag. I have a script that runs if I initialise it in the `<body>`, like this: ``` function codeAddress() ...

8 Apr at 08:34

SQL Server SELECT INTO @variable?

I have the following code in one of my Sql (2008) Stored Procs which executes perfectly fine: ``` CREATE PROCEDURE [dbo].[Item_AddItem] @CustomerId uniqueidentifier, @Description nvar...

28 Jan at 01:53

How do I detect if software keyboard is visible on Android Device or not?

Is there a way in Android to detect if the software (a.k.a. "soft") keyboard is visible on screen?

Could not load file or assembly or one of its dependencies

I'm having another of these "Could not load file or assembly or one of its dependencies" problems. > Additional information: Could not load file or assembly 'Microsoft.Practices.Unity, Version=1.2.0.0...

18 Feb at 22:14

Ruby on Rails generates model field:type - what are the options for field:type?

I'm trying to generate a new model and forget the syntax for referencing another model's ID. I'd look it up myself, but I haven't figured out, among all my Ruby on Rails documentation links, how to fi...

Get the current script file name

If I have PHP script, how can I get the filename of the currently executed file without its extension? Given the name of a script of the form "jquery.js.php", how can I extract just the "jquery.js" pa...

10 Aug at 15:27

Changing ImageView source

I have an `ImageView` with a source image set in the xml using the following syntax: ``` <ImageView android:id="@+id/articleImg" style="@style/articleImgSmall_2" android:src="@draw...

26 Jun at 15:39

What does (function($) {})(jQuery); mean?

I am just starting out with writing jQuery plugins. I wrote three small plugins but I have been simply copying the line into all my plugins without actually knowing what it means. Can someone tell me ...

8 Aug at 15:30

How to change the button text of <input type="file" />?

``` <input type="file" value="Browse" name="avatar" id="id_avatar" /> ``` I tried to modify the `value`, but it's not working. How to customize the button text?

21 Jan at 12:10

What's the difference between window.location= and window.location.replace()?

Is there a difference between these two lines? ``` var url = "http://www.google.com/"; window.location = url; window.location.replace(url); ```

26 Sep at 19:46

Getting the last argument passed to a shell script

`$1` is the first argument. `$@` is all of them. How can I find the last argument passed to a shell script?

10 Feb at 15:27

How to connect to SQL Server database from JavaScript in the browser?

Can anybody give me some sample source code showing how to connect to a SQL Server 2005 database from JavaScript locally? I am learning web programming on my desktop. Or do I need to use any other sc...

What is the most appropriate way to store user settings in Android application

I am creating an application which connects to the server using username/password and I would like to enable the option "Save password" so the user wouldn't have to type the password each time the app...

Generic method with multiple constraints

I have a generic method which has two generic parameters. I tried to compile the code below but it doesn't work. Is it a .NET limitation? Is it possible to have multiple constraints for different para...

24 May at 10:58

What's the best three-way merge tool?

Subversion, Git, Mercurial and others support three-way merges (combining mine, theirs, and the "base" revision) and support graphical tools to resolve conflicts. What tool do you use? Windows, Mac O...

4 Mar at 08:23

Matching a space in regex

How can I match a space character in a PHP regular expression? I mean like "gavin schulz", the space in between the two words. I am using a regular expression to make sure that I only allow letters, n...

13 Nov at 03:43

How are Anonymous inner classes used in Java?

What is the use of anonymous classes in Java? Can we say that usage of anonymous class is one of the advantages of Java?