instruction stringlengths 71 95.1k |
|---|
I have a project which we need to migrate from an on-prem solution to the AWS cloud. Currently, the software is running on a single instance. It's working fine but the business want the software to be Highly Available (HA). As part of the HA, the program will be installed on a shared file system (AWS EFS) and mount the... |
I know there are if, then, else and switch.
But the code below is a mixture of if, then else, else if, else.
@HostListener('document:keydown', ['$event'])
onKeydown(event: KeyboardEvent) {
let index = 0;
if (this.selectedItemIndex === null || this.selectedItemIndex < 0) {
this.changeAria.emit('showall');
} el... |
I am creating a program that will be given a text file as output with the board's dimension and the piece id along with the piece width and length. The goal is to arrange all blocks in the board correctly. Currently, my program takes forever to come up with a solution. I need help optimizing or figuring out what I need... |
I just implemented a generic concurrent queue in C, and I'd like some feedback on my implementation, as well as the logic in handling generic data and concurrency.
buffer.h
#ifndef BOUNDED_BUFFER_H
#define BOUNDED_BUFFER_H
#include <stdlib.h>
typedef struct _boundedBuffer BoundedBuffer;
BoundedBuffer* allocBoundedBu... |
I wrote an implementation of a shared pointer. I would like a review of it.
It seems to work, but running it through Valgrind shows that that it leaks memory somewhere in my tests, but I don't know where.
Here is my .h file:
#include <stdexcept>
//Try to create a smart pointer? Should be fun.
template <class T>
class... |
I am trying to retrieve filename and ID list with Google Drive API (the latest Drive API version v3 is used here) as a first step in order to analyze and manipulate these files on Google Drive. The experimental implementation is as below. (Note: credentials.json file is needed and the step to generate this file is here... |
I want this function to find the closest value to n such that 32 % n == 0 in Java. I'm trying to make this more efficient / functional. Here is what I have tried, but I'm sure there is a better way. I'm using Java 8.
Question: Is there a better way to implement this function that is more efficient?
private static d... |
I'm a C/C++ programmer and this is my first Rust program. A heavy simplification of the console system like used in Quake and Source engine games, that lets you set variables and run commands.
I'm aware the parsing algorithm is bad, it's just supposed to be simple. I want to know how I can improve this code to make it ... |
I recently completed a coding challenge for a company that did not get me to the next stage.
They were kind enough to provide the following feedback:
The coding assignment does not match what we are looking for, a mid-level Front End Engineer.
The code does not fully comply with what is asked in the assignment and the... |
Imagine you can't use the standard functions for time calculation or anything alike. You have to start from scratch as it is the case on embedded systems.
Thus I came with the following code to determine the seconds, minutes, hours, days, months and years from unix timestamp. Tested the code, works for everything I thr... |
After searching a lot, on how to do it and not finding any good solutions, I implemented my own UDP livestream from an Android device to a C#/WPF desktop application. It works, however, since I get complete JPEG images from the camera2 API each frame in android, I need to wait until I have data for the complete image b... |
I've made this to pick the LQR parameters for my self balancing robots simulation. So to break down what I have done,
Randomly Create Population
I create a random population. The population is a list of lists having 4 parameters each of which is randomly generated. But I have applied bounds for them using the values I... |
I'm looking for ideas on how to optimize the following code. I don't really know how to condense anything, I'm still very new to coding and this is the first time I've really created anything besides "Hello World".
import pandas as pd
import csv
#Method that calculates the Current Budget of the contents in the .csv fi... |
I have two access roles as of now for example account_type 1 and 2.
What I am doing is, account_type 1 can log in using mobile no and account_type 2 can log in with email and password.
Both scenarios are working with the below code but is this code is the best code or is this the right way to do? or can we reduce the c... |
So the problem is
Find the duplicate entries (2nd occurrence onwards) in the given numpy
array and mark them as True. First time occurrences should be False.
And my solution is:
import numpy as np
def duplicates(a):
uniques = np.unique(a)
result = []
for i in a:
if i not in uniques:
... |
I have made a calculator app to help Bengali high-school students in solving mathematical problems on Newtonian equations of linear motion aka SUVAT equations. I am using python version 3.8.8 and streamlit version 0.80.0.
Originally, I have used Bangla as the user interface language of the web app (Github Repo). But he... |
I am making a video editor with tkinter, and seriously need to clean it up and make it nicer to read / more efficient. Can anybody help me clean up my code (I was sent here from stackoverflow)
Here it is: https://github.com/MiniMinnoww/moviepy-video-editor
The parts I kinda need to figure out are:
Buttons and popup wi... |
I have 3 push buttons, 3 leds, and 2 relays. When you push button1 once, the led1 turns on and timer is set to 10 sec. When push button1 twice, led2 turns on and timer is set to 20 sec. When push second button once, select first relay. When pushs second button twice, then select second relay. And in the end start butto... |
This is a simple interpreter for the esoteric brainfuck programming language, written in C. It is one of my personal projects and I would love to receive expert advice.
Behavior
All characters except the eight commands ><+-.,[] are ignored and
treated as comments.
The array has 30,000 cells and each cell in the array... |
Here is a short pice of code that suppose to work as Pub/Sub or EventDisptacher of some sort.
I only do code in JS a few times a year, so hence I'm asking for your time. Right now I'm working on little full-stack pice for my portfolio, and I'm really not a frontend developer :)
Here is the code:
class StreamDispatcher ... |
I wrote this code for a fibonacci sequence generator. Can anyone tell me whether my code is designed well? if not, why?
import logging
def fibonacci_calc(current_val, current_pos=0, max_seq_length=5, sequence_list=[]):
try:
if(current_pos != 0 and len(sequence_list) == 0):
raise Exception("Plea... |
Here's my second try at pairwise summation in Haskell:
pairwiseSum :: (Num a) => [a] -> a
pairwiseSum [] = 0
pairwiseSum [x] = x
pairwiseSum x = pairwiseSum (sumPairs x)
sumPairs :: (Num a) => [a] -> [a]
sumPairs [] = []
sumPairs [x] = [x]
sumPairs (x:y:xs) = ((x + y) : sumPairs xs)
I ran both versions on pairwiseSum... |
I'm trying to write a code for a function that takes an empty array of pointers and its length n.
And scans n strings of max length of MAX_LEN (a defined constant) until a new line is given by the user.
The strings are separated by one space.
int scan_strings(char * words[], int n) {
char current = getchar(); // to... |
I have been developing a real time application in C and I need to calculate sine and cosine of a given angle in radians. In respect to the fact that the application is a real time application the functions from the standard library are not suitable for my purposes due to the fact that there is not fixed calculation tim... |
I have the following working code:
person.h
#ifndef PERSON_H
#define PERSON_H
#include <iostream>
#include <string>
class Person {
private:
std::string firstName;
std::string middleName;
std::string lastName;
public:
Person() = default;
Person (std::string pFirstName, std::string pMiddleName, std... |
I have been developing a control software in C++ and for implementation of the control algorithms I need basic matrix operations like addition, subtraction, multiplication and multiplication by scalar.
Due to the fact that the application is the real time application I need to avoid the dynamic memory allocation so I h... |
I'm trying to understand the Functional Programming Paradigm (or style) implemented with Javascript. There are a few things I have difficulties with. The naming conventions, and dependency injections. I would be super happy if you could help me out with these two problems.
const items = ['', '', '', ''];
const pickRan... |
I'm using Laravel and this PHP method is in a controller. It's the back-end for a edit profile page. The user can change the profile picture, reset the password, the username, and so on. I'm new in PHP and would like to know if there is a better or simpler way to code this.
public function update(Request $request){
... |
I have written one method; however I feel I can refactor it even more but not sure what
Can someone help me here?
public static PaymentOptions GetPaymentOptions_NonGBCulture(TestConfigurationCDO testConfiguration, int siteId)
{
var paymentOptions = default(PaymentOptions);
var paymentOptionList... |
I have implemented a producer/consumer functionality using threads in a given framework and
I'm pretty sure I did not cover all possible scenarios.
I made a small reproducible version. Lines ending with # simulate the functionality of the framework.
In the original code the total number of products and consumers is not... |
I'm quite new to the STL.
Does this make sense? Is there a better way of removing the listeners instead of using shared_ptr while keeping the code short and simple? Is there something in the STL to replace this?
Class:
template<class ... Arguments>
class Callback
{
using Function = std::function<void(Arguments ...)... |
So here is the problem:
Given 2D numpy arrays 'a' and 'b' of sizes n×m and k×m
respectively and one natural number 'p'. You need to find the
distance(Euclidean) of the rows of the matrices 'a' and 'b'. Fill the
results in the k×n matrix. Calculate the distance with the following
formula
$$
D(x, y) = \left( \sum _... |
I have developed a function that takes a list of line segments and a rectangle that breaks the line segment into two where it encounters the rectangle. Here is a picture demonstration of what it does:
And here is a full demo code representation here:
var ctx = document.querySelector("canvas").getContext("2d");
func... |
I managed to make a very simple contact form.
I used PHP for server-side validation and reCAPTCHA v2.
You can access the form at the following link:
https://test.dexsolutions.digital/index.php
And this is the code:
index.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Contact Form</title>
... |
I have written a Python snippet that reads lat and long stored in an Excel file. Converts them to a point which is then used to perform multiple geospatial analysis including buffer, intersection, and searching within a shapefile's attribute table (finding count of a specific attribute occurrence and a single row can h... |
I have written a program to parse a string depending on the string the user provides.
Any advise/criticism is appreciated.
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#define DEFAULT_SIZE 10
#define RESIZE_MULTI 2
/*compares value to see if it exists in parse. return 0 if exists*/
s... |
Introduction
After finishing most of the tutorials on https://learnopengl.com/ I started to encapsulate code in their respective classes and started to write a mesh class and a polygon class as my first primitive geometry object to figure out the structure of my code. There are a few questions about the code I'll add a... |
I've implemented my own insertion sort algorithm, and here's the code.
def insertion(lst):
for i in range(1, len(lst)):
for j in range(i):
if lst[i] < lst[j]:
val = lst[i]
del lst[i]
lst.insert(j, val)
break
return lst
Typical ... |
Is there any way to lower the lines of this code and make it better in terms of being more Pythonic? The program collects data from truecar.com and then puts them into my database.
Any help would be highly appreciated.
Code
import mysql.connector
import requests
import math
# takes the car's name
requested_car_name ... |
I inherited the following regex:
/[^.!?\s][^.!?\n]*(?:[.!?](?!['"]?\s|$)[^.!?]*)*[.!?]?['"]?(?=\s|$)/g
This regex is used to split sentences, and is dealing with things like quotes after periods at the end of a sentence (He said "I don't care.") correctly. I've been playing with this regex, but I'm not sure yet if... |
I want make my looped data into one flat array without associative keys. I have solved it with my code, but I think it is so crowded and not simple.
This my code:
$data = array();
while($dt = $this->db->fetchAssoc($res_weight)){
$data[] = array_values($dt);
}
$datas = json_encode($data);
$datas = str_replace("[",""... |
This is my first C++ program. It would be nice if you can tell me anything I could add or do differently.
I am new to C++ programming and I hope to learn more.
#include <iostream>
using namespace std;
int main()
{
float a, b, result;
char op;
cout << "Enter an operator." << endl;
cin >> op;
cout... |
I was asked to program the following:
Develop a two-player dice game that will have the players roll two 6-sided dice each and get points depending on what they roll. There are 5 rounds in a game. In each round, each player rolls the two dice.
The rules are:
The points rolled on each player’s dice are added to their s... |
I have a simple golang app in which I have two background tasks that produce data,each of them use it's own channel to signal it produced another unit of data.
I have a single consumer that needs the data form the two other background tasks as input in a 1-to-1 ratio. What I want to do,for the lack of a better term, is... |
I have been working on creating a scraper that auto detects if there is any changes on a website as example as there is a release date or a increas/decrease of size value.
I have created couple of files where I have:
product_monitoring.py - The brain behind to check if there is any restock or not
#!/usr/bin/python3
# -... |
I had a problem at my work that we have some tasks that need to be executed as fast as possible. To do this we implemented them so they are multi-threaded in an ExecutorService. Originally we had for each different type of task a different ExecutorService (simple Executors.newFixedThreadPool(cpuCount)).
However, these ... |
I have written my first react js web app. It is a portfolio project which is a restaurant website. I have used firebase to authenticate users and to host my website. I am asking the Code Review community to kindly review my code if there are scopes for improving and refactoring the code.
And I faced three problems whil... |
I was wondering if anyone would be able to review my Grade Calculator for a course ERD? I'm looking for ways to improve the current design (if any improvements need to be made that is) and if anyone could review the current MySQL query which is there. In order for this to be reviewed I was told I needed an SQL query to... |
Recent i started my fist "real" project.
My goal is to code the first gen of Pokemon in Java.
I have higly oriented my code on a YouTube viedo
(https://www.youtube.com/watch?v=dEKs-3GhVKQ&list=PLah6faXAgguMnTBs3JnEJY0shAc18XYQZ&index=1).
I have learned a lot working through the tutorial and understood everything so far... |
I'm trying to solve the 15 Puzzle problem using IDA* algorithm with a Linear Conflicts heuristic. I already implemented the heuristic from what I understood : link
Here's my goal state ("snail" format) and initial state :
GOAL_STATE =
[[ 1 2 3 4]
[12 13 14 5]
[11 0 15 6]
[10 9 8 7]]
INITIAL STATE =
[[11 ... |
I'm writing a VBA program which copies and organizes data from one master sheet into numerous other sheets. One of the recipient sheets unifies all the data from the master sheet which holds the same id number into a single row. For this operation, I am looping through the master sheet for each id number, copying each ... |
I am have made a small copy-to-clipboard script.
I have made a method called copyToClipboard that does the following:
create an input box;
read the content of an HTML element;
set the input box value to the content previously read;
append the input box to a container;
select and copy its value to the clipboard;
remove... |
I have a small and weak microcontroller. I also don't have access to the complex library. I wrote this iterative version of the FFT to hopefully get better performance than the recursive version, and also just to learn how the FFT works, and brush up on C.
I'd like to know if the code itself is understandable, and if t... |
This is a sparse matrix (dgCMatrix) class that extends Rcpp.
WHAT: This class includes Rcpp::NumericVector and Rcpp::NumericMatrix classes which are simple references to R objects. This class fully supports reference-only no-copy conversion of the Matrix package dgCMatrix class from R to C++ and vice versa.
WHY: I want... |
I have 3 nested loops and they do the following:
Get scopes from DHCP
Get hostnames from csv file
Compares hostnames and leases, matches are added to a hash table
There are 5 DHCP servers, 100's of scopes and thousands of leases.
What would be a good method to speed this up?
$DHServers = Get-DhcpServerInDC #get DHCP ... |
TLDR: Is my code following best practices for OOP and PyQt5 regarding inheritance, and is it okay to initialise classes within another class? What can I do to improve my methods, or what would be a better approach to my specific problem?
I'm very new to OOP and PyQt5. My Code creates a GUI with 2 tab widgets, each with... |
I have a pretty simple method that grabs data from an sql query and then puts it inside of a list and finally iterates through two for each loops onto an excel file. It works fine with small amounts of data, but not at all with larger amounts. What would be the best way to iterate and also write to my workbook the quic... |
I originally posted this on StackOverflow but was requested to post it here instead as it relates to optimization/performance of the code rather than a specific problem.
TL;DR: Get-Random produces an even distribution of numbers where every number in the pool has an even chance of appearing. I'm looking for a way to ge... |
How can the following method be flattened? I tried to pipe all the operators to the first pipe (from(this.fireAuth.currentUser)) but I lost access to the previous variables. It's an Angular HTTP interceptor that adds a Bearer Token when the user has logged in, the chain should continue as usual when the user has not l... |
I want to start making some command line programs in C, this is a fork of something else I made but is more suitable to this site. My big question is there a better way to pipe commands? I think the way I did it feels improper. I especially feel the string method is a bit hacky.
#include <stdio.h>
#include <unistd.h>
#... |
Started learning C++ a few weeks ago, tried to accurately simulate a Pokemon battle. Not too optimistic how it turned out, please tell me how I could improve it.
Only the bare minimum(damage, accuracy, type effectiveness) are implemented, items weather etc are not.
typechart.h:
#pragma once
constexpr float typeChart[18... |
I've made a code that does exactly what https://sapin.herokuapp.com/?n=5 would do.
Here's my code ;
import sys
def firtree(tree_size):
fir = []
width = 1
minus = 2
foot_width = 1
for i in range(1,tree_size+1):
for j in range(1,i+4):
fir.append("*"*width)
width = widt... |
I implemented as an exercise a function which maps over object values in Typescript, and I am truly horrified by my type annotations.
The function:
type map = <F, T>(f:callback<F, T>) => mapping<F, T>;
type callback<F, T> = (value:F, index:number, entries:Entry<F>[]) => T;
type Entry<T=any> = [key:String, value:T];
typ... |
I am learning React by doing a Contact Manager, I am trying to write this code more efficiently. Any ideas...good practise, component splitting, formatting tips are accepted too. Thanks in advance
P.S. Sorry for my English...I am from Italy.
First I used a separate function for everything, then I transformed person var... |
I created a simple text to morse code converter in python, and was wondering if there was an easier/shorter way to do this. Is there a way to generate the dictionary without having to hard-code every single option?
def main():
print("This program translates words to morse code\n")
words = input("Enter a word ... |
I created a "2-player" rock-paper-scissors game in Python mainly using if statements and a single while loop. The program is really simple, but I was wondering if using switch statements or perhaps another format would make it less cluttered/quicker/etc.
again = 'y'
while (again == 'y'):
p1 = input("Player 1 --> ... |
I am rather new to haskell, and could use some feedback on my code and the decisions I had to make. In my previous project, I made a JSON parser, but relied heavily on guidance from a university course.
This project is a brainfuck interpreter, for which I used nothing but the wiki article on brainfuck (i.e., no foreign... |
I wrote a program to find all the prime numbers up to N on my TI-84, however, it is quite slow for any number above, like, 50. Are there any ways to optimize my code?
(I added comments using //)
Input N
{2}→L₂
For(I,3,N,2) // Loop through every odd number up to N starting at 3
1→J
0→H
√(I)→S
While L₂(J)≤S and H=0 // ch... |
I was thinking about how unit tests require you to manually instantiate all your dependencies, even though many of them are the same for every test or don't really matter (such as logging, where people usually just inject mocks). As a possible solution to this problem, I wrote a unit test framework that injects any kno... |
I'm pretty new to Powershell but have been using it more and more to automate tasks at work. Now I'm reaching out for some help. I typically use the scripts I write in a way where I copy and paste the ps1 into the directory I want to perform the task on. Then double-clicking. That is why you'll see that the ps1 filenam... |
I use the following code which works and install helm chart (in the loop) in parallel,
it get a kubeconfig file (to access to k8s) create a helm client and install the charts from the defined location and waits (upgradeAction.Wait = true) that each chart installation will finished successfully.
At first I do it in sequ... |
I created an rxjs search for a hiring company, but I got rejected for the following reason:
-performance issue on a bigger data set.
-bugs
My question is how can I make this code better for the next time if I have similar task?
brands = These should be populated from the brand property from the collection of products.... |
Hello Everyone!
Fellow human beings, today I present to you my dice rolling script! Behold, in my amateurish attempt at some raw C# code. Perhaps this will remain here regardless of the dozens of other dice rolling scripts out there.
Contains a 'for' loop, a 'switch', and a method that returns a value.
using System;
n... |
I need to change the page title based on the current state of my store. Right now I came up with
const useTitle = () => {
const { foo, bar } = useSelector(selectFoorBar);
const baz = useSelector(selectBaz);
const fooBarDisplayString = format(foo, bar);
const barDisplayString = (bar ?? 0).toFixed(0);
useEffe... |
I have this work task, to write a SQL query that would show how many of the active customers are new (= do not have prior transactions) as opposed to returning per a given period.
There is nothing particular in the DB to get this, so my solution takes a transaction and compares customer_id to the pool of customer_ids t... |
Here is the problem:
Given an array of a non-continuous sequence of dates. Make it a
continuous sequence of dates, by filling in the missing dates.
# Input
dates = np.arange(np.datetime64('2018-02-01'), np.datetime64('2018-02-25'), 2)
print(dates)
#> ['2018-02-01' '2018-02-03' '2018-02-05' '2018-02-07' '2018-02-09'... |
So i created a social media website in django and here is how i managed accepting friend requests and showing friends posts in home page.
Would it be better to do this operation in models.py file, create a function and call it in views using django forms? My concern is security
def home(request):
if request.user.is... |
I wrote a python program to find if a matrix is a magic square or not. It works, but I can't help feeling like I may have overcomplicated the solution. I have seen other implementations that were a lot shorter, but I was wondering how efficient/inefficient my code is and how I could improve it and/or shorten it to achi... |
I have written a code to replace all spaces in a String with %20.
Input: "Mr John Smith "
Output: "Mr%20John%20Smith"
My logic:
public class URLify {
public static void main(String[] args) {
String str = "Mr John Smith ";
str = str.stripTrailing();
char[] ch = str.toCharArray();
St... |
// generate a random "walk" of letters from A to Z in a 2D grid, assuming a
// character set with contiguous values of uppercase letters (e.g. ASCII);
// stops if the "walker" gets stuck
// example of a successful walk:
// A . . . I J K . . .
// B C F G H . L . . .
// . D E . . . M . . ... |
I have a program that gives the player a random U.S. state, asks for its capital, and keeps score. This keeps going until the player decides to stop playing. At the end, it prints out both the amount of correct answers and amount of incorrect answers.
I took some of the advice into account that I got on my other posts ... |
Objective:
Create a function to sum a list of fractions (represented as pairs)
Rules
Only Prelude functions allowed
Notes
I was debating if I should create a Fraction data type. Is it worth "upgrading" from a simple pair?
Is the code easy to follow and well-structured? How are my function names?
Is a simple error ... |
I have developed Mockingbird a mocking framework for c++, it depends on function injection, here is the code from the repository:
/*
* Mockingbird is a simple and a powerful mocking framework for c++.
* Copyright (c) Mouaz Chamieh April 2021.
* Distributed under the MIT License. Please refer to the LICENSE file a... |
I wrote a simple Java bank application and I would like to get an review!
I learned today about exceptions, so I tried to apply it on my code, but sadly I couldn't made it. I hope someone here could help me with that.
Account.java
private final String firstName;
private final String lastName;
private double balance;
pr... |
I have tried to achieve the following task using Factory Pattern with PHP version 7.0.
Define the classes and their methods (including parameters and return types) for a system that consist of a bookshelf,
books, magazines, and notebooks. The bookshelf should allow store and retrieval of the items as well as reporting... |
I'm really new to both Python, data analysis and Panda and for gathering a bit of familiarity with this components and trying to replicate a trading strategy I'm creating a function that give me the Wiliam Fractal technical indicator, which by nature is a lagging indicator to apply at the currently analysed row of the ... |
I'm relatively new when it comes to programming in React and in JavaScript, but have a surface level understanding of what things do. I've created a basic program that fetches user data from an API that generates random users, and appends the users to a list when you click a button. I was wondering if what I'm writing ... |
My first project in C/SDL2 after completing a short tutorial coding Pong.
These 2 projects are my entire experience with both C and SDL2, although I had some previous basic experience with Python.
I also added a "life trail" that shows recently deceased cells in grey. Darker grey = died more recently.
There is also a 1... |
Im not that good at C, so go easy on me, but I wanted to be able to have individual bit access in C without using a ton of functions to do bit manipulation on a uint8_t. Tell me where I could improve upon it
#include <stdio.h>
#pragma pack(1)
union bit_array {
struct {
unsigned char b8:1, b7:1, b6:1, b5:1... |
Main function will ask what the user wants to do. LoginSystem class will handle the sign up and login process as well with the checking if password is right. passwordHashing will use bcrpyt to salt and hash the password.
import bcrypt
from loginDbMySQL import insert, logging_in
def main():
login_instance = L... |
I'm new to C#, and want to conform as much as possible to good design patterns. This code is the beginning of a Microservice, running as Asp.Net. It is based on a Microsoft tutorial doing similar work.
It has three functional components currently:
Converts a CSV file to JSON, for return via REST
A REST controller to t... |
I recently needed to create a function to approximate a complex trigonometric function on an embedded system without a floating point unit and without a fast trigonometric library. So I pulled out my ancient copy of "Numerical Recipes in C, Second Edition" by Press, Teukolsky, Vetterling and Flannery, and updated the ... |
I have a simple web api where each request "item" is stored in a list and thus a list is built without creating a new list per request. I have achieved this via dependency injection , but I want to know if there is a better way to do it?
[ApiController]
[Route("[controller]")]
public class MyController: ControllerBase
... |
I made a snake game in c, it runs pretty well, everything is working, I think, I'm just wondering if there are any bugs I'm not aware of or if there is anything I can do better.
#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <windows.h>
#include <math.h>
#include <time.h>
int gameOver = 0, width = ... |
I'm making a terrain-deformation system in Unity that utilizes the common marching-cubes algorithm. So far I've gotten the system working, employed Unity's job system and burst compiler, and managed to cut down frame calculation time from ~100ms per job to ~25ms. That's great, and I'm getting around 20 FPS during the w... |
I've been playing around with this example from the Scala 3 documentation, and I noticed that certain things duplicate functionality already present in the standard API; In particular, the summonAll (which was working for Eq[_] only) seemed to be a combination of
Tuple.Map[Tup, F] type constructor, which recursively d... |
Exercise 1
Please implement code and data structures that read the files:
src/test/java/resources/people.csv
src/test/java/resources/relationships.csv
and use them to build an in-memory data structure that represents the people in the file and their relationships with each other.
Exercise 2 - Validate correct people ... |
In a few hours I threw together this little text-based java game. Pretty much you're managing a forest and have to try and keep it together while keeping enough of a profit to move forward.
package com.company;
import java.util.Arrays;
import java.util.Scanner;
import java.util.concurrent.ThreadLocalRandom;
import st... |
I'm working on a simple method that would censor emails (GPDR stuff) so they won't show the full name of a user, with 1st character, optional dot, 1st character after the dot and whatever is left after the @ to be left uncensored. So, the intent is like this:
Email to be censored: name.lastname@email.com
Desired effect... |
I want to write the test case for Service class.
My Service Class dynamic-form.service.ts
import { HttpClient, HttpBackend } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Router } from '@angular/router';
@Injectable({
providedIn: 'root'
})
export class DynamicFormService {
priv... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.