instruction stringlengths 71 71.9k |
|---|
I am rather new to coding, and I would like to see what improvements should I make to the code I wrote to ensure that I am using good practices, and that it will function as it's supposed to. The following code detects the operating system (I have it set for either Linux or Windows), detects the folders around it, dete... |
I have this short program for simulating a random packet routing algorithm:
Packet.java
package net.coderodde.simulation.network;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* This class implements a packet being transmitted ... |
Based on previous question , I have implemented all suggestions. also, i have fixed all unnecessary copies for std::string objects in the code.
Is there any thing else can be done to this code?
#include <iostream>
#include <string>
#include <regex>
#include <cctype>
#include <limits>
#include <sstream>
#include <casser... |
The development and testing was performed on a Dell M6400 Laptop (Intel Core 2 Duo) running Centos 7, g++ compiler version 4.8.5, compiler switches -O3 -std=c++0x -D__cplusplus=201103L. (machine bought August 2009 with Windows XP
). It was also tested on a four core i7 based version of CentOS 7 with 12GB of DDR3 RAM (b... |
Warning: lots of code. If it's too much, please focus primarly on channel.h and channel.hpp.
This is my first time posting on Code Review, so I apologize in advance if anything is unusual or could have been written better.
Context
The program in which I am using this data structure is a DAQ to CSV conversion tool. Put ... |
So I have the following code which works well-ish. Looking for ideas on how to improve it.
public void testItAll() {
System.err.println(determineRate(226.34, 25.00, 12));
System.err.println(determineRate(5800.00, 29.00, 31));
System.err.println(determineRate(4000.00, 25.00, 460));
System.err.println(de... |
My most recent project is this simple Snake game, and I would like to know what you think of it and if you have any suggestions.
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
var keys = new Array([]);
var body = [ //Body of snake
{
"x": 6,
"y": 0
},
{
"x": 5,
"y": 0
},... |
I have got two tables articles and tags in the database. My goal was to retrieve all fields from articles table and one category field from tags table with Eloquent. I couldn't do this so instead I came up with the following method in my controller.
public function showCategory($category){
$data = DB::select('selec... |
Below is a Ruby implementation of a random statistical event, based on a hash with the actual observed counts of outcomes.
I'd be interested in feedback in particular on what techniques I might use to avoid a loop-based accumulator in the RandomEvent#predict! method. I'm also very curious as well about any other sugges... |
I've written a quick script for a coworker to split a large CAN log into smaller chunks. (If you're not familiar with CAN, it's a communication protocol used by the ECUs in many cars.) I know where to split because I've inserted dummy CAN messages (with ID 0x00) at the start of each section, and one at the end of tes... |
I've been agonizing over this for an hour or two. I require a bidirectional dictionary that was thread safe. From what I understand about dictionaries, they're thread safe when being read from, but no so much when being written to. I've tried to write this code snippet to my understanding of correct, but a review would... |
This question is part of a series solving the Rosalind challenges. For the previous question in this series, see A sequence of mistakes. The repository with all my up-to-date solutions so far can be found here.
Problem: PRTM
In a weighted alphabet, every symbol is assigned a positive real number called a weight. A st... |
Can I get feedback on below code? Problem statement is Maximum difference between two elements such that larger element appears after the smaller number
Would this solution be still considered O(n) for time complexity? I know I do one additional pass but I found this way to be more intuitive
Is error handling done prop... |
Objective: Crop the image so only the number stays in the image
Problem: Slow Performance
I have code that crops an image.
The image pixels are 0 or 255. There are no values between.
The background is 0 (black) and the letter/number is between 0 (not-inclusive) - 255 (white).
This code is being used to crop a Mnist Di... |
Here is my implementation of a segment tree with a sample driver file (I didn't make an update function because I didn't need it for what I was doing).
I'm a huge fan of geeksforgeeks, but I do not understand why this link makes such a complicated implementation. I didn't use the height or compute the maximum size in ... |
The code takes in two arguments, a path to search and an output file name. It searches the supplied path (including sub directories) and writes out all files that have the same size as any other files in the path. This will form part of a multi-step process to identify duplicate files within the file system.
Example ... |
I often need to switch connection strings and databases (dev/prod) and I need to be able to execute queries with the NOLOCK flag.
For this purpose I create a few utilities that should make this a little bit easier.
The main class is the QueryService that encapsulates the enitre setup process that I had to repeat for e... |
Here you can see a mediocre code of mine where I have fun with four deques, each with a different priority.
Here is how it works: in a while loop I generate a random number between 1 (highest priority) and 4 (lowest priority), and this number tells me in which deque I will insert the new element (by insert(int num, int... |
I am playing with a sort of linked list using C++ classes. I have used a lot of C linked lists (struct based) during C programming course, but there was no behavior. Thus, I am a bit confused about the correct definition of a class containing a pointer to another object of the same class.
Here is the header:
#ifndef CO... |
NOTE: I previously asked this question in Stack Overflow and got pointed here.
I have a macro that I am trying to get running a little more quickly. The intent of the macro is to merge multiple files into one. These files contain a unique ID for each item, some descriptive information about the item, and some measureme... |
I recently wrote this PHP MVC framework. Would like your review.
index.php
<?php
//In the linked web folder we would only have index.php,js,css,images.
//Rest of the code is in ../core
chdir('../core');
require 'common.inc.php'; //define constants, auto loading etc
run();
function run() {
if (isset($_REQUES... |
Let's say that i have a database which contain cheese. I love cheese.
Depending on the request my server is getting (c# WebApi), i have to filter user data accordingly.
Maybe the user wants to only get cheese up to a certain date, or from a certain date, or between to dates. Maybe he wants all french cheese, or america... |
I'm working on a "nice" crawler that start with one URL, and find the other URLs to process each page, a kind of "Google" crawler, to index pages.
I worked hard on this crawler to respect many points I've found over many websites, including:
Respect of robots.txt
Not querying too much each website (I add a delay for e... |
I have a paper on the definition of (i) available here. I was curious about the simultaneous real numbers associated with the roots of unity, and noticed there was not a routine in R.
I have this code and would like to know any efficiency to be had in either the derivation or plotting. Thanks for any suggestions and ... |
I'm working on a Meteor application which integrates a user's contacts from external sources (Google in the case of this example). I'm currently writing the server side code to retrieve this data and send it to the client.
I figured using promises to do this made sense due to the asynchronous manner of requests. So I h... |
Based on previous question, The code now is relied on std::regex for validate and split the input. For current improvement, I removed all duplicates functionality by reading the input and applies conversion in-place.
How can I improve it further.
#include <iostream>
#include <string>
#include <regex>
#include <cctype>
... |
I've written a little script to download sequentially named files, rename them, and delete files smaller than an certain number of kilobytes. I came up with this but I'm not too happy. Any advice for me?
#!/bin/sh
echo
echo -n "Start file #:"
read start
echo
echo -n "End file #:"
read end
echo
wget --progress=bar:for... |
Today I read this thing about the Collatz Conjecture and wanted to try and write a program that calculates all the numbers. If you have any idea how the code could be shortened, please tell me.
List<string> liste = new List<string>();
long num = 1;
long z = num;
while (num != 100000)
{
... |
I worked with a friend on the following prime number generator. Our goal was to make it as short and as fast as possible. This is what we came up with:
def p(n): # will print out primes between 0 and n
s=[True]*(n/2)
for i in range(int((n/2-1)/2) >> 1):
for j in range((i*(i+3)<<1)+3,n/2,(i<<1)+3): s[j]=False
... |
I tried to write a simple program using linked list where I just insert the value stored in every node and then through a function print the values.
This is the code:
#include<stdio.h>
#include<stdlib.h>
typedef struct Node {
int value;
struct Node* link;
} Node;
void print_node(Node * );
int main() {
N... |
The challenge requires the program to receive data from the console and use binary search to find if a term is contained in a set of other terms. I've unit-tested the solution below, but according to the grader, my solution is too slow (i.e. the logic is "correct" but inefficient). The grader returns 30 seconds of exec... |
Recently, I made a small bot to simulate an ASCII-based RPG in a chat room. The other users can enter commands (.left, .right, .up, .down) to move the character.
It's made with JavaScript and everything is in global scope, so I can simply enter it in the console window to create a game.
This version can run outside of ... |
I've just coded this for my country's programming Olympiad. I want to know if this method is a good approach in terms of readability and performance. I would also like to know how to improve it.
Note: We can assume all numbers entered are different, positive and smaller or equal to 100.
#include <stdio.h> ... |
I wrote a couple programs in the past that use VB6's Winsock to achieve TCP communications, but still I'm kinda new to socket programming in .NET.
I needed the same functionality of the Winsock to use in .NET with the advantages of multi-threading and asynchronous support (I'm kinda new to that as well). I couldn't fin... |
So I've made custom binary streams which work like this:
/// \brief Reads a variable from the stream.
/// \tparam T Type of the variable.
/// \param[out] var Variable to read.
/// \return Reference to this stream.
/// \throw TODO
/// \note No endianness conversion will be performed if a byte is not 8 bit
/// wide.
temp... |
Initial post: Sequentially displaying a list of game objects
This file creates a dialogue box and sets the chat history box too inactive. It finds which NPC dialogue to display, creates the list and sets which index of the dialogueList should be active.
This. is what the code looks like being ran in-game.
Initially I c... |
I've written a Bubble Sort algorithm in Java and I want a review on these:
Performance improvements.
Code conventions.
Algorithm design improvements.
Cleaner approaches.
I would highly appreciate if you can review based on the points above, and I would prefer if you can add more points on top if it if you find necess... |
I've written a InsertionSort algorithm in Java and I want a review on these:
Performance improvements.
Code conventions.
Algorithm design improvements.
Cleaner approaches.
I would highly appreciate if you can review based on the points above, and I would prefer if you can add more points on top if it if you find nece... |
This here is a templated singly linked list that I have been working on for the past couple of days in C++. I am not a programmer or computer scientist by training; finishing up my undergrad in physics this fall but trying to add more skills to my toolkit, so to speak.
I have been working my way through implementing th... |
I would like to determine is an array of numbers, is always increasing (for all x, x+1 >= x) or always decreasing (for all x, x+1 =< x). If so return true. Another way to state the problem is, return true if the array is sorted or reverse sorted. Here is the code:
public static boolean isAlwaysIncreasingOrDecreasing(in... |
This shell script writes my environment variables. If there is an argument, the shell script will grep for the argument in the environment variables.
PAGER=more
if type less > /dev/null;then PAGER=less; fi
echo $PAGER
if [ -z ${1+x} ]; then printenv|"$PAGER"; else printenv|grep "$1"|"$PAGER"; fi
If the above script is... |
I coded a small user script with PHP. I'm improving the script, learning from my mistakes. I recently learned about object oriented programming and wrote 2 big god classes (user class and message class). That didn't feel right, so read about the MVC model. I wrote a controller class to handle the big god classes while ... |
Two code files below : the actual logic & the test logic.
Core Logic
package stringBuilder;
public class NoksStringBuilder {
//initial capacity
private static final int INITIAL_SIZE = 3;
String[] stringList = new String[INITIAL_SIZE];
//number of strings in the builder currently
int size = 0;
... |
I made a simple math expressions solver that using a "for" loop iterates over all the characters and stores the numbers and signs in std::vector.
It give support for unlimited parentheses and does multiplications and division before other calculations.
I really appreciate if you give any suggestions.
Here's the code:
u... |
I am very new to coding and I have created this relatively simple code to do with my basic knowledge of the language. However I have had to do with some unwanted code including shutting it down if password is too long. so could anybody help me with any improvements to this?
import time
passwordx = float(input('create ... |
This is my first hand crafted makefile in quite a while. I thought it might be useful for anyone who wants to review the Knights Tour - Improved Refactored Recursive Breadth First Search.
I believe there is a lot of room for improvement on this makefile.
The C++ source code as well as the makefile can be found on git... |
This prints the character that occurs the most in a given string.
Input: String of word(s)
Output: Max occurring character
public class mostOccurringCharacter {
public static Character findMaxOChar(String text){
HashMap<Character, Integer> map = new HashMap<Character, Integer>();
Character maxChar = ' ';
l... |
The program makes HTTP requests (checks video stream status) and calls an external program.
{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.ByteString.Lazy.Char8 as B
import Control.Lens ((&), (.~), (^.))
import Network.HTTP.Client (HttpException(..))
import Network.Wreq
import Data.Text (Tex... |
The input is an unsorted array of integers. The output should be an array of integers sorted based on the modulus of 3 (or any other number).
It begins with all integers conforming to Integer % 3 == 0 then 1 and then 2.
public class sortByMod {
public static void main(String args[]) throws Exception {
int a[] = {1... |
I'm sure there are better ways to code this. I spent a lot of time re-working the code to get it as clean as possible. I would appreciate any input on what I could change to have the program run more efficiently and look cleaner.
outer = False
while outer == False:
room_list = []
room = ["This place stinks, b... |
I need to initialize several parameters of an object but I also wanted to make it immutable. At the same time I don't want the constructor to take all several parameters because some of them are optional and have default values that the user can change during initialization like an IReadOnlyDictionary so I was experime... |
This is my admin class, DB class and how I use OOP.
I am looking for ways to improve my code to make better use of OOP. Please help me if you think I can improve my code in some way.
db.class.php
class database
{
private $conn;
private $db_name = 'profil_penduduk';
private $db_user = 'root';
private ... |
I have only been coding for a short time and I have written these two functions and am looking to optimise them. If anyone could point out things that could be done better it would be much appreciated.
Please Note:
This code has been reviewed/improved using the suggestions below, take a look:
# Python 3.4.1
# Function ... |
I want to learn some C# syntax/paradigms (I'm more used to Java), and have been wanting to get a bit better at math as well, so I solved ProjectEuler3: Largest prime factor with the following small program in LINQPad. It gives the correct answer and completes in 0.05s-0.08s.
For reference, here is the problem statemen... |
The purpose here is to find if there is a conflict in the given set of start and end times of the meeting time slots listed.
Input: Start and end times of meetings
Output: True / False for conflicts
package code.Misc;
import java.util.ArrayList;
public class Calendar {
static int time [] = new int[1440];
public sta... |
Obviously is the XOR-operator is used in low-level programming-languages used a lot for setting a value back to all bits 0.
For example:
11010 ^ 11010 => 00000
Brought my teacher to figuring a out few exercises.
One is:
"Set the bits of a number back to 0 by using just the bitwise AND (&) and the bitwise NOT (~) opera... |
This is my second take on creating a tcp client C++ class. The class declaration is general but the implementation is Windows only at this stage and uses the Microsoft Winsock WSAEventSelect model.
The first attempt is here:
TCP client library using Winsock WSAEventSelect in C++
for some background.
The changes are mos... |
I am performing search in a contact list using linear search with complexity \$O(n)\$. Please suggest me how to improve search strategy in my code.
public class ContactService {
private Set<Contact> contacts;
public ContactService() {
this.contacts = new TreeSet<>();
}
public void addContact... |
Task is basically:
"Write a function which takes two number as the first two parameter. The third parameter is one of the arithmetic operators (+ , - , * , /). Execute the arithmetic operation (number1 operator number2) and return the result of it."
Here's the first idea I've had:
function calculate(num1, num2, oper... |
Question:
Compare and update the inventory stored in a 2D array against a second 2D array of a fresh delivery. Update the current existing inventory item quantities (in arr1). If an item cannot be found, add the new item and quantity into the inventory array. The returned inventory array should be in alphabetical orde... |
For example, given 15 integers
70, 75, 32, 4, 64, 98, 73, 52, 36, 88, 96, 58, 79, 39, 75
How can we obtain is 72?
4 operators can be used for the 15 integers to get the equation to the answer of 72, which are + - * /. Divison is only allowed where there is no remainder.
A few answers will be
4+32+36+39+52-58-64-70+73... |
I have got this interview question which has asked me to write a production level code which flattens the arbitrary nested array of arrays.
Code
/**
* Flattens the array of arrays.
*
* @param {!Array<?>} elements The nested array elements.
* @return {!Array<?>} The flat list of array objects.
*/
function flatten(e... |
I have an array of hashes, each of which has two attributes: "title" and "Zscore". I want to return either the result of find or the last element. This can be done with:
a = array.select{|i| i["title"] == "some title"}
b = a.find{|i| i["Zscore"].to_f >= 5} || a.last
Is there an elegant way to put the conditional insid... |
This code creates a problem for the user to solve (very simple problem) it will then check if the user has got it right and will say so.
import random
import time
def mathsquestion():
attempts=2
bananas1 = random.randrange(1,40)
bananas2 = random.randrange(30,70)
print('lucy has', bananas1,' bananas an... |
I was very intrigued with the manner to solve this problem. The program needs to know if 2 rectangles fit in another one, considering the lines of the 2 rectangles are always parallel to the other one's.
I know I could just put everything in a single if, but is that more readable? I want to know a good approach for thi... |
Crosspost from here, it was suggested that this is better place to pose my question.
I'm implementing a series of classes in a game that all derive from one base class that references the scripting of the object that it pertains. Most of these are objects that are generated by certain spells/abilities, and very freque... |
I have a matrix (500x500) of integers. For each entry, I need to look at its surrounding neighbours (so 8 elements) and determine what the integers are, and run a function on these integers.
Here what my function looks like right now (R code with the RCpp package).
fx2<- cppFunction('NumericMatrix getNeighbours(Numer... |
I really hate copy and pasting my code from one method to another. It signals something in my brain, "This could be done either more efficiently or more readable". This is used in a minesweeper program I am implementing with a JavaFx GUI (that's not very relevant, but it might help to know). Hopefully this is enough co... |
I'm looking for feedback as to how I've structured the async calls, and If anything should be written differently.
endpoints.js
module.exports = {
lotto: 'https://www.norsk-tipping.no/api-lotto/getResultInfo.json?drawID=',
keno: 'https://www.norsk-tipping.no/api-keno/getResultInfo.json?drawID=',
extra: 'https://w... |
I have this page that allows a user to quickly compile \$\LaTeX\$ code into a mathematical display. Whenever the user compiles the code, that page also generates an URL from which it is possible to view the output simply by visiting the URL:
index.html (Note that this Stack Snippet generates non-working URLs because i... |
I made a Guitar Hero III bot for PC. I was able to beat the song "Through the Fire and Flames" on Expert with the bot which can you see here.
If you watched the video, you can see that the bot misses a few notes, which isn't normal for a BOT to do. When you normally see bots playing Guitar Hero, they never miss a singl... |
I created this Mad Libs generator, but I don't know how to get the value of the key "ans" into a format string tuple. I feel like it's not Pythonic and that it's very convoluted and over-complicated.
Check out on REPL.it
# Our Mad Lib
madlib = "On the %s trip to %s, my %s friend and I decided to invent a game. Since th... |
I am writing a large shell program comprised of several source files. I was looking for a basic import system that accomplishes three goals.
Avoid sourcing entire files for access to just a few functions
Prevent files from being sourced multiple times.
Imported functions must be executed in the context of their scrip... |
I have made a MySQL script to query a table with a set of id using an IN clause and after some reading I found out that there are security issues with it like prone to SQL injections and the likes.
Are there other ways to write this code with a more secure way? Although I'm using PDO, is that really enough?
public fun... |
A while ago I asked for a code review of my automatically keyed map and I have recently had the time to get around to writing some unit tests for it using JUnit4.
The test ensures that all of the "primary" functionality works, i.e. the things that could actually go wrong. The reason I don't test every method is that ha... |
I needed to check the values in various Lists and Maps. In my case, the various types of Objects that needed checking were of four types:
String
List<String>
Map<String, String>
Map<String, List<String>>
So, I came up with the following types test methods:
@Test
public void testString() {
Assert.assertEquals("Str... |
Is there a quicker/better way of doing this, mine works great for small vectors but if i get a vector with an arbitrarily large size this would probably take forever to run. Thanks.(P.S. its been a while since I've written any code so please excuse me for any sloppiness).
/*Fill a vector with integers,
sum each pair of... |
In order to practice my programming skills, I am trying to implement a Button class, to use in pygame. I know there are libraries like PGU, I do this to improve in programming.
I spent a bit of time creating a function to find a good font size for the text inside the button, depending on the length of the text and the ... |
I have a repository method which retrieve a list of items, for example:
StaffID: 250026965
Name: Abbasov Islam
FreeTextName: NULL
StaffID: NULL
Name: NULL
FreeTextName: Antonio Puccio
StaffID: 358
Name: Prosinecki Robert
FreeTextName: NULL
I have to sort this list in this manner:
First the items with StaffID > 0 by ... |
I created a PHP script which will be running 24/7 as a TCP socket server and will send data from the DB back to clients. The code is working, and so far, I see no problems.
However, I can only test it with one client. The info I need is, what will happen when there will be 100+ clients? Can any of you see any weaknesse... |
I am working on a e-shop in ASP.NET MVC, and I just made the listing of product the way I figured out this night. Is it correct? Or should I make it differently? How?
So this is my Product controller, used for displaying the products from Db.
using WebShop.Models;
using System;
using System.Collections.Generic;
using S... |
Sometimes when designing a fluent-api it's important to build an object in a specific way/sequence.
I tried to create such a guided builder and came-up with this:
public class Query
{
public static IFrom Build() { return new Builder(); }
public class Builder : IFrom, IWhere, ISelect, ICreate
{
pub... |
I am receiving and Expression (String) as follows:
String expression = "+name;-age;-city";
I parse this expression by splitting it using ";" and interpreting the +/- signs and create a List<OrderRule>. To wrap this I created the following:
public class OrderExpression {
public HashSet<OrderRule> Rules { get; set; ... |
Essentially I have a large directory with many sub-folders and different formats of files. It reads through XML, JAVA, .txt, etc, in search of a selected String inputted by the user. The results come back as snippets, reading a certain amount of characters previous and after the selected string has been found.
It do... |
I have a GET method that handles paging, filtering, and sorting. Development has been fairly rapid and I'm not completely sold on some of the implementation. A few assumptions have to be made for this method: I'm using System.Dynamic.Linq. I want to put as much work as possible on SQL Server. The page will make use of ... |
In my code, I'm trying to manipulate data for an audit between 3 sheets in a workbook.The first block of my code is to paste the data of items I need to find for the audit from the original sheet onto the 3rd sheet by setting each row equal to the data of the original row in the first sheet. The second block is used to... |
I completed the "Nested Lists" challenge on HackerRank, and would love any feedback on my code.
My program is fed text with the number of students in a classroom, the name of a student, and their grade. For example:
4
Shadab
8
Varun
8.9
Sarvesh
9.5
Harsh
10
The code should return the student with the second lowest g... |
I have some info. that looks like this:
Header Debit Credit
aaaa 20 0
bbbb 0 60
cccc 30 0
xxxx 10 0
xxxx 0 40
xxxx 40 0
xxxx 0 10
oooo 500 0
oooo 0 52
oooo 0 500
pppp 10
pppp 0 10
(Note this starts in col. H)
The idea is that I want to go through this rang... |
To teach myself Rust, I implemented a naive binary tree with support for insert, delete and lookup operations as well as in-order iteration.
I'm still a little rusty (no pun intended) when it comes to writing idiomatic code and especially elegant handling of borrows.
use std::cmp::Ordering;
use std::cmp::Ordering::{Les... |
Please review my implementation of a Circular Singly Linked List.
public class NodeS {
public int num;
public NodeS next;
public NodeS(int n){
this.num = n;
}
}
public class SinglyCircularList {
private static NodeS head = null;
private static NodeS tail = null;
private static i... |
I have been trying to solve this simple problem on SPOJ for quite some time now, but I keep on getting TLE (Time limit exceeded) for some reason.
Since the problem is in Portuguese, a brief description of the problem is like this (without the story):
You are given an array of size N, you have to arrange the array in... |
Given a string, compute recursively a new string where all the
lowercase 'x' chars have been moved to the end of the string.
endX("xxre") → "rexx"
endX("xxhixx") → "hixxxx"
endX("xhixhix") → "hihixxx"
Here's the initial idea I've had:
public String endX(String str) {
ArrayList<Character> track = new ArrayList<Ch... |
I've been slowly learning Python so I want to know what the most Python-esque way of doing things are.
The scenario is that I'm connected to a database with a Customer and a SalesRep table in a database called sports2000. I also have a flat file containing a list of customer id's and salesrep names. My end goal is to ... |
I wanted to make some simple functions that would be used in the encryption and decryption using a Vigenere square.
# Define the alphabet used in the cipher once so as to not define in memory for every encrypt/decrypt action
$global:alphabet = "abcdefghijklmnopqrstuvwxyz"
function Encrypt-VigenereCipherCharacter{
... |
I am new to R and programming. I have a set of ratings for 45000 users and 40 odd movies. I need to predict new ratings for each user based on their pearson correlation with other users. I also need to store the set of similar users for each user-movie combination.The code that I have managed to write is this
# Matrix ... |
My goal is to prepare the Excel file (see the download link at the end) I would share with my non-technical colleagues, so that they enter some data into it and then I was able to automatically generate CSV without having to manually change format of dates, leading zeros and in other special cases (this CSV I will late... |
I am in the process of making a game, and during this endeavour, I have come across problems maintaining a good frames per second while drawing my sprites. When I draw my background image, my frames drop from ~65 to ~30. My background image is simply a green tile 2000x2000 wide, constructed from 900 50*50 tiles.
What c... |
I found an interesting question on Stack Overflow. It involves having two main checkboxes and 4 checkboxes for the 2 main checkboxes group.
I'm new to React and wanted to try this with React. I have two groups of checkboxes, one which shows a list of fruits and another which shows a list of vegetables.
The structure lo... |
I created this countdown timer as a tool to count down the remaining time on a test a few months ago. However, I looked at the code today and it looks like it needs some improvement, but I'm not sure what to fix.
Some problems I've already identified:
It makes a call to a macOS-specific command: say.
It uses the bell... |
This is my invoicing program I made for myself to keep track of purchases people made from me. (Yes I know eBay does this for me but I wanted to see what I could make.) Basically it can search the invoice file for a keyword (the invoice number) or lets you enter a new invoice to a file named usb.txt. It is usb.txt beca... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.