RandomStranger

0

votes
0

answer
3

views

Migrating from webpack 2 to webpack 4

I'm trying to migrate a project I'm working on from webpack 2.4.1 to the most recent version 4.29.3. (A much needed upgrade, I know) I think I have converted everything correctly, from replacing extract-text-webpack-plugin to mini-css-extract-plugin, etc. The problem occured when I tried to replace...
RandomStranger
5

votes
3

answer
557

views

Conditional GroupBy() in LINQ

I'm working with a matrix filled with similarities between items. I save these as a list of objects in my database. The Similarity object looks like this: public class Similarity { public virtual Guid MatrixId { get; set; } //The id of the matrix the similarity is in public virtual Guid FirstIndex {...
RandomStranger
1

votes
2

answer
93

views

Making a keyevent in a JFrame

I'm trying to make a key make something happen in a JFrame. Right now I'm just trying to disable a button when you press the left key, but nothing is happening. I thought I have everything right, but it does nothing. EDIT: I noticed that when I don't click start first, it works. But after you press...
RandomStranger
12

votes
1

answer
772

views

Using matrix factorization for a recommender system

I'm working on a recommender system for restaurants using an item-based collaborative filter in C# 6.0. I want to set up my algorithm to perform as well as possible, so I've done some research on different ways to predict ratings for restaurants the user hasn't reviewed yet. I'll start with the rese...
RandomStranger
5

votes
1

answer
237

views

How to extract variables from speech recognition

I'm using System.Speech to recognize some phrases or words. One of them is Set timer. I would like to expand this to Set timer for X seconds, and having the code set a timer for X seconds. Is this possible? I have little to no experience with this so far, all I could find is that I have to do someth...
RandomStranger
1

votes
2

answer
63

views

Getting averages from different table in Entity Framework

I currently have several tables, but the relevant ones are Restaurant and Review. Each restaurant can have multiple reviews, but a review has only 1 restaurant. Now when I retrieve restaurants from the database, I want their average rating from the reviews on each restaurant. I select the restaurant...
RandomStranger
1

votes
1

answer
120

views

Retaining order with LINQ using .Contains

