LINQ: When to use SingleOrDefault vs. FirstOrDefault() with filtering criteria
Consider the IEnumerable extension methods `SingleOrDefault()` and `FirstOrDefault()` [MSDN documents that SingleOrDefault](http://msdn.microsoft.com/en-us/library/bb342451.aspx): > Returns the only...
- Modified
- 17 Nov at 02:24
How can I find WPF controls by name or type?
I need to search a WPF control hierarchy for controls that match a given name or type. How can I do this?
CSS Box Shadow - Top and Bottom Only
I cannot find any examples of how to do this, but how can I add a box shadow only to the top and bottom of an element?
- Modified
- 22 Jul at 03:11
File Upload ASP.NET MVC 3.0
(Preface: this question is about ASP.NET MVC 3.0 which [was released in 2011](https://stackoverflow.com/questions/51390971/im-lost-what-happened-to-asp-net-mvc-5/51391202#51391202), it is not about w...
- Modified
- 27 Dec at 13:36
Convert DateTime in C# to yyyy-MM-dd format and Store it to MySql DateTime Field
I am trying to convert `DateTime` format to `yyyy-MM-dd` format and store it to `DateTime` object. But it gives me the System `DateTime` format that is `MM/dd/yyyy`. I am using following code to conve...
Failed to build gem native extension (installing Compass)
When I attempt to install the latest version of compass ([https://rubygems.org/gems/compass/versions/1.0.0.alpha.17](https://rubygems.org/gems/compass/versions/1.0.0.alpha.17)), I get the following er...
- Modified
- 20 Mar at 20:59
How to find out what is locking my tables?
I have a SQL table that all of a sudden cannot return data unless I include `with (nolock)` on the end, which indicates some kind of lock left on my table. I've experimented a bit with [sys.dm_tran...
- Modified
- 5 Sep at 20:16
Switch tabs using Selenium WebDriver with Java
Using Selenium WebDriver with Java. I am trying to automate a functionality where I have to open a new tab do some operations there and come back to previous tab (Parent). I used switch handle but it'...
- Modified
- 25 Nov at 09:5
Easiest way to copy a table from one database to another?
What is the best method to copy the data from a table in one database to a table in another database when the databases are under different users? I know that I can use ``` INSERT INTO database2.tab...
How to update TypeScript to latest version with npm?
Currently I have TypeScript 1.0.3.0 version installed on my machine. I want to update it to latest one i.e. 2.0. How to do this with npm?
- Modified
- 29 Aug at 14:51
CentOS 64 bit bad ELF interpreter
I have just installed CentOS 6 64bit version, I'm trying to install a 32-bit application on a 64-bit machine and got this error: > /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory Ho...
- Modified
- 29 Dec at 03:12
How do I stretch a background image to cover the entire HTML element?
I'm trying to get a background image of a HTML element (body, div, etc.) to stretch its entire width and height. Not having much luck. Is it even possible or do I have to do it some other way besides ...
- Modified
- 18 Dec at 23:4
private final static attribute vs private final attribute
In Java, what's the difference between: ``` private final static int NUMBER = 10; ``` and ``` private final int NUMBER = 10; ``` Both are `private` and `final`, the difference is the `static` at...
- Modified
- 26 Sep at 22:10
Best algorithm for detecting cycles in a directed graph
Is there an efficient algorithm for detecting cycles within a directed graph? I have a directed graph representing a schedule of jobs that need to be executed, a job being a node and a dependency bein...
- Modified
- 18 Dec at 17:53
Get content of a DIV using JavaScript
I have two DIV's called DIV1 and DIV2 and DIV1 consists of dynamic content and DIV2 is empty. I need content of DIV1 to be displayed in DIV2. How can I do it. I coded in below manner which is not wor...
- Modified
- 27 Dec at 17:10
How can I make a CSS glass/blur effect work for an overlay?
I am having trouble applying a blur effect on a semi-transparent overlay div. I'd like everything behind the div the be blurred, like this: [](https://i.stack.imgur.com/OzXrT.png) Here is a jsfiddle...
- Modified
- 28 Sep at 08:33
Reading tab-delimited file with Pandas - works on Windows, but not on Mac
I've been reading a tab-delimited data file in Windows with Pandas/Python without any problems. The data file contains notes in first three lines and then follows with a header. ``` df = pd.read_csv...
Constant pointer vs Pointer to constant
I want to know the difference between ``` const int* ptr; ``` and ``` int * const ptr; ``` and how it works. It is pretty difficult for me to understand or keep remember this. Please help.
How to hide elements without having them take space on the page?
I'm using `visibility:hidden` to hide certain elements, but they still take up space on the page while hidden. How can I make them totally disappear visually, as though they are not in the DOM at all...
How to Polyfill node core modules in webpack 5
webpack 5 no longer do auto-polyfilling for node core modules. How to fix it please? > BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default. This is no longer the...
Java Timestamp - How can I create a Timestamp with the date 23/09/2007?
How can I create a Timestamp with the date 23/09/2007?
Submit form on pressing Enter with AngularJS
In this particular case, what options do I have to make these inputs call a function when I press Enter? Html: ``` <form> <input type="text" ng-model="name" <!-- Press ENTER and call myFunc --> />...
- Modified
- 18 Aug at 17:18
How to copy file from HDFS to the local file system
How to copy file from HDFS to the local file system . There is no physical location of a file under the file , not even directory . how can i moved them to my local for further validations.i am tried ...
Breaking out of a for loop in Java
In my code I have a for loop that iterates through a method of code until it meets the for condition. Is there anyway to break out of this for loop? So if we look at the code below, what if we want ...
RuntimeWarning: invalid value encountered in divide
I have to make a program using Euler's method for the "ball in a spring" model ``` from pylab import* from math import* m=0.1 Lo=1 tt=30 k=200 t=20 g=9.81 dt=0.01 n=int((ceil(t/dt))) km=k/m r0=[-5,5*...
- Modified
- 13 Feb at 20:9