Questions

Entity Framework Code First - two Foreign Keys from same table

I've just started using EF code first, so I'm a total beginner in this topic. I wanted to create relations between Teams and Matches: 1 match = 2 teams (home, guest) and result. I thought it's eas...

Difference Between ViewResult() and ActionResult()

What is the difference between `ViewResult()` and `ActionResult()` in ASP.NET MVC? ``` public ViewResult Index() { return View(); } public ActionResult Index() { return View(); } ```

24 Jun at 17:11

How to clear an ImageView in Android?

I am reusing `ImageView`s for my displays, but at some point I don't have values to put it. So how to clear an `ImageView` in Android? I've tried: ``` mPhotoView.invalidate(); mPhotoView.setImageBi...

How do I break out of a loop in Scala?

How do I break out a loop? ``` var largest=0 for(i<-999 to 1 by -1) { for (j<-i to 1 by -1) { val product=i*j if (largest>product) // I want to break out here ...

2 Nov at 22:35

Counting the number of distinct keys in a dictionary in Python

I have a a dictionary mapping keywords to the repetition of the keyword, but I only want a list of distinct words so I wanted to count the number of keywords. Is there a way to count the number of key...

28 Apr at 08:56

What is "vectorization"?

Several times now, I've encountered this term in matlab, fortran ... some other ... but I've never found an explanation what does it mean, and what it does? So I'm asking here, what is vectorization, ...

Are global variables bad?

In C/C++, are global variables as bad as my professor thinks they are?

27 Jan at 18:36

How to find my Subversion server version number?

I want to know if my server is running Subversion 1.5. How can I find that out? Also would be nice to know my SVN client version number. `svn help` hasn't been helpful. I don't want my revision n...

15 Apr at 16:24

Keyboard shortcut to paste clipboard content into command prompt window (Win XP)

Is there a keyboard shortcut for pasting the content of the clipboard into a command prompt window on Windows XP (instead of using the right mouse button)? The typical + does not seem to work here.

6 Feb at 07:14

What are the differences between a clustered and a non-clustered index?

What are the differences between a `clustered` and a `non-clustered index`?

Getting all types in a namespace via reflection

How do you get all the classes in a namespace through reflection in C#?

4 Feb at 05:2

How can I start an interactive console for Perl?

How can I start an interactive console for Perl, similar to the `irb` command for Ruby or `python` for Python?

How do I find duplicate values in a table in Oracle?

What's the simplest SQL statement that will return the duplicate values for a given column and the count of their occurrences in an Oracle database table? For example: I have a `JOBS` table with the ...

9 Jul at 11:6

Create a directly-executable cross-platform GUI app using Python

Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux. The problem be...

What is the question mark for in a Typescript parameter name

``` export class Thread { id: string; lastMessage: Message; name: string; avatarSrc: string; constructor(id?: string, name?: string, avatarSrc?: string) { th...

25 Mar at 14:0

How to delete an element from a Slice in Golang

``` fmt.Println("Enter position to delete::") fmt.Scanln(&pos) new_arr := make([]int, (len(arr) - 1)) k := 0 for i := 0; i < (len(arr) - 1); { if i != pos { new_arr[i] = arr[k] k+...

5 May at 06:32

How do I force Kubernetes to re-pull an image?

I have the following replication controller in Kubernetes on GKE: ``` apiVersion: v1 kind: ReplicationController metadata: name: myapp labels: app: myapp spec: replicas: 2 selector: a...

8 Feb at 06:22

Why does git say "Pull is not possible because you have unmerged files"?

When I try to pull in my project directory in the terminal, I see the following error: ``` harsukh@harsukh-desktop:~/Sites/branch1$ git pull origin master U app/config/app.php U app/config/database.p...

Unique Key constraints for multiple columns in Entity Framework

I'm using Entity Framework 5.0 Code First; ``` public class Entity { [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)] public string EntityId { get; set;} public int FirstColumn {...

Simplest PHP example for retrieving user_timeline with Twitter API version 1.1

Because of the Twitter API 1.0 retirement as of [June 11th 2013](https://dev.twitter.com/blog/api-v1-retirement-date-extended-to-june-11), the script below does not work anymore. ``` // Create curl r...

24 Jun at 15:39

What data is stored in Ephemeral Storage of Amazon EC2 instance?

I am trying to stop a Amazon EC2 instance and get the warning message > Please note that any data on the ephemeral storage of your instance will be lost when it is stopped. What data is stored i...

Simple state machine example in C#?

Again thanks for the examples, they have been very helpful and with the following, I don't mean to take anything away from them. Aren't the currently given examples, as far as I understand them & sta...

20 Jul at 15:54

Nginx location priority

What order do location directives fire in?

8 Mar at 21:11

How to resolve the C:\fakepath?

``` <input type="file" id="file-id" name="file_name" onchange="theimage();"> ``` This is my upload button. ``` <input type="text" name="file_path" id="file-path"> ``` This is the text field where...

10 Feb at 20:22

Finding all possible combinations of numbers to reach a given sum

How would you go about testing all possible combinations of additions from a given set `N` of numbers so they add up to a given final number? A brief example: - `N = {1,5,22,15,0,...}`- `12345`