I have read this question about retaining order in a list, but I didn't see anything about using the .Contains() method, hence why I'm asking this questions. I have created a wrapper class which can contain different objects, like below: public class RecommenderItem { public Guid Id { get; set; } pu...
RandomStranger
6

votes
2

answer
1.5k

views

How to use a custom font in polymer

I am working on a generic polymer 2.0 login page application, and I'm trying to use a custom font for a title bar. In my login-page.html, I have this for the custom style: body { margin: 0; } app-toolbar { background-color: #4F1585; font-family: 'Roboto', Helvetica, sans-serif; color: white;...
RandomStranger
2

votes
1

answer
336

views

Decision between an user-based and item-based filter

I'm working on an algorithm to generate recommendations for a platform where you can review restaurants. So the database exists of 3 tables, 'Users', 'Restaurants' and 'Reviews'. Reviews have a rating of 1-5. Each restaurant can have multiple reviews, and users can have multiple reviews. A review ca...
RandomStranger
3

votes
1

answer
3.3k

views

MongoDB and C# - Checking if document exists, if it doesn't insert it

I currently get a list of 50 restaurants from the Yelp Fusion API. I want to save these restaurants in my database for further use in my application. Since I get this list based on the user's coordinates, it's possible the API will return restaurants that are already in my database. To prevent dupl...
RandomStranger
4

votes
1

answer
341

views

Mocked method with moq to return null throws NullReferenceException

I am using .Net Core 2.0 for my project, and Moq v4.7.145 as my mocking framework. I have this protected virtual method, which normally uploads bytes to a cloud service. To be able to unit test this, I wanted to mock this method which works fine for all other scenarios. The problem occurred when I w...
RandomStranger
3

votes
3

answer
112

views

Filling list with different types of objects

I'm working on a recommendation algorithm which all works fine. But now I wanted to implement this code into the branch of my development team. I'll start from the top. My algorithm can recommend 2 types of objects, restaurants and dishes. Restaurant: public class Restaurant { public Guid Id { get;...
RandomStranger
2

votes
3

answer
2.9k

views

Correct way of using the 'using' statement in Entity Framework

I have some questions about using the using statement. I understand what it does (If I'm correct, it disposes all open connections and such), but I'm unsure how I should use it correctly. The project I'm working in doesn't contain any repositories, which you don't need for Entity Framework. So basic...
RandomStranger
2

votes
1

answer
230

views

Visual Studio 2017 File icons broken

I have a weird issue with my visual studio 2017. When I load a project the icons look just fine, but when I edit and save some code the icon disappears. It looks like this: The issue isn't breaking, it's just odd that it's broken. I have used the installer to 'repair' my visual studio, but to no ava...
RandomStranger
1

votes
3

answer
142

views

How to make an element span the whole div?

edit: Thanks to you awesome people the webpage finally looks awesome! I couldn't choose the best answer because all of them helped me a lot :p here's the result if anyone's interested http://i.imgur.com/RABpT9u.png I'm trying to make a simple website with a site "logo" on the top, a navbar on the le...
RandomStranger
1

votes
4

answer
101

views

Using structs or classes as parameters

I'm fairly new to C# and programming in general, hence why I'm asking this question. I recently got my code reviewed by a colleague, and he stated that for the following method, I should use a class for some parameters. public List DoSomething(List someItems, int amountOfItems, DbGeopgrahpy Locatio...
RandomStranger
3

votes
4

answer
984

views

Microsoft.SqlServer.Types' version 10 or higher could not be found on visual studio online

I have seen this problem on several questions, all of the solutions work fine when you're building locally. I currently have my code on visualstudio.com, and I have an automatic build whenever I push code from my machine. I know you have to install a nuget package (Which I have) and install the type...
RandomStranger
1

votes
2

answer
1.6k

views

C# - Splitting by columns on a CSV file

I want to import some data from a csv file, but I've encountered a small problem I can't really figure out. The person who gave me this file, added comma seperated values in cells, so when I split them they will be added to the list. Instead, I would like to get all values per column as a string, I...
RandomStranger
3

votes
3

answer
145

views

Picking random entries from dictionary based on value

I have a dictionary with restaurants and a type of restaurant like this: Dictionary Where restaurants is my class and for simplicity I use a string for my type of restaurant. Let's say I have 25 entries in my list, where there can be groups of 3, 4 or 5 restaurants with the same type. Now I want to...
RandomStranger
5

votes
2

answer
202

views

Matching users who reviewed the same restaurants

I'm working on an algorithm which calculates a similarity coefficient between restaurants. Before we're able to calculate said similarity, I need 3 users who rated both restaurants. Here is a table with a possible scenario as example: | Restaurant 1 | Restaurant 2 User 1 | X | 2 User...
RandomStranger
2

votes
2

answer
38

views

Entity Framework - Adding row many to many table without having to load navigational properties

My data model is very simple currently. You have users, and you have restaurants. In between is a many to many relationship called 'Reviews'. When I want to add a review to the database, I have to retrieve a user object and a restaurant object before I can save the review object. This is done with t...
RandomStranger
2

votes
2

answer
1.7k

views

Placing objects automatically when ground plane detected with vuforia

I'm working on an application where the concept is that you can 'select' objects before actually placing them. So what I wanted to do was have some low quality objects on a shelf or something like it. When the user selects the object he then can tap to place the high quality version of the object in...
RandomStranger
2

votes
3

answer
46

views

Filling up a matrix without doubles

I'm working on an item-based collaborative filter, for which you need similarities between items. I have found that create a matrix like below works well, but I now want to prevent it from calculating doubles. I'll explain what I mean with an example. Assume you have a list of 5 items, each with rat...
RandomStranger
8

votes
6

answer
1.4k

views

Merging lists with a for loop

I'm working on an algorithm which can generate 2 types of recommendations, restaurants and dishes. All of this works fine, but I wanted to merge these 2 types of recommendations in a single list, which is where I encountered some issues. From my previous question I concluded that I needed a wrapper...
RandomStranger
1

votes
1

answer
819

views

Choice between an adjusted cosine similarity vs regular cosine similarity

I'm working on an item-based CF which uses an adjusted cosine similarity. I have recently added a regular cosine similarity and I got totally different results. Now my question is which fits better considering my data? This is a possible scenario of users, items and ratings User 1 | User 2 | User 3...
RandomStranger