Questions

Set database from SINGLE USER mode to MULTI USER

I need help with setting a database that was restored in `SINGLE_USER` mode to `MULTI_USER`. Every time I run ``` ALTER DATABASE BARDABARD SET MULTI_USER; GO ``` I get this error: > Changes to the st...

20 Jun at 09:12

Linq select objects in list where exists IN (A,B,C)

I have a list of `orders`. I want to select `orders` based on a set of order statuses. So essentially `select orders where order.StatusCode in ("A", "B", "C")` ``` // Filter the orders based on the ...

3 Feb at 17:17

How to find Java Heap Size and Memory Used (Linux)?

How can I check Heap Size (and Used Memory) of a Java Application on Linux through the command line? I have tried through jmap. But it gives info. about internal memory areas like Eden/ PermGen etc., ...

Convert command line arguments into an array in Bash

How do I convert command-line arguments into a bash script array? I want to take this: ``` ./something.sh arg1 arg2 arg3 ``` and convert it to ``` myArray=( arg1 arg2 arg3 ) ``` so that I can ...

12 Jun at 23:4

How do you produce a .d.ts "typings" definition file from an existing JavaScript library?

I'm using a lot of libraries both my own and 3rd party. I see the "typings" directory contains some for Jquery and WinRT... but how are they created?

19 Oct at 09:1

Programmatically change input type of the EditText from PASSWORD to NORMAL & vice versa

In my application, I have an `EditText` whose default input type is set to `android:inputType="textPassword"` by default. It has a `CheckBox` to its right, which is when checked, changes the input typ...

17 Feb at 17:3

How to load a tsv file into a Pandas DataFrame?

I'm trying to get a `tsv` file loaded into a pandas `DataFrame`. This is what I'm trying and the error I'm getting: ``` >>> df1 = DataFrame(csv.reader(open('c:/~/trainSetRel3.txt'), delimiter='\t')) ...

29 Dec at 01:20

Generating random number between 1 and 10 in Bash Shell Script

How would I generate an inclusive random number between 1 to 10 in Bash Shell Script? Would it be `$(RANDOM 1+10)`?

28 Apr at 08:34

ALTER TABLE to add a composite primary key

I have a table called `provider`. I have three columns called `person`, `place`, `thing`. There can be duplicate persons, duplicate places, and duplicate things, but there can never be a dupicate pers...

ViewBag, ViewData and TempData

Could any body explain, when to use 1. TempData 2. ViewBag 3. ViewData I have a requirement, where I need to set a value in a controller one, that controller will redirect to Controller Two and...

20 Jun at 09:45

How do I escape a percentage sign in T-SQL?

This [question also has the answer](https://stackoverflow.com/questions/700648/escape-percentage-sign-db2-sql), but it mentions DB2 specifically. How do I search for a using `LIKE` that already has ...

8 Mar at 02:9

Find where python is installed (if it isn't default dir)

Python is on my machine, I just don't know where, if I type python in terminal it will open Python 2.6.4, this isn't in it's default directory, there surely is a way of finding it's install location f...

11 Apr at 13:12

How to set entire application in portrait mode only?

How do I set it so the application is running in portrait mode only? I want the landscape mode to be disabled while the application is running. How do I do it programmatically?

9 Jun at 08:11

No ConcurrentList<T> in .Net 4.0?

I was thrilled to see the new `System.Collections.Concurrent` namespace in .Net 4.0, quite nice! I've seen `ConcurrentDictionary`, `ConcurrentQueue`, `ConcurrentStack`, `ConcurrentBag` and `BlockingC...

How to put individual tags for a matplotlib scatter plot?

I am trying to do a scatter plot in matplotlib and I couldn't find a way to add tags to the points. For example: ``` scatter1=plt.scatter(data1["x"], data1["y"], marker="o", c="b...

25 Jun at 20:43

convert string array to string

I would like to convert a string array to a single string. ``` string[] test = new string[2]; test[0] = "Hello "; test[1] = "World!"; ``` I would like to have something like "Hello World!"

30 Jan at 05:55

Why am I getting "Unable to find manifest signing certificate in the certificate store" in my Excel Addin?

I've got an Excel add-in project that was created a couple years back in Visual Studio 2008. It's got some changes to be made so I've upgraded to Visual Studio 2010 (the only IDE I am able to use). No...

23 Dec at 09:32

Validate phone number with JavaScript

I found this code in some website, and it works perfectly. It validates that the phone number is in one of these formats: or The problem is that my client (I don't know why, maybe client stuffs) ...

4 Mar at 20:10

Generate random numbers with a given (numerical) distribution

I have a file with some probabilities for different values e.g.: ``` 1 0.1 2 0.05 3 0.05 4 0.2 5 0.4 6 0.2 ``` I would like to generate random numbers using this distribution. Does an existing modu...

24 Nov at 10:56

Calculating Pearson correlation and significance in Python

I am looking for a function that takes as input two lists, and returns the [Pearson correlation](http://en.wikipedia.org/wiki/Pearson_product-moment_correlation_coefficient), and the significance of t...

22 Nov at 07:18

C#: how to get first char of a string?

Can the first `char` of a string be retrieved by doing the following? ``` MyString.ToCharArray[0] ```

7 Oct at 04:59

How to switch between hide and view password

Is there a clever way to let the user switch between hide and view password in an android EditText? A number of PC based apps let the user do this.

18 Aug at 17:28

Shadow Effect for a Text in Android?

> [Android - shadow on text?](https://stackoverflow.com/questions/2486936/android-shadow-on-text) How can i make shadow effect text in a `TextView`. Any Idea?

23 May at 11:33

Set the layout weight of a TextView programmatically

I'm trying to dynamically create `TableRow` objects and add them to a `TableLayout`. The `TableRow` objects has 2 items, a `TextView` and a `CheckBox`. The `TextView` items need to have their layout w...

Android - How To Override the "Back" button so it doesn't Finish() my Activity?

I currently have an Activity that when it gets displayed a Notification will also get displayed in the Notification bar. This is so that when the User presses home and the Activity gets pushed to the...