instruction stringlengths 71 95.1k |
|---|
Will be very grateful for thoughtful code review.
I needed hash table (again) and I wrote one. Code here is here or inline:
#ifndef HASHTABLE_DEFINITION // single file library cannot use pragma once
#define HASHTABLE_DEFINITION // https://en.wikipedia.org/wiki/Header-only
// ... |
I wrote a blocking serial port library, Blocking serial port C library, but prefer non-blocking so wrote this library where user can specify callbacks. So it is event driven.
The code assumes C99 or better. How could this be improved?
The example is fairly custom to working in the UK with the British Telecom Caller I... |
I wrote this program as part of a work-related problem but with a focus on improving my Python skills. The program was needed to do a word count PDF files. The problem was there were a large number of PDF files (over 1000) which were scattered over a drive. I made use of a number of modules to achieve this.
Quick descr... |
This is an extension of my Reusable Progress Indicator post. I realised that I needed to add additional compiler constants for compatibility of the Windows API functions used in the HideTitleBar sub which is called on the Userform_Initialize event; however, I am unsure if they are correct for all cases. I have tested t... |
I want to know if there is a better way to do this function. The function calculates a payback. Basically, the company spend x amount of money and per year they will save some money overtime. They want to count how many years it takes to get the money back.
I.E. The company spends 100k. year 1 they save 45k, year 2 sav... |
I am working on a CodeWars titled 'Square into Squares. Protect trees!' it can be found here: https://www.codewars.com/kata/54eb33e5bc1a25440d000891/train/javascript
I have a working solution, the issue is that the performance is so horrid that if I run it with an argument higher than around 15 my browser/tab freezes. ... |
Overview
I am attempting to learn Node JS with Express by creating a project.
I have seen many examples of setting up an express.js application with functional based programming, like so:
// app.js
"use strict";
const express = require("express");
const path = require("path");
const mongoose = require("mongoose");
co... |
This is the first time I have programmed something that I will actually personally use, so I am happy about that. I tried to write good code whilst applying functional programming concepts. So no state, and a concise function.
I know that when making the lists it pulls information from the JSON that doesn't get used l... |
I have a model that is in a HABTM relationship with 2 other models:
Activity.rb
has_and_belongs_to_many :mandates, -> { distinct }
has_and_belongs_to_many :contacts, -> { distinct }
I had to add the following callbacks, since the models defined above have a 'score algorithm' that must be recomputed if activities a... |
Improved upon my previous calculator program. This program has the following features:
Gives information using session prompts.
Supports all common operators.
Follows operator precedence.
Use of identifiers is supported.
Result of the previous expression can accessed by using the 'r'
identifier.
Special commands:
n: ... |
I use self-closing bodyless for loop to quickly find an element within an array or collection. Learned it from a Java teacher.
But I'm seeing warnings on certain IDEs that have a code inspection tool.
For example, IntelliJ deems this construct to be a probable bug and objects to the empty body of the loop.
The code bel... |
In language dictionary application users can add new words and do other staff with this word such as adding additional information to the word (description, etymology, speech parts, noun class etc.) I'll count all this information and maybe later create some application gamification based on this information. I decided... |
I am trying to check if a class has only numeric values in it and then return a bool, however, some instances there may be non numeric chars in an object that should only contain numeric values.
At the present I am using reflection to loop through the object (Which in some cases can have up 200 properties) and then che... |
I solved this programming challenge whose objective is to come up with an OO solution to the problem.
The problem statement is quite verbose and the tl;dr version would be:
Given an enemy army(Falicornia) made up of Horses, Elephants, Armoured Tanks and Sling Guns and our own similar army(Lengaburu). Find out the min... |
Context
I'm a duck retailer. I rent ducks to farmers, and when they don't need them anymore, I get them back. In order to track which ducks I rented to whom, I have a PostGreSQL database that I keep updated with my operations.
When I record a rent operation I need to manipulate two tables: Ducks and RelationDuckFarmer.... |
I've never had my C++ code reviewed before so I'd appreciate any feedback. Although my main focus was not on the implementation of the algorithm itself, any suggestions regarding improving it would be welcome. I'm mostly looking for C++ related feedback though.
#include <iostream>
#include <vector>
using namespace std... |
I've been studying the BST code in Paul Graham's ANSI Common Lisp.
He provides (my comments):
(defun bst-min (bst)
(and bst ; [3]
(or (bst-min (node-l bst)) bst))) ; [4]
(defun bst-max (bst)
(and bst ; [5]
(or (bst-max (node-r bst)) bst))) ;... |
I need to make a function like these two, but at least an order of magnitude faster in python.
Any tips or tricks?
These functions inputs are nested lists, like: request_parameters = [1, 2, 3, 4, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, [110, 111, 112, 113, 114]]
Their output should be: [[1, 2, 3, 4, 5, 110], [1, 2, 3, 4, ... |
Introduction
I used React to write a component, which is meant to be a faithful emulation of the input for "Tags" which you see at the top of every question/topic on SE.
Why this project?
If you're wondering why I did that, it was because (apart from a chance it might eventually become useful as a live product), it's a... |
I am creating program which will parse .csv file and I am using FileReader and Scanner classes from java API.
FileReader throws FileNotFoundException, IOException.
Scanner's method hasNextLine() and nextLine() throw IllegalStateException and NoSuchElementException.
Should I use 1 try and 4 multiple catch blocks? Or try... |
I had me a code challenge and I was thinking: is there a way to make this more efficient and short? The challenge requires me to scan a string and ...
In the first line, print True if it has any alphanumeric characters. Otherwise, print False.
In the second line, print True if it has any alphabetical characters. Oth... |
I am currently learning JS Frameworks, right now exploring React and wanted to make sure I keep everything in order, as in: the logic of working with React, code quality, any shortcomings, good/bad practices etc?
The code renders a simple Search panel that will allow to call an API, get the results (if any) and render ... |
I made this huge code (Edit: huge for such a simple task) for transferring data and adding an ID number to every new row of data. The only functionality flaw I see is that it creates new ID numbers if you transfer blank cells. I was wondering if anyone can help me improve this code? I'm very bad at loops so if there is... |
Long story short, I have over 180K files that I need to delete. I have all of the file names that need to be deleted in a TXT file, however the files that need deleting are scattered in over 400 folders within this one directory.
I'm attempting to design a script that reads a .TXT file, checks if the file exists in an... |
For the given strings (not containing numbers), print their shortened
versions, where each adjacent sequence of the same characters longer
than 2, change to an expression consisting of a sign and a number of
repetitions.
Sample input:
4
AAA
ABCDEF
CCCCCCDDDDDDD
ZZAACCCDDDDEEEEEE
Sample output:
A3
ABCDEF
C6D7
... |
I have the following code:
import pandas as pd
import numpy as np
import itertools
from pprint import pprint
# Importing the data
df=pd.read_csv('./GPr.csv', sep=',',header=None)
data=df.values
res = np.array([[i for i in row if i == i] for row in data.tolist()], dtype=object)
# This function will make the subsets ... |
https://www.codewars.com/kata/find-the-stray-number/train/javascript
I solved this challenge by sorting from least to greatest, and checking if the first element in the array matched the second element in the array.
If the first element does not match, then the different element is the first element.
If the first ele... |
About a month ago I made a Tetris game for Windows. After a helpful review, I improved the code. I want to hear again an opinion about the implementation, how readable the code is, new mistakes or anything that will improve the quality of the code.
Action.h
#pragma once
#ifndef ACTIONS_H
#define ACTIONS_H
/*
Pos... |
The code creates a table and adds rows and columns.
Does it make sense to write the code like this?
Would you design it differently?
Is there a better OOP approach to this?
class Table
attr_reader :grid
def initialize(rows: , columns:)
@grid = construct(rows, columns)
end
def construct(rows, columns)... |
We have an existing situation in an MVC ASP.NET app where it's possible for two threads to come back asynchronously, one from an external api(the payment gateway) and one from within the browser for each cart in an online shop. Only one should be able to run some further code, but they can come back almost simultaneous... |
I'm designing a scraping application using python, requests and BeautifulSoup4.
I decided to divide the logic into two classes:
Spider : gets the base url containing a list of job offers and logs them into a SQL table logs .
Extractor: it pulls the urls of job offers' posts from the logs table and it dumps them into j... |
This is a code challenge, from Codewars, the details of the specific challenge in depth can be found here: https://www.codewars.com/kata/magnet-particules-in-boxes/javascript.
The summary of it though is a function which gives a sum of particles in a set of boxes given a number of rows and a number of columns to work ... |
I needed to synchronise several processes, so I developed this ipn::Notifier class that uses a mutex+condition variable stored in shared memory to notify all processes.
The ControlBlock structure is stored in shared memory and holds the sync elements as well as a counter of clients.
#ifndef CONTROLBLOCK_H
#define CONT... |
Would there be a more clear/efficient way to write
public function getModelName()
{
return substr(strtolower(substr(strrchr(preg_replace('/(?<!\ )[A-Z]/', '_$0', __CLASS__), "\\"), 1)), 1);
}
for example:
__CLASS__: Namespace\To\SettingOption
Output: setting_option
|
The alpha that I create is not created in a crazily efficient way I know, but the main bottleneck in this code is in what I call the "Maximization step" (see comments in code). There are double for-loops twice (with list comprehensions inside), and the reason for this is that I need to use the computed vector from the ... |
This code checks if "B2" and so on is filled in and if it is then it will generate a new ID number for the row of data that was transferred to the worksheet on the next empty row, I know this code creates opportunities for bugs so I want to make it better but I don't really know how I could do it. (PS: I am very bad at... |
I use JS/JQuery validation for radioboxes, input field etc. Because of AJAX I use one global validation (in a separate file) and 4-5 other files to coverage actions in a relevant registration form pages. These actions are repeated in a few places so I need to refactor it to be in line with DRY.
I have validation for ch... |
I wrote a simple image scraper for the Desktop Wallpaper project by The Fox is Black. The site is a fantastic (yet, apparently dead) blog full of fabulous images. However, there's no way to download an entire bundle of images, hence this simple scraper.
I'm putting the code up for scrutiny. Any areas for code style and... |
I would like to ask a code review regarding a concrete exercise. Let's suppose I have to get the number of all specific substrings in a string.
We call something specific if any of these conditions are is true:
The string consists of similar characters. For example: "aaaaa"
The string consists of similar characters... |
The task is to find the maximum number in an array of numbers.
I have taken every number in the array to be byte-sized.
I have written the code such that the result is stored in ch at the end.
The code is written to run on Intel 8086.
Code optimization and improvement required.
org 100h
;registers: bx - to stor... |
I am trying to improve the following code to make it more broadly applicable and quick to use.
# IMPORTS
import numpy as np
import pylab as py
import matplotlib.pyplot as plt
from scipy import optimize
from scipy.optimize import curve_fit
# THE INEFFICIENT PARSING: SELECTING VALUES FROM SEVERAL TABLES ONE BY ONE
skip... |
I am new to C, and I have very little formal education on programming (Although I am currently in college). I work as a Robot Automation technician, and me and my team are required to document a lot of things. I wrote a program that we run on our robot computers to do this, but the language (RAPID by ABB Robotics) had ... |
I would like to know any suggestions about to improve my code solution and your rating of my approach to the problem, I based my code on the fact that if the strings have different length removing one character from the longer string is equal to add one character to the shorter one.
Description
One away : There are th... |
I am currently refactoring a larger solution where the compiler gave multiple warnings about disposing the used System.Timers.Timer instances. The timers are running in short intervals so I would have to check before I dispose the timer if the elapsed callback is currently active.
Following the implementation with whi... |
Consider this code:
class AssemblyFactory
{
public function makeAssembly(array $params)
{
if (array_key_exists('modelNumber', $params))
$pump = $pumpFactory->fromModelNumber($params['modelNumber']);
else if (array_key_exists('productId', $params))
$pump = $pumpFactory->fr... |
The following code is checking if the user's browser is IE and if this is the case and there's no localStorage yet, it sets a localStorage, which should be valid for only 24 hours.
(function ieAlert () {
var isIE = document.documentMode
var lastClear = window.localStorage.getItem('myLocalStorage')
var timeNow = (... |
I just submitted this code to solve the "When to take medicine" challenge on CodeChef:
#include <iostream>
#include <string>
#include <sstream>
int countDays(int dd, int subtract)
{
return ((subtract - dd) / 2) + 1;
}
int main()
{
int t {0};
std::cin >> t;
std::cin.ignore();
while (t--)
{
... |
I'd like some constructive feedback on the code that I have written to test the API for smartsh33t.com I wrote it in Python.
I wrote the program to take .json files and read them into the testrunner. then invoke the companies API for the create sheet functions, then record the results.
I am interested in general stru... |
I'm learning about the command design pattern and would like you to critique it for division of responsibility, especially with regards to how the robot "undoes" commands it previously executed and where those commands are stored (inside RobotController)
Everything seems to work correctly.
I do have a question:
If I w... |
The script downloads images and videos from a user's profile page on Instagram. It works fine, but I'd like to know if there are ways to improve it. All ideas and suggestions are welcome.
import sys
import os
import requests
import urllib.request
import time
import json
from colorama import init, deinit
from termcolor ... |
My code parses through a contiguous range of data in a spreadsheet (orng) and creates subranges from orng that contain the same string value (lot number) in the 6th column of orng. orng has 42 rows and 38 columns and each subrange has 1-15 rows and 38 columns.
As far as I know, I can't create a new range object for eac... |
I attempt to write a STL-like vector, mostly to figure out how it works. I wonder which parts look weird or what I made stupid. Any kind of comment is appreciated:
alloc.hpp
#pragma once
#include <limits>
#include <memory>
namespace p1v0t {
template <class T>
class allocator {
public:
using value_type = T;
templ... |
Overview
I got rubber-stamped in code review today even though I called out specific concerns about my own code and asked for advice, so I'm turning to this community for advice. Thank you for taking a look!
I'm implementing a simple protocol in C. The protocol is composed mostly of fixed-width messages, each of which ... |
An alternative to std::function for when compile time is more important than runtime performance. Doesn't pull in any headers.
(#include <functional> pulls in 19k lines of code.)
This satisfies my needs, but I'm curious how it could be improved (without adding any dependencies).
template<typename>
class func;
// Alter... |
My code works fine but I definitely have unecessary repeat code. I'd like to use functions so I don't have repeat code. I would appreciate any advise on how to make my password generator code more concise.
I've tried looking through other forums but I couldn't find the answer I'm looking for.
import string
import rando... |
I've been starting to migrate some C++ code from imperative to more of a functional style. I'm new to functional programming so I'm trying to get a sense of how well this code fits into the functional programming paradigm.
The purpose of the code is to scan tokens from CSV files, and currently passes all the written te... |
I have began to practice Python after a couple of years and for my first Project, i decided to make a fighting/rpg-like game with different characters. So far, I am only familiar with loops and functions, not classes or OOP. Please give me any feedback on how I could improve my code, through debugging, optimization, or... |
Report time at whole hours
#!/usr/bin/python3
import time
from datetime import datetime
from pydub import AudioSegment
from pydub.playback import play
bell_sound = AudioSegment.from_wav("/home/me/Music/audio/bell.wav")
while True:
now = datetime.now()
# repeats = 1 if now.hour % 3 == 0 else now.hour % 3
... |
I am using this syntax to query a table and return a record set and if the number of times total the customer has been emailed is less than 5, send an email with a canned response. If the number of times emailed is >= 6 then the draft is saved with bold text so the user knows to review this (case by case basis of what... |
Problem statement
There are sometimes foreach scenarios that require deep nesting due to multiple disposable objects involved that look like this:
using(..)
{
foreach(..)
{
using(..)
{
}
}
}
or a real-world example from one of my applications:
using (_logger.BeginScope().Correla... |
Description:
I wrote a Java program that checks whether the content of the given file begins with the Java class File Format magic number 0xCAFEBABE, in big-endian byte order.
It prints a success message if:
The first 4 bytes match the magic number
It prints an error message if:
The file doesn't exist or cannot be r... |
I have two versions of a function that performs the same task, however I'm not sure which one to use. Speed is something to take into consideration, but I also want to know what the best practice is. Below is the same function, except one uses an If statement to throw an exception where as the other uses the try catch.... |
Security assessment of our codebase reported the following vulnerability -
Vulnerability Description
The method x() in xyz.java stores sensitive data in a String object,
making it impossible to reliably purge the data from memory.
Vulnerability Risk
Sensitive data (such as passwords, social security numbers, credi... |
I have extensively reviewed 2 old articles on the subject: https://stackoverflow.com/questions/14766951/convert-digits-into-words-with-javascript and https://stackoverflow.com/questions/5529934/javascript-numbers-to-words and the answers therein using various methods for spelling a number into words in English.
I have ... |
I'm currently writing an activity reporting system based on users; upon looking through a lot of files I'm noticing that I do a lot of if statements that clearly can be rewritten;
How would you improve this structure of file? I can then take any ideas/improvements from this file & apply them to the rest of the project.... |
Problem statement
I have an application that needs to get files from various sources (disk, embedded, http, ftp, ...) so I use a common API for them:
interface IResourceProvider { }
Then I just provide implementations:
class PhysicalFileProvider : IResourceProvider { }
class HttpProvider : IResourceProvider
{
pub... |
I've decided to code Perlin noise generator in Java. It works pretty well, I just want to know If I am doing everything right and if it is a valid implementation!
PS : The metaVector2f and metaVector2i are just 2D vector classes
public float[][] generate(long seed, metaVector2i size, metaVector2i gridSize) {
Random... |
I have written the below code to read a huge text file of size 20+ MB and insert the values to a PostgreSQL table. The code is working fine, but I'm facing below issues in the code.
1) The code is taking too long to complete (nearly 2 hour). Is there a way to make it faster?
2) I wrote a condition (if field6!=field8: i... |
Sometimes I use std::unique_ptr<BaseClass> when all I really want is polymorphism. For fun, I made this container that skips the heap allocation. The downside is that it needs to know all possible derived types it will store in order to know how much space to reserve.
Any feedback is appreciated, but I'm especially i... |
I did two simple functions in VBA (see below).
When a user calls TirNoPer360 in Excel he must select cashflows and dates (as range), then he will get a rate (through iterations according to the second function TirNoPer360).
Function Opt(Caja, Fecha As Range, tasa As Double)
Dim i As Integer
Dim sum As Double
Dim Init... |
I have a PivotTable with a slicer that has 5 filters. I'm looking to have these filters to each be selected individually one by one and run a copy/paste code for every filter selected.
I've set up the code to work for each filter so far with completely rewriting/copying each code for each filter and everything works bu... |
I have created my own personal data structure libraries for C and I've re-engineered it about two times now and I've added alot of preprocessor checks and defines concerning OS type and compiler type.
One thing I've wanted to add to my personal libraries is having an informal "standard" fixed-size floating-point types.... |
The question is pretty self-explanatory. I wrote a regex pattern which should (in theory) match all possible integers and decimal numbers. The pattern is as follows:
import re
pattern = '^[+-]?((\d+(\.\d*)?)|(\.\d+))$'
re.compile(pattern)
How foolproof is this pattern? I tested out quite a few scenarios, and they all... |
I have written a function buildGroupRequests() to build an array of multiple groups.
It checks the size of the request group. If a request group is greater than MAXSIZE = 50 then it will create another group in an array.
The logic seems to be complicated, is there a way to rewrite this to be more readable and maintaina... |
An alternative to shared_ptr to minimize compile time. Intrusive. Reference count changes are not thread safe.
(#include<memory> pulls in 17k lines of code)
This satisfies my needs, but I'm curious how it could be improved (without adding any dependencies).
It's not particularly good at handling incomplete types (ref<T... |
For this challenge on HackerRank:
A valley is a sequence of consecutive steps below sea level, starting with a step down from sea level and ending with a step up to sea level.
Given Gary's sequence of up and down steps during his last hike, find and print the number of valleys he walked through.
For example, if Gary's... |
I am writing a program to generate primes in range 1 upto 10^9 but it seems to be timing out.
It implements the Sieve of Atkin
I have tried optimizing my code using bitsets and pragmas.
Please are there any other ways i can optimize my code. Code below
#include<bitset>
#include<vector>
#include<iostream>
#include<alg... |
Goal: Transfer Sheet Test1 2nd Column to Sheet TestS 2nd Column.
Where:
For each CPU in Test1. If CPU name in Sheet Test1 match CPU name in sheet TestS, copy 2nd column of that CPU in Test1 and paste in 2nd column of that CPU in TestS.
Else, create new row with the unfound CPU name and 2nd column after the last CPU... |
Just looking for some feedback/ways to improve this basic networking layer written in Swift. I'm still learning, please elaborate with as much detail as possible.
enum HTTPMethod: String {
case get = "GET"
}
class HTTPLayer {
let baseURL = URL(string: "https://example.com")!
func request(at endpoint: ... |
I wrote my first module in Verilog. The purpose is to maintain two counters and emit signals corresponding to VGA's HSync and VSync, as well as HBlank and VBlank pulses to be used by a video controller for the blanking intervals. The only input is a clock signal of 25.175 MHz. All timing information was acquired from h... |
I am good at logic and most of the time I write working code. But I want to learn writing code which follows best practices and is very efficient. I tried to implement some of them in my code but it still looks very unclean.
Could anyone please explain how I can make this code better and make it production standard cod... |
I am building a primitive Store Management System based on Qt and would appreciate some feedback.
Classes:
ManagementSystem - the logic unit of the system
User - might be either Admin or Manager (they access the system)
Member - the people who are the members of the Warehouse Club. Might be either Executive (obtains 3... |
I have deliberately avoided any OOP for this project. I'm fairly happy with my implementation of the classic strategy game "Chomp". The computer just uses a random valid choice, so no AI.
I would appreciate feedback on points of style and correctness. Is the code basically OK? Does it seem to have a coherent style? Wha... |
I agree that using regex to parse HTML is not a good way, in particular I am worried about their fragility with respect to change in the HTML.
The problem is that any alternatives are really too slow.
I am parsing this web page which is quite big (3MB). Somewhere in the html there is:
<form class="form-inline" id="exp... |
I'm pretty new and I posted on SO earlier because I wanted to make sure my code was right and all that and I got redirected here.
So I have this code that I put together (using Example C Program: Creating an MD5 Hash from File Content and some some other code I found online) to try to hash a directory in SHA256. I am ... |
I wrote a simple prime number generator in C++17. The function generate_primes(max) generates all prime numbers up to max. I aimed for maximum portability. Here's the code:
#include <cstdint>
#include <iostream>
#include <set>
#include <range/v3/view/iota.hpp>
namespace view = ranges::view;
using number_t = std::u... |
I am fairly new to C++ and programmed a maze game as an exercise. However, looking at it I can see it can be improved a lot. These are my requests if you don't mind:
I do not want to use the library <conio.h>.
I want to use another method instead of system("CLS").
This code is old; I think it has many unsafe codes in ... |
The goal of the following code is to calculate the mean and the standard error of vectors of randomly-generated numbers. I am looking for feedback both on the correctness of the calculation, and on its efficiency.
import numpy as np
def mean_and_stderr(num_of_iterations:int, instance_generator) -> (float,float):
... |
As an update (conversion) to my article “Simple Number to Words using a Single Loop String Triplets in JavaScript” in JavaScript, I have converted the code to work as a VBA function using the same method of "Single Loop String Triplets".
The explanation of how it works is detailed in the above reference article with im... |
A bishop can capture any other bishop if it lies along the same
diagonal line, so long as no other bishop is in its path.
Given a list of coordinates of the bishops locations, and a board size, determine how many bishops are unsafe.
This code has a time complexity of \$O(N*K)\$ where N is the number of bishops, ... |
I have a very simlpe app built using Kivy, for performing bootstrap algorithm (statistics). We must input some samples in the form x1,x2,...,xn (these will be received as a string "x1,...,xn" but then will be transformed into a list of the samples. From these samples, we will perform the bootstrap algorithm to approxim... |
I was tasked with using C++ to turn this
"Hello Jarryd, do you like socks?"
into:
"socks? like you do Jarryd, Hello";
Edit: The condition was to reverse this in place.
Here's what I came up with, knocked up in Visual Studio using the TestExplorer to run it. Criticism is much appreciated!
.h
namespace SentenceFlipNamesp... |
I need to generate semi-complex throw-able passwords (just one use) in my application. I want it to be:
at least 8 characters long;
contains at least 1 digit, 1 [a-z] char, 1 [A-Z] char;
I generate a few passwords a day, and I don't mind about speed. I'm more looking for suggestions about code being maintainable (or ... |
As the title says, I'm loading (or at least trying to) two CSV files and store them in two separate arrays. What I have so far worked, but it isn't the most elegant, no efficient solution.
The end goal is to read in two CSV files and run comparisons on them both - that's why the separating them is important.
Note - I ... |
I have two base classes: City and Building:
public class City
{
public string Name { get; set; }
public double Area { get; set; }
}
public class Building
{
public string Name { get; set; }
public double Area { get; set; }
public int Stories { get; set; }
}
With two classes that inherit from Buildi... |
I'm trying to implement the enumerate built-in using iterators. So far it works but for unordered objects, such as sets or dictionaries, I'm not sure if this implementation is considered valid, although it works.
class myEnumerate:
def __init__(self, iterable):
self.iterable = list(iterable)
self.in... |
I'm interested in a way to join three (or more) tables in a way that is more efficient (both in terms of conciseness of code and in terms of generating the results) than what I have currently.
Underlying tables:
table ISIN
+---------------+----+------+
| isin | id | code |
+---------------+----+------+
| US037... |
I often like to get a feel for a text file containing a lot of numbers quickly by making a histogram. One can do this in plotting software like Gnuplot, but sometimes having something in the terminal is nice (or can even make plotting later easier).
To this end, I wrote a program that reads numbers from stdin and sorts... |
I made this program as a baby step to creating an animal shelter management system that will be used in a real life animal shelter. The goal is to move from text files to an online database, and from console interface to a GUI. Two things I'm yet to learn.
I set out with the goal of creating a CRUD program that stores ... |
I would like to get some feedback on my completed code that finds and displays the articulation vertices in an undirected graph.
I included a test case within the code, it should (and does) print c as the only articulation vertex.
Also I would like to clarify my understanding on some things,
This runs in \$\mathcal{O}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.