instruction stringlengths 71 95.1k |
|---|
Let's take the famous fibonacci problem as an example but this is a generic problem. Also, taking scala as the language as it's rather feature-rich. I want to know which solution you'd prefer.
we all know that the following implementation is evil as it's not stack-safe:
//bad!
def naiveFib(n: Int): BigInt = {
if (n ... |
I wanted to get feedback on the correctness and efficiency of this post order traversal routine that my wife and I find really easy to grasp.
def postOrderTraversal(root: TreeNode):
curr = root
stack = []
while stack or curr:
if curr is None:
if stack[-1].right is None or popped == stack[-1].right:
... |
I made a preg_match to get my results and it works fine but I think it can be done with simple lines instead of repeating the code
$input = array('http://example.com/blue-bloods-s10e13-more-text/','http://example.com/charmed-2018-s02e11-more-text/','http://example.com/dynasty-2017-s03e11-more-text/','http://example.com... |
here is my first project : I have made a double pendulum animation with tkinter on Python. Can you give me some feedback on what can be improved ?
Thanks !
Code :
# General imports
import tkinter as tk
import random
import math as m
# Parameters
G = 9.81
class Pendulum():
def __init__(self, theta: float, theta_... |
I have the following piece of code:
$Page = str_replace('-&-', '-[+]-', $Page);
$Page = str_replace('&', '-[+]-', $Page);
$Page = str_replace('-and-', '-[+]-', $Page);
$Page = str_replace('-et-', '-[+]-', $Page);
$Page = str_replace('-und-', '-[+]-', $Page);
$Page = str_replace('-y-', '-[+]-', $Page);
$Page = s... |
So I'm writing a big server and I've made a simple start on console commands. I'm not sure if the way I'm doing it in is correct so I'd like to have it reviewed.
I have a class called ServiceCollectionExtensions where extension methods are defined that can be used on ServiceCollection. In there I have a function to reg... |
I'm basically wondering what the optimal method for returning to the top of src/main.rs::main() is?
Maybe something like this:
mod main;
pub fn main() {
crate::main();
}
Or maybe there's a keyword built in?
I want to handle certain kinds of errors by 'restarting the program'.
|
I am currently learning JAVA. I barely have any coding experience. I wrote a program which asks a user for a sentence. It then swaps the words of the sentence (first with last, second with second to last, etc.). Program will then output the new sentence.
I know that this is not the most optimal way this task could be ... |
The Task
A task I've been given recently is to design a data entry form which transfers data from the form to a table on a worksheet.
Depending on the answers given to various questions, other questions are displayed or hidden. For the most part I've achieved this by using different forms.
There is one route that requi... |
I would like to know if this is a good approach to finding out all the expressions within brackets. (I was actually asked to find out the smallest bracket expression, I have omitted the function to check for the smallest string and spaces within the expression).
s = "((a+b*d)*(x/2))*(1+(y+(x-2)/10))"
b = []
j = 0
b.app... |
I'm a novice in C++. I want to do three things:
Get the number of lines in the file
Get the number of total words in the file
Get each frequency of each "unique word".
Here, "unique word" is simply the same set of characters delimited by whitespace; different punctuation and casing are considered different.
I am usi... |
I wrote a Mandelbrot renderer in C++ that uses AVX intrinsics to calculate 8 pixels per thread in parallel. It can compute 1080p frames with 256 max iterations in about 40 milliseconds on a 2 core 4 thread i5-6200U laptop. Any advice on performance, code style etc would be appreciated.
https://github.com/voldemoriarty... |
I am practicing python, and in order to brush up my skill, I am trying the programming contest site AtCoder's past problems.
Daydream
Basically, you are given an input string and have to output YES if the string is constructed with choices of 4 different words ('dream', 'dreamer', 'erase', 'eraser'), otherwise NO.
I im... |
I am trying to solve the following problem:
Given three numbers, a, b, and c, return their product, but if one of the numbers is the same as another, it does not count. If two numbers are similar, return the lonely number. If all numbers are same, return 1.
I have the following solution:
def solve(a, b, c):
produ... |
This is the second iteration of this question
A note to start with: the first iteration of this question can be found here:
Editing system files in Linux (as root) with GUI and CLI text editors
As stated in there:
My intention is to POSIX-ly write one generalized function for running various text editors I use for di... |
I've been reading about thread pools in C++ for a few days now and decided to roll out my own. I mainly intend to use it to learn how to implement parallel algorithms at some point in the future but before that I have to know if there's something I can do to make it more efficient.
These are all the variables I'm using... |
hello guys i made a file watcher in rust using notify crate that watches a directory and if it detects file changes it will copy all of the files within the directory to another directory,i wanted you guys to do a code review, im a beginner in rust here is the code.
use notify::DebouncedEvent::{
Chmod, Create, Erro... |
Below is my attempt at bitmap in bitmap searching using 1bpp bitmaps.
Any suggestions on how I can reduce complexity and improve speed? Any comment is appreciated.
using System.Drawing;
using System.Drawing.Imaging;
using System.Runtime.InteropServices;
using System.Linq;
using System.Collections.Generic;
using System.... |
I have implemented the kaprekar's constant algorithm in c#, and I want your feedback.
Here is how the algorithm works:
it takes a number of 4 digits (e.g: 5823)
we order that number in ascendent and descendent order, which gives as two numbers (e.g: 8532 and 2358).
we subtract the larger number from the smaller numbe... |
I've written a little calculator in C++ for complex numbers:
#include <iostream>
using namespace std;
class ComplexNumber {
public:
double real;
double imaginary;
void add(ComplexNumber a, ComplexNumber b) {
//Just add real- and imaginary-parts
double real = a.rea... |
I have this piece of code written as a function to handle a button-toggle for sorting a list in ascending and descending order. Below is the code which is working as expected, but I would appreciate if someone knows a better, shorter and cleaner way of writing it.
// method called every time the button is clicked
/... |
As a learning exercise, I am writing a library to evaluate the complexity of an algorithm. I do this by seeing how long the alorgorithm takes for given inputs N, and then do a polynomial regression to see if the algorithm is best fitted by N, N^2, log(N), etc. I wrote Unit Test cases and they seem to work for N^2 and ... |
This is a follow up to this question and this question
Objective:
Manage what happens when users interact with Excel Tables (ListObjects)
Code incorporates:
Mathieu's suggestions:
ITables: Refactored interface and it's implementation
Tables: Hide SheetTables collection and exposed as a SheetTable(item) property
Tables... |
There are the following class:
class ConsoleForegroundColor : IDisposable
{
public ConsoleForegroundColor(ConsoleColor color)
{
OriginalColor = Console.ForegroundColor;
Console.ForegroundColor = color;
}
public ConsoleColor OriginalColor { get; set; }
public void Dispose()
{
... |
I have made some notification preferences in which there are 4 major preferences
SMS
PUSH
FAX
EMAIL
And then there are some specific templates such as booking-accepted and within booking accepted there are again these 4 notifications.
So what I have to do I need to check 1st priority notification preferences first t... |
I have made a code that can run a calculation from text. When I tested it, I didn't find any bugs. You are sharper than me. Maybe you can discover some bugs in this code. When you know some improvements to this code. It would be nice when you let me know.
I also made a calculator with this code. Of course you can easil... |
I am putting together a php Rest API service that uses Controller and Command pattern to handle requests.
Firstly, in Apache config I redirect all requests to a single end point, /api/v1/index.php.
RewriteEngine On
RewriteRule ^/api/v1/([^/]*)/([^/]*)/* /api/v1/index.php/?command=$1&subcommand=$2 [PT]
RewriteRule ^/api... |
I created an asio framework using epoll.
Full project: https://github.com/arkceajin/EpollSocket.git
I wanna know is there any potential issue.
Below is the core part, and the remaining part is the application and serialization code.
The abstraction of socket connection.
abstractsocket.h
#ifndef ABSTRACTSOCKET_H
#define... |
I need to run filtering on nested Lists and return a List of items from back
I will put a sample code here with my model
import lombok.Data;
import java.util.List;
import java.util.stream.Collectors;
class Scratch {
public static void main(String[] args) {
ParentModel parent = new ParentModel();
... |
I have a method that iterate a list of maps if a certain element is found then set value of certain variables and break the loop.
I'm trying to revamp this into Java 8. And further if it can be improved, please suggest.
public static void doAction(List<Map<String, String>> decisionTree, String code, StringBuilder desti... |
After following the suggestions from the first question on that topic (link), I'd like to show you the result now:
#include <iostream>
class ComplexNumber {
private:
double real;
double imaginary;
public:
ComplexNumber operator+(ComplexNumber b) {
//Just add real- and ima... |
On a game I'm working curently I keep on memory a simplified representation of the map which only have solid and non-solid cells. I need to get the outline of the shapes that adjacent cells might create, something like this:
I do not have a 8×8 array of bools on memory but a container of cell1 objects:
struct point { ... |
After a hiatus, I have returned to coding in C++. In an effort to learn some of the newer aspects of the language and for exercise and 'up-skilling', I am writing some simple classes and this HugeInt (huge integer) class is an example.
Looking on the web there are a number of implementations, which appear to use base-1... |
We need to find the minimum number of adjacent swaps required to order a given vector. The maximum number of swaps that an element can carry out is 2. If the vector can not be ordered under this conditions, we should output "Too chaotic", else we should output the total number of swaps required.
HackerRank New Year Cha... |
I've wanted to try Rust and WebAssembly for a while. I recently realized that I could try both at the same time by compiling Rust to WebAssembly.
I wanted to know what the performances of something like that would be so I came up with a simple test :
Make a few mathematical operations in pure js a few times in a loop ... |
I'm new to react and I'm still using the life cycle methods, so my question is since componentDidMount() acts like a constructor I'm planning to initialize everything there:
render() {
return (
<div className="done-container" style={this.style().taskContainer}>
<span style={this.styl... |
I'm a beginner and I have a question (somehow silly and stupid :) ). Today I decided to challenge myself and I came around the challenge that wanted me to create a program that ciphers (or encrypts) the message using the substitution cipher method. I solved the challenge by myself but mine is way different than the s... |
I use the following function for opening files in Python:
def file_path(relative_path):
folder = os.path.dirname(os.path.abspath(__file__))
path_parts = relative_path.split("/")
new_path = os.path.join(folder, *path_parts)
return new_path
I call it with a relative path, like this:
with open(file_path("... |
DB version is: Oracle 12c. Restricted to the use of inline PL/SQL.
The end goal here is to get a count of open items by day, inclusive of created date, exclusive of the end date.
The data structure is approximately:
| id | open_date | close_date |
|----|------------|------------|
| a | 01/01/2020 | 01/04/2020 |
| b... |
Once upon a time there was a noob developer who learned it all by himself because he grew up in a nation far behind in IT.
I've tried to learn C# for about 5 years, without any improvement over the last two. Then i decided to use you! StackExchange community.
Every time i try to write code i will stand in front of what... |
During a discussion in a development chat, a user suggested to another (in the context of C# originally),
UserA: Challenge: Create an implementation of RPS, and then show how it can be extended to include an unlockable option Bomb (blows up paper and rock, but scissors cuts the fuse - basically Paper+; AI that has Bom... |
EDIT: The result looks like this: http://gomokuu.glitch.me/
This is my code for gomoku. I made it with JavaScript and HTML. I think the checkWinner function can be improved or made shorter. Also, should the functions be re-organized?
Here is the code:
Javascript:
var turn = 0;
var width = 15;
var height = 15;
var game... |
I was working on an assignment in my Python class to sort 10 numbers but I wanted to be able to sort any set of numbers be it large or small. The assignment didn't really cover any sorting algorithms other than bubble sort so I started working and decided to just do something simple find the smallest number and remove ... |
I have a class with a various set of optional parameters when instantiated.
I would like to be sure that the user input ONLY the available parameters option, and also add a default value if nothing is passed.
I come with this
export enum HexagoneType {
POINTY,
FLAT
}
export interface HexagoneOptions {
center?: V... |
Does this code seems good or it can be improve (without any library)?
Elements swapping of a list with its neighboring element
alist = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
lenofalist = len(alist)
index = 0
temp = 0
last_element = 0
if lenofalist % 2 != 0:
last_element = alist.pop()
lenofalist -= 1
... |
I have been trying to find defects (brown/copper parts) on this sample using PyQt, OpenCV and Python:
And I can find defects, too. My problem is, I have nobody to ask, get feedback etc. I need some feedback about my code. Of course, I don't want someone to review my code line-by-line, but even a simple reviewing would... |
I wrote some function to compare the duration taken for 1000 loops. Just wondering if the comparison is right? For the thread, I want to set to maximum 3 thread. Thread is core, right? Task took the longest time which seems not correct.
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
... |
On Eric Amodio's website and JS.ORG, there is a Javascript animation which makes text appear/disappear as if it is being typed.
I tried to replicate something similar but far more basic on JSFiddle.
In my experiment, the words Code review appear typed, are hidden by toggle(200), and the words Code review appears again.... |
This is a project I've been working on and it's my first, so please feel free to just copy this into python and give this a try.
Below you'll find the main code and a small bit on rules and how to play, Enjoy!
import random
print("▄▄▄█████▓ ██░ ██ ▓█████ ▓█████▄ ▄▄▄ ██▀███ ██ ▄█▀ ▓█████▄ █ ██ ███▄... |
Last December I interviewed with Storj and was unsuccessful after my code challenge. Storj were good enough to pay me for the time it took to complete the challenge, but have refused to give any kind of feedback as to where or why my submission was not up to their standards.
The repo for this code challenge can be foun... |
As regarding the following question I have completed the code as below.
But I am curious about other effective solutions. I am also curious about if there is any solution that could be applicable by using java stream API.
It is not mandatory to keep records at int[][] matrix. Any data structure can be used.
My solution... |
I coded this Support Vector Regression (SVR) myself following some equations in a journal (see here, or here (not in English)). The loss function used by the journal and the code below is mean absolute percentage error (MAPE).
I need to make it run faster because I will use this function 1600 times for evaluations. If... |
I have written a function that compares two version number strings (e.g. 1.2.0 and 1.2.2) and return 1 if the first string is greater, -1 if the second string is greater and 0 if the strings are equal for a code challenge that I'm attempting.
Also, it's guaranteed that both strings contain an equal number of numeric fi... |
I have designed and Online Book Reader System. You can find the classes below. I would be appreciated for the valuable reviews.
Assumptions: "Online Book Reader System" is a system includes online books and serve their customers to read books online.
User should be login to reach their accounts.
... |
I have been working through Introduction to Algorithms 3rd Edition, and have implemented an AVL tree through prototypal inheritance. The code presented here does work as expected based on the tests that I currently have.
What I am looking for
Review of overall implementation in terms of efficiency, and correctness
Pot... |
I have recently been brushing up on my statistics and calculus and wanted to implement Linear Regression, the code will be for a calculus/statistics library I am working on (I know there are libraries for this but I am trying improve my both coding and math skills).
The following code works as intended. However, I feel... |
I have given the Mars Rover challenge a go in Python.
(edit) Here is the challenge, for those unfamiliar:
A rover’s position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four cardinal compass points. The plateau is divided up into a grid to simplify navigatio... |
I am working on a Nagios Scraper in Python3. I have Github set to automatically run checks (i.e. Python Linter) to make sure the code is good. It is currently failing that check, although the code works.
When I check with a PEP8 checker online, I am getting constant warnings about `line break before binary operator. Th... |
In an api I'm building, I have multiple routes that require an agency to exist before any action is performed on the requested agency.
To avoid repetition I've written some middleware to check that the agency does indeed exist before continuing (and throws if it does not).
The code I have works but I have to make two ... |
I made this code to compute definite integrals in Processing. It works by getting the rectangle between the maximum value between the previous function value and the current function value, and then I calculate the area by multiplying the maximum value described before and the step. And finally, the integral is just su... |
I need to compare a title for 3 strings
here what I'm doing
var textMessage = ""
props.screen == 'dd' ? textMessage = "Next, select the dd " : null
props.screen == 'ff' ? textMessage = "Next, select the ff " : null
props.screen == 'ss' ? textMessage = "Next, select the ss " : null
|
It was not obvious how to get a random member of a container. So I wrote a function to retrieve it given a generator.
namesapce ThorsAnvil
{
namespace Util
{
using Distribution = std::uniform_int_distribution<int>;
/* Get a distribution from [0, max) */
/* None maths nerds: Note the [... |
I wrote a class that opens a shared memory communication to use in my project, and would like a review.
mylib_com.hpp
#ifndef __MYLIB_COM_HPP
#define __MYLIB_COM_HPP
#include <sys/mman.h> /* For mmap */
#include <fcntl.h> /* For O_* in shm_open */
#include <unistd.h> /* For ftruncate and close*/
#include <s... |
I am an experienced self-taught professional Python programmer working my way through the book Classic Computer Science Problems in Python to try to catch myself up on some of the things I missed by not going to school for this. I am also currently trying to learn Clojure, and I thought why not kill two birds with one ... |
Recently I started to learn Python and PyQT5.
So here is my code for a calculator. Personally I don't like how the doMath() function is looking but I don't know how to make it more readable and pythonic.
import operator
import sys
from functools import partial
from PyQt5.QtWidgets import (QApplication, QShortcut, QLab... |
Many a times, I've had the need to use a permutations with replacement function.
So, I've written a function to do just that:
from sys import setrecursionlimit
setrecursionlimit(10 ** 9)
def permutations_with_replacement(n: int, m: int, cur=None):
if cur is None:
cur = []
if n == 0:
yield cur
... |
This multi-threaded code takes an array of 3d images and applies the convolution function with padding, stride, pad values .. as parameters and same applies for creating pooling layers. I need suggestions on how to improve performance and maybe get rid of the for loops used(if that is possible).
Use this photo tiger.jp... |
I have given the Mars Rover challenge a go in Python as DSA practice.
Here is the challenge:
A rover’s position and location is represented by a combination of x and y co-ordinates and a letter representing one of the four cardinal compass points. The plateau is divided up into a grid to simplify navigation. An exampl... |
I've been wondering for some time what the best way to pass a 2d array to functions is. I know that arrays, passed to functions, decay into pointers, so int arr[25] would become int *arr inside a function. The problem is with 2d arrays, int arr[5][5] would not become int **arr. Instead I've been taught to pass it like ... |
Anyone please review and share your feedback for the following code.
Multiple producers generate random integer numbers and a single consumer receives it to display only odd numbers out of it.
package main
import (
"fmt"
"time"
"math/rand"
"sync"
)
var msgs = make(chan int)
var dummy = make(chan bool)
var wg sync.Wa... |
I am trying to check that a list of files are all images using functional programming.
Some actions I go through are asynchronous, so I have to wait for them to completely finish before passing to a new one.
const filteredFiles = ['favicon.ico', 'site.webmanifest', 'browserconfig.xml'];
const fileBuffers = await Promis... |
I want understand how to correctly structure a functional asyncio-based program.
The code below wraps two external APIs to provide the client a simple send_weather() function. Its structure reflects my current understanding of ansynchronous programming and the very little I've grasped of functional programming.
import ... |
Given a positive integer n, find the smallest number of perfect squares (for example, 1, 4, 9, 16, ...) that sum to n.
sums = {0:0, 1:1}
def numSquares(n: int) -> int:
if n in sums:
return sums[n]
else:
s = 2**31
squares = [i**2 for i in range(1, int(n**(1/2)) + 1)]
while len(squ... |
TLDR: Does the javascript community regard it as poor syntax to include a terminating semicolon inside an anonymous function inside an Event Listener / Event Assignment statement, when the terminating semicolon of the surrounding statement will be following not long after?
I'm currently writing a parser which reads op... |
I want to store a value in a dict (to behave like a cache) but I care about performances. I wonder if it is better to create a second variable in order to store the result of the sum compared to retrieving the value from the dict where the result is already stored.
Real code:
@property
def total_stats(self) -> Statisti... |
I have written a Matrix library that contains all the main properties of matrices.
It's a relatively long project, I am hoping it is ok to post here since I really want to have it reviewed.
The project is compiled in GCC 9.2.0 and Boost 1.71.0, from https://nuwen.net/mingw.html, environment codeblocks windows 10.
Uti... |
This code structure allows me to quickly create and manage behaviours on p5.js sketches. I'm planning to move to Java but wanted feedback beforehand.
The behaviour interface:
interface Behaviour<Element> {
apply(...elements: Element[]): void;
}
interface LinearBehaviour<Element> extends Behaviour<Element> {
ap... |
I have a Repl.it account that I use for my projects, and I don't really want to make a new api for storage every time, I've seen some like EasyDB and Jsonstore (I use Jsonstore in the background as storage here) but it doesn't have some of the features i want. It isn't done, but its working. I just wanted to see if the... |
https://www.codewars.com/kata/best-travel
Briefly, the problem states that we have to create a function choose_best_sum(int t, int k,std::vector<int> xs) that will take as parameters t (maximum sum of elements, integer >= 0), k (number of elements to be chosen from the vector, k >= 1) and ls (list of positive elements ... |
Thanks in advance if you are reading this code.
I recently submitted this code as part of an interview (took about 4-5 hours). Unfortunately, they did not like the code and I received a form rejection email without any sort of feedback. However, I am committed to improving my code and I would like to learn from my mist... |
For Each MyIndex In Worksheets
If MyIndex.Name = "Inv_IB" Or MyIndex.Name = "Inv_MP"
With Sheets(MyIndex.Name)
nFilasActual = .Cells(Rows.Count, 4).End(xlUp).Row
Set dataRng = .Range("A2", .Range("N" & nFilasActual))
dataRng.Sort key1:=Ran... |
As a Rust beginner, I would like to know how I could improve the following points considering the function below:
Handling Path and PathBuf types correctly;
Performance;
Rust writing style in general.
Here is the function, decorated with a full working example:
use std::env;
use std::path::{Path, PathBuf};
const RUS... |
This script tries to determine the time when you woke up.
Of course, it only applies if you turn your computer on not too long ago after getting out of bed.
If not, it might still be useful as an indicator of when you turned your computer on.
It works by getting information from journalctrl, sleep-resume dates and boot... |
I was de-serializing objects that had an extra newline that needed to be removed before getting the next object.
#ifndef THORSANVIL_UTIL_H
#define THORSANVIL_UTIL_H
// Removed headers for getDist() and getRandomContainerIterator()
// We already reviewed those two.
#include <iostream>
namespace ThorsAnvil
{
nam... |
I have this method to check if a move is possible in Reversi. The method works as it should, but it doesn't feel right for some reason. It feels very repetitive. I have tried to make it less repetitive by splitting it up in other methods, but that didn't make it any better.
public bool MovePossible(int y, int x)
{
... |
Given a string, return the count of the number of substrings that contains characters A, B and C. Two substrings are considered different if the starting, ending or both positions differ.
Example - s = "ABBCZBAC", there are 13 substrings which are "ABBC", "ABBCZ", "ABBCZB", "ABBCZBA", "ABBCZBAC", "BBCZBA", "BBCZBAC", "... |
I'm a beginner in Python programming. Currently, I learn how to work on the files...
I've created a program, which excludes the names (first & last) from each row, that contains both of them. When the pair of names does not include for example the Last Name part, it places n/a in the last_names.txt file.
Like from the ... |
I have this code
@objc func didClickActionButton(sender: UITapGestureRecognizer) {
if let contents = contentList {
if contents[currentScreenIndex].customMeta["permission-location"] != nil {
//request Permission
ApiHelper.shared.initLocationHelperWithBeacon()
}
if contents[current... |
I am implementing conflict-based backjumping with nqueen. I want to optimize my code especially in recursive call.
In short,backjumping is similar to backtracking and it uses conflict set. When checking failure, it stores the fail value in conflict set.When it needs to backtrack,it jumps from the conflict set and not a... |
I have classes:
public abstract class House{
public string Name {set;get;}
public SomeClass Property1 {set;get;}
public OtherClass Property2 {set;get;}
}
public class WoodenHouse:House{
public string WoodType {set;get;}
public int WoodAge {set;get;}
}
public class StoneHouse:House{
public string Ston... |
So I decided to write my own DI container for educational purposes and would like some feedback on how I can improve the quality of my code.
I'm not sure about the documentation as most of my experience has been with closed source personal code, so I would like some feedback on that.
Another area is where I am using ex... |
I've created an Open-source ADO.NET driver for ClickHouse database: ClickHouse.Client
Would appreciate if someone has any hints to improve code quality/performance (or suggest new ideas)
The core part of binary deserialization (as the 'hot path' in profiling):
using System;
using System.Net;
using System.Numerics;
usin... |
I have started a project where I am scraping JSON-data from an API. How the scraping is done right now is done in a very repetitive way where the keys of interest are specified and scraped. The data-structure I use is a nested dict to store all the data for each function.
So the steps of each function is straightforwa... |
I need a data structure to store a list of single commands that a user can enter. You may consider a simple shell. I already finished the parsing but need a nice data structure to store the individual commands.
Consider the following example:
A user inputs something like this:
>>> ls -l | wc -c && echo "Hello World";
... |
Note: In order to keep this post somewhat short, I have moved some data from the database to the client-side. An example hereof is the prices object.
This is a simple program/chatbot which users can use to order coffee. The code is working just fine, but it's very messy. I am looking for ways to clean up the code, to m... |
Version 2 may be found here.
The company I work for has customers around the globe. I work with a time-series database that contains manufacturing process data for each customer site. I was asked to provide daily averages for the past 2 years. Requesting averages from the 3rd party time-series database is easy. The... |
Below is a JSON parser written in Go. It's just a task I set myself in order to learn Go, which is also the rationale for reinventing this wheel. At the moment, it's not 100% complete but it can process quite some input already and also provide diagnostics on invalid inputs.
My questions concerning this code are:
I ha... |
I'd like feedback on my solution to the outlined programming challenge (medium level). I've tried it fast in any way I know how to, but, what might be a more efficient and/or pythonic solution?
[Caesar Cipher]
Using the Python language, have the function CaesarCipher(str,num) take the
str parameter and perform a ... |
I want to come up with a simple convenience function to save and load pickle objects. A secondary objective is to simply execute the function without the above function. I have come up with two versions so far. Just want some opinions, which of the following will be better from a software engineering point of view. Or ... |
It's been a while since I last looked at C++ so before resuming one of my old projects I thought I'd brush up on the basics so I've written a basic noughts and crosses game (because it's just getting back into the language don't expect a fully fledged game, just a bit of working practice).
The game features (or lack th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.