instruction stringlengths 71 95.1k |
|---|
My take on this problem for a hobby project.
I have an event loop that advances game state and processes user input.
Rendering is no concern of this event loop, and is intended to run on a separate thread.
The event loop is GUI agnostic and works with a generic GameLogic that must comply with a certain interface.
Any ... |
I am trying to optimize this code for solving a system of ODE. It seems Cython does not speed up the code compared to code using numpy.
This the python code using numpy:
"""Solve system of ODEs."""
def solver(ode_sys, I, t, integration_method):
N = len(t)-1
u = np.zeros((N+1, len(I)))
u[0, :] = I
dt =... |
I have a big collection of MP4 files and an unstable internet connection so I use this batch file to check for the files integrity.
Having posted this primitive code and received valuable reviews, I decided to take into consideration as much as I can, especially not mixing C code unless when using Windows API and impl... |
I've been trying to make an std::vector of boolean values and I got fed up with the specialization. To get around this, I made a wrapper class around bool and a testsuite to make sure that it compiles and works as expected.
It seems to do everything std::vector<bool> does, except, of course, flip(). It also satisfies t... |
Background
I've recently made a contribution to an open source project, ledger-autosync, which is a CLI "to pull down transactions from your bank and create ledger transactions for them".
Most of the functions are fairly stand alone which means passing configuration values from the argument parser to the function where... |
After learning Javascript for quite some time, I began learning ReactJS and... I am confused with the proper design patterns.
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const Search = ({persons, filter}) =>
{
const [name, setName] = useState(void 0);
function search(event){
... |
I am coding a command line based game with 1 player and 2 monsters.
Monster attacks player at specified intervals and player takes input from standard input to attack specific monster.
I would like your feedback on how I can improve class relationships.
I feel there is strong cohesiveness between monster and player cl... |
I am new to Rust, began learning a few days ago. I have written a simple csv_sorter based off of one I had written for a class previously. Everything runs fine and I have gotten my expected results. I do not know all of the Rust conventions, and am unsure what I may be doing wrong, or what can be done differently.
Woul... |
In some of my past c++ projects, I would sometimes end up having to use a multidimensional array. However, I often would spend more than a needed amount of time on how to store the multidimensional array.so as a result, I decided to create a multidimensional array c++ class.
here is the code
mdarray.hh
#pragma once
#in... |
I was trying out some variation in implementation of a leetcode example and was surprised by the runtimes. I was expecting it would be better to use map() than classic grandpa style for-loop
In short the problem is to find if a value in the list is smaller or larger than a threshold value
https://leetcode.com/problems/... |
I produced below code and soon it became outdated due to the blocking nature of it's loops which I can't see how to avoid that.
Work-flow summery
Client send a request to "/" to get a list of JS objects via JSON format. Few hundred thousand records of them. Array A
First script should retrieve translation documents fo... |
Introduction
I am a Rust novice. So far, I have finished reading the first 15 chapters of The Rust Programming Language (a.k.a. the book). Here's my first big Rust project — Tic Tac Toe.
Each invocation of the program starts a session, in which the scores of two players O and X are tracked on an internal scoreboard. ... |
A project to automate file organization in Linux using Python. I've always wanted to do this project way before I know how to code. Now that I did, I want to improve it even more.
Used Language: Python.
Compatible System: Linux.
Used Modules: OS Module.
How it works:
When you save/move/copy a file to one of the main d... |
Generating documentation for VBA code
The goal of this exercise to is create an application which can read module files created in VBA project and generate markdown documentation for them.
Key features
User should be able to pass standard module (bas) based on which markdown file is created.
Limitations
There are mo... |
I need to write a function that accepts a function as argument, if this function is new, adds it to an array otherwise do not add it.
I assigned a property a my function StoreFunctions and use it as the private storage space, is this an acceptable way to do it? I tested it with function c and d, I did get the correct ... |
Goal: find total number of elements in a nested iterable of arbitrary depth. My shot:
import numpy as np
def deeplen(item, iterables=(list, tuple, dict, np.ndarray)):
# return 1 and terminate recursion when `item` is no longer iterable
if isinstance(item, iterables):
if isinstance(item, dict):
... |
I have made a text-based Snakes and Ladders game in Java with only simple concepts like Scanner and Arrays. I don't know how to use different methods or to use inheritance to make the code shorter. Can anyone please advise me on how to write it efficiently?
Some specific things I want to do are:
You will notice that t... |
I'm still new to programming and I'm not confident about this code. I recently created this File Organizer that organizes files in folders based on their extensions. How can I make this code cleaner?
# File Organizer - organizes file in folders based on their extensions.
# 03/05/2020
import shutil, os
root_path = "C... |
I'm writing a code that, starting from an XML file:
stores the index of child elements of a tag and the child elements as
key, values in a dictionary (function get_xml_by_tag_names);
deletes keys whose values contain a certain string (the specific text
size) and puts these keys and the corresponding values into a seco... |
Here is a class to store global parameters of any type with static methods Set() and Get()
What do you like and don't like about the implementation?
How would you make it to work from multiple threads?
class Parameters
{
public:
template<typename T>
static void Set(std::string id, const T& value) {
au... |
I am new to Python (and to programming). I tried to implement this game in Python and took some help from the code reviews of similar questions posted on this website.
# rock paper scissors game
import random
import sys
choices = ["rock", "paper", "scissors"]
def check_victory(computer_choice, user_choice):
if u... |
I'm trying to learn Clojure coming from a Java background. I have written a simple implementation of Conway's game of life in both Clojure and Java, trying to keep the overall structure of the code as similar as possible to make them easy to compare.
I'm measuring the number of simulation steps per second and my Java v... |
Description
I've developed an application which use axios to communicate with the PayPal API. PayPal has a NodeJS SDK, but unfortunately this doesn't support the Subscription API, so I'm using axios to handle the API requests.
The code is working well, but I want improve the Access Token logic. Essentially the PayPal t... |
I made a script to start something akin to a "session" in which I start services and open tcp and udp ports in the firewall in order to work with, for example, a full stack project, and stop and close the
corresponding services and ports once I'm done using them.
When I call the script, I place the services with the -s... |
Just for the sake of practice, I've decided to write a code for polynomial regression with Gradient Descent
Code:
import numpy as np
from matplotlib import pyplot as plt
from scipy.optimize import approx_fprime as gradient
class polynomial_regression():
def __init__(self,degrees):
self.degree = degrees... |
This code is for procedural terrain generation in a game. The generation happens in form of a grid of so called "chunks". Each chunk has the same size and has its column and row index in the grid associated with it. The grid of chunks expands into the negative dimension as well.
The chunk data itself is a 2D array of c... |
Some time ago, I implemented shuf(1), but it had an issue: it ignored nul characters in the input.
This new version tries to solve this problem (but uses the double of memory).
shuf(1) shuffles the lines of the files given as arguments or the standard input (if no argument was provided) and print it. If the -n NUM opti... |
Answers to this explain why I can't reliably get int type arrays. While there are some workarounds I have a hunch there's a better, cleaner or otherwise "less tricky" way to get these hexagonal arrays of dots arranged in this spiral pattern than the way I've done it by using several conditions.
Is my hunch correct?
Not... |
God sidetracked by this question: “Rock-Paper-Scissors Tournament”
Which led me to the "Knight's Tour" problem.
Initially did a brute force solution. This worked for most of the test. But timed out for the last test. No matter how I added quick exits to the brute force solution could not pass the last test. So did some... |
I came across this issue in the problem titled: Another Prime Problem. Here's my solution with JavaScript which passed test case-1, but for other test cases it led to timeout.
function processData(input) {
input=input.split('\n');
input.shift();
for(var i=0;i<input.length;i++){
values(inp... |
I am have created a predicate builder that takes predicates (functions with a single input and produce a boolean) and can chain them using boolean logic, so AND, OR and NOT. It is inspired by the Java Predicate class. This is mostly to practice my TypeScript, so general feedback is of course appreciated. However, I am ... |
I have the below code. I have list of status which contain may contain 4 values. R,UR,DO,NDO
based on this list. i need to convert to Y,N values
If list contains R the Readstatus="Y"
If list contains UR the Readstatus="N"
If both the ReadStatus="Y,N"
If list contains DO the DoneStatus="Y"
If list contains NDO the Do... |
My friend is taking a C++ course and it inspired me to write my own version of the "Rock, Paper, Scissors" assignment he was given in order to help ease me back into coding. I don't have any people other than said friend that can offer input on it, so I was hoping y'all could give me some.
I am prepared for harsh criti... |
So, here is my code for converting musical notes stored in a text file to WAV. You can see an example of its output here.
#include <iostream>
#include <fstream>
#include <string>
#include <cmath>
#include <map>
std::map<std::string,float> notes;
int sampleRate=44100;
int main(int argc,char **argv) {
notes["a"]=22... |
I'm currently trying to learn C from the K&R book, reading through and attempting the exercises. I came across exercise 1-12 yesterday and was a little stumped but managed to complete it. I was wondering if someone on here would help me improve it, and also guide me on how to approach testing something like this too.
T... |
In my project I have the following base interfaces used through the application:
interface Node { /* ... */ }
interface NodeService<T> { /* ... */ }
Concrete classes might look as follows:
class User implements Node { /* ... */ }
class UserService implements NodeService<User> { /* ... */ }
class Entity implements Nod... |
I have implemented an LFU cache and I'm looking for ways to make my code more idiomatic.
[dependencies]
linked_hash_set = "0.1.3"
//! A Least Frequently Used Cache implementation
//!
//!
//!
//!
//! # Examples
//!
//! ```
//! extern crate lfu;
//! use lfu::LFUCache;
//!
//! # fn main() {
//! let mut lfu = LFUCache:... |
Hi guys below is my code to generate random long unique Ids, I use System.nanoTime to generate long Id but now to make sure that it doesn't clash in the database with previously created Id I get all Id's in the DB then check if it already exists and increment the value. Can you please review and advice if I need to enh... |
fairly new to playing around with proxy servers. Wrote a really simple one with Express to help keep some API keys secret so that my front-end app can query the GitHub API. Definitely feels a bit clunky, but is working so far. I really haven't done performance testing before but the way this is implemented it seems lik... |
I am a relatively new programmer. I am trying to use iter and cycle to cycle over a list (key) and 'pair' each item with each consecutive item in the second list (message). The code below works as expected, producing the desired pairs and stopping when it is done. It does not, however, execute that last print statement... |
I've decided to learn Python about 2 weeks ago, been going through various books and videos, and I've decided to try my hand at programming a Tic Tac Toe game. I was somewhat successful (it doesn't recognize if there's already a mark in a certain spot and allows overwriting of already placed marks) and I was wondering ... |
I am calculating a likelihood surface for a modified negative binomial distribution with two parameters: mean R and dispersion k (the probability distribution is 'modified' to account for total size distributions of networks, so cant use inherent MLE (i.e. MASS::fitdistr)). Thus, I'm running simulated data through the ... |
I am building an API server in golang with mongodb. My main.go file looks something like this:
func main() {
r := mux.NewRouter()
question := r.PathPrefix("/question").Subrouter()
question.HandleFunc("", handler.PostQuestion).Methods("POST")
question.HandleFunc("/{id}", handler.UpdateQuestion).Method... |
Question
I feel like my code could be more elegant/more pythonic/faster, but I can't think of too much more to improve. So, I've come to the internet to see what more can be done with standard python.
What my code does
My code counts anagrams for each word in a list of words. For example:
post, spot stop, tops
are fou... |
The goal is to find the longest peak in a sequence of numbers. A peak is defined to be a strictly increasing elements until a tip is found and then a strictly decreasing elements.
e.g. (1): 3, 2, 1, 2, 3, 4, 3, 0, 10, 0, 1, 2, 2, 1, 0
1, 2, 3, 4, 3, 0 is a peak;
0, 10, 0 is a peak;
0, 1, 2, 2, 1, 0 is NOT a peak (there... |
I could like to read a file from a specified offset to a certain number of bytes in a file. I would pass the filename, the offset, the number of bytes as an argument. The constraint is should use only read, write, open, and close system call. Could anyone say whether the code would handle the test case of bytes > buf_... |
I was wondering about the Array built in methods in java 8. As there is no specific method other than Arrays.binarySearch. So for multidimensional array I wrote following method.
public int[] search(Integer[][] mat,int key)
{
int r=0,c=0;
for(Integer[] a:mat)
{
if(Arrays.asList(a... |
In a Python Bottle server using SQLite, I noticed that doing a DB commit after each INSERT is not efficient: it can use 100ms after each client request. Thus I wanted to improve this in How to commit DB changes in a Flask or Bottle app efficiently?
.
I finally came to this solution, which is more or less a "debounce"-... |
Is there a more elegant way to ensure that colnames(output) of a output R dataframe retains the original column variable names in the referenced sample dataset data? So that I can eliminate the 2 gsub() lines of code, which rename my column names back to my original variable names. My R code, which can be run, is as fo... |
I see in old code two function that uses same switch like this:
private string GetPath(Charts chartType)
{
switch (chartType)
{
case Charts.Revenue:
return "/../..";
case Charts.Risk:
return "/../some";
//UPDATE
case Charts.Sales
return "/123/x... |
I recieve this array in my controller:
"sort" => array:6 [
0 => array:2 [
"id" => "153"
"sort" => "2"
]
1 => array:2 [
"id" => "152"
"sort" => "1"
]
2 => array:2 [
"id" => "154"
"sort" => "3"
]
3 => array:2 [
"id" => "166"
"sort... |
This is an assignment known as a Cachelab from CMU 15-213. The full writeup for the lab can be found here, the handout I'm working against - here. All in all, the task is to emulate a cache, given the amount of block bits, set bits and associativity, run it against a sample valgrind-generated input, output the statisti... |
I have a very large JSON Lines File with 4.000.000 Rows, and I need to convert several events from every row. The resulted CSV File contains 15.000.000 rows. How can I optimize this script?
I'm using Powershell core 7 and it takes around 50 hours to complete the conversion.
My Powershell script:
$stopwatch = [system.d... |
I am a beginner to java and I've coded the Game of Life! For those not familiar, the game entails creating a grid of specified dimensions with each box in the grid being either dead or alive. The grid starts with a random dead or alive state for each box. New generations have new dead/alive boxes based on the following... |
This is a code I wrote for solving the famous nqueens problem. It returns only the first solution. I would like your reviews and comments and ways to convert it to a solution which will return a set of all solutions are welcome.
So, here I go:
#include <stdio.h>
#include <stdlib.h>
int isSafe(int** matrix, long long r... |
I'm a relatively new programmer. I've made a simple Vigenere cipher program. It takes three arguments and acts on a file. I have made some of the steps more "explict" for myself by using more lists than I need to, rather than applying multiple "transformations" at a time. I would appreciate feedback on how this code wo... |
As part of an utilities "library" I'm putting together I've worked to make a multi-threaded for-each that splits a job of applying a function to each element of an index-accessible container in multiple threads.
The first version used to spawn new threads, run them, and join them after one call.
This versions never sto... |
The code reads the specified number of bytes from a specified offset in a file, I have handled the partial reads and bytes > buf_size conditions. Could anyone review the code? and say whether the handling strategy is good. The constraint I am not allowed to use system calls other than open, close, read, write,Thanks a... |
I'm trying to write up a cross-platform rust library (one, that will be used in iOS/Mac/Android dev etc.) It is based largely on concept's and code from Mozilla. One of the requirements I have is to observe changes to struct properties in rust (similar to KVO in Objective-C). The following is a pretty big wall of code ... |
I have an ECS implementation I wish to make more cache friendly and I'm stuck on what I should do.
Let me first present you with the implementation.
ECSManager.h:
class ECSManager
{
private:
std::unordered_map<unsigned int, std::vector<std::unique_ptr<ComponentBase>>> m_Components;
std::unordered_map<unsigned i... |
My take on a binary search algorithm without research or knowledge of an efficient one. It would be appreciated if one could show me an efficient way to do it using recursion or a more pythonic approach.
from math import *
numList = [i for i in range(11)]
while True:
try:
beginning = 0
end ... |
I'd love some pointers on how to refactor this
async function validate_request_args(req, request_type) {
let problem_id;
const errors = [];
switch (request_type) {
case "post":
if (req.body.id == null) {
errors.push({
msg: "Missing id of the problem",
... |
My take on Doubly Linked List in Python. Is there a more efficient and compact way to do this? Are there any bugs in my program if so how can i fix it?
PS: I'm a beginner in Object Oriented Programming, so i might have gaps in my knowledge, please explain any new concept i failed to add to my implementation, Thanks.
cl... |
This simple program, that I call trim(1), trims trailing lines and, if the flag -l is passed as an argument, it also removes empty lines and lines containing only blanks.
I did this as an exercise for learning C and good practices of C programming in UNIX.
It reads from standard input if no argument is passed or read f... |
I am learning C, and wrote this pig-latin translator.
If no argument is given, it operates on standard input. Otherwise, it operates on the arguments given.
Here are some examples:
$ echo "The quick brown fox jumps over Vladmir's lazy young Yggdrasil!" | ./piglatin
Ethay ickquay ownbray oxfay umpsjay overway Admir'svla... |
I am trying to improve the performance of one of my project's methods, which obtains the command line of a process using WMI. A summary of key points:
The method is on an object representing a Windows Process.
Many (hundreds) of such objects will exist
The code to obtain the command line for a single process takes ~50... |
I had old enum, I converted it to Enumeration class and added one method inside (isValid). I am not sure if it is good approach to add such small business logic into Enumeration class. I would like to understand if this is a good approach or not.
Here is old enum:
internal enum Rule
{
None = 0,
Compensatio... |
Yes, this is one of my assignments.
Question:
I am asked to rewrite a generic QuickSort algorithm using only Java List Interface.
The purpose is that the algorithm can be executed for both LinkedList and ArrayList with any type extends Comparable interface. Professor suggests me that I should think stackwise and list a... |
Note for future reference and google searches
The list of urls for IP retrieving will very likely need continuous adjustments in the future.
// Few services that should return the IP as plain text,
// properly configured to accept CORS
const IP_URLs = [
'https://api.ipify.org/',
'https://ipecho.net/plain',
'https... |
To display all the shops, I get data from a database (Firestore) and push them into array and setState, and use map to display shops from this.state{ shops }.
This is working okay, but I am wondering if there are better ways.
export default class Shop extends Component {
constructor(props) {
super(props);
thi... |
I have a code that adds a user to the database, getting the username from the dialog.My fragment implements the interface with the onInputSend method, which is called by the dialog when the user clicks the desired button.
Here is the code that adds the user to the database. I want to hear criticism of my code.
UsersAct... |
This is a matrix-vector multiplication program using multi-threading. It takes matrixfile.txt and vectorfile.txt names, buffer size, and number of splits as input and splits the matrixfile into splitfiles in main function (matrix is divided into smaller parts). Then mapper threads writes the value into buffer and reduc... |
I have been shifting all of my SQL queries to prepared statements in the past few weeks and all of the INSERT statements run extremely fast, however, UPDATE is taking an inordinate amount of time. At present, I am adding to the prepared statement then sending. Updating 20 records can take over two minutes sometimes. ... |
This is my first Python web scraper (and overall my first Python project). I am also relatively new to OOP but do understand its core fundamentals. The script below scrapes two local news sites for their daily weather / allergy forecasts and converts it into an HTML file which opens locally in my browser. The file path... |
Since Python 3.6 and PEP 525 one can use asynchronous generator:
import asyncio
async def asyncgen():
yield 1
yield 2
async def main():
async for i in asyncgen():
print(i)
asyncio.run(main())
I created a function which is able to wrap any asynchronous generator, the same way you would wrap a bas... |
I have a panel that has 4 images per row and a lot of rows. Each image has a 15 pixels separation and are 250,250 each.
Here is a screenshot:
I'd like to be able to click on a picture and identify the image number (from 0 top left to the right). Of course, avoiding the separation.
protected override void OnMouseClic... |
I am making a C# console maths test where the user answers maths questions.
I am trying to add a timer to the test, I have managed to make a timer but when I run my code it becomes a mess!
Here is some example code:
class Program
{
public static OtherCode()
{
\\*other code for test
}
public clas... |
I've been working on a program that automates the painful task of downloading each file from a website for courses one by one and sorting them using python. This is my first python webscraping project on this scale, as such I would love some advice and lessons on how to make my code better! Here is the website I'm scra... |
I write this program based on the algorithm of the word frequency counter program on the K&R book, page 139. I added some idioms of mine, some command-line options, and a dynamically allocable buffer.
Use it on stdin or give one or more file as arguments.
The option -k considers only keywords (beginning with _ or alph... |
If you could rate my code, 1-10. What will it be and provide reasoning on why you gave that answer, i feel like i could of written this code better but i don't know what i am missing or what i could have done to make it better
import random
print('Lets play Rock Paper Scissors')
user_point = 0 #To keep track of t... |
Can this be made any simpler/shorter/more efficient?
This function will compute paycheck amount according to hours worked and rate per hour.
def compute_pay(hours: int, rate: float) -> float:
"""Computes pay according to hours worked and rate per hours.
For every hour worked after the 40th hour the rate per ho... |
I was trying to solve the following question:
You are given 2 arrays: one representing the time people arrive at a door and other representing the direction they want to go (in or out) You have to find at what time each person will use the door provided no 2 people can use the door at the same time.
Constraints: the d... |
I have a code, which does the following:
Get data from the HrAttLogs Table
Input data from the HrAttLogs Table to the HrAttLogsFormatted Table
I would like to know whether the query below, which I will provide, can be improved? In terms of Performance and Speed.
SELECT
FingerId,
ShiftId,
DateIn,
D... |
This is my code for a 15 puzzle.
The basic gist is to get a grid of equal width and height (size) and number them in ascending order, with the exception of the last square getting a 0 value ('0' integer not shown on the tile so it looks like a blank tile). The grid is scrambled and then the user has to click tiles eith... |
I'm a beginner in Java programming. At the start, I wanted to make something easy and then develope it more and more. I chose to do TicTacToe game. At this point I added some menu, playing with bot, bigger map. This is my first bigger OOP project, so I'm the most curious ,if I did it correctly. Could You tell me some... |
So, I am trying to generate a web-page template with JavaScript according to user specified values. I tested it with just background-color and made it working.
I wanted to add a bunch of new elements. Also I need to add style to each elements. I am able to do it with the current code.
But the problem I am having is tha... |
I have a API and the corresponding service method is like this:
@Transactional
public List<Object> getData(args) {
databaseStatements;
databaseStatementsOnOtherThread();
NetworkCallStatements;
CPUBoundStatements(calculation, sorting, etc)
}
With this setup, each request holds a database connection as I... |
As a beginner I wrote my first program (calculator) with Python and as far as functionality is concerned it just works fine but I have some concerns about one thing at the end of the code. Under CalculateAgain() in the if statement, Calculate() is without the return statement. If I used it, it would just run the functi... |
I have implemented the integer residue ring \$ \mathbb{Z}/m\mathbb{Z} \$ and the integer multiplicative residue group \$ (\mathbb{Z}/m\mathbb{Z})^* \$. Functionalities include:
In \$ \mathbb{Z}/m\mathbb{Z} \$ , you can do addition, subtraction, multiplication and raising elements to a nonnegative integral power.
In \$... |
My goal is to make a form builder class, that generates bootstrap 4 form inside a modal.
My doubt is whether I should leave it as is or if I should crate a interface and then implement that interface for all types.
Also is there a better way to write html inside php?
Class to generate the form
class BS4Form
{
prote... |
I am trying to implement smart pointers for our project.
We're using FreeRTOS which is written with a C API so it was quite a challenge to implement sending smart pointers around but somehow I managed it by combining casts, new calls (dont really like that..) move semantics and some other tricks.
On the surface it beha... |
I've been struggling with python OOP. I've gone through the basics but I'm struggling with implementing them. So I've decided to create something small everyday while in quarantine to get more comfortable with OOP.
My code simulates a simple coffee machine that makes 4 types of coffee.
This is the first one. What do y... |
I have created a program but I feel the def common(friendships, person1, person2) function can be more efficient, if anyone has any good idea how I can improve it I would appreciate it.
from My_graph import Graph
def friends_of_friends(friendships, person):
"""Return the set of friends of the person's friends.
... |
https://www.spoj.com/problems/ADDREV/
My answer to ADDREV challenge on SPOJ (link to the problem given above), written in JAVA, was accepted. However, the timing was 1.23 and memory used was 82M, which doesn't seem impressive/up-to-the-mark.
I'm new to competitive programming and want to know -
a. In what ways can ... |
I was working on a project recently that had a good amount of business logic associated with status codes. To better understand the flow of logic in the domain layer, I created an enum representation of the statuses and overloaded the equality operator in the status domain model to check against the enum.
Is this g... |
I would like to ask you to point me some good direction with writing clean code with Spring framework and Java in general.
I am creating a simple app, which has two main features: searching for beers and being able to comment on those beers.
So on the page user is presented with search form:
<div class="container">
... |
This is my first time using Boost and templates in general, so I'm mostly looking for a style critique on my C++. In particular, I'd like feedback on:
state_type, is there a good way to do this such that consumers of the library and the private members of the class can use this type? Other than making two separate typ... |
Best way to initialize rr and cc depending on cycle number to pre-defined values in r and c.
int func(int cycle, int index, int i) {
char *rr;
char *cc;
if (cycle % 2 == 0) {
char r[4] = { 0, -1, 0, 1 };
char c[4] = { 1, 0, -1, 0 };
rr = r;
cc = c;
}
else {
char r[4] = { -1, -1,... |
I have a StudentSchedule class that contains schedules of a student, the student may switch between rooms over time. There's no overlap with the date ranges so if a student stops at 2020-01-01 the next record would be 2020-01-02.
Given the StudentSchedule, I want a ProgramEnrollment which disregards room changes and c... |
Today I learnt the basics of OOP. I have tried to apply them to this Rock-Paper-Scissors project. However I'm still a beginner, and so I feel my code can be improved. Are there any tips, trick or other other advice I can follow to improve the look, runtime, readability or take full advantage of OOP?
The program is a fl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.