instruction stringlengths 71 95.1k |
|---|
For a small project, I had to implement Caesar encryption in Swift(4). I'm mainly looking for performance optimizations.
This whole code should be copy and pasteable in a playground and is functioning as expected as far as I can see.
import Foundation
let caesarNumber:Int = 7;
let alphabet_array:[Character] = ["a","b... |
I have the following C++ code snippet that randomly samples a single row in an array called pop with num_specs columns and perms rows. In addition, K = 1. The triply-nested for loop uses a pointer for referencing.
Some of the below syntax (such as IntegerVector) is from Rcpp, an R package to integrate C++ code with R c... |
Here are the commands I ran to start setting up a database I need.
CREATE TABLE user ( id smallint unsigned not null auto_increment, constraint pk_user primary key (id) );
CREATE TABLE discord_user ( id varchar(20) not null, owner smallint unsigned, constraint pk_discord_user primary key (id), constraint fk_discord_us... |
I wrote code that parses a table header string in order to obtain two string tags, one for variable name (like GDP) and another for unit of measurement (like bln_rub). The tags collectively make a unique identifier for the table data.
Perhaps something can be done better/shorter/more easily readable?
import Data.List (... |
I'm looking for a review of a recent project I finished for school. It is an app that functions like Twitter. It includes an Express server and Routes. Instead of using databases, it uses JSON files. Users can create, edit, and delete 'chirps' (tweets) with fetch requests. Specific instructions for the project are incl... |
I am learning about templates in C++ so I decided to implement an N-dimensional vector. The code seems to work fine, but there are a few things that I am unsure about.
To stop GetW() being called on a 3-dimensional vector, I used std::enable_if. This works, but the error message given when it's misused isn't as helpful... |
I have some code which saves a mongoose model from the submitted form data. However the user might also upload an image along with the form, which needs to be saved on the server (moved from the buffer).
Here is my first attempt:
// Save a new job to the database.
exports.save = function(req, res, next) {
// If the r... |
I was trying to use Math.Net's dense matrix class. But, it doesn't support int. So, I have to create a wrapper for a jagged 2d array.
I knew that jagged arrays have better performance.
Data Size : 966 x 345
Naked 2d Array : 10 milliseconds
Naked Jagged Array : 6 milliseconds
Jagged Wrapper : 82 millise... |
I have a need to do some conversions in a loop to display the results using C++98 on Linux, which doesn't have any itoa() to complement atoi(). I opted for this instead of snprintf(). This is for an embedded device and the conversions will be done in a few loops, so speed is important.
It's based on some code I found o... |
I know I can do all this via SSMA quite quickly, but I wanted to see if I could do it efficiently in PowerShell myself as a little project.
Basically, the entire script takes tables from an Access database and creates a database in SQL Server with the same data. Everything from creating the table structure to cleansing... |
Trying to find the median of two sorted arrays in O(log(m+n)) or better. I believe this is O(log(m+n) or O(log(m)) or O(n).
var findMedianSortedArrays = function(nums1, nums2) {
let ar = []
let len = nums1.length + nums2.length
let half;
if (len % 2 === 0) {
half = len / 2
} else {
half = Math.cei... |
The following is some code for a Battleship game I'm working on. The plan is to create a multiplayer game using Xamarin Forms. This is just the model code, i.e. what the GUI will be interacting with when playing the game. I'd like some advice on conventions and any other code optimizations that can be found. Any help i... |
I'm just learning Assembly. This program is a simple attempt to determine if a given number is prime or not.
Compiled as follows using VS2019 x64 Native Tools Command Prompt:
> nasm -g -fwin64 isprime.asm
> cl /Zi isprime.obj msvcrt.lib legacy_stdio_definitions.lib
isprime.asm
bits 64
default rel
extern printf
ext... |
I have this simple loop that prints numbers from 0 to 29 (30 in total). I want to "split" the results in threes and remove the middle number. So the first set is 0,1,2 and I only want 0,2. The second set is 3,4,5 and I only want 3,5. This works as it supposed too, but is there a way to make it more simpler?
z = 1
for i... |
I am working on a problem in which given a 7 digit telephone number, we need to print out all possible combinations of letters that each number could represent.
I came up with below code and I was wondering if there is any way to optimize it or if there is any better way? As of now complexity is O(n3).
public class Let... |
Thank you for your patience. The game is fully functional again!
I have tried to incorporate all the advice I have received so far. Thank you for taking the time to review and comment.
I have now decoupled the Model / Presenter from the View as much as VBA allows (please correct me if wrong). There are two functions f... |
I am new to react (and javascript in general) but am enjoying learning it.
I have decided to make a little multiselect component which should work as follows:
I start with my data in one list, when I select an item from the list it goes into a second list (I can 'unselect' as well).
I also can filter the first list wi... |
I have been studying C#, and I have made a simple math quiz program.
Is my program reasonable or is there anything I need to improve?
class Program
{
static void Main(string[] args)
{
Console.WriteLine("============== Math Game ===================");
double num1, num2;
double userInput... |
In the following code, I implement a class that starts a process and returns its return code, stdout and stderr. It also has a concept of timeout after which the child process is killed. This class will be used as a part of a multi-threaded application.
#ifndef PROCESS_H_
#define PROCESS_H_
//Header
#include <chrono>
... |
I am implementing the factory method approach. My intention is to know if my approach is correct for factory method. Any modifications to be done to align with the approach?
First I am creating an interface IAuto.
//IAuto.cs
namespace TestDesignPatterns.Auto
{
public interface IAuto
{
... |
This is a fairly short code snippet, but it made me a little headache, because it is hard to understand, isn't it?
// You have to be in both 'group' and 'board' to get access (or be a superuser)
if ( ( !$is_in_group || !$is_in_board ) && !$is_superuser) {
die('No access');
}
This code is from a download page, wher... |
Made some adjustments to my original program. Here's a link to it: original. Also, here's a link to the problem statement: problem statement.
The assignment is past due; The code I turned in is stupid simple. Which is great, but I didn't learn anything, so I am testing the many different ways to do things in C, and hop... |
This is the code I built to implement a simple linear regression to check the impact of variable A on B. I am not interested in predicting that's why the statistical approach is important for me to focus on the descriptive analytics such as the statsmodels summary and comparing RMSE of training set and test set to see ... |
I am in the need to cache Bitmap's in a memory-optimized way because the API I am building will need to process many colored Bitmap's in parallel and can be used in x86 or x64 compiled applications.
If the API is being used in x86 I can't just store the Bitmap's as they are but need to store them as compressed MemoryS... |
The full question is... "Please, how can this code base or project (for client-side routing using Knockout and HTML5 History API) be further enhanced as regards security, production-readiness, ES6, etc.?".
I intend that this eventually stays on somewhere like GitHub where anyone who has been faced with the challenge of... |
I have a static homepage with some routes and thought about creating this with VueJs. I am totally new to this and just know NodeJs with Handlebars. So normally I would have something like this
#page {
margin: 30px 0;
}
<div id="header">
<a href="#">Page 1</a>
<a href="#">Page 2</a>
<a href="#">Page 3</a>
</d... |
In a ray tracing project that I'm trying to make compile-time (constexpr) for fun and challenge, I've run into a bit of an issue: I have an object (intersection) that needs to refer to one of a group of other objects (shapes).
Now, my understanding is that you cannot use polymorphism / virtual methods with constexpr be... |
I have this working code tested over lots of np.arrays. It is a for-loop that walks through all the values of a np.array (x,y).
For each y-row, it finds the first x-column for which the value is different to zero. Afterward, it finds the last x-column for which value is different to 0.
Then all the columns between firs... |
This is my first asp.net core web api and i did followed the Repository pattern but i don't know whether this approach is good practice.
public class TrainerRepo : IRepoTrainer
{
private readonly IConfiguration _config;
public TrainerRepo(IConfiguration config)
{
_config = config;
}
public... |
I made a simple authentication system with php for an elm webapp that will have a small number (1 - 5) of users able to log in.
I am planning to send the users their php session-id at login, and keep this in memory while the app is running in order to anthenticate all the requests sent by the app to the server.
Elm a... |
Problem statement: Given an integer list from 0 to 100 find the missing Element.
I saw this problem on reddit on a compilation of interview questions, tried it out for fun. Mainly tried to generalize the code for any boundry(not just 100) and multiple missing arguments. Focused on readability and writing docstrings bas... |
I'm working on an Android app, and at one point I need to retrieve a request code in a callback method and perform some database operations depending on the request code. It started out ok when there were just 2 request codes, but then I had a need to add two more, and I can't really find a good way to avoid a messy lo... |
Recently I've started learning ReactJS and I do not look forward to making one Page website so I learned about react-router and this is my way of doing to it.
App.js
import React, { Component } from "react";
import "babel-polyfill";
import Navbar from "./Components/MenuNavbar";
import Footer from "./Components/Bottom";... |
The following is some code that is used to provide the frontend with certain parameters when rendering a form. The parameters are conditional based around what data is being changed, getNewSaleFormOptions provides a way of quering these options using a GET request and url params (ie /sales/new?dealership=11&vehicle=2),... |
This is the revised code from my prior question. Same requests as before! Something I'm doing new here is using the XmlEncoder extension methods to handle serialization and de-serialization.
XmlEncoder.cs
using System;
using System.IO;
using System.Text;
using System.Xml.Serialization;
namespace Battleship
{
//htt... |
I'm looking for the fastest way to determine if a long value is a perfect square (i.e. its square root is another integer). I was asked this in an interview recently.
Here is the very simple and straightforward way I'm doing it now:
private static boolean isSquare(long n) {
int i = 1;
for (;;) {
if (n <... |
I've written my own UI for Mathieu Guindon's VBA Battleship (Battleship UI: GameSheet) which uses a webpage in a WebBrowser control for the View.
Webform: Userform
Displays the webpage in a Webbrower control.
Private controller As GameController
Private Sub UserForm_Initialize()
Dim View As WebView
Set View =... |
I've write a gomoku terminal game with socket client and server.
The main suggestions I am looking for:
Am I using the multithread in right way? As when I tried to migrate the terminal game to GUI(pygame), the main thread is blocking, pygame can't render.
I am new in socket in python, so any suggestions about socket ... |
I have been studying C#, and I am trying to model the "Rock / Paper / Scissors" game.
Is my program reasonable or is there anything I need to improve?
user input a round.
user input RockPaper or Scissor.
After the game is finished , user can choose to play again or quit.
namespace Project_RockPaperSci_Revised
{
... |
I am using VS 2017 with C++ 17 standard set on Windows OS. What I'm missing in couple of heavily threaded projects is synchronizing mechanism that can be atomically upgraded from shared to exclusive access, without releasing the shared lock. Using boost is not an option for me (another topic is why), so I decided to de... |
We are using Keycloak v4.4.0 as SSO for multiple microservices and SPAs. The main goal is to prevent user entering his credentials when landing to another SPA UI.
I've not worked with such authentication mechanism before, so I'm trying to use all its features.
This js module is compiled via webpack. decodeToken funct... |
Made some adjustments to the previous code thanks to the helpful and thoughtful review by @G.Sliepen.
Problem statement: This program should ask for the total number of shops that will be visited. At each shop, ask for the number of ingredients that need to be purchases. For each ingredient... |
I was wondering if someone could help critique this code I put together. It is supposed to delete all temp files and folders and then empty the recycle bin. I had to make some adjustments because using Pyinstaller, I wanted the console to stay open and have the user proceed after reading.
import os
file_size = os.path.... |
I have a file of SQL (actually HiveQL) queries terminated by semicolon (;). I need to obtain a list of formatted queries from this file. Formatting includes replacing multiple spaces with single one and removing extra spaces in cases like '( ', ' )', ' ,'. So, the following is my approach and it looks monstrous:
fdHql ... |
Today I have written my first implementation of a SkipList (on top of a std::vector), because I was tired in using std::lower_bound and the other functions manually. I tried to create it as generic as possible to provide the user as much freedom as healthy.
During the implementation I always had an eye on the std::set ... |
I was able to find all kinds of examples that demonstrate how to validate a Luhn Checksum but very few that actually generated the check digit. Here is my attempt in base 10, based on the validation examples found at Wikipedia and Rosetta Code:
/// <summary>
/// Constructs the check digit for a given numeric string usi... |
I have a method, which outputs multiplication table sized by given maximum number. Also, it visually separates first row and column from the rest table. How my code could be improved or optimized?
public class Example {
public static void main(String args[]) {
printMultiplicationTable(15);
}
pr... |
This is my first bigger than a few lines bash script.
It automates kernel updating and removing on Ubuntu through ukuu (Ubuntu kernel update utility).
I'm not yet familiar with all the bells and whistles of GNU utilities and want to strive for clarity. The only thing I know now is grep -P and everything seems like a na... |
I've implemented the search/insert part of a hashtable in JavaScript.
This is in linear probing style. It resizes when the array is out of space.
var share = { bucketSize: 10 };
function hash(key){
return key % share.bucketSize;
}
function expandArr(arr){
share.bucketSize = share.bucketSize * 2;
let newArr = ... |
The task is to make a program that prints out how many possible paths a driver can use to visit three cities so that he visits each city exactly n times. The program must be executed within 1 minute and print the solution for n = 10. The program works correctly but for n above 7 it doesn't execute in time. Is there a w... |
I am creating an Idle game right now (tycoon style) which has 9 trains, (8 of them needed to be purchased), and 1 is always active, no matter if you just started the game.
I was trying to create a simple code, but it got really really messy, so there's 8 buttons, that each one, should "instantiate" the train and the tr... |
I am learning about monadic structures and have created a sort of monad list that implements the map and binding "operators" (or technically methods) in C#.
I understand that Linq already exists and would solve many of the problems that my solution solves (I am in fact already using linq to help in parts of my code) an... |
The Story
While flying a plane over the forests of Wisconsin a couple years ago, I thought to myself "If I lost an engine, I would be awfully long way from an emergency landing airport. I wonder where the worst place to lose an engine in Wisconsin would be, if we define worst as "furthest from any airport"?
To scratch ... |
In my project I send messages, so there are items that should be sent and that were already sent. I want to have container to manage these two entities.
The container I wrote seems to work ok. It supposed to be thread unsafe, data racing issues should be managed by class users.
What might be done better? All ideas are ... |
This is my first bowling kata solution in java. I would be very grateful if you say something about that. I want to learn from you to become a better programmer.
I think the score method is quite small, but is it clear enough as well?
How can I improve it more?
public class BowlingGame {
int[] rolls = new int[21];
... |
I've been trying to pick up some Rust experience and decided to try and make a text adventure game. I'd like some feedback on potential bad practice and non-Rust-style code I may have used. I'm moving towards Rust from a Python perspective.
use std::io::stdin;
struct Game {
room: usize,
inventory: Vec<Item>,
... |
This is a relatively simple implementation of the Sieve of Eratosthenes in Rust. The main objective is to find the \$n\$th prime quickly when \$n\$ might grow to huge numbers.
pub fn nth(n: u32) -> u32 {
// A convenient variable that will help in simplifying a complicated expression
let x = if n <= 10 { 10.0 } ... |
I solved this CodingBat problem:
Given a string, return a new string where "not " has been added to the front. However, if the string already begins with "not", return the string unchanged. Note: use .equals() to compare 2 strings.
notString("candy") → "not candy"
notString("x") → "not x"
notString("not bad") → "not ... |
Here is my code of project Euler #7:
from math import *
import time
start = time.time()
def isPrime(n):
prime_fst = [2,3,5,7]
num = round(sqrt(n))
j=0
while num>7:
if num%2!=0 and num%3!=0 and num%5!=0 and num%7!=0:
prime_fst.append(num)
num-=1
prime_fst.sort()
while ... |
I don't like my current code, because of duplications. What's the best way to leverage Kotlin to make it more concise. I have simple registration form
data class RegisterForm @JvmOverloads constructor(
val email: String = "",
val emailError: String = "",
val lastName: String = "",
val l... |
You are given an array sorted in ascending order which is rotated at
some pivot unknown to you beforehand. Find your target in \$O(log n)\$
which means it should be a binary search. If the value does not exist
return -1.
The approach I took was to narrow the subset of solutions by using an upper bound infinity ... |
I'm creating a Tic Tac Toe solver algorithm. The idea is to iterate through each row, column and both diagonals and put them into a map in JavaScript. With that map I can run other logic to check for a winner and where that winner's position is.
I'm not building an actual TTT game nor am I writing any AI for now. My qu... |
In the code below, I implemented the SpaceSaving frequency estimation algorithm described in this paper. Given a parameter eps, the algorithm finds all elements of a data stream of length n that occur more than n/eps times (with high probability). Here's a screenshot from the paper with the pseudocode:
I would appreci... |
I've implemented a simple ListView in MVVM that displays a few PrepSteps (short form of PreparationSteps). While implementing I wasn't sure about if my approach is "the way to go" so I decided to get the code reviewed.
First I want to share the image of the application so you get a better idea of what I have accomplish... |
I got the below code that is looping through all controls and changing the state in a after update event and enables new row for user to use. Everything works fine but i'm just wondering whether there is a better way to achieve the same result as what i have done is long winded. This will only enable the controls if th... |
This is k-means implementation using Python (numpy). I believe there is room for improvement when it comes to computing distances (given I'm using a list comprehension, maybe I could also pack it in a numpy operation) and to compute the centroids using label-wise means (which I think also may be packed in a numpy opera... |
I'm trying to script a C# game of Draughts/Checkers. I'm at the point of taking user input and validating it. I first check the input of current x and y coords to see they are numbers, then check the coord pair against the board. Then repeat for target coords. I end up with a really long function that has repetition, b... |
I decided to resume my (limited) Python skills after not coding for a long time.
Here's a very simple self-contained program to convert the characters of an email address into their HTML entities (the purpose is to make the email invisible to spamrobots).
Any comment for improvement? (e.g. args parsing, code style, ... |
I am trying to achieve an event system, which I refer as actions, and would like your ideas about what I come up with so far. I have made research on several design patterns, and several systems used for jobs like this, like Signal & Slots, Observer and command patterns etc. However, I have found several various implem... |
I wrote the Python3 code below. This is actually a stripped down version of a bigger project, but in essence it boils down to this code. There are two classes: Point, which is a point in 3D space and PointCloud, which is a sequence (list) of points.
In the PointCloud class, I have a method to calculate the minimum and ... |
I have a Throttler and Debouncer functions that I took from an unmaintained library. I added my own tests, but not sure if the tests fully prove that it works and can be trusted. If the tests are good, then I’d feel a lot better about using it and can refactor if needed. Below is what I got.
Throttler:
/// The Throttle... |
I wrote this code to make a non-blocking server without using select(), my main concern is to catch as many exceptions as possible for worst case scenarios (so I would appreciate some feedback on cases I missed), and to let each client to be handled separately by its own thread.
Any feedback on style/performance/good o... |
My code is a mix-up between dynamic programming with the HashMap and brute force with the way I reach out the results and substring. I don't know how to optimize my algorithm without googling and looking for already solved solutions with different approaches.
class Solution {
public String longestPalindrome(String ... |
I am implementing a new compression algorithm for the weights of a neural network for the Leela Chess project. the weights are roughly 100Mb of float32s which I want to compress as small as possible. Error tolerance for this application is 2^-17, so lossy compression is clearly the right answer here. All of the weights... |
I have been studying C#, and I am trying to model the Random number guessing game.
1 User inputs the number of try.
2 Computer generates random number.
3 If numbers doesn't match user lose one try
and if they match user gets two bonus try.
Is my program reasonable or is there anything I need to improve?
As player go... |
Recently, I had a sick leave and to had some fun and improve coding skills I got a challenge to write a Snake Game for WPF.
Desired RESULT
1) Game must be in separate .dll library;
2) Must have settings;
3) Must use Canvas as playing field.
SOURCE
If you want to skip reading or just to watch and to make review - you're... |
I have a dictionary self.indexList = {} filled with 3-item-lists values = [lineId, nominalLineId, vertex] for each dictionary key (its a supplement to a QgsSpatialIndex in PyQGIS, btw).
I need to reverse-search this dictionary for matching tuples of lineId and vertex. This function is the dealbreaker in a larger PyQGIS... |
I want to implement a directed graph which has 3 main kind of edges:
self referencing edges
non directional edges between two nodes
directional edges between two nodes
Also I want to be able to do global operations on the graph, like e.g. counting or removing all edges fulfilling certain criteria.
The easiest progra... |
So I have some test, maybe the given side of that test is not so important to catch the point of my confusion. I wrote
List<LinkedHashMap> failedEvents = ...
//...
assertEquals(failedEvents.size(),1 );
assertTrue(failedEvents.stream().allMatch(x -> x.get("eventId").equals("EVENT3")));
and in the result my code review... |
PGF is a graphics framework for \$\TeX\$ and friends. It supports shadings (gradients), but only in RGB.
There is often a need to output shadings in CMYK and I am having a go at implementing this.
I'm looking for feedback from those who know PGF well as to whether my strategy is good or not and what things I might not ... |
I am really excited that I just wrote my Haskell maze solution in bfs. This is my very first haskell (and I still haven't tried to build a maze in haskell so that maze is hard coded xD)
ANY suggestions all super welcome!!!
maze = [[0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 2, 2, 2, 2, 2, 2, 2, 0],
[0, 2, 0, 0,... |
So again, I am a bit confused about some notes that i'am getting from my reviewer. I have some kind of utils, to print/prepare log messages. Yea, maybe I am a bit fanatic java 8 lambda guy but I think it is still under control. :)
So its looks like that [I hide 'sensitive' data]
public class ExceptionUtils {
private... |
I wrote a basic menu application for my intro to python. I'm fairly new, and python does look promising.
the_burger = 16.99;
french_fries = 5.99;
currie_sauce = 19.99;
napkins_with_chocolates = 10.50;
juice_box = 89.01;
takeout = 18.99;
total = 0.0;
DONE = False
print("""
+-------------------------------------------+
|... |
//not an elf file. try PE parser
PE pe=PEParser.parse(path);
if(pe!=null)
{
PESignature ps =pe.getSignature();
if(ps==null||!ps.isValid())
{
//What is it?
Toast.makeText(this,"The file seems that it is neither an Elf file or ... |
I got a forms list, and it has a tags list. I received from my front end app an array of tags (String), gotta filter these forms by these tags.
forms.forEach(form -> {
br.com.softplan.ungp.dynamic.form.api.model.Form formJson = new Gson()
.fromJson(form.getSchema(), br.com.softplan.ungp.dynamic.form.api... |
This function was built to replace DLookup so that i could pass in parameterized queries for a speed increase. I also wanted a simple way to get more than one value if needed. For example, if i want 4 or 5 fields out of a particular record or maybe 4 or 5 records with only one field, I could get that with this function... |
In my intro CS class we're reviewing data structures. I'm currently working on implementing a stack using a linked list (LIFO) in C. I'd appreciate a review of the implementation as well as of my understanding of how a stack should work.
// This program is implementation of stack data structure
// via linked list (LAST... |
I just faced a problem where I needed to know if extra data was present in a given collection after a Take operation took place. Specifically, this is related to generating @odata.nextLink values in an OData-enabled API only if there is remaining data on the server: the user should not receive a "nextLink" if no more d... |
I came up with this simple function to return the length of a double, working fine in all my test but want to make sure that this code will work in all doubles, can't think of a case in which it would not work but I'm sure if there is, then you can find it, here it is:
int length(double number){
int result = 0;
... |
I'm very new to the programming world and have been working exclusively with console window applications in C# thus far. I've created a program which took me way too long to produce but I'm very proud to have completed it exactly as I set out to make it. It does what I wanted it to do, however the code is separated int... |
I was recently tasked with determining which hex RGB colors in list color_list are nearest to each hex RGB color in list target_colors, using euclidean distance as the measuring stick, and only returning items that are within 10 distance from each target color. My first pass at this was for each item in target_colors... |
Still learning Assembly. This program is a simple guessing game to test most of the new things I've learned! Any advice and all topical comments on code optimization and conventions is appreciated!
Compiled as follows using VS2017 x64 Native Tools Command Prompt:
> nasm -g -fwin64 guess.asm
> cl /Zi guess.obj msvcrt.... |
I have created a sign up layout as image below.
Does this part of code looked bad since the dp I used for the floating button are quite large.
android:layout_marginTop="110dp"
android:layout_marginLeft="70dp"
If yes, how can I change it ?
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:andro... |
I made a state machine.
You can press 0 and 1 to switch between the hypothetical menu and playing state.
I hope you can help me improve it further.
StateManager.h
#pragma once
#ifndef StateManager_H
#define StateManager_H
#include <iostream>
#include "State.h"
/*
State classes
*/
class StateManager {
public:
//... |
I have this piece of code in Python 2.7:
As you can see is very hard to read the SQL query, what is the best way to re-write it?
try:
if title and url:
sql_query = "INSERT INTO news (title, author, description, " \
"content, url, url_to_image, source_id, source, " \
... |
I've created a relatively simple Blackjack game in java. The reason why I decided to do this specific project was to improve my object orientated programming in java.
I will post my code so feel free to come with criticism etc. I am reading my first course in Java, have that in mind.
Player class
import java.util.Arr... |
I have the following code where I try to manage user roles in teams:
Teams have entries, an entry has a creator. This creator is member of a team and has a specified role. Moderators may delete all entries, users may only delete their own entries. Here is how I implemented this:
public class TeamMember implements TeamR... |
This is a code uses mergesort algorithm to sort a list of elements.What are the possible improvements on the code?Also are there any unhealthy coding practice involved in this code?
#include<iostream>
#include<vector>
#include<random>
#include<chrono>
using namespace std;
using namespace std::chrono;
vector<int> merge(... |
A generic class to get object collection from csv string. I would like to know if there's any better way?
Converter class
public class CsvConverter<T>:List<T> where T:class
{
private readonly string _csvText;
private readonly string _separetor;
/// <summary>
/// Get object collection from CSV string
... |
I created a simple guessing game for the sake of practice, it's been a while since I've had any code reviewed. I do have a tendency to over-engineer things sometimes and I'm not typically aware of it until well after the programs creation, so please let me know if I've done such a thing. Other than that, I'm open to an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.