Questions

How to return a string value from a Bash function

I'd like to return a string from a Bash function. I'll write the example in java to show what I'd like to do: ``` public String getSomeString() { return "tadaa"; } String variable = getSomeString...

2 Nov at 21:14

How to write a simple Html.DropDownListFor()?

In ASP.NET MVC 2, I'd like to write a very simple dropdown list which gives static options. For example I'd like to provide choices between "Red", "Blue", and "Green".

Wait .5 seconds before continuing code VB.net

I have a code and I want it to wait somewhere in the middle before going forward. After the WebBrowser1.Document.Window.DomWindow.execscript("checkPasswordConfirm();","JavaScript") I want it to wait ....

7 Apr at 01:25

Safe String to BigDecimal conversion

I'm trying to read some BigDecimal values from the string. Let's say I have this String: "1,000,000,000.999999999999999" and I want to get a BigDecimal out of it. What is the way to do it? First of a...

30 May at 07:18

Does Notepad++ show all hidden characters?

In Notepad++ I have set "replace tab with 2 spaces". When coding in Python I copy-pasted some code from the web and it appeared indented correctly. But running the code resulted in indentation errors...

C# listView, how do I add items to columns 2, 3 and 4 etc?

To add items to column 1 in my `listView` control (`Winform`) I'm using `listView1.Items.Add`, this works fine but how do I add items to columns 2 and 3 etc?

14 Oct at 10:52

How to use CURL via a proxy?

I am looking to set curl to use a proxy server. The url is provided by an html form, which has not been a problem. Without the proxy it works fine. I have found code on this and other sites, but they ...

23 May at 12:17

Operation Not Permitted when on root - El Capitan (rootless disabled)

I am trying to move something to on OS X El Capitan. I have disabled rootless using the following commands: `sudo nvram boot-args="rootless=0"; sudo reboot`, but I keep getting the same error: ``` ...

7 Jan at 12:0

Basic example of using .ajax() with JSONP?

Please could someone help me work out how to get started with JSONP? Code: ``` $('document').ready(function() { var pm_url = 'http://twitter.com/status'; pm_url += '/user_timeline/stephenfry...

9 May at 23:33

How to post data in PHP using file_get_contents?

I'm using PHP's function `file_get_contents()` to fetch contents of a URL and then I process headers through the variable `$http_response_header`. Now the problem is that some of the URLs need some d...

3 Nov at 10:46

VBA Excel sort range by specific column

I have a table that can contain any number of rows: ![enter image description here](https://i.stack.imgur.com/LwwBf.png) As I said it can contain 1 or ∞ rows. I want to sort range `A3:D∞` by the Da...

22 Apr at 12:32

Boolean vs boolean in Java

There are discussions around `Integer` vs `int` in Java. The default value of the former is `null` while in the latter it's `0`. How about `Boolean` vs `boolean`? A variable in my application can ha...

24 May at 01:19

In a Django form, how do I make a field readonly (or disabled) so that it cannot be edited?

In a Django form, how do I make a field read-only (or disabled)? When the form is being used to create a new entry, all fields should be enabled - but when the record is in update mode some fields ne...

30 Jul at 01:58

How to set gradle home while importing existing project in Android studio

How to set gradle home while importing existing project in Android studio. While trying to import I need to set up this path. ![enter image description here](https://i.stack.imgur.com/e2k3g.png)

What is the difference between React Native and React?

I have started to learn out of curiosity and wanted to know the difference between React and React Native - though could not find a satisfactory answer using Google. React and React Native seems to h...

Pass a PHP array to a JavaScript function

I am trying to get a PHP array variable into a JavaScript variable. This is my code: ``` <html> <head> <script type="text/javascript"> function drawChart(row,day,week,month...

26 Sep at 17:28

When do Java generics require <? extends T> instead of <T> and is there any downside of switching?

Given the following example (using JUnit with Hamcrest matchers): ``` Map<String, Class<? extends Serializable>> expected = null; Map<String, Class<java.util.Date>> result = null; assertThat(result, ...

9 Jun at 22:38

How to trim a string to N chars in Javascript?

How can I, using Javascript, make a function that will trim string passed as argument, to a specified length, also passed as argument. For example: ``` var string = "this is a string"; var length = 6...

13 Sep at 21:4

How to remove outliers from a dataset

I've got some multivariate data of beauty vs ages. The ages range from 20-40 at intervals of 2 (20, 22, 24....40), and for each record of data, they are given an age and a beauty rating from 1-5. When...

11 Mar at 02:35

cout is not a member of std

I'm practicing using mulitple files and header files etc. So I have this project which takes two numbers and then adds them. Pretty simple. Here are my files: ``` #include <iostream> #include "add...

28 Mar at 07:18

How to run a class from Jar which is not the Main-Class in its Manifest file

I have a JAR with 4 classes, each one has Main method. I want to be able to run each one of those as per the need. I am trying to run it from command-line on Linux box. ``` E.g. The name of my JAR is...

29 Mar at 15:2

How best to include other scripts?

The way you would normally include a script is with "source" eg: main.sh: ``` #!/bin/bash source incl.sh echo "The main script" ``` incl.sh: ``` echo "The included script" ``` The output of ...

22 Feb at 01:28

How do I get today's date in C# in mm/dd/yyyy format?

How do I get today's date in C# in mm/dd/yyyy format? I need to set a string variable to today's date (preferably without the year), but there's got to be a better way than building it month-/-day on...

23 May at 12:10

Missing visible-** and hidden-** in Bootstrap

In Bootstrap v3 I often use the hidden-** classes combined with clearfix to control multi column layouts at different screen widths. For example, I could combine multiple hidden-** in one DIV to mak...

15 Dec at 13:43

How do I install Java on Mac OSX allowing version switching?

I want to install OpenJDK Java on Mac OSX and have it work alongside other JDK's since it is a newer release. Currently, I downloaded the tar.gz and placed it in my path but that is hard to maintain....

29 Sep at 20:52