Questions

Should functions return null or an empty object?

What is the when returning data from functions. Is it better to return a Null or an empty object? And why should one do one over the other? Consider this: ``` public UserEntity GetUserById(Guid u...

29 Jul at 17:27

Parse JSON in C#

I'm trying to parse some JSON data from the Google AJAX Search API. I have [this URL](http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q=cheese&rsz=large) and I'd like to break it down so tha...

23 May at 12:25

How to convert DateTime? to DateTime

I want to convert a nullable DateTime (`DateTime?`) to a `DateTime`, but I am getting an error: > Cannot implicitly convert type 'System.DateTime?' to 'System.DateTime'. An explicit conversion exi...

14 Jun at 06:39

What is the use of "ref" for reference-type variables in C#?

I understand that if I pass a value-type (`int`, `struct`, etc.) as a parameter (without the `ref` keyword), a copy of that variable is passed to the method, but if I use the `ref` keyword a reference...

What is the proper way to re-attach detached objects in Hibernate?

I have a situation in which I need to re-attach detached objects to a hibernate session, although an object of the same identity MAY already exist in the session, which will cause errors. Right now, ...

6 Apr at 23:42

How to get database structure in MySQL via query?

Is it possible to somehow get structure of MySQL database, or just some table with simple query? Or is there another way, how can I do it?

8 Feb at 11:1

XPath find if node exists

Using a XPath query how do you find if a node (tag) exists at all? For example if I needed to make sure a website page has the correct basic structure like `/html/body` and `/html/head/title`.

1 Apr at 19:42

Why use finally in C#?

Whatever is inside finally blocks is executed (almost) always, so what's the difference between enclosing code into it or leaving it unclosed?

13 Feb at 21:36

How to keep the console window open in Visual C++?

I'm starting out in Visual C++ and I'd like to know how to keep the console window. For instance this would be a typical "hello world" application: ``` int _tmain(int argc, _TCHAR* argv[]) { co...

27 May at 14:57

Visual Studio opens the default browser instead of Internet Explorer

When I debug in Visual Studio, Firefox opens and that is annoying because of the hookups that Internet Explorer and Visual Studio have, such as when you close the Internet Explorer browser that starti...

31 Mar at 18:18

Why can't I have abstract static methods in C#?

I've been working with [providers](http://msdn.microsoft.com/en-us/library/aa479030.aspx) a fair bit lately, and I came across an interesting situation where I wanted to have an abstract class that ha...

8 Jan at 22:20

C# 8 switch expression with multiple cases with same result

How can a switch expression be written to support multiple cases returning the same result? With C# prior to version 8, a switch may be written like so: ``` var switchValue = 3; var resultText = strin...

26 Nov at 00:34

The annotation for nullable reference types should only be used in code within a '#nullable' context

I have a console app to try out the C# 8 null reference types. Switched the project to build with lang ver C# 8. Then the following code results in a warning. ``` class Program { static vo...

Is ConfigurationManager.AppSettings available in .NET Core 2.0?

I've got a method that reads settings from my config file like this: ``` var value = ConfigurationManager.AppSettings[key]; ``` It compiles fine when targeting .NET Standard 2.0 only. Now I need mult...

How to change port number in vue-cli project

How to change Port number in Vue-cli project so that it run's on another port instead of 8080.

'Found the synthetic property @panelState. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your application.'

I upgraded an Angular 4 project using angular-seed and now get the error > Found the synthetic property @panelState. Please include either "BrowserAnimationsModule" or "NoopAnimationsModule" in your ...

PHP error: "The zip extension and unzip command are both missing, skipping."

When I run a `composer update` I get this error message: ``` Loading composer repositories with package information Updating dependencies (including require-dev) Failed to download psr/log from d...

22 Dec at 02:13

PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value

After typing `cordova run android` in terminal, I'm getting this error: ``` Waiting for emulator to start... PANIC: Broken AVD system path. Check your ANDROID_SDK_ROOT value [/Users/username/Library/...

17 Nov at 18:21

Move to next item using Java 8 foreach loop in stream

I have a problem with the stream of Java 8 foreach attempting to move on next item in loop. I cannot set the command like `continue;`, only `return;` works but you will exit from the loop in this case...

6 Feb at 16:54

How to run .sh on Windows Command Prompt?

How can I run .sh on Windows 7 Command Prompt? I always get this error when I try to run this line in it, ``` app/build/build.sh ``` error, ``` 'app' is not recognized... ``` or, ``` bash app/b...

23 Oct at 06:59

Pandas: sum DataFrame rows for given columns

I have the following DataFrame: ``` In [1]: df = pd.DataFrame({'a': [1, 2, 3], 'b': [2, 3, 4], 'c': ['dd', 'ee', 'ff'], 'd': [5, 9, 1]}) df Ou...

28 Apr at 07:19

How to set tbody height with overflow scroll

I am facing problem while setting tbody height width overflow scroll. ``` <style> tbody{ height:50px;display:block;overflow:scroll } </style> <h3>Table B</h3> <table...

2 Jun at 07:35

Pandas DataFrame column to list

I am pulling a subset of data from a column based on conditions in another column being met. I can get the correct values back but it is in pandas.core.frame.DataFrame. How do I convert that to list...

1 May at 11:31

Failed to load resource: net::ERR_INSECURE_RESPONSE

IS there a way to trick the server so I don't get this error: Content was blocked because it was not signed by a valid security certificate. I'm pulling an iframe of an html website into another w...

Is it possible to cast a Stream in Java 8?

Is it possible to cast a stream in Java 8? Say I have a list of objects, I can do something like this to filter out all the additional objects: ``` Stream.of(objects).filter(c -> c instanceof Client)...

29 Jul at 06:52