instruction stringlengths 71 95.1k |
|---|
What my program does
I'm trying to estimate for how many minutes in average a football(soccer) match will be in different game states depending on implied goals of both teams.
Problem domain
For our purposes there are three possible game states:
Home team is ahead, e.g. 1-0
Both teams are drawing, e.g. 2-2
Away team i... |
I am newbie in the field of programming, but I have tried to make relatively "huge" project. My "app" would derivate a mathematical expression, after that simplify the output expression.
How could I improve the expression simplify function to further simplify the output expression?
I know about simpy, I want to impleme... |
the aim of the code below is to print all balanced sequences with equal number of 'A' and 'B'. A sequence is balanced if every prefix of length \$\geqslant 4\$ is balanced. A prefix is balanced if the ratio of 'A' in this prefix is between 0.4 and 0.6 inclusive.
For example, ['A', 'B', 'B', 'A', 'A', 'B', 'A', 'B'] is ... |
The project outline:
Write a program that opens all .txt files in a folder and searches for
any line that matches a user-supplied regular expression. The results
should be printed to the screen.
My solution:
import os, re
from pathlib import Path
while True:
user_path = input("Enter a path to search: ")
if u... |
I've a table in HTML looks like this:
Subjects
n1
n2
n3
subject1
10
0
0
subject2
0
5
20
<table>
<thead>
<tr>
<th class="subject">Subjects</th>
<th>n1</th>
<th>n2</th>
<th>n3</th>
</tr>
</thead>
<tbody>
<tr>
<th class="subject">subject... |
This was a homework assignment for a data structures course. The goal was to implement a given interface and the assignment was auto-graded by a system that ran some validation tests. Sadly I did not really get any feed back on the code structure or any advice on how to improve on what I did if anything was wrong or no... |
I'm learning how to reverse list and strings. Is there another way of reversing a string other than using [::-1] method? even if the other method is the long route i would much appreciate it
txt = ["Hello World"]
st ="".join(txt)
print(st[::-1])
|
I am writing an observer design pattern that is not too complex but I still feel there's a lot for me to learn about C++ be it little details (especially coming from C).
A couple of observations:
I wanted to understand was Subject here isn't an abstract
class unlike Observer however I would ideally have caller
instant... |
This is some assembly code I've written to add two base-10 numbers. The input and output are represented as null-terminated ASCII strings, with digits in big-endian order.
I have also provided comments for each line explaining what it does. Is there anywhere I can use SIMD or something which will be faster here?
Since... |
This is my 1st time developing PHP code and I am only 13 years old. I have experience in other programming languages like lua, python, and c++.
This is a simple Number to Roman Numeral code I made for my mom because she had a hard time making herself one. Below is my code. Don't mind the names of the variables.
<?php
... |
I have the following O(N) code submitted:
class Solution {
public int lengthOfLongestSubstring(String s) {
int currentLongest = 0, idx = 0;
if (s.length() <= 1){ return s.length(); }
for (int i=1; i<s.length(); i++){
String str = s.substring(idx, i); //substring up to current ... |
pacdef is my declarative package manager for Arch Linux. I have written it since I often found myself discovering a new tool at one of my PCs, using it there for a while, and then missing it when I'm at another PC. So I was looking for a consistent state of software on all my Linux machines.
It works like this: In my p... |
This is an implementation of a custom timeout middleware.
I am creating a context with a deadline in my middleware and using it in the rest handlers for timeouts (to wrap the query to DB eventually) and it is working as expected. Long story short, I am looking for best practices. I was wondering if any Go/Gin expert ca... |
I am new to python.
I am trying to get the total number of failures by checking first how did the transition of the column Failure Sensor. Then creating the Start column from devicetimestamp if the next value of Failure Sensor is equal to the value and finally getting the count when the values are true and ignoring the... |
On last test, the below code takes approximately 10 seconds to download then print the data from 10 url's. I wish to speed this up as much as possible as later on I plan to expand this further and use the scraped data as live data in a GUI.
The display_value() function consists of 95% of the time, which seems like an a... |
Getting my feet wet with Rust, I implemented a solver for quadratic equations.
I implemented both, ABC and PQ formula solvers, to challenge myself with branch conditions.
main.rs
mod quadratic;
use quadratic::QuadraticEquation;
fn main() {
let equation1 = QuadraticEquation::new(3.0, 3.0, -18.0);
let equation2 ... |
DmenuWacom
During my raids, I came across and solved several problems, obviously in my style, very similar to the suckless.org approach and which still works quite well. In fact, I started writing a script and at the moment it works very well and has already received some contributions even though I am trying to improv... |
I wrote this code as a refactor of code I saw on Programiz. I thought about this refactor before going to bed and implemented it successfully in code.
// Make an array of suits
const suits = "S D C H".split(' ')
// Make an array of values
const values = "A 2 3 4 5 6 7 9 10 J Q K".split(' ')
// Create a function to... |
I have created the following code:
Option Explicit
Function EuropeanOption2(OptionType As String, Spot As Double, Strike As Double, RiskFreeInterest As Double, Volatility As Double, TimetoMaturity As Double, Dividend As Double, n As Double, Iterations As Double)
Dim m As Integer
Dim p As Integer
Dim OptionPayoff() As ... |
I'm sure you've heard this before, I'm a beginner, however I'm trying to break out of the basics and use more intermediate things like functions and such but I'm having a hard time understanding how to properly integrate them into my code. I've created a number guessing game that uses 2 functions, it has difficulty set... |
I created a simple battleship game and wanted to be able to place as many ships on my board as possible.
The logic to place the ships uses some kind of backtracking to find a correct placement.
Correct placement
|1|1|O|
|2|2|4|
|3|3|4|
Wrong placement
|0|1|1|
|2|2|0|
|0|3|3|
First I wrote a recursive backtracking sol... |
I used numpy for the O(n) parts, but I didn't add any ability to change grid size because I still wonder if there's a way to make it better than O(n).
main.py:
import pygame
import numpy as np
from random import randrange
from clickablebox import ClickableBox
# values of grid spaces
EMPTY = 0
BUG = 1
SNAKE_UP = 2
SNAK... |
I'd appreciate any feedback on this code. The assignment was to have each philosopher eat three times. I introduced time into the problem where eating takes 20 minutes and then the philosopher shouldn't eat again for at least 50 minutes.
Particularly, I'm wondering about my use of sync.Mutex instead of 1-length channe... |
This is the first API wrapper I've written and I'm wondering what I can do to improve. I've read through the feedback of a few similar posts
Readme
Code
import requests
import time as notdatetime
import datetime
import matplotlib.pyplot as plt
# uses Algolia for API
class API():
def __init__(self):
self.ba... |
So far I have reached chapter 5 of the K&R Book, Edition 2 from which I have been learning C. I spent a few days thinking of a solution to this program. I wrote two or three versions of the same program, And the truth is that I couldn't bring myself to think of a better solution for this exercise:
Exercise 5-11. Modif... |
I'm learning algorithms and I wrote the single-directional linked list implementation in C. I need a code review of what can I improve in my code and I want to make sure there are no possible memory leaks.
Code:
#include <stdio.h>
#include <stdlib.h>
struct node {
int data;
struct node *next;
};
void push_bac... |
I have a couple of VBA loops that work in the blink of eye when I execute them through Excel, but doing this as part of an Access VBA application takes like 15 minutes. The loops run through each row and check to see if multiple conditions are met, and if they are they change the value of one cell in the row in questio... |
Looking for a more efficient way of achieving this. In particular the combine_all_rss_lists so I don't need all those params. Feedparser module doesn't accept lists which is why I've had to initially break them into strings. Would be ideal to have minimal arguments as well.
def create_rss_urls():
topics = ['busines... |
I have the code below which currently pulls pricing data for Ethereum from CoinGecko API. From this request I am building a dictionary that contains the pieces of information and returning it to be used elsewhere in my code.
This function works fine, but I can't help think it could be written so much shorter than this.... |
This python program takes user input of the number of elements in a list in the variable b and then takes user input of the list elements in list a. It then finds out the maximum product of a pair of the list elements.
For example, if the list elements are 5,4 and 6, then the maximum product is 30.
Can we simplify it i... |
Instead of using so many if and elif statements I want to organize the names and ages into a list and when a user input the name and age it will iterate through the list of ages to see if any of them are older and if they are it will then return the name of the people who are older from the list of names. This is what ... |
I am developing (WIP) a mine sweeping game to get more familiar with Rust.
I decided to represent the mine field as a 2D grid.
While developing I realized that this grid can be outsourced as a general purpose grid into an own module.
Here it goes:
#[derive(Debug)]
pub struct Grid<T> {
width: usize,
height: usiz... |
I tried to implement the mcolor colormap in the paper
at page 8 to 10.
I developed the code to process a image file and it works ok.
Now, I want to adopt this image processing method to the camera which is captured by opencv.
I implemented it by python and opencv.
It looks like that it's not workable as the computing l... |
I'm a beginner in Python programming, been doing it for only a few weeks and I decided to make a tic-tac-toe game in the Python interpreter. I'm looking for feedback on the program and any way I can improve it and shorten it and point out inefficiencies/errors since I've done everything I can to get rid of all errors I... |
As an exercise in using PyQt, the Python switch statement and abstract classes, I made a little app to make conversions between geodetic (WGS84) and PSD93 (Oman) and UTM 40N projections (instead of the ubiquitous calculator).
The app has a main window and 3 dialog windows; 4 types of conversions (geod_proj), (proj_geod... |
I am enjoying making various programs with C++.
This is my first code review request. And I hope I can get some insights or might have good advice to make my code better.
I make a task class using C++14 standards after having insights of System.Threading.Task class of C#.
Although I could not make a perfectly same code... |
Problem:
I need to get data from JSON file containing information about "contributors". Each contributor has an atrribute jobs, which is a list of string-like job positions. The program should print five most popular jobs (in the whole dataset) and assign an attribute top_job to each contributor with a job position of ... |
I followed your answers for my last questions (1st 2nd) and I came up with these new versions of my codes but I face some difficulties to measure the efficiency of my code, I use chrono library to determine the run time, and of course it does not give a full description of the efficiency of the code.
How can I do the b... |
I have a react native app. I have a search component, that I reuse in the SearchScreen (where I search for train stops) and again in my Report screen where I report (and first search station) not station with issues. I was trying to apply best practices but not sure how well I did. I would really appreciate some advice... |
def parse_names(tex_names: list[str]) -> set[str]:
# the list comprehension in question
return set(parsed_name for parsed_name in [_parse_name(tex_name) for tex_name in tex_names] if parsed_name)
def _parse_name(tex_name: str) -> Optional[str]:
tex_regex = re.compile(r"^%? ?([\w() äöüÄÖÜß]+)( \((ab|bis) \... |
Following is my simple implementation of the std string class. Please review my code and offer some advice. I want to figure out is there anything wrong with my code or is there anything I can improve on my code.
#include <iostream>
using namespace std;
class String{
private:
char *buf=nullptr;
int size;
public... |
I want to load credentials into my program from different sources. If one source does not have 'valid' credentials (in my case valid credentials are all tuples of two non empty strings), try the next source until you get a valid credential (or the sources run out).
I wrote a method (validate) that checks if credentials... |
I currently am creating a vector and fill it with random values( for this case the random values will be 1) once the vector is created i want to calculate the total sum which should be 100000000, I am using ones to test that the addition was done correctly.
My goal is to make this code more efficient and run faster, I ... |
I'm working on an application that exports and imports work items from Azure DevOps. To import work items into Azure DevOps, I have written the following code.
Would you be able to review and make suggestions? I'm unsure whether I've used the Async-Await pattern correctly.
namespace Export_Import_AzureDevOps.Factory
{
... |
I am trying to learn callbacks in Delphi (7). Could not find a complete simple tutorial, so I puzzled together a few bits here and there. This is my first attempt, of course trivial.
My form contains a button and a label. For the test, I make a loop in the onClick code, and every time do a callback function.
The code ... |
import os, errno
import pyaudio
from scipy.signal import lfilter
import numpy
from tkinter import *
from tkinter.ttk import *
from tk_tools import *
from tkinter import messagebox
root=Tk()
root.title('Decibel Meter')
root.grid()
gaugedb = RotaryScale(root, max_value=120.0, unit=' dBA')
gaugedb.grid(column=1, row=1)
le... |
Board.h
#pragma once
#include <vector>
#include <iostream>
namespace Logs {
inline void announce_winner(char winner) {
std::cout << "Game Over! " << winner << " wins the game\n";
}
inline void draw() {
std::cout << "Game Over! .. Draw\n";
}
inline void already_chosen() {
s... |
I am writing a loop (in R) to webscrape Reddit posts - using Reddit's API ("Pushshift").
Essentially, I would like to get every comment that contains the word "Trump" between now and until 20,000 hours ago at an hourly basis. The API stores the comments in a JSON frame - I wrote the following code in R to obtain these ... |
A little over a year ago, I asked for feedback on Code Review for a unit testing framework I created in VBA. Development of this project has been off and on for the past year. Sometimes I wouldn't touch the project for months. Other times, I'd be working very intensely on pushing updates. The project has changed signif... |
I'm particularly concerned here that I'm copying more often than I need to, and that's slowing things down; obviously, given the algorithm/approach, I need to do some copying, but I don't want to be doing more than necessary. Code also available at https://gist.github.com/fizbin/905a219af86adb95a6e7fd4bd26a507e
/*
* T... |
I created this list view component and am pretty
happy with how it came out.
Im looking for critique on what I could improve regarding
code readability, best practices and perhaps performance, it
seems pretty fast to me, granted the picsum url takes a bit time to load,
in production I´d likely have just a file url ther... |
So I want to use PDO transaction in PHP OOP where in the class are multiple insert/update queries.
If I create a new methods in Class like beginTransaction(), commit(), rollback() and I use them afterwards in my code is it okay?
Here is one example:
class TestClass
{
private $pdo;
public function __construct($d... |
Link to task
Similar question to same challenge
Attribute Parser
This challenge works with a custom-designed markup language HRML. In HRML, each element consists of a starting and ending tag, and there are attributes associated with each tag. Only starting tags can have attributes. We can call an attribute by referenc... |
I am making a module that allows you to create sand and simulate it. I have successfully done this, but it runs very slowly. I need this to be able to simulate at least 1000 particles, at a fps higher than 5.
How do I optimize this code?
My code:
import pygame, random, sys
pygame.init()
FPS = 60
fpsClock = pygame.time... |
This is a basic rot13 encryption program. I'm just looking for a general review, any feedback, or any optimization of what I wrote today as practice. I know that I need to not rely on indexes as I do in this code for iteration, but in this specific function I'm not sure how to get around it.
import string
def encrypt(... |
This post is about computing order statistics: given an array \$A\$ (not necessarily sorted), find the \$k\$th smallest array component. The entire repository is here.
com.github.coderodde.algo.selection.Selector.java:
package com.github.coderodde.algo.selection;
/**
* This interface defines the API for the selectio... |
I'm new to Typescript though I've got a few years experience with plain Javascript. This is the first full program I've built in Typescript using Next.js. I'm just curious about areas where I can improve especially with the interfaces.
import type { NextPage } from 'next'
import { useEffect, useState } from 'react'
in... |
I have three different types of schema possibilities as below:
obj_1 = {
'title': 'deposit-test-schema',
'type': 'object',
'properties': {
'title': {'type': 'string', 'x-cap-permission': {"users": ['test@test.com']}},
'date': {'type': 'string', 'x-cap-permission': {"users": ['test_user@test.... |
This is a basic 6 trigonometric functions calculator that I will incorporate into my main calculator project. It works as intended, but the BUILD MESSAGES issue a warning, the warning being:
Warning: 'op' is used uninitialized in this program.
The program works as intended, the only problem being that it gives one warn... |
Given a Timeit method which runs for n times the provided function, which approach between multithreading and multiprocessing should be better to speed up the execution of all iterations and avoid the loop? Multithreading would be memory safe? What would be a pseudo code of the implementation? Thanks in advance
typ... |
Integers need to be converted to a byte array of defined endianness to be reliably and consistently saved and transmitted, and converted back to be accurately received and read. The goal is to be as portable as possible, while maintaining concise and fast code.
#ifndef LE_h
#define LE_h
#include <stdint.h>
inline stati... |
Question:
There are given N ropes of different lengths, we need to connect these ropes into one rope. The cost to connect two ropes is equal to sum of their lengths. The task is to connect the ropes with minimum cost. Given N size array arr[] contains the lengths of the ropes.
Example 1:
Input:
n = 4
arr[] = {4, 3, 2, ... |
I need to parse a file, with a standard formatting:
200 lines of uninteresting data
=====================================================================
Column(s)
=====================================================================
Column Description : HP-PONA
Inventory# : au... |
This module saves/loads application settings. The application should instantiate the top API class, SettingsManager, which activates the appropriate backend (as specified or based on file extension; see BackendFormat enum). Internally, all backends store the settings in a dictionary in a unified format, permitting back... |
I just want this code optimized to the max and I don't mind knowing if the optimization is pretty much at the max already or if I am doing movement and collision wrong. My game is a 2d Minecraft style game so it will have a lot of other_rects. Hopefully my code is easy to read.
Code:
def move(rect, movement, other_rect... |
I want to get a code review on the following transliteration code. I wrote it because there were some libraries that I have tried and they were specifically failing with the name "Yuliya" from Latin to Cyrillic. I wrote unit tests for my functions.
Things I noticed:
I don't need it to support both standards GOST 1687... |
I’m pretty new to Python. I’m trying to build a multiple choice quiz using Edamam API. It’s currently not flagging any errors but there has to be a neater way to ask the questions, I’m just stuck as some of them require pulling through data from Edamam.
import requests
def recipe_search(meal_type, ingredient, Health)... |
I have this code written and I wanted to get a better performance out of it. Could somebody help me please? If possible I would like my code to get a better performance when rolling high numbers and when it getting to the percentage operation.
#implementation of multiple dice rolls at the same time and showing what eac... |
Im new at backend development and I'm noticing that my code is very messy and difficult to read. I know this doesn't have a single correct answer but id like to know how I can make my code tidier when I have so many queries and const definitions. Thank you!
I have this piece of code from a function that retrieves data ... |
The function below is written by me in an app that lets you merge 2 or more video clips together, so I used a text box in the GUI, it asks you how many clips you want to merge, and will do it for you accordingly, however, it looks really messy and it is so repetitive.
def merge_vid():
number_of_videos = box.get()
... |
Alright. So TryHackme is a website that tries to teach hacking with hands on labs. They have a room called JVM Reverse Engineering where the user gets to reverse engineer Java apps, and in particular the code that I am asking you to review is for task #5.
Task #5 challenges the user to crack a password encrypted with a... |
I'm new to C++ and I decided to experiment with the language, by writing a mathematical expression evaluator, using the Shunting-Yard algorithm. A design choice that may stand out as weird is the fact that the parser creates an abstract syntax tree rather than just converting it to Reverse Polish Notation. The reason f... |
I made some C# code to grab youtube thumbnails from urls, I originally made this in python took some time converting it to C#. I am VERY new to C# and did this with minimal help.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
... |
I'm making a file management project that I eventually want to be automated later in the future (once I learn how to). What it does is take files from my download folder and move those files to the appropriate folder. i.e pictures to the picture folder.
Before I go any further, are there any hidden improvements that yo... |
Here's my code:
<?php
$db = new PDO('mysql:dbname=dbname;host=host', 'user', 'pass');
$ne = explode(',', $_GET['ne']);
$sw = explode(',', $_GET['sw']);
$shape = "Polygon((
$sw[0] $sw[1],
$ne[0] $sw[1],
$ne[0] $ne[1],
$sw[0] $ne[1],
$sw[0] $sw[1]
))";
$sql_where = '';
if (strlen($_GET['exclude'])) {
$excl... |
I created a two steps changing email system. Firstly I show you the concept how it should work and then the code. I am using Django and React.
Main question: is it a good way to do it? Is it fine to use Redis in this situation? Can I improve something in this code?
Concept
When the user wants to change their email addr... |
[HttpPost]
[Authorize("PublicCreateOrder")]
public async Task<ActionResult> CreateOrder(CancellationToken cancellationToken)
{
var watch = System.Diagnostics.Stopwatch.StartNew();
//--------------> Performance measure Start <------------ FROM THIS POINT
StreamReader requestReader... |
In my Azure DevOps Project, I have a Git repository that I would like to copy to another Azure DevOps Project.
In other words, I should be able to copy the original repo into other Azure DevOps projects as needed.
To import work items into Azure DevOps, I have written the following code.
Would you be able to review and... |
Based on this question, I thought I should show how to implement an expression evaluator using Flex and Bison.
Updated: Here
Currently it does not handle releasing the expressions (I only spent an hour throwing it together).
Makefile
YACC ?= bison
LEX ?= flex
CXX ?= g++
SRC ... |
I used to write singleton in Python, which actually Alpha only need to initialize once and the trading bot will run forever. For example in main.py:
from time import sleep
import asyncio
from collections import deque
from typing import Dict, Union, Any, List
import aiohttp
from lib.utils import Config
from pprint impor... |
I am trying to sum primary diagonal and secondary diagonal of 2D array of python like this:
records = [[12, 5, 2 , 1], [15, 6,10 , 1], [10, 8, 12,1], [10, 8, 12,1]]
primary_diagonal_sum = 0
array_size = len(records)
secondry_diagonal_sum = 0
for index , record in enumerate(records):
primary_diagonal_sum += re... |
I created (basically) an organizational chart in Visio with different levels and want to be able to hide the levels with the press of a button. If I hide level 1 (= top level), all levels below it have to be hidden too because it is a hierarchy.
The reason I'm posting this for review is that I'm not sure I chose the b... |
I am trying to learn C++ by writing a basic graphics library; undergrad-toy-project level.
I am trying to write modern C++ (C++ 20 standard), but avoiding features that are not well supported by my IDE (VS Code), such as modules. As I come from a C, Python, and C# background there may be some code smells / biases.
Can ... |
Attempt 2: First Try here.
Usage:
./expression
Then you can either type expressions that are evaluated when you hit <enter>.
10 + 2 ^ 2
Value = 40
Or you can assign value to variables:
data = 10 + 14 / 2
data + 1
Value = 18
Note: It is a feature of the language that all variables are always valid. By default they ar... |
Can somebody have a look at my code for an entropy-based binning algorithm?
I follow the idea of this website.
The code with some test data can be found here.
I think there is definitely some room for improvement w.r.t. readability and speed. I hope someone can help me find optimization solutions and even errors within... |
I tried implementing a general purpose hashtable in C99.
The basic structure is I have a huge array of hashtable entries and each entry is the entry point to a doubly linked list so that in case there are hash collisions due to a poor hash function the data is automatically appended to the linked list and then while re... |
I am learning Rust for about a week now. I just finished my first little working project, a mine sweeping game. The game comes with a little extra feature, namely old, broken (rusty) mines, that will not explode if you step on them. I'd like to have feedback on the general code style, since I'm still new to Rust and w... |
import random
tries = 0
while tries <= 2:
user_input = input("Enter your Symbol => ")
possible_actions = ["Rock", "Paper", "Scissors"]
computer_action = random.choice(possible_actions)
score = 0
print(f"Computer Chose {computer_action}")
if user_input.lower() == "rock" and computer_action == ... |
I have a Laravel 8 project hosted at xxx/laravel/ on an Apache server, where xxx is the domain. I want to serve the contents of xxx/laravel/public/ when users access xxx/laravel/. However, I need to prevent access to other files at xxx/laravel/, e.g. xxx/laravel/.env.
Normally, I would host the project files in directo... |
I'm building a GUI application with Python3+Pyside6 and have many QDialog classes that are similar, and i was looking for a way to avoid having to rewrite the same code when initializing them. The code below is one solution to this
This code creates a python decorator modal_dialog_init to avoid having to write boilerpl... |
Does the following look like acceptable code to replace some escaped regex characters?
export function parseString(s: string): string {
let r : string;
if ( s[0] === 'r' || s[0] === 'R' ) {
r = s.substring(1); // no escape
} else {
r = s.substring(1, s.length - 1);
r= r.replace('\\n', '\... |
The xstack filter allows to build a mosaic video file with ffmpeg.
https://ffmpeg.org/ffmpeg-filters.html#xstack
To automate its usage, I wrote a script that takes video files with unmatched resolutions, durations and ratios, and used letterboxing to fit them and encode it with only 2 stages, for video and audio. I di... |
With my rustymines 1 2 project, I realized, that it was cumbersome, to copy and paste all the code files into Markdown for review here. So I wrote a small program that formats source code files as Markdown for me:
src/main.rs:
use std::collections::HashMap;
use std::env::args;
use std::fs::File;
use std::io::{BufReader... |
I tried to make a 2-player Chomp game in javascript:
const num_rows = 4;
const num_cols = 7;
var cur_player = 1;
var rows = [];
var buttons = [];
cur_player_text = document.createElement('div');
cur_player_text.innerText = "Current player: " + cur_player;
cur_player_text.id = "cur_player";
document.body.appendChil... |
I need to develop a database to handle muting people in an online community. The DB needs to keep track of the currently muted people. When somebody gets unmuted, that entry gets moved to an archive table. People can only be muted by specific staff members. This is the code I came up with:
CREATE table sh_members
(
... |
I am a junior Software Engineer, C++ is usually my main jam but I started picking up Python for a research project I am doing in college. I am eager to learn as much Python syntax, tricks, best practices or software architecture in general as possible. So here is a portion of my project ~300 lines of code that simulate... |
I have a SceneManager class (code shown below) that I think should contain my "business logic" for loading scenes in some way that I want using SceneLoader. Right now I have methods for loading Main Menu, Gameplay and Persistent scenes. But what if I want to add in the future logic for loading Test Scene or any other. ... |
I'm trying to solve a LeetCode problem target-sum, in two languages: Python & Dart. The difference of time taken is shocking for me"
Python took ~70ms while Dart took ~900ms !! Why does Dart take so long? screenshot
What should I do to improve Dart performance?
Solution in two different languages are as follows (same... |
I have to parse information from several Excel files (.xls, .xlsx). The structure of the files is nearly identical except for the columns order. In this case it is # Number Name but in other cases it might be # Name Number.
Sample .xlsx file can be found here (Google Spreadsheets).
Assumptions:
Industry name: ^Ind... |
There is a need to authorize the Users based on their Roles, particularly a set of roles that should allow all GET operations and a second set that should allow all POST operations.
Eg:
All Get methods should be accessible to the reader
Post method access is granted to contributors
I don't want to mark the individual... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.