instruction stringlengths 71 95.1k |
|---|
i'm a beginner in C++
i decided to learn the Scary C++ Programing Language
i am a slow learner and after 2 Months learning C++ i saw the need to have a Nice and Tidy progress bar for my programs.
Here what i wrote:
#include <iostream>
#include <string>
#include <iomanip>
#include <unistd.h>
// That function controls t... |
I am using hourly weather data to estimate performance of commercial refrigeration systems under various parameters. The formula for estimating co-efficient of performance (COP) of these systems is repeated for each hour.
I defined a formula to do this calculation:
Public Function estimatedCOP(dischargeTemp As Double,... |
I am scraping HTML pages. Part of the page has a table which has acts and sections of those acts mentioned in table format. For some other project I need to convert them to Dictionary. The key values are previously set (in the other project). I want to use the same key values for the dictionary and then replace corresp... |
I have written the code for implementation of system() function using fork(), exec() and waitpid(). Could someone please review this code and provide feedback. Thanks a lot.
#include<stdio.h>
#include<string.h>
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<error.h>
#include<errno.h>
#define s... |
I'm trying to write a function that takes a sports bet and returns its Net result.
If you are not familiar with betting, an exhaustive test suite should help with understanding what the program is supposed to do. How can I solve this problem in a way distinct from enumerating all of the possible cases?
SUPPORTED_BET_TY... |
I was doing 3sum question on leetcode
Question
Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
The solution set must not contain duplicate triplets.
Example:
Given array nums = [-1, 0, 1, 2, -1, -4]
A... |
This is my first test, I think it's testing what I need it to test but wanted to get some feedback.
I wanted to test to make sure the controller action returns a view with a certain ViewModel.
The code that it will be testing:
Controller:
public class UserController : Controller
{
private readonly ILogger<UserContr... |
I'm still new to C++ and I am very open to any kind of suggestion on how write proper and understandable C++ code. I decided to create a class for the code to have everything closely tided together. Don't know if that was a good idea.
About signature scanners (aka. pattern matchers), see see wiki. Signature scanners ar... |
Currently my code works but I wanted to know if I'm going about this the right way. I want to be able to individually call variables from method 'data_by_name' in 'otherfile.py' . At the moment I import 'otherfile.py' and put the elements into a list within 'main.py' and use tuple unpacking to give each element a varia... |
I have written a timer class.
Here it is in all its "glory" with some functions around it to test it:
https://rextester.com/LQSXUA43758
Below is the class on its own, note it also relies on another class called stop_watch (which can be seen in the link), but stop watch is quite simple and just relies on std::chrono::st... |
I tried a Hackerrank problem and it gives me a successful message, it works fine for Hackerrank criteria.
The member states of the UN are planning to send 2 people to the moon. They want them to be from different countries. You will be given a list of pairs of astronaut ID's. Each pair is made of astronauts from the s... |
I am looking to have a code review on this tiny repository.
The code seems to work, but I am not sure if I have written it in idiomatic Rust.
#[derive(Debug)]
pub struct QuickFind {
items: Vec<u64>,
}
impl QuickFind {
pub fn new(length: u64) -> QuickFind {
let mut result: QuickFind = QuickFind { items:... |
Is there any way I could make my Tic-Tac-Toe board more aesthetically pleasing?
Is there anything else I can improve besides the look of the board?
from AskUser import ask_user as As
from random import randint
Choice = 0
Player1 = None
Player2 = None
#Introduction
def intro():
global Choice
while True:
... |
I'm learning The essence of SQL by Rozenshtein indirectly from the SQL Cookbook which has a section on it with modern SQL operators introduced after the book was released.
The exercise:
Given:
create table student
( sno integer,
sname varchar(10),
age integer
);
--
/* table of courses */
create table courses
( cno ... |
I have a React/Redux/Router/Reselect app in which I am syncing some parts of the redux state with the URL. As an interim, hacky measure (I've only been learning how to write wepapps for about 6 months so I'm very much a n00b right now) I’m currently implementing that sync as follows:
A selector provides the parts of t... |
This is the first Time implementing a Binary Search Tree, based on how it works from the visualgo website. I made this algorithm purely based on what I saw, and the remove method was quite challenging. How can I improve the speed/efficiency and make the code look better?
Methods:
Inorder: basically an inorder traversa... |
Good afternoon,
I have a set of working code, which works as a loop between values i = 0-90 step 0.25. It gives 360 combinations exactly.
I used to do this loop separately column by column. It takes time and I must repeat the process exactly 9 times.
So, red bounded is the column first, which I am currently working on... |
I have a feature with feature flagging enabled, basis the condition I want to load different pages in my screen, to achieve this I have the following enum:
enum class ImageHolderEnum(
val titleId: Int,
val qFragment: BaseFragment,
val fragment: BaseFragment
) : IPageHolder {
PAGE1(R.string.tab_shop_bab... |
Below code just for assemble data into network packet. but the code logic has many repeat parts to convert integer for byte array. what's the best method for such purpose to simplify below logic?
typedef struct _INFO {
int pid;
int score;
} INFO;
void send_packet(int connfd,INFO* info,int len) {
int buflen... |
I have a geojson file with results for each province and one that gives other results for each constituency (an administrative part of the province). I would like to make a third one that puts the results of the first one for each 'constituency' level of the second one that has the same province with the first one, so ... |
I am solving the "Point where max intervals overlap" problem on geeks for geeks, https://www.geeksforgeeks.org/find-the-point-where-maximum-intervals-overlap/.
Following the solution in the article, I used two lists to store start and end times of the intervals. This is my solution in Python:
def maxIntervalOverlap(int... |
This is an answer to this question on Code-Golf.SE (but obviously not golfed). How can I shorten the runtime of my program? It is taking far too long to run some of the test cases. Can I utilise Python map() or lambda?
def main():
# Store number of test cases
T = int(input())
# Loop for each test case:
... |
I am working with Cassandra where I am getting some stuff out of it using Datastax C# driver.
Below is my code which interacts with Cassandra db and in my GetAsync method I am extracting stuff from three different tables by making multiple async calls for each client id and item id.
Earlier we were using IN clause que... |
I've been trying to kind of teach myself "Modern C++" the last couple of months and I just finished this interview type problem and thought it would be a good one to get some feedback on. I not including the full implementation for brevity, just the relevant parts for the problem.
Random Node.
Implement a binary tree ... |
My own Givens-based QR decomposition function in R (pseudocode from Politecnico of Turin's math department) is the following:
>Givens.fn<-function(V) {
tol<-1.0*10^-14
m<-dim(V)[1]
n<-dim(V)[2]
spId<-bandSparse(m,m,0,list(rep(1, m+1))) # computed just once
Q<-spId
... |
#include <stdio.h>
#include <cs50.h>
int main(void){
long long card;
int i;
int otherdigs;
int multiply;
int sum = 0;
int sumofothers = 0;
int finaladd;
int length;
int card_length;
long long get_card;
get_card = ge... |
I was doing Search in sorted array question from leetcode
Question
Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7] might become [4,5,6,7,0,1,2]).
You are given a target value to search. If found in the array return its index, otherwise return -1.
You... |
For context, I worked on the LeetCode May 2020 Challenge Week 3 Day 1. The challenge was described as this:
Given a string, sort it in decreasing order based on the frequency of
characters.
Example 1:
Input: "tree"
Output: "eert"
Explanation: 'e' appears twice while 'r' and 't' both appear once. So
'e' must appear... |
I am trying out websockets using the python async framework aiohttp.
Basically I have created a game which will include multiple players and they will be able to chat using web sockets. There could be multiple game rooms and a player will be in a single room at a time.
I believe I have the implementation right.
Please ... |
I am making a simple API for news items using Python and the Bottle framework.
I return a Python dictionary from my endpoints as Bottle converts this to JSON automatically in the response to the client.
I wanted to ensure a consistent structure to the responses, so I have declared a template dictionary. The code for ea... |
Aim: To make pages located in site.com/page-1, site.com/page-2. Those pages are pretty much static so I won't use database.
First, I've created the PageController.
class PageController extends Controller
{
public function page($slug)
{
$page = $this->pageContents($slug);
return view('page', ['page' => $page]);
... |
This is a solution to this problem: https://www.codewars.com/kata/53005a7b26d12be55c000243/train/ruby
The task is to make a simple interpreter that will take expressions and calculate the results. I'm just looking for general feedback on following Ruby standard practices and ways I could shorten the code by omitting pa... |
A slick way to write the zip function in Scheme/Racket:
(define (zip . lsts)
(apply map list lsts))
(zip '(a b c) '(1 2 3))
'((a 1) (b 2) (c 3))
Is using cons instead of list in zip to get a list of dotted-pairs correct?
(define (zip-dot . lsts)
(apply map cons lsts))
(zip-dot '(1 2 3) '(a b c))
'((1 . a) (2 . b... |
I'm working on a text adventure game for a while now, learning more about user input etc.
I have a feeling there is something fundamentally wrong about my code, it seems too repetitive.
The use of structs should make things less bulky but can't figure out how to use it properly.
#include <stdio.h>
#include <time.h>
#in... |
It has been a long time I used c++.
So I brushing over concepts for interview preparation.
Can you please help me with code review?
If you have any observations/bugs/alternatives please point out.
For better formatting, I have shared code here feel free to open issues. :)
Thanks a ton in advance.
#include <cstring>
#in... |
At first I wasn't really proud of this one, but then I decided that I need to know what's so bad about it? Why does it feel unsatisfying? How can I do it better?
So yeah here's a unity project that does the following:
Spawns a maximum of 3 wall bouncing corona balls where the player clicks, which when they collide with... |
I have written Python code to rearrange some files in a directory, create new directories and delete old ones to form the dataset in the structure that I want it. Previously, I was doing this with repetative code because it got the job done but I want to clean it up and see no reason to repeat code.
test_names_path = ... |
I've a created a simple generic numeric input component with input mask which must only valid decimal numbers as input. Please check the code for any improvements.
import React, { useState } from 'react';
import PatternConstants from '../Constants/PatternConstants.js';
const NumericInput = (props) => {
const patte... |
I decided to challenge myself to code this data structure by just seeing how it looks visually and this is what I got. I can change this easily to minheap by changing some greater than (>) operators. If there are ways to make this efficient/more compact, I'd love to hear it.
class MaxHeap:
def __init__(self, List=N... |
I'm new to using type hinting in Python. I've used it for a small scraper I had to build (see code below), everything works fine and mypy gives no errors. However I'm sure there are better ways to write this (avoiding the repetition between the Ratings and ScrapedData tuples, better way to handle the Literal in functio... |
I'm using this class as Modal in my CodeIgniter project, as I'm newbie in CI, I wanna know if this has some issues, I'm using this modal for all queries, like I call this with parameters and it returns results as I wanted. But I'm not sure if it a good idea or it might give some bad impact to structure and security.
<?... |
I am trying to solve this question: MaxCounters.
Solving it is straightforward, but solving it fast enough is proving very difficult. How can I improve the performance of this code? At the moment it is too slow for the large_random_2 and extreme_large tests.
function solution(N, A) {
const M = A.length;
let max... |
I am writing a modified travelling salesman problem recursively in Python 3.7. It has to find the best path around breweries to find the most beer types and not to exceed the max_distance. The problem is the execution time. I left it to run for 10 hours and it still didn't calculate final answer. When max_distance is s... |
I've made simple app that is able to take screenshot each -t seconds and OCR it to -o file. It's also able to take -path and OCR all images to -o file.
It works pretty well thanks to tesseract ocr. Unfortunately my code seems much more complicated than it really is. Can you tell me what I'm doing wrong? I enjoy program... |
I want to save NUnit local tests in a mysql database hosted in Amazon RDS, and
I'm wrapping up everything in a transaction like so :
using (var context = new StDbContext())
{
context.Database.Log = Console.Write;
if (!context.Database.Connection.State.HasFlag(ConnectionState.Open))
... |
This is a part of simple sfml C++ game, but I think neither the library nor the language is that much crucial here. I am mainly worried about the design.
I have a class template ResourceHolder<Key, Resource> to hold one type of Resource such as texture or sound, inside a map. A key is usually an enum but can be anythin... |
I'm pretty new to Rust and to it's async/await model, and I'm trying to do something that looks like a specialized Haskell's traverse function. Given a Vec<T> and a function T -> Future<Output = R> I want to get a Future<Output = Vec<R>>.
At the moment, I have the following:
use futures::{FutureExt, StreamExt};
pub as... |
I have created the following few functions for handling the use of doubly linked lists.
list.c:
#include "list.h"
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
/* all functions returning a pointer return NULL on failure
* all functions returning an integer return != 0 on failure
*/
//internal
sta... |
I will import given code for my main QMainWindow.(I only add import sys etc. to run it)
Is there a more compact way to code this lines.
Output is correct for my expectation.
from PyQt5.QtWidgets import *
import sys
class ButtonWidget(QWidget):
def __init__(self):
super(ButtonWidget, self).__init__()
... |
I am teaching myself some coding, and as my first "big" project I tried implementing a Steepest Descent algorithm to minimize the Rosenbrock function:
$$f(x, y) = 100 (y - x^2)^2 + (1 - x)^2$$
The algorithm goes like this: We start with an initial guess \$x_0\$ (vector). We update the guess using the formula
$$x_{k+1} ... |
I was practicing C++ and data structures and wrote my own implementation of a doubly linked ring. I would love to improve my code a little bit more and would need help from the community.
Here is the implementation I have:
#ifndef BIRING_H_INCLUDED
#define BIRING_H_INCLUDED
#include<iostream>
#include<string>
using n... |
So I implemented drivers for I2C and USART using interrupts with some guidelines online, and was wondering if I can get some suggestions from a design point of view even though the code works (tried at 9600 and 115200 baud rate), but I do get a hardfault upon using two different baud rates at RX/TX. One reason could be... |
After some time poorly designing my web applications' backends (mixing database calls with the controller, etc.), I have decided to try the "Clean Architecture" approach.
In this example I have a REST api users which allows you to get a list of all users in MongoDB and to put a user inside the database.
Please, any sug... |
My excel program import from another workbook, exported from SAP, some columns to update my dashboard.
To do this I use ADODB, the code run right and fast (26K rows and 32 columns on 00:00:26:1226).
But I see that some columns with data/time aren't correctly formatted, the poblem is that not all date columns just some,... |
Would appreciate any input on these building blocks functions of tic tac toe.
def display_field(cells):
print('''\
---------
| {} {} {} |
| {} {} {} |
| {} {} {} |
---------\
'''.format(*cells))
def analyze_field(cells):
"""
Args:
cells (str): a string of an XO pattern
Returns:
(str)... |
The standard library heapq in python doesn't support updating keys as a public method, which makes it hard to be used as a priority queue. Although the official documentation has suggested a workaround, it is somewhat convoluted. So I decided to implement my own priority queue as a min-heap.
Here is my code:
class Heap... |
I know there's already a whole bunch of similar attempts at this and I've looked at a few of them to get some tips. My main aim with this was not to write anything fancy. I wanted to create a simple game with the most basic functionality but write it really well. In other words I'm more interested in making my code pro... |
Requirements
I have a table of the different diagnoses a patient has received, with the date the diagnosis was first recorded. It so happens that in medicine, diagnoses are recorded as codes from a huge list called ICD10, and sometimes several different codes are related to a single disease, for example a patient will ... |
I have 2 asynchronous return values from 2 different classes, one from HealthKit, the other from MotionManager. I combine the outcome of these classes through a combinedViewModel. The code works, but I want to know if it is properly formatted and if all functions, ... are used in the right place. With other words, can ... |
I have just read the Chapter 5 of Data Structures and Algorithms with Python. The authors implemented hash sets using linear probing. However, linear probing may result in lots of clustering. So I decided to implement my hash table with a similar approach but using linear congruential probing instead.
Below is my code:... |
I wrote some code to estimate the solution to the following problem:
If you break a line segment at two random points, what is the probability that the new line segments can form a triangle?
The code is relatively simple, and it works. However, I can't shake the feeling that each of the three functions I've created c... |
I made the bellow macro to create a time line in excel.
It shows the working days, the week numbers and the month together with the year.
First I start with projectstart date and projectend date.
As these dates can be any working day and I want my timeline to start on a monday and end on a friday, I find the firstmonda... |
I am writing some code that performs a simple time-history integration solver (Newmark method for structural dynamics) and I looking for some suggestions in how I can improve the performance of my code. Currently, I am calculating a parameter called displacements for many time steps (think on the order of 5,000,000 ste... |
For learning purposes I'm writing a very simple mqueue based file transfer server. Below is a thread function that takes care of an incoming request:
static void * handle_client_request(const char *request_string) {
char request_pathname[_part_delim_alloc_size],
request_fifo_name[_part_delim_alloc_size];
... |
Last night I had to build dropdown for the menu on the website that I'm working on. As I'm still React newbie I first looked if there is some package for what I'm trying to achieve but there wasn't, so I had to try to build it on my own.
So the menu has its menu items, whichever is hovered it should show its content an... |
I'm doing a little more grad school, and for a group project I wanted us to be able to quickly share and update our project, so I coded up a Python script to handle that. As usual, I'm proud of the work, but I'm here for you to tear it to shreds again.
First, the imports, some globals, and the main:
import time
from su... |
Please review my code for the performance and correctness, everything works and we get visible wifi access points by opening http://esp8266_ip_addres/hotspots except on refresh the values gets duplicated. and does not reset as I have done in the else block.
#include <ESP8266WebServer.h>
#define HTTP_REST_PORT 80
#de... |
I'm currently implementing a Minesweeper clone in Java using Swing. Rather than updating the tiles like so
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
for (int row = 0; row < rows; row++ )
{
for (int column = 0; column < columns; column++)
... |
I've a scenario where 10K+ regular expressions are stored in a table along with various other columns and this needs to be joined against an incoming dataset. Initially I was using "spark sql rlike" method as below and it was able to hold the load until incoming record counts were less than 50K
PS: The regular expressi... |
Used classes to make this simple tic tac toe game.
Any improvements?
from itertools import chain
class Field:
def __init__(self, sequence):
self.sequence = sequence
self.rows = [[sequence[i] for i in range(j, j + 3)] for j in range(0, 9, 3)]
self.columns = [[row[i] for row in self.rows] f... |
Question:- Why is this code so ugly ??
This is my first code, it is working fine, but I feel it doesn't looks as standard code … I am still studying java through youtube, as I have just completed two topics language fundamentals and operators and assignments in java.
I have tried to create code that calculates loan on ... |
Here is an implementation of Conway's Game of Life. It is kind of a brute force but it works fine. I have a special question about the method cv::Mat render() const, which renders and returns a cv::Mat. Should I return a reference cv::Mat& render() const or allocate an object on the heap and return the pointer? I would... |
So I've just finished my first Python module (and published on Github), with this little project I'd like to learn how to distribute my code so that other users can use it as a plug in for their own projects.
Specifically I'm looking for feedback in the following direction:
Is the interface to the module designed corr... |
I am writing a program to combine the basic form of a word with suffix arrays following the choices from a form group (Angular 9) to receive the declination.
This is the flow:
The user inputs a word.
The user chooses the predefined grammar categories of the word (genus, class, animacy and others).
According to the cho... |
I implemented the following react hook to get live updates of an element's position and dimensions in the DOM:
/**
* @author devskope
*/
import { useCallback, useRef, useState } from 'react';
import { throttle } from '../limiters';
const useElementDimensions = () => {
const [dimensions, setDimensions] = useSta... |
I am learning javascript and have developed a car game using:
HTML Canvas
javascript
The repository link is: https://github.com/lazycoder-007/car_race_html_javascript_game
The code is given below:
This is the GameArea object, with functions related to load, start and stop the game.
var myGameArea = {
canvas : do... |
Is the method used below to get data from a database efficient and optimal? The data is in a MySQL database, and in my server I have a PHP file with the following code to return some information:
if($_POST["method"] == "requestBusinessFood") {
requestBusinessFood();
}
function requestBusinessFood() {
$categor... |
This is a Yahoo Finance wrapper to get income/balance statement for a stock ticker. What I have tried to do is make an abstract implementation so more features can be added easily in the future. The base-class YahooFin
contains methods to get and beat the data into shape so it easily can be put into a pandas DataFrame.... |
Let's Fight:
one Entity can perform an attack (thus making him an attacker) on another Entity (defender). This follows some Rules, described within the AttackProcedure.performAttack(). The FightRules describe, what Chances one Entity has to succeed (or not) and what Damage will results from an attack.
(C) https://www.... |
I have written the following Javascript code which increments and decrements 3 separate inputs by 1:
//INCREMENTS/DECREMENTS BEDROOMS BY 1
function plusOneBedrooms() {
var addRoom = document.getElementById('rooms_amount_bedroom');
value = parseInt(addRoom.getAttribute('value'), 10) + 1;
addRoom.setAttrib... |
Wrote a python script to web scrape multiple newspapers and arrange them in their respective directories. I have completed the course Using Python to access web data on coursera and I tried to implement what I learned by a mini project.
I am sure there would be multiple improvements to this script and I would like to l... |
Inspired by MIT OCW (6.006)'s lecture on BSTs, I implemented them with the slight tweak where an element has to satisfy the "k-minute check" before insertion. If its value is within k of any other existing value in the node, the node should not be inserted. k is a positive integer parameter provided upon creation of t... |
This is a fully functional code that i have just completed today. I just want to know how efficient is this. and how could i improve it or if theres any bugs that i have miss out.
import os
from AskUser import ask_user as As
from random import randint
#initialising the board
class Board():
def __init__(self):
... |
I've self-taught myself Python and have recently started learning tkinter. I made a simple stopwatch program and I wanted to know if the code is clean and written in a way that the code works efficiently. I would highly appreciate any suggestions on how to improve my code! Thank you!
from tkinter import *
import time
... |
Beginner functional programmer... (but not beginner programmer)
Currently, I have the following code:
import Control.Monad (mapM_)
main = gridMaker 3
gridMaker :: Int -> IO ()
{-Creates a nxn matrix filling the lower triangle with "O"'s
and filling the rest with "X"s
Example:
O --- X --- X
O --- O --- X
O -... |
The Requirements:
List the expensable items sorted by date and location given two variables: 'categories' and 'expenses'. The Categories variable provides the following information in order: Category ID, Category Name, and whether the category is expensable (Y/N). The Expenses variable provides the following informati... |
I was following a tutorial for a social network. I want to know how secure this code is because I plan on launching it to the public web.
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// declaring vars to prevent errors
$fname = ""; //First name
$lname = ""; //Last name
$em = ""; //Email
$em2 = ""; // ... |
I am trying to implement topological sort. The idea is that I have a vector of pairs in which the first element is indegree and the second is a linked list. I tried a bunch of tests, they seem to work, but I am not really sure about my implementation. Is this really a topological sort? Can you please review my code and... |
I have a following list which indicates the indexes.
List<Integer> integerList = Arrays.asList(1, 3, 5, 6); // index
I have the following collection of objects.
Collection<Test> testCollection = new ArrayList<>();
Test test01 = new Test(0, "A"); // 0
Test test02 = new Test(1, "B"); // 1
Test test03 = new Test(2, "C"... |
I have written the following code for my 1st year project, the Fibonacci series. I programmed it without searching Google. Is my code good enough to get me an A or a B? Can I make the code more professional?
#include <stdio.h>
#include <windows.h>
#include <math.h>
main(){
double x, y, xy;
printf("Presenting t... |
I was just wondering if there is a way to speed up the performances of this for loops in Python.
I'm trying to process an image to get the color-moments without using libraries.
It takes about 12sec to do the calculate_mean and calculate_standard_deviation functions for each part of the image.
import math
import cv2
... |
I'm trying to determine whether the prime factors of a given number are different to the primes that I have in a list.
The number has to:
be dividable with any of the primes in the list
not have any other prime factors not in the list
Example:
Given my_primes = [2, 3, 5], then n = 14 should return [7]
14 has factor... |
I have the following code which works. Been trying to write it in Java 8 streams to make it more readable but unable to get my head around it. Looking for any feedback to make it more readable.
Thanks.
// Expected output like: 1~CODE1|2~CODE2|3~CODE3|4~EX|5~CODE5
private String getFormattedValue(List<Content> list) {
... |
I'm trying to get my basic coding principles right but there's still a long way to go. This is an exercise for CodeGym. They logic itself isn't very hard and I passed the exercise easily but I'd like my code reviewed with the following in mind:
In terms of the general architecture, I wasn't quite sure if I needed two ... |
I decided to make my own data structure. I did this because I wanted a data structure that is a queue but has o(1) time on lookup.
template <class Object>
class ObjectQueue;
template <class Object>
class ObjectQueueNode: private NonCopyable
{
friend class ObjectQueue<Object>;
public:
ObjectQueueNode(const... |
After following up this question, I'm thinking if there's a better/shorter way to write this text element that has part with different style, while allowing localizations:
<p>
<span class="has-text-grey">{{ $store.releaseList != null ? $store.releaseList.length : 0 }}</span>
<span> versions released</span>
</p>... |
I have created a database using Django. I have a small statistics page as shown below. Can I improve this code?
View file
def statistics(request):
""" Return the number of categories (Category is based on first
three-letter character, say Cry in the example) in the database
and its correspondi... |
Following This post : https://stackoverflow.com/questions/630803/associating-enums-with-strings-in-c-sharp/56482413?noredirect=1#comment107635743_56482413
I wanted to go further as it didn't quite fully met my needs for a Enum like Class that would act as string I ended-up with a solution that allows me to do the foll... |
I am conversant with Kadane's Algorithm. This is just an exercise in understanding divide and conquer as a technique.
Find the maximum sum over all subarrays of a given array of positive/negative integers.
Here is what I have worked on but accumulating sum in solve_partition() looks pretty similar to solve_crossing_p... |
I have this little server at home, which is hosting some websites, school stuff and a minecraft server. I made this backup script and I would like some feedback since I'm not very good at scripting.
#!/bin/bash
# declare folders to backup
dirs=(
"/home/ferre/Minecraft"
"/var/lib/automysqlbackup/daily"
);
# bac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.