instruction stringlengths 71 95.1k |
|---|
I'm just starting to use C++ so beginner feedback is fine here.
CPP code
(main.cpp, node.h, node.cpp, trie.h, trie.cpp, utils.h)
main.cpp
#define BOOST_PYTHON_STATIC_LIB
#include <string>
#include "boost/python.hpp"
#include "boost/python/module.hpp"
#include "trie.h"
BOOST_PYTHON_MODULE(ptrie)
{
using namespace... |
I am working on a little thread-safe, garbage collectible memoizer for Funcs in C#.
The goals:
Make it easy to Memoize deterministic functions.
Make sure invocation of a memoized Func with a given input is only actually computed once, even if invoked from multiple threads simultaneously.
Make the memoizer's cache opti... |
I am learning programming online and currently watching CS50 lectures, in third lecture, professor introduces us to merge_sort though only through pseudo code, so I wanted someone to review my implementation and tell me where I can improve and what I possibly missed.
#include <algorithm>
#include <assert.h>
#include <c... |
I have created a neural network that can identify watermarks and can classify them to which company do they belong. Now I created a script that will identify watermark from a folder and move them to different folders where they belong. But this script is quite slow and consumes too much RAM. What should i do to improvi... |
This is my first routing system on PHP. As you can see it's very simple. Any advice or tip about it that can make it better? I want to make it better so I could use it in real websites.
First I include db connect, then get the URL, if the URL have special index like post id or post name, then include post.php or if $s... |
I have a web application that allows users to create customs items and later change those items. For eg. a change, the application takes the parameters and performs some basic sanity checks.
If the checks pass, a REST service is called and the result of the response is converted to an ActionResult that can then be fur... |
My goal is to create a compact function that can create a JSON Like object from JSON string. I want a function with a small footprint that I or anyone who wants to use it, can simply paste into a module and use. At 61 lines of code, I am happy with its size and portability. Any feedback on ways to improve the perform... |
The following excerpt is part of a web application microservice framework.
The goal of the provided module is to define a base class Message that may be configured by INI-style configuration files providing the message text in several languages. The code is limited to Python 3.4.
"""HIS web API messages."""
from confi... |
Let it be clear that in this question I ask for further guidance with my current version of Makefile used for my own Shell OpenSSL file en-/decryption scripts, not those scripts themselves.
I did my best, but this is my own first Makefile, so I better give it to you for review. I may only think the work is done, there ... |
Given an integer X within the range of 0 to 9, and given two positive
integers as upper and lower bounds respectively, find the number of
times X occurs as a digit in an integer within the range, excluding
the bounds. Print the frequency of occurrence as output.
Input: The first line of input is an integer T, deno... |
The task is simple to understand: how to shuffle an array keeping some elements fixed.
Let us take an example: starting from the array [1, 2, 'A', 3, 'B']. Having both 'A' and 'B' as fixed elements. Therefore the process needs to only randomize the position of all other elements in the array. Thus leaving us with six d... |
As a hobby project I implemented Game of Life in Java using Swing. I don't have much experience with Java using Swing and would like to get feedback on the code.
One thing in particular that I would like to improve is how cells at the edges of the board is handled, right now they just get stuck.
All code and some tests... |
Can I optimize this Tic-tac-toe game or make it smaller?
Known optimizations: string turn = "X"; can be changed to char turn = 'x';
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.... |
Recently I have attended an Interview with a firm. They gave me a task to complete. I have done it and tested it as well. But they rejected my code. Is the given code properly written? Is my coding style good enough?
The Question is as below:
Problem Description
The objective of this problem is to allocate the orders ... |
I'm trying to increase the performance of my N Queens Puzzle solution. I'd find some threads on SO already but they don't appear to help me to increase performance.
My best solution, however, is a strategy with a constant amount of working threads. I also tried to implement a solution with RecursiveTasks. But it appear... |
I'm pretty new to large projects, and usually my code is neat and manageable. But now that I'm about a month deep, things are starting to seem sloppy (or at least not aesthetically pleasing).
Are there any good methods/things I should keep in mind when designing a function that is compact and neat?
Function is question... |
I've written a simple Java class to encrypt and decrypt files using AES. The code works and I'm able to encrypt and decrypt files.
However, I understand this is an easy way of implementing AES and far from the most secure (my usage of ECB mode for example).
I'm looking to improve the strength of encryption this code pr... |
I've written an Arduino sketch to continuously read values from multiple analog IR distance sensors, average the last 7 values and output in millimeters. Being pretty new to both Arduino and embedded programming, I'm sure there's a lot of room for improvement. Any critique would be highly appreciated, including idioms ... |
I wrote a Python script that generates a Sudoku puzzle. Everything works just fine but it takes too much time to generate puzzle from a completed board (remove_cells).
How can I enhance the efficiency and make it faster?
import random
def generate():
""" Returns a completed Sudoku board """
board = [[cell() f... |
Here is a class I'm working up to register classes derived from a Module base class. These classes may or may not be instantiated (via the ModuleCreatorBase::create() method) based on some logic which is not yet included in the code.
I wanted to allow constructing Modules which take no arguments and Modules which take ... |
I made a really simple Dice class and test script in Python as a gist. It is simpler than other dice I found on StackExchange being here and here. I made it simple for modularity and reusability. Granted, there are some quirks such as its max value being determined by a system's word size that may hinder its use. The w... |
I am making a Schema to store items from Wynncraft's API.
See an example assortment of items here:
https://api.wynncraft.com/public_api.php?action=itemDB&search=a
I have not finished making the Schema because I want to know if there's a better way I should approach it:
const mongoose = require('mongoose');
const unique... |
PURPOSE:
In order to get comfortable with Python classes and object-oriented programming, I've decided to simulate the Exploding Kittens card game. To make it easier to program, I've greatly simplified the rules of the game.
I'd really appreciate feedback on my code to identify errors in syntax, style, modeling, or exp... |
I wrote a simple program to print out any vowels found in a string, as well as the amount of times that vowel occurs.
Here is my code:
#include <iostream>
#include <string>
#include <map>
void findVowels(std::string& theString, std::map<char,int>& map);
bool vowelCount(char& temp);
std::ostream& operator<<(std::ostre... |
I want to utilize namespaces and make the code on this file uploading script more secure, and cleaner looking, here is what i have so far
it uploads an image and inserts it into a database.
I want to be able to use namespaces within view files, without it looking messy.
i know i can use laravel blade etc, but for the s... |
I'm trying to use composition to design an application that works with different types of bank-accounts. Instead of deriving from a Account Class I want to have separate account classes that are created with appropriate behaviours with a factory. For the example below can I please get some comments on:
Overall design ... |
Write a function that a receives file name and an integer N as arguments, that represent a binary file which contains N integers, which constitute a permutation. Return the number of cycles in the permutation.
Code
int countCyclesHelper(int* array, int N) {
int i, first, current, temp, counter = 0;
for (i = 0; i < ... |
Write a function that a receives file name of a txt file, which contains unknown number of words of max length 10 each. Print the word with the most occurrences. Assume the input is correct and contains at least one word.
Code
#define MAX_CHARS 11
int mostFrequentWord(char* filename) {
char ch;
int i, j, k, occurr... |
Question.
There are 5 CPUs and N number of tasks in the queue. You have to use
minimum CPUs to process the tasks.
A task is of format [arrival time, time to process the task].
Note:
You can only use at most 5 CPUs. If it is not possible in 5 CPUs, print -1.
The time to process the task should not be greater than 10... |
For a school project, I've to create a website for a refugee foundation in Haarlem. But designing is one part, coding the actual design is a whole other world. The hamburger menu went pretty well and I'm very proud of that piece of code, but the mosaic tiles just don't feel right. It is designed mobile first, so the de... |
I've written the code to perform some action every 5 minutes, regardless if the application is currently on the foreground or not. I'd like to get a feedback about correctness - have I chosen the right API to do the work and is it implemented correctly?
This is the code:
PeriodicActionFacade.java which is the entry poi... |
I have a simulation that runs a process on a tree structure, where the slow processes down processes are separate from each other. This looked like a thing that would be a prime candidate for multiprocessing to me, so I tried to wrap my head around the python multiprocessing module and its locks, pools etc. and wrote a... |
My first real Python project. I have a web scraping PowerShell utility that scrapes Kijiji (Canadian Craigslist) for listings and loads them into MariaDB. What the bot does is periodically check the database for listing flagged as new. Creates embeds from the listing data and post them to an appropriate discord channel... |
I haven't been coding super long in this language so if someone could take a look and help me improve my code and make it more efficient, that would be great! The HTML is one input field that you can type a show and then you get the result on the screen. From the beginning you get the top ten shows with the highest rat... |
The code opens some files and does some transformations. I am looking for syntactical help where I can do the same thing I am doing now but speed it up. I can supply some of the calls code if requested.
Can anyone help me optimize this? I need help limiting my access to workbooks in order to speed this up.
Public Sub g... |
I have two Pandas DataFrames and I want to subset df_all based on the values within to_keep. Unfortunately this isn't straight forward pd.merge() or df.join() because I have multiple columns that I want to match on, and I don't care what order the match happens.
I don't care if df_all['source'] matches in either to_k... |
This is a prime numbers generator class, loosely based on the sieve of Eratosthenes. It is supposed to generate a decent quantity (i.e. millions) of prime numbers.
static class PrimesGenerator
{
private const int StartFrom = 2;
public static IEnumerable<int> GetPrimes()
{
var number = StartFrom;
... |
Using PowerShell I have made a class based Kijiji webscraper that records progress in a MariaDB table (for use in another project). I had made this as a module with cmdlets months ago but I wanted to revamp it using PowerShell Classes while I was at it.
While they are not as good as C# classes this is baby steps for m... |
This a snake game I wrote about 1 month ago. It's working well.
Looking for any suggestions for my code, I want my coding improved.
jsfiddle link http://jsfiddle.net/geswhvdc/
/*snake game by Chase last edited 4/5/2018*/
/*lib*/
let getRandomInt=max=>Math.floor(Math.random() * Math.floor(max));
let getBetweenInt=(mi... |
Given an integer number of seconds, return a string which represents in human readable format the number of days/hours/minutes/seconds that are equivalent.
from datetime import datetime, timedelta
def GetTime(sec):
d = datetime(1,1,1) + timedelta(seconds=sec)
days = (d.day-1,'d',' ') if... |
I am currently studying Latin from Wheelock's Latin. Given that a core component of language learning is memorizing vocabulary I needed somewhere I could memorize vocabulary, online, namely Quizlet (which allows you to import character-separated data sets, .csv, etc.). Thankfully, I was able to find a site, The Bridge,... |
I recently launched my first website, and despite being very proud of how far I've come, I know that my code is more "I got it to work" than "It works the best that it can." I'd like some criticism, and insight into how you would accomplish the same effect.
This script shows and hides overlapping Divs to tell a story t... |
I am requesting a review for my solution to this problem from exercism.io. I'm posting it here since there is not always input on solution submitted through exercism.
The problem is as stated:
Calculate the Hamming difference between two DNA strands.
A mutation is simply a mistake that occurs during the creation or
... |
I've been annoyed with the new side bar layout, so I chose to hide it. But then, the useful links were gone, so I decided to make this little user script in Tampermonkey to bring them back to [roughly] how it looked before. Here is a screenshot:
It's nothing very complicated, and it's all plain regular JavaScript, bu... |
How can I optimize this code? I want to use more C++11 features.
game_control.h
#ifndef GAME_CONTROL_H
#define GAME_CONTROL_H
#include <iostream>
#include <array>
#include <string>
class Game
{
unsigned int number_of_turns = 0;
unsigned int user_score = 0, comp_score = 0;
std::array<std::string, 3> data =... |
This is a late followup to a previous question of mine on same subject.
Context:
I want to have a tool that allows to use all the C++ goodies (algorithms, for loop on containers, etc.) on a multidimensional contiguous array whose sizes are only known at run time. That immediately means that std::arrays are off (compile... |
We've tables adm_app, quals_data to which personal_data is a parent table. We are retrieving data from another table sub_marks which has a foreign key of quals_data and the query is like this
select
sub_marks.obtain_marks,
sub_marks.convertion_marks,
sub_marks.max_marks
from sub_marks
inner join quals... |
I'm trying to implement a Timer that schedule an async action with the following requirements:
thread safe
only one action should be running at any given time (period countdown should start when the previous action has been terminated)
the action should be cancellable
Here's the code, can you please review it and po... |
I have a number of related classes (Burger, Pizza, Cupcake) with a common base class Food and a function eat which consumes class instances. The design shown here works, but I can't help but feel it could be made better or more elegant. Can you help me make a more nutritious and satisfying lunch?
First, here's the c... |
I have attended an interview recently and my coding got rejected by the panel. I am new to Python and is mentioning my code below. Please help me improve the code quality or any bug:
Question: Given weekly slot availability and current time, return the very next 'n' available slots. Function I have implemented are get_... |
I've just made this "serialization" module in Ruby that takes a hash and outputs a XML string.
module Xml
extend self
def serialize(hash_obj)
hash_obj.map do |key, value|
noderize(key, value)
end
end
def noderize(key, value)
if value.class == Hash
node_value = serialize(value).join
... |
I am interested to find an absolute value (not an approximation) of "combination without repetition" for given \$n\$ and \$k\$, or \$\binom{n}{k}\$.
The brute force solution would look like this
private static ulong Factorial(int x)
{
ulong res = 1;
while (x > 1)
{
res *= (ulong)x--;
}
ret... |
I've started learning programming and as matter of practice I've decided to make a program that will output all possible string combinations and put them in a file.
I've manged to do that and it works perfectly fine. Then I added the option to generate words of different length, so the output looks something like this ... |
A simple game of TicTacToe.
Please review for style and other.
Is this a proper ViewModel?
namespace TicTacToe3
{
public partial class MainWindow : Window
{
private ViewModel viewModel;
public MainWindow()
{
InitializeComponent();
viewModel = new ViewModel();
... |
I have a script that uploads an image, inserts it into database, and displays it on the home page.
However it's not secure, how can i make this script more secure and make sure it allows only jpeg/jpg files.
UploadController.php
public function upload_image($filename, $image_name)
{
$this->uploadfile = $this->d... |
I am learning about stacks, queues, lists & hash tables from the book Data Structures using C and C++ by Tanenbaum. I am also spending time to take in OOPs essentials, to ensure they sink in well, so that I don't learn by osmosis/need-be basis in the future, and there are no knowledge gaps.
The author of the book sugge... |
I am trying to retrieve the series, seasons and episodes from the movie database, however I am pretty new to Ruby on rails and I feel like what I am doing could be improved a lot.
I use an ActiveJob to retrieve all the data, and call the job in the after_initialize initializer.
Here is the code for the job:
# app/jobs/... |
I decided to study an animation in React and created a simple example of an collapsible panel using CSSTransitionGroup.
To make an animated collapsible, I added max-height: 0, overflow: hidden and a transition for the max-height property, to the panel class.
It works but I'm not sure that this is best way to create col... |
Premise
I'm writing a simple postfix calculator app in C++ using the Qt (5) GUI framework. This is simply for practice with software development.
Visually, my calculator looks like this:
The calculator has a Back button (with a corresponding keyboard shortcut) that allows users to erase the previous input.
The code
Al... |
For a small blog with a limited count of categories, I wrote this code to fetch categories and subcategories from the database.
I used a recursive function to call all categories and sub categories , my goal since I do not have a lot of results is to get them all and display them.
So here is my code. I wish to get your... |
I am new to C++ and game programming. I am using SFML for graphics. I wrote a clone of Sokoban in my free time and to be honest, I am not happy about the result. I feel like I reused some code too many times. Please don't hesitate to criticize every bit of it. Also I am open to advices about the improvements and update... |
A while ago, I wanted to make a multiplayer game, so I wrote some TCPClient and TCPListener code, and it worked, but it was messy. I looked around for a way to use the TCPClient with events, but I couldn't find any good APIs for it. So I made my own.
This library successfully turns TCP networking (sending messages to a... |
I am working on an application that has various "panels" contained within splitters. I wanted the panel border to change color when one of it's children gained focus. Here is a simple example of the solution I came up with. I think it is pretty clean and quite scalable, but I wanted to see if there is anything I might ... |
I am trying to write a basic function that will decide whether the object already exists in array of objects based on unique id that is inside this object as a property. Upon searching I came up with this code, and it seems to be doing the job fine, but I can imagine there is a better and faster way to determine whethe... |
I wrote a program sometime ago that reads csv files, sorts, reorders and groups their columns/rows' content (with itertools) and later labels the groups using a dictionary. The groups and dictionary are then flattened and rows of length N (columns) are uploaded to a spreadsheet. This is another function, not specific t... |
I have a class with some mandatory properties which I set via constructor, like this (properties omitted for sake of simplicity):
public SqlDependencyEx(
string connectionString,
string databaseName,
string tableName,
string schemaName = "dbo",
NotificationTypes listenerType ... |
I did it and it works as intended but it seemed very inefficient. I made the string a list, then I standardize it (removing accents, commas and points). After that, I count every word using a dictionary, then sort it in a loop.
Is there a better way to do it?
Edit - Thanks to you both, with your tips I managed to impr... |
My app is setup where there are musical artists and albums have message boards through a has_one polymorphic association.
class Artist < ApplicationRecord
has_one :board, as: :boardable, dependent: :destroy
after_create -> (artist) { BoardGenerator.create(artist) }
after_update -> (artist) { BoardGenerator.upd... |
I have this class/service, which I need to maintain. Its purpose is to manage a temporary directory so that
all content can be deleted on next restart
files are not left behind when you're done with a unit of work
Which may sound nice, until you realize that it
can be done just by deleting the whole temp dir
can be... |
I am trying to convert filesystem paths to a tree.
I have following paths
> /path1/path2/path3
> /path1/path2/path3/cell_lists
> /path1/path2/path3/path4
> /path1/path2/path3/path4/ALLCELLS
> /path1/path2/path3/path4/ALLCELLS/cells
> /path1/path2/path3/path4/ALLCELLS/cells/field
> /path1/path2/path3/path4/ALLCELLS/ce... |
I have a controller action that takes JSON bodies. I know, that the JSON is either of type A or B, where both classes are of interface IModel.
[HttpPost]
[Route("api/post/")]
public IHttpActionResult MyPost([ModelBinder(typeof(MyModelBinder))]IModel viewModel)
{
doSomething(viewModel);
... |
I have a list of items 116 thousand and my mapping function is taking quite some time to process. I am using the file helpers library to write the CSV to disk but its the for each that is taking forever to complete any ideas how I might optimize this.
private List<ItemsExport> MapTradeItems(List<TradeItems> tradeIt... |
This is my code to chmod all .htaccess files under all website dirs under public_html dir.
The reason I use this code is to make sure WordPress plugins won't "freak out" and change my .htaccess file undesirably.
This is a shared server environment so I can't access htppd.conf instead, and must edit the different .htacc... |
First I explain the data to give context:
We have the following folder structure:
atlas
caballo
cabeza
etiquetas
cabeza01-es-latin.txt
...
cabeza20-es-latin.txt
original
cabeza01.nrrd
cabeza01.png
...
... |
Recently I was given homework to make a hangman game, where I wrote the below.
How can I refactor this to use classes?
import secrets
def guess_the_word():
tries_left = 9
output = ["_"] * len(secret_word)
print(str(' '.join([letter for letter in output])).strip())
while tries_left >= 0 and not secre... |
When I run my code, I get an "Excel not responding" error at this sub as I step through the code, more specifically the write portion of this code. Can anyone help optimize this? I think this is because the loop is writing so many records cell by cell (50k) records and it's causing my Excel sheet to become unresponsive... |
I am solving a question in which we are given the LCM and HCF and two numbers 'a' and 'b', our task is to find the pairs of numbers between a and b [inclusive] whose HCF is the given HCF and LCM is the given LCM
I have written a code with time complexity O(m) where m is the number of integers lying between the range a... |
Warning
Wall of text, little bit of code. This question is about as much as introducing the language as it is about whether or not I still know how to write the language.
Introduction
Programmable Logic Controllers (PLCs) are industrial, heavy-duty computers used to control (semi-)automated processes in factories. The... |
Given an array of integers, replace every element with the next
greatest element (greatest element on the right side) in the array.
Since there is no element next to the last element, replace it with
-1.
Input:
The first line of input contains an integer T denoting the number of
test cases. The first line of e... |
Looking forward for C# Nullable Reference Types in C# 8.0. I do not like to use the preview implementation in a production code though, so just went with these simple helper classes intending them to be upgraded to new syntax by search and replace when time comes.
Usage sample:
static void Main(string[] args)
{
va... |
I'm working on some book material on classes and interfaces in F#. My example is a latitude/longitude class:
open System
type LatLon(latitude : float, longitude : float) =
member __.Latitude = latitude
member __.Longitude = longitude
override this.GetHashCode() =
hash (thi... |
I have a dictionary with about 4.2 millions of lines, each line contains a word (+some trash data I don't need) or whitespace. I need to convert this into a dictionary of anagrams (words that can be created from another words by changing positions of letters).
So far I came up with this solution:
class Program
{
st... |
This is my first real excursion into Python, coming from C#. I wanted to see if my code is well-formatted and efficient.
The following will read the needed codes from a Database Table, then submit the codes to an API, store them in individual objects, and then dump them back into another table in the Database.
import ... |
I happened to need to find both the maximum and the minimum of an array, so I decided to implement a minMax function in D.
Questions:
Is this an efficient implementation?
Is it readable?
Any general feedback is appreciated.
Thanks!
import std.range;
import std.traits;
import std.typecons;
import std.functional;
clas... |
This is my first deep dive into C, and I want to make sure that I'm not doing anything stupid. The code below creates an "Array List" of sorts, which automatically resizes itself.
This code is meant to run on a PIC24, where memory is at a premium.
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <std... |
Recently I have finished my first bigger Android project. I made a little Tetris App.
Here is a picture of my app in emulator:
My Tetris has following functions:
fast drop down
play tetris music
start/pause button
Gameover Screen
View which shows next Piece
"Levels" if you reach a particular score, level will be incr... |
This is the crux of a problem found on one of those code challenge sites.
I'm fairly new to programming and this was a difficult challenge. I've attempted to solve this with stacks and calculating totals on the fly. I think this is pretty close to O(n). With the exception of values repeated without a larger value betwe... |
I was wondering about my HTML & CSS. I'll just create a list as to what concerns I have:
Does my HTML & CSS follow proper coding standards and conventions?
Am I making proper use of semantic tags in my HTML document?
Is there any better way to do some of the stuff I am trying to accomplish? (e.g. centering elements in... |
Need reviews on my readable implementation of Trie. Also what other methods can or should be added to this data structure.
from collections import defaultdict
class Trie:
def __init__(self):
self.root = TrieNode()
def add(self, word):
curr = self.root
for letter in word:
n... |
Looking for a way to efficiently use 3rd party CSV reader without making a dependency on it. I would also prefer to make my class be available everywhere (not just in IoC container injectable Services), so I decided to go with a questionable decision – configure through the static property. Can you see a way to reduce ... |
This function started very clean but I had to add requirements:
Added a Stopwatch to only update the caller periodically. I guess that responsibility could be handled elsewhere but I'm undecided about whether or not it should be.
Added a Stopwatch to only check a computationally expensive operation periodically.
Give ... |
Code reviewers, I have changed code whatever be suggested by code reviewer and I want you to give me some feedback on the basis of my new code.
I have written TCP server client code to send data of any size (1 byte - 200KB) in a loop.
The client (A) sends data to the server (B). B then sends the same data back to A. A ... |
I made a simple C# library which detects incoming data from 1 or 2 scales plugged into a computer's usb.
My main concerns:
I feel like I should potentially be using events/delegates to process the data, but I'm not sure how to approach this so would appreciate any advice
My error-handling can probably be improved
The ... |
I have automated a small task. My application is a windows based application. I was using Java language and worked with Winium tool. I have to select players from the GUI and there is a scroll up and down is in another place. I want to improve my coding. There is some repetition in my code. How do i avoid that ?
public... |
Given is an array $array and a key $key. If the array has the key, then I want to return the value, otherwise null. Is there a better way in PHP7 now, then doing it like that:
return (empty($array[$key])) ? null : $array[$key];
|
In a Laravel (PHP framework) project, we implemented a backup feature - backing up user-generated files and database tables. What we've searched so far, the best solution in backing up mysql database is to run the mysqldump command.
So we made the command:
<?php
$storage_path = 'path/to/backups';
$database = env('DB_DA... |
I have two windows services working in parallel. Each of them is using a network drive that is connected and disconected dynamically by each one as required. They do it by executing net use command. (This is necessary because there've been issues with automatic reconnection when the server is rebooted. Not it's running... |
I have written a class that represents humans. The class will serve as the basis for creating a program for managing and analyzing family trees. However, before using this class as the basis for my project, I would like to ask if my class is useful for this purpose, or if I should implement certain things differently. ... |
I am storing item's price in database as int. Now, I want to display that data in my a app s it were double. I found 2 ways to do this:
class Item
{
public int Cost { get; private set; }
public string CostFormatted { get { return ((double)Cost/100).ToString(); } }
}
and second:
class Item
{
private int cos... |
Is there a better way to read in
the name of a textfile and
the content of a text file into a dataframe?
(Or is my implementation even okay?) Can I avoid storing the data in lists?
path =r'.../test_age7'
allFiles = glob.glob(path + "/*.txt")
df_7 = pd.DataFrame() # create empty DF
stories = []
filenames = ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.