instruction stringlengths 71 95.1k |
|---|
i've been working on an implementation of a my own from scratch set of library Astron and I wanted to get my TPL usage reviewed because i'm not confident with this technology :/
My app is currently unpacking .d2p files, which is a custom file format from a french game called Dofus, it's simply an archive of others infl... |
I made a postfix calculator in Java.
The code performs the functions I planned without problems, However, I'm not satisfied with it, because it's too verbose and I couldn't split it up into methods properly, especially PostfixCalculator.changeNotation().
Any help would be greatly appreciated.
Main.java
public class M... |
Introduction
When implementing a one-dimensional array, you need to keep track of the size. Such quantities are best represented by std::size_t:
std::size_t count;
Analogously, when implementing a multi-dimensional array, you need to store the dimensions. This time, a one-dimensional std::size_t does not suffice. Y... |
The task
is taken from leetcode
You are given a map in form of a two-dimensional integer grid where 1
represents land and 0 represents water.
Grid cells are connected horizontally/vertically (not diagonally). The
grid is completely surrounded by water, and there is exactly one
island (i.e., one or more connected... |
I am currently learning javascript at university. We have an assignment where we shall write various functions for calculating values. In one case, we shall write a function which returns the sum of two values, if only those two values were passed as arguments. If there is the third optional argument, which shall be an... |
A while ago I was working on a multipurpose database class (an es6 javascript class) that works with any database supporting adodb.
This class is a wrapper on the "node-adodb" npm library. This database class has four main methods, all of which process some options, passed in as parameters, into sql, which is then run ... |
The task
is taken from leetcode
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array),
some elements appear twice and others appear once.
Find all the elements of [1, n] inclusive that do not appear in this
array.
Could you do it without extra space and in O(n) runtime? You may
assume the returned li... |
How can I make this code faster? the string can contain characters such as ", .?#" and possibly others.
Const Nums = ['0'..'9'];
function CleanNumber(s: String): Int64;
Var z: Cardinal;
begin
for z := length(s) downto 1 do
if not (s[z] in Nums) then Delete(s,z,1);
if s = '' then
Result := 0 else
Result ... |
I have a drive with many thousands of sound effects. The files have been stored on different operating systems and NAS devices over time and there are now duplicates of many files, but the filenames contain different UTC timestamps. For example:
1-14 Crowded Bowling Alley (2016_06_28 02_14_41 UTC).aif
1-14 Crowded Bo... |
The task
is taken from leetcode
Given a string, find the first non-repeating character in it and
return it's index. If it doesn't exist, return -1.
Examples:
s = "leetcode"
return 0.
s = "loveleetcode",
return 2.
Note: You may assume the string contain only lowercase letters.
My solution
/**
* @param {string} s
*... |
I want to implement my own custom observable class so I can have a hierarchy of components and the closest defined configuration item bubbles to the front.
<form controlClasses="formDefinedClass">
<group controlClasses="groupDefinedClass">
<control controlClasses="controlDefinedClass"></control>
</group>
</form... |
I have the following function and code snippet to extract cell values for multiple years, format it, and save to a list. Each raster has 365 bands — one for each day. A separate operation is performed on each flattened list pr_flt which contains daily cell values of XY for 1991-2015. The cursor contains XY coordinates ... |
I need a rather simple file encryptor/decryptor in Python, after some research, I decided to use tye pynacl library reading the file in blocks, writing them back out, and then at the end using Blake2b to generate a signature for the file. Each file is encrypted with a unique key, which will be distributed along side th... |
I've been a fan of coroutines and asynchronous programming for a while, and I recently took a trip down memory lane to when I was using Python's tkinter module for a GUI. I wanted to combine the two worlds, one of smooth coroutines and one of callbacks.
My hope is to find a better solution for the basic event loop, imp... |
i made an audio player in html5 for learning purposes, also i tried to use BEM pattern with sass (i dont know if i did it well) i also encapsuled my code as much as possible, but i think i can make it better, maybe i can include some js pattern or maybe i can divide my code in different files, basically im just asking ... |
I have the following Python script. The purpose of the script is to extract text from PDFs. I use textract for that because soon I realized there is no easy way to check if a page contains an image or not. So I extract the whole text using textract.
The workflow is like this. main() parses each pdf file from a folder,... |
I'm implementing a Yahtzee app and i have a class StrategicAdvisor that is responsible for deciding which strategy should be followed. The StrategicAdvisor has some tools: a RollAnalyzer which provides information about the current roll and a BoardAnalyzer which can tell us about the Fields vaccant (or occupied) in the... |
I created it to map buffers returned by ODBC driver to my objects directly without creating DataSet like storage.
It works quite nice, but I have some questions. UPD: I resoled those questions, just sharing code.
For those who unfamiliar with ODBC: after calling to SQLFetch driver fills buffers specified by SQLBindCol ... |
The first code I ever wrote, sorry that the prints are in German.
I tried to do some code improvements myself but well whenever I do I fail.
Hopefully somebody can help me improve my coding skills.
while True:
print(" ")
print("ax^2+bx+c ausrechen UwU, Bitte Achte!!! Bei Kommazahlen . benutzen, nicht , Beispiel... |
I'm trying to optimize this nested foreach and if statement function for work. My code is retrieving data from a SSMS SQL database with thousands of fields from multiple tables of data, moving them to lists and then looping through the lists to retrieve the data. It is moving all the data to a data grid view to be expo... |
I wrote this code to automate in Word from Visual Fox Pro. I put between the escapes <|< and >|> some VFP code (like take some values from tables and so on). At the press of a button, the code scans all of the document and, when finding these escapes, evaluates the instructions between. The last two FOR loops eliminate... |
For a homework assignment, I was asked to complete this CodeStepByStep problem. It's coded correctly and gave me a right answer. I'm just wondering if there's an easier way to solve this problem without the big blocky code in the if statement. The fact that I have to check each lowercase vowel AND THEN the uppercase vo... |
I am still learning Rust and I think I have a long way to go. This question is from exercism.io. I am posting here to get some more reviews and suggestions to improve my code.
Linked list aren't a good data structure but they help to learn a programming language better.
I know I can use recursive calls for linked lists... |
I have a .csv file of 8k+ rows which looks like this:
state assembly candidate \
0 Andaman & Nicobar Islands Andaman & Nicobar Islands BISHNU PADA RAY
1 Andaman & Nicobar Islands Andaman & Nicobar Islands KULDEEP RAI SHARMA
2 Andaman & Nicobar Islands ... |
I am using Entity Framework Core as ORM in my ASP.NET Core 2.1 project. I want to perform server-side pagination in Career Controller for getting list of careers. I have a model which looks like:
public class Career
{
private string _title, _description;
[Key]
public long career_id { get; ... |
Implement a MapSum class with insert, and sum methods.
For the method insert, you'll be given a pair of (string, integer).
The string represents the key and the integer represents the value. If
the key already existed, then the original key-value pair will be
overridden to the new one.
For the method sum, you'll... |
I have a set of files in folder my_dir, which is not the folder where my Python script resides. Sample content of my_dir:
foo.bar
ba.bar
moog_0001.h5
moog_0007.h5
moog_0020.h5
moog_0027.h5
moog_0032.h5
moog_0039.h5
moog_0041.h5
moog_0053.h5
moog_0060.h5
I need to:
find the files with extensio... |
I'm building a "sliding puzzle" game. This is the animation code for when you click a Tile.
This "loop" function is running all the time.
When you click a tile, if it's available to move, I set the "isAnimating" property to true and then set the target left position, and the step (calculated with the starting and end p... |
The task
is taken from leetcode
Given two non-negative integers num1 and num2 represented as string,
return the sum of num1 and num2.
Note:
The length of both num1 and num2 is < 5100.
Both num1 and num2 contains only digits 0-9.
Both num1 and num2 does not contain any leading zero.
You must not use any built-in Big... |
I wrote this code in Haskell (instead of Python) for the educational benefit. Can anyone suggest ways to improve this code?
I'm guessing that I'm using fromIntegral inefficiently.
It takes two commandline arguments. The first is a path to a symmetric distance matrix. The second is a threshold. The program interprets ve... |
This is the first little project I've made that didn't feel it was complete gibberish. But I couldn't tell.
The biggest problem I had with this was using the BoardValue enum working like I wanted to. I understand that classes should have a level of abstraction to them and I suspect that the way I implemented the at(int... |
A Fibonacci sequence is the integer sequence of 0, 1, 1, 2, 3, 5, 8.....
The first two terms are 0 and 1. All the other terms are obtained by adding the preceding two terms.
Here is my code:
def recur_fibonacci(n):
if n <= 1:
return n
else:
return(recur_fibonacci(n - 1) + recur_fibonacci(n - 2))
nt... |
An assignment at school required me to write a program for this task using Kadane's algorithm (explained here):
Define the function find_max_subarray that takes a list as an argument and two indices, start and end. It finds the maximum subarray in the
range [start, end – 1].
The function find_max_subarray returns t... |
I wrote this script to download images from Reddit. I would like to hear from others on how can I improve this script.
import requests as _requests
import os as _os
class Redpy:
def __init__(self, user):
"""Enter a user agent"""
print("hello")
self.user = user
def download(self, subre... |
An assignment at school required me to write a program for this task:
Create a class and define two methods in the class.
Method f1 is used to pass an empty list and the sorted list is taken from the user to method f2.
Method f2 is used to compute all possible subsets of the list.
Then the result is returned from the... |
The most basic code(i guess so) to find all the factors of a number
Note:factors include 1 and the number itself
Here's the code:
c=0
x=int(input("Enter number:"))
for i in range(1,x+1):
if x%i==0:
print("factor",c+1,":",i)
c=c+1
print("Total number of factors:",c)
Please make this code efficient..... |
After doing the Snake Game I decided to go more crazy and made an Arkanoid Clone:
Currently this only runs on Windows. I tested it under MSVC2017 with Windows 7. If you want to get it to run on Linux or Mac you have to implement the Part in Console.cpp.
I organized the code as following:
GameObject: This class is th... |
i've recently released a from scratch set of library Astron,
and I wanted to get my memory policy logic reviewed.(you can find a little doc about it here).
My first goal was to provide an extandable API to allow the user to implement his own memory policy, but I've also provided some base implementations especially on... |
i got a college project and i'm trying to create a map for my text-based game in Java.
Me and my colleague* created this code:
public class Mapsystem2 {
//δημιουργία των πινάκων maps
static int[][] map1= { {0,0,0,0,0,0,3,3,3,3,0,0,0,0,0,0},{0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0},{0,3,3,0,0,0,1,1,1,1,1,1,1,1,1,1},{0,1,1,0,0... |
Novice Java developer here. I've never really used a time/date library before and I'm curious how an experienced developer would solve this. You're given 4 ints: startHour, startMinute, endHour and endMinute. Now, check if current time is within the given timeframe. Is there a more clean way of doing this than what I'v... |
Here is my Countdown word solver.
This code aims to find all possible permutations of any length of a given input (which in the Countdown words game is any random assortment of letters).
It then compares each permutation with the dictionary and prints it if it is a valid word. For example the letters "PHAYPC" could yie... |
I am learning PHP 7 and decided to implement a simple FIFO singly-linked queue in it:
<?php
class QueueNode {
var $item;
var $next;
function __construct($item) {
$this->item = $item;
}
function get_item() {
return $this->item;
}
}
class Queue {
var $head;
var $tail;
... |
I got a C# class:
public class Agent
{
public string AgentId { set; get; }
public double Longitude { set; get; }
public double Latitude { set; get; }
}
There are several agents in several different locations. During the program's lifetime, they can receive a call to another (latitude, longitude) point whi... |
I recently posted a solution for the numbers game on the Countdown TV show using a recursive technique. For those unfarmiliar with the rules…
A fixed set of numbers (usually 6) are chosen at random
A target value is set
The player must reach the target value using some or all of the numbers from the list of 6 random ... |
I have never posted to this forum, but was referred here. I need some help printing key iterations as well as optimizing my code for run time. If someone had some time to help/explain how to correct various parts, I would be much obliged. I am fairly new to R and trying to help out on a project.
I am trying to run a bi... |
I am trying to implement Dijkstra algorithm. I try to calculate cost of reaching every node from first node. Though I have tried with couple of graphs and results are correct but I have one doubt which leads me to think that something is wrong with my implementation. Here is my implementation
private int[] findShortest... |
I'm making a puzzle game in Unity with sprite-based graphics. When the game is paused, I want to hide most game elements, because I don't want the player to be able to pause and leisurely think about their next move.
I could just make the sprites invisible, but I decided to do something more stylish; render sprites wi... |
1. Backstory
I recently starting programming and I found out that Entity Framework works perfect for my small-sized applications due its simplicity.
I've made my custom authorize attribute for MVC controllers and controller methods to check if the current user has a certain role (which is an enum type in my case).
The ... |
This is my library class. This does not have any issues but I want to know if I have any mistakes, or ways to improve performance:
variable and call (example of SELECT):
include(class_dbmanager.php)
$this->DBMANAGER = new Class_DbManager();
$Query['DatabaseName'] = "SELECT user FROM table_user WHERE unsername='" . $u... |
The task
is taken from leetcode
Given a non-empty array of digits representing a non-negative integer,
plus one to the integer.
The digits are stored such that the most significant digit is at the
head of the list, and each element in the array contain a single
digit.
You may assume the integer does not contain ... |
I have here a working method of parsing input arguments however it seems redundant. I would like to shorten this code so it doesn't appear so repetitive.
tool.sh <file-to-use>
tool.sh <file-to-use> -o <output-file-name>
# If arguments are set and equals "-o" then set APP_NAME
if [[ -n $3 ]] && [[ $2 = "-o" ]]; then ... |
I am building out a simple web server in Go. My goal is to expand on this framework in a different application I am building.
Here is my github repo
https://github.com/jmacnc/gowebserver
Is what I have here using best practices?
I am specifically looking for feedback on the tests, and how I am connecting to different... |
I have small web application that need a users permissions system to access some content or add/edit it.
I'm using roles given to a user to manage priviliges, and also a user custom meta to set a custom priviliges to a specific user.
I want to know if this method is good ? if not why ? Is there is any suggestion better... |
I was tasked with creating the class RandomStringChooser that prints the strings in the passed array in a random order, based on the for loop in the tester. If the number of iterations in the for loop is larger than the size of the array passed, then "NONE" should be returned. Look at the tester in the program for an e... |
The Original Post (v1)
I'm looking for feedback on the updated version of the code posted at the link above.
#pragma once
#include <memory>
#include <cassert>
#include <type_traits>
namespace datastructures {
template<class _Ty, size_t _Size>
class CircularBufferv2 {
// uses char as type to prevent ... |
I have improved this post to the code below.
As always, any critique is much appreciated!
<?php
class QueueNode {
function __construct($item) {
$this->item = $item;
$this->next = null;
}
function __destruct() {
$this->item = null;
}
function getItem() {
return $t... |
This simple piece of software is generating a vehicle object by using the get_vehicle() function,
Whenever i need to generate a specific vehicle I pass in the vehicle ID to this method and it returns the appropriate vehicle.
Within the get_vehicle() function, each vehicle is generated within a case label within a swi... |
My idea is to not not expose/use service's Proxy everywhere throughout the application, rather exercising all service communications(using client Proxy) from a single class. To achieve this I have created below class: -
namespace MyOrganization.EventSender
{
using MyOrganization.EventSender.DTOs;
using MyOrgan... |
A factorial of a number is the product of all the integers from 1 to that number.
For example, the factorial of 5 (denoted as 5!) is 1*2*3*4*5 = 120. The factorial of 0 is 1.
def recur_factorial(x):
if x == 1:
return 1
else:
return (x * recur_factorial(x - 1))
num = int(input("Enter number: "... |
I have written a Python program to take in two strings and print the larger of the two strings.
Here is my code -
string1 = input("Enter first string: ")
string2 = input("Enter second string: ")
count1 = 0
count2 = 0
for i in string1:
count1 = count1 + 1
for j in string2:
count2 = count2 + 1
if (count1 <... |
I'm hoping someone would be able to identify if my code is prone to SQL injections, and just overall see if there is anything that could be done better, faster or more efficiently
Im very new to OOP and prepared statements so there might be some glaringly obvious problems but just let me know!
auth_class.php
require 'd... |
I'm new to docker and after much research and stufy I've created a sample application and would like it to be reviewed in case if I'm missing any corner or if there's redundant information that can be simplified.
Dockerfile
FROM node
WORKDIR /src
COPY . .
RUN npm install
CMD ["npm", "start"]
docker-compose.yml
MySQL... |
I have written a program for a simple calculator that can add, subtract, multiply and divide using functions.
Here is my code:
# This function adds two numbers
def add(x, y):
return x + y
# This function subtracts two numbers
def subtract(x, y):
return x - y
# This function multiplies two numbers
def multiply... |
I wrote code sample below that is finding decimal values in jObject without '.' char, and convert them to long type. The issue is that it works for max jObject that contains two child jObjects.
public JObject ModifyDoubleIntegers(JObject objectToModify)
{
JObject resultObjectModified = new JObject();
foreach (v... |
I have written a Python program to check for Armstrong numbers in a certain range.
An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 371 is an Armstrong number since 3**3 + 7**3 + 1**3 = 371.
Here is my code:
lower = int(input("Ent... |
A linked list is a data structure that has a beginning, and an end. The only way through the structure is to go to the "next step", like stepping stones. This linked list works the same way, but in ascending order.
There's two things I'd like to know about this code:
Are there any efficiencies I can make?
What methods... |
This function (find_prefix) is supposed to find words starting with a given prefix in a container. The container is sorted. This function is a fairly performance-critical part of the code, so I am open for any optimization suggestions. Here is a brief usage case; test_in is a file with \n separated English words:
#incl... |
I'm working on a new API written in Swift 5 and I wanted to play with the new Result. I wanted to know what you guys think about this syntax:
enum NetworkRequestError: Error {
case hostNotAvailable
case accountNotAvailable
func finish<T>() -> Result<T, NetworkRequestError> {
return .failure(self)
... |
My objective is to find a hash collision of my modified hash function. Assuming my modified hash only outputs the first 36 bits of SHA-1. As we know, SHA-1 is a 160-bit hash value, hence, we only need to output 9 characters out of 40 characters for comparison.
How i begin my program is by hashing a string (I have a SH... |
I'm trying to extend my coding skills to other languages by doing projects. (learned Java in school) and since python is very popular right now thats what I ended up choosing for this project, though I'm fairly new to it. Does this code follow common best practices? Is there anything I can do to improve this program so... |
https://leetcode.com/problems/minimum-cost-to-hire-k-workers/
There are N workers. The i-th worker has a quality[i] and a minimum
wage expectation wage[i].
Now we want to hire exactly K workers to form a paid group. When
hiring a group of K workers, we must pay them according to the
following rules:
Every worker in... |
I have quickly written some code for a task in which takes a name of an 'earthling', their age and then applies a random operator with a random value in between 0 and 100. If their new age is below 0 or above 120, they die. The operator, name, previous and new age must be printed to the screen.
Code:
import operator
im... |
Please review the code readability, I would like to have an easier to follow code.
Thanks
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace ArrayQuestions
{
/// <summary>
/// https://www.geeksforgeeks.org/inplace-rotate-square-matrix-by-90-degrees/
/// </summary>
[TestClass]
public clas... |
The task
is taken from leetcode
Write a function that takes a string as input and reverse only the
vowels of a string.
Example 1:
Input: "hello"
Output: "holle"
Example 2:
Input: "leetcode"
Output: "leotcede"
Note: The vowels does not include the letter "y".
My first solution
/**
* @param {string} s
* @return {st... |
I am new to programming and I am trying to develop a machine learning approach for image segmentation (https://en.wikipedia.org/wiki/Image_segmentation) and here I want to evaluate the predicted (output) segmentation. In order to do this, I am using multiple (common) metrics (dice score, jacquard index, surface distanc... |
The Original Post (v2)
As stated in the previous post, i'm looking for feedback on the updated version of the code posted.
A few things specifically I'm looking for feedback on, are:
I switched to using the std::aligned_storage as suggested in the previous post, but on the cppreference.com - std::aligned_storage page,... |
The task
is taken from leetcode
Given an integer, write a function to determine if it is a power of
two.
Example 1:
Input: 1
Output: true
Explanation: 20 = 1
Example 2:
Input: 16
Output: true
Explanation: 24 = 16
Example 3:
Input: 218
Output: false
My solution
/**
* @param {number} n
* @return {boolean}
*/
var ... |
I'm writing a PowerShell script to loop through an organization's PowerBI workspaces and spit out the report IDs, names, and URLs for each workspace - so, a nested loop.
Here's my working script thus far:
Install-Module -Name MicrosoftPowerBIMgmt
$myArray = @()
Login-PowerBIServiceAccount
Get-PowerBIWorkspace -Scope ... |
I have written a program that simulates a TickeTron and allows the user to book seating in a virtual audience. The virtual audience is read in from a text file which will be included below. The program does work when run but I feel there are ways to greatly increase the efficiency of the program. Ugly code is a pet pee... |
I built a wrapper in Swift to practice CoreData.
My question is more general, I hope this is acceptable. I wanted to know whether my implementation of this wrapper is correct or poorly implemented for practical use. Any feedback like design-patterns, conventions, etc are welcome as well.
Currently I have a class I refe... |
This is a Leetcode problem:
You are given a string, S, and a list of words, L that are all of the same lengths. Find all starting indices of substring(s) in S that is a concatenation of each word in L exactly once and without any intervening characters.
Here is my solution to the problem:
class Solution:
def __i... |
The code below works, but I want to ask if my solution is adequate or if there's something I should structure differently. If it's alright, I'll apply the same code in other subs.
My code copies stuff from Excel to PowerPoint and inserts it as a picture. In order to do this, I first have to copy data from one part of... |
I would be thankful for feedback for following html5 markup.
The outer div (class articles) has no more meaning as setting flex for it's child elements. Is a div the semantically correct choice in this case?
.articles {
display: flex;
}
.articles__article {
flex: 1;
}
<main class="main">
<div class="articles">... |
I have written a code to sort a main table containing tables in each of its rows. Here I am trying to sort the table by first sorting the rows in each of the main rows and then sorting the table from the sorted main rows. Whenever I click on headers the table is sorted in ascending and descending order alternately. How... |
This implements 128-bit unsigned integer using C++14.
It works on MSVC and 32-bit architectures being complementary to the unsigned __int128 type provided by GCC and clang on 64-bit architectures.
// intx: extended precision integer library.
// Copyright 2019 Pawel Bylica.
// Licensed under the Apache License, Version ... |
During a question on Stack Overflow, another user had some comments about the way this code works. He had a few choice words for it, including "magic", "ugly contraption", "you're doing things you shouldn't be doing". I wanted to ask some feedback on this sytem. Note: there might be some minor things in here like super... |
I have a class, which is meant to show a full screen modal controller with a set of actions (apart from actions it also has some static content, a lot of labels and images which are irrelevant, so I omitted approximately 500 lines of code to keep it simple). It looks as follows:
import UI_Framework
class DescriptionVi... |
This is a follow up question to this question:
https://stackoverflow.com/questions/4573526/what-could-be-causing-a-cannot-access-a-disposed-object-error-in-wcf
I have created a WCF service and it is up and running. When I used it, I was closing the connection after each time I got a response in a finally.
Trying to us... |
I was asked to complete this CodeStepByStep problem. Here's a quick summary:
Write a function named count_even_digits that accepts two integers as
parameters and returns the number of even-valued digits in the first
number. An even-valued digit is either 0, 2, 4, 6, or 8. The second
value represents how many dig... |
I'm writing a system daemon in Rust that may be started by the user manually. Only one instance of the daemon should be running at a time
so I have created a pidfile locking mechanism to prevent multiple instances. This is my first time doing any kind of unix style file locking
and I would appreciate another pair of ey... |
I'm recieving UDP messages as byte arrays and depending on details in some of the first byte, I need to convert remaining bytes into a multitude of different possible arrangements of other data types.
These data types are primarily 'uint', 'ushort' and just 'byte' but can be in any order, and there can be any number of... |
This is a Leetcode problem:
Given an unsorted integer array, find the smallest missing positive
integer.
Note:
Your algorithm should run in O(n) time and uses constant extra space.
Here is my first solution to this problem:
class Solution:
def __init__(self, A):
self.A = A
def firstMissingPositive(... |
This is a Leetcode problem:
Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that
position.
Your goal is to reach the last index in the minimum number of jumps.
Note:
You can assume that you can alway... |
I'm trying to make a code review for an external developer on my project. His code could be improved and I need your advices in order to know if my overwritten parts are better or not.
Part 1
# INITIAL
if 'error_message' in result_import:
result_import['error_message'] = "The file could not be uploaded. \n" + resu... |
I have this controller and some test cases. Any corrections/advice are appreciated to make them better.
public with sharing class MTX_MatrixDetailViewController {
public transient String activities {get;set;}
public MTX_MatrixDetailViewController(){
String candidateId = ApexPages.currentPage... |
I am creating Tetris in javascript. I have finished the basic mechanics. I would appreciate some feedback on how I could improve it.
Down, left, and right arrow keys move the piece while the up arrow key rotates it. It works best in full page mode.
"use strict";
const pieceData = [
{ // O
builds: [
[
... |
I want to evaluate Poker Hands an wrote the following Code:
https://dotnetfiddle.net/mxMvq9
Anything wrong / to imporve?
public class Deck
{
private Random rnd;
private List<Card> DeckCards { get; set; }
private int PlayerCount { get; set; }
public Deck(int playerCount)
{
rnd = new Random();... |
I'm working on a network sniffer program, whose structure uses 3 main classes:
Frame Class - One per monitored frame, holds reference to all the other sub frames
Parse Class - Holds the hex value of the entire frame
Protocol Classes - Individual classes for each network protocol
When a new frame is captured its sent ... |
While reworking my teaching materials for an exercise of an introductory course on mobile robotics, I recently created a animation/simulation of an incremental rotary encoder, e.g. often used for odometry purposes.
I'm quite happy how it turned out and it was indeed helpful when talking about signal patterns induced by... |
I have picked up a problem from Codility website and tried to work it out.
A binary gap within a positive integer N is any maximal sequence of consecutive zeros that is surrounded by ones at both ends in the binary representation of N.
Write a function:
class Solution { public int solution(int N); }
that, given a posit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.