Questions

Difference between database and schema

What's the difference between a Database and a Schema in SQL Server? Both are the containers of tables and data. If a Schema is deleted, then are all the tables contained in that schema also deleted ...

C# List of objects, how do I get the sum of a property

I have a list of objects. One property of the individual object entry is amount. How do I get the sum of amount? If my list was of type double I may be able to do something like this: ``` double tot...

4 Dec at 04:24

How to make space between LinearLayout children?

I am programatically adding custom views to a vertical LinearLayout, and I would like there to be some space between the views. I have tried adding: setPadding(0, 1, 0, 1) to my CustomView constructo...

26 Sep at 03:40

How do I temporarily disable triggers in PostgreSQL?

I'm bulk loading data and can re-calculate all trigger modifications much more cheaply after the fact than on a row-by-row basis. How can I temporarily disable all triggers in PostgreSQL?

15 Oct at 12:36

How to find common elements from multiple vectors?

Can anyone tell me how to find the common elements from multiple vectors? ``` a <- c(1,3,5,7,9) b <- c(3,6,8,9,10) c <- c(2,3,4,5,7,9) ``` I want to get the common elements from the above vectors (...

17 Jan at 10:39

Show percent % instead of counts in charts of categorical variables

I'm plotting a categorical variable and instead of showing the counts for each category value. I'm looking for a way to get `ggplot` to display the percentage of values in that category. Of course, i...

2 Aug at 10:52

How do I use IValidatableObject?

I understand that `IValidatableObject` is used to validate an object in a way that lets one compare properties against each other. I'd still like to have attributes to validate individual properties, ...

26 Jun at 17:41

Set Colorbar Range in matplotlib

I have the following code: ``` import matplotlib.pyplot as plt cdict = { 'red' : ( (0.0, 0.25, .25), (0.02, .59, .59), (1., 1., 1.)), 'green': ( (0.0, 0.0, 0.0), (0.02, .45, .45), (1., .97, ....

Getting number of elements in an iterator in Python

Is there an efficient way to know how many elements are in an iterator in Python, in general, without iterating through each and counting?

24 Aug at 13:52

How to specify a min but no max decimal using the range data annotation attribute?

I would like to specify that a decimal field for a price must be >= 0 but I don't really want to impose a max value. Here's what I have so far...I'm not sure what the correct way to do this is. ``` ...

Multiprocessing: How to use Pool.map on a function defined in a class?

When I run something like: ``` from multiprocessing import Pool p = Pool(5) def f(x): return x*x p.map(f, [1,2,3]) ``` it works fine. However, putting this as a function of a class: ``` cla...

9 May at 13:37

Make a DIV fill an entire table cell

I've seen [this question](https://stackoverflow.com/questions/291537/how-can-i-get-a-div-to-fill-a-table-cell-vertically) and [googled a bit](http://www.google.com/search?sourceid=chrome&ie=UTF-8&q=cs...

23 May at 12:3

How to split (chunk) a Ruby array into parts of X elements?

I have an array ``` foo = %w(1 2 3 4 5 6 7 8 9 10) ``` How can I split or "chunk" this into smaller arrays? ``` class Array def chunk(size) # return array of arrays end end foo.chunk(3) #...

18 Aug at 06:30

A simple scenario using wait() and notify() in java

Can I get a complete simple scenario i.e. tutorial that suggest how this should be used, specifically with a Queue?

15 Aug at 14:58

Automating the InvokeRequired code pattern

I have become painfully aware of just how often one needs to write the following code pattern in event-driven GUI code, where ``` private void DoGUISwitch() { // cruisin for a bruisin' through ex...

Viewing full output of PS command

when I run `ps -aux` command on my linux server, to which I connected using putty, few processes are too long to fit in my current window width. Is there an alternative? -- Update -- I am sorry for ...

31 Mar at 21:36

Capture screenshot of active window?

I am making a screen capturing application and everything is going fine. All I need to do is capture the active window and take a screenshot of this active window. Does anyone know how I can do this...

11 Apr at 16:43

Set background color of WPF Textbox in C# code

How can I change the background and foreground colors of a WPF Textbox programmatically in C#?

21 Apr at 10:28

How to convert a double to long without casting?

What is the best way to convert a double to a long without casting? For example: ``` double d = 394.000; long l = (new Double(d)).longValue(); System.out.println("double=" + d + ", long=" + l); ``` ...

21 Sep at 20:39

Is there a performance difference between a for loop and a for-each loop?

What, if any, is the performance difference between the following two loops? ``` for (Object o: objectArrayList) { o.DoSomething(); } ``` and ``` for (int i=0; i<objectArrayList.size(); i++) ...

25 Jun at 17:48

How do you compare two version Strings in Java?

Is there a standard idiom for comparing version numbers? I can't just use a straight String compareTo because I don't know yet what the maximum number of point releases there will be. I need to comp...

13 Oct at 21:16

JavaScript: client-side vs. server-side validation

Which is better to do client side or server side validation? In our situation we are using - - A lot of the validation I do is validating data as users enter it. For example I use the the `keypre...

15 Mar at 06:1

How do you append an int to a string in C++?

``` int i = 4; string text = "Player "; cout << (text + i); ``` I'd like it to print `Player 4`. The above is obviously wrong but it shows what I'm trying to do here. Is there an easy way to do thi...

22 Dec at 22:31

Auto-saving files upon changes with Visual Studio Code

I have used [WebStorm](https://en.wikipedia.org/wiki/JetBrains#WebStorm) from JetBrains for almost four years now. It's a fantastic IDE for many reasons, but one of the best features is that it saves ...

Flutter remove all routes

I want to develop a logout button that will send me to the log in route and remove all other routes from the `Navigator`. The documentation doesn't seem to explain how to make a `RoutePredicate` or ha...

5 Feb at 16:12