instruction stringlengths 71 95.1k |
|---|
Im refactoring a large internal legacy application and part of the stuff I want to get rid is the widespread code repetition.
I'm starting with the way the website checks if a User can access a route e.g., '/admin` and which parts should be rendered or not.
I made this little function and works pretty well but wante... |
Very new to coding, so please don't bully me.
Implement the legendary caesar cipher:
In cryptography, a Caesar cipher, also known as Caesar's cipher, the shift cipher, Caesar's code or Caesar shift, is one of the simplest and most widely known encryption techniques. It is a type of substitution cipher in which each let... |
following is My Code for Collapsing div on Click using JavaScript It is Working Fine But i Want to Precise the onClick Function in Script Any Suggestion will Highly appreciated.Thnx In Advanced.
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="https://fonts.googleapi... |
I've made a sudoku solver which solves a sudoku, given user input, and can also extract digits from a picture of a sudoku to solve it. I've used OpenCV and GTK+ 2.0 to achieve the above. I am very open to any kind of suggestion on how write proper and understandable C++ code. I have the following question:
How would y... |
This is a follow-up (somewhat) to this post. I said somewhat because I've kinda changed most of the logic.
Changes:
I've changed the project name
I've changed the CLI UX
I've added encryption / decryption
I've added a setup.py for easier installation.
I've added click
Temporarily removed type annotations & docstrings.... |
With a specific requirement of showing/hiding the pages, the following implementation has been carried out.
The pages which needs to be hidden will be provided through an array
this.unshowPages = ['menuPage', 'aboutusPage','linkedInPage'];
The corresponding HTML file,
<ng-container *ngIf="showaboutPages">
<l... |
I applied for Junior Java Developer in some company.
Got a task:"Listing words (without duplicates) from text, provide lines where appears, count them."
Output should looks like:
Alphacoronavirus - 3 - pozycje -> [1,3,2]
gatunki - 4 - pozycje -> [1,3,2,7]
Koronawirusy - 2 - pozycje -> [3,2]
Wirusów - 1 - pozycje -> [1]... |
I have the following function which works properly and returns all of the rows from a specific table, then loops through each row to add data related to it as a subarray.
public function fetch_products() {
$return = $this->db->all("SELECT * FROM consumables_products");
foreach($return as &$r) {
$r[... |
I have the below code for a A* pathfinder, however it is taking upwards of 10 minutes to find a solution using a simple 1024 x 1024 array.
I had to comment out //Collections.sort(this.openList); as it was throwing a comparison method violates its general contract! error when running.
Is the algorithm correct and any i... |
I have to write a simple web application using the Java Spring framework as my course project. So I decided to write a simple Stack Overflow clone. My application has the following features:
Authorization (using Spring Security);
Posting new questions and answers;
Voting up/down for questions/answers.
I am very new i... |
I have an input dataframe like below, where 'ID' is unique identifier, 'Signals_in_Group' is a derived field containing list of all unique 'Signal' column values present in a 'Group'. And 'Signals_Count' is also a derived field whose values are count of items in 'Signals_in_Group'.
groups_df
ID Timestamp Signal ... |
I'm writing a small program to plot new COVID-19 infections. As of right now, I have it so the program reads the given data file, pulls out the daily cases and dates for each country, and adds together all the cases for a given date. However, because both of the lists generated have lengths of over 2000, it currently r... |
I have written a series of functions that are designed to create a space-filling curve (similar to a Hilbert Curve) that is intended for symmetric matrices (as opposed to a square region).
I plan to ultimately use the function in R, but decided to write it in c++ for the sake of speed.
Also, you may notice that I am ... |
I have written a simple Integrator class in C++17 that can perform either a definite single integration of a single variable or a definite double integration of a single variable using the same integrand.
Here's my Integrator class:
Integrator.h
#pragma once
#include <algorithm>
#include <utility>
#include <functi... |
This code below, was for my school project, first year. I am new to C programming, before which I learned Python. Hence, I do not know the tweaks and tricks in C language. What are the various ways to improve the code? Moreover, my requirement requires me to have indentation. I am unsure how to apply that indentation i... |
This question is related to my previous two questions, in which I have implemented HashTable, and also SortedListMap and BinarySearchTree. Since the three types of mappings have similar interfaces, if I wrote three separate tests for them there would be lots of boilerplate codes. Instead I decided to write a single tes... |
Intending to reuse the installation process of a GNOME extension, I wrote the following script:
#!/bin/bash
# It installs a target gnome shell extension defined via url
STORE_URL="https://extensions.gnome.org/extension-data"
EXTENSIONS_PATH="$HOME/.local/share/gnome-shell/extensions/"
ZIP="gnome-extension.zip"
cd ~/D... |
I'm working on a program that takes website links and extracts the website name. Right now, it works perfectly, but it is very much a brute force approach and very ugly in my opinion.
Some of the properties of the links are as follows:
- entirely random
- will all contain https:// and .com
- may not contain www.
Here's... |
I am just trying to understand the algorithm of the problem statement
Given an array, we need to find the maximum sum of absolute difference of any permutation of the given array.
Here is my implementation after following the algorithm mentioned in the link
static int sumOfMaxAbsDiff(int[] arr) {
Arrays.sort(arr... |
Find the limit to the number of items that can be prepared with given amount of ingredients -
Let's try to understand with input/output pattern:
Input
4
2 5 6 3
20 40 90 50
Output
8
1st Line: Number Of Ingredients
2nd Line: Each unit required from total ingredients given
3rd Line: Each value represent total number... |
This is my implementation of Clojure's assoc-in function. I am looking for tips on making it more idiomatic and in general, better.
(defn my-assoc-in
[m [& ks] v]
(let [sorted-keys (reverse ks)]
(loop [curr-key (first sorted-keys)
rem-keys (rest sorted-keys)
curr-map (get-in m (reverse re... |
So, I made this in order to practice my Python OOP and algorithms skills, and refactored it a bit after a few months of s tale. May anybody review it in a PR please? Want to see the flaws that could be fixed, considering I didn't improve much since the initial development of this.
https://github.com/fen0s/TABSlike/
One... |
I submitted my solution for palindrome Index coding challenge but I get "test cases terminated due to time out error". My code is working and so I don't know what else to do to optimize it. Please help:
function palindromeIndex(s) {
let palindrome = s === s.split('').reverse().join('')
if(!palindrome) {
... |
note: You might be scared seeing the length of the post, but it's actually not that long because you don't need to read the compiler logs or the python code to understand my code (I wish StackExchange allowed foldable code like github).
I've been reading CodeReview for a while but this is my first post here. This is a... |
I have the following short function code that converts Exponential (e-Notation) Numbers to Decimals, allowing the output of large number of decimal places.
I needed to cover all the e-notation syntax permitted by Javascript which include the following:
Valid e-notation numbers in Javascript:
123e1 ==> 1230
1... |
I am working on a project where I want to generate random throughput on a particular method so that I can do some performance testing on it. This way I can test my method by generating random throughputs and see how my method works under all those scenarios.
For example: I need to call my doIOStuff method at an approxi... |
I can't find out which loop is better performance than another, if you know help me.
I try about loops in js and performance in this site
and this is code snippet, you can run and check.
const array1 = [];
for (let i = 0; i <= 50000; i++) {
array1.push(i);
}
//for...
var forT0 = performance.now()
for (let eleme... |
I was just reviewing the source code of Nifi, see explanation and public version of the source. This got me wondering whether there are any obvious improvements here to increase the performance of the random generation.
As there are many people using this, the size of the random array could be anything, but probably it... |
I have written a function that prints all the prime factors for a given number. Here is my code
static void printPrimeFactorization(int number) {
if (number <= 1 || isPrime(number)) { // If given number is already prime, no more factors for it
System.out.println(number);
return;
}
// check divis... |
Is this my_upgrade_mutex class a valid implementation of boost::upgrade_mutex semantics? (Ignoring the try_* and *_for/*_until part.)
class my_upgrade_mutex
{
std::mutex xmutex;
std::shared_mutex smutex;
public:
void lock_shared()//u->s
{
smutex.lock_shared();
}
void unlock_shared()//s->... |
I'm new to std::atomic, std::mutex, std::unique_lock, std::condition_variable and more or less c++11 std::thread, so I wrote this little Job_Queue class, where you can submit a void() function and it will be distributed among some threads. I wonder if there's room for improvement or if I made to beginner's mistakes. Th... |
Implementing A Simple Singly Linked List
I'm trying to learn Go and wanted to implement various data structures and algorithms from scratch.
I wanted to try and implement a singly linked list without using slices.
In the sake of keeping things simple, I am not taking into account concurrent access to this list and am e... |
I am writing a game via SFML. In difference places I want to use loaded fonts. So I decided to write the fonts loader, so that load fonts only one time and use them in the future from class. My code:
enum class FontsID
{
PIXEBOY,
DIGITAL7
};
class FontObject
{
public:
FontObject::FontObject(const std::stri... |
I have stumbled across these unit tests in a code review that are using in memory db:
private DatabaseContext _context;
private Fixture _fixture;
[SetUp]
public void Setup()
{
_fixture = new Fixture();
_fixture.Customize(new AutoNSubstituteCustomization());
var options = new DbContextOptionsBuilder<Datab... |
please roast my code, I hope this is the good place to look for some advice on where I can improve.
Problem definition:
Apply modifications on values depending on date ranges.
Data:
Base array - holds dictionaries in the following format:
[{'date': 20200101, 'value': 1}, {'date': 20200102, 'value': 2}]
Modifier array -... |
I'm going through the book Grokking Algorithms which is in Python but wanted to write everything in C++. Up to this point everything's been pretty straightforward translation but the code for Dijkstra's algorithm really exploits nested dictionaries and weak typing which I used as an excuse to try out std::optional. I a... |
There are probably a lot better ways to do it, but take it as a learning exercise. Basically below is the JSON InputValidation and parsing using nlohmann::json which takes expected fields, objects arrays and verifies its presence and (optionally) parses them into an appropriate c++ structure.
inputvalidation.hpp:
names... |
In a part of our system a lot (I'm not sure how many, probably a couple thousand) of emails are being sent to the users at a specific time of the month. It seems this kills the server.
So I was asked to add the mailing of these emails to another part of the system that uses a Scheduler to do calculations.
The idea bein... |
I'm solving yet another problem in HackerRank (https://www.hackerrank.com/challenges/determining-dna-health/problem). In short: you are given 2 arrays (genes and health), one of which have a 'gene' name, and the other - 'gene' weight (aka health). You then given a bunch of strings, each containing values m and n, which... |
I'm working on a Node.js chat app project using the ws library. I have it up and running but I'm still making improvements and adding stuff like authentication, etc. Before I get too far, I am wondering what the best functional approach to handling messages (and other events) is. For example, right now I have the follo... |
I am writing a simple merge algorithm in Haskell. I wanted to add simple logging, hence am using the Writer Monad to include logging.
type ArrayWithLogging a = WriterT [String] Identity [a]
merge :: (Show a, Ord a) => ArrayWithLogging a -> ArrayWithLogging a -> ArrayWithLogging a
merge al bl = do
a <- al
b <- ... |
I am implementing an algorithm for estimating light at the ocean surface as a function of wind (waves, surface roughness), chlorophyll, and zenith angle. I want to do this using climate projections from CMIP6 as input for the period 1950-2100 on a monthly basis. I use Python and Jupyter notebook to read global values o... |
This outputs the manufacturer string associated with your CPU using the CPUID instruction. I wrote this up for a homework assignment, then found out that I didn't need to.
When run on my (virtual) machine, I get the following output:
EAX: 16
EBX: 756e6547
ECX: 6c65746e
EDX: 49656e69
GenuineIntel
What I'd like comment... |
I recently have been very interested in custom allocators, so I decided to make the very basic (this should be faster than malloc) bump allocator. Here is my code in C:
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <sys/mman.h>
#include <unistd.h>
#define KB(size) ((size_t) size * 1024)
#define M... |
I have an array of colors for my app to choose from. My goal was to have the app cycle through the array of colors, apply it to my object, and reset to the beginning once each color has been used. This is simple enough to implement, but I am looking to see if it's possible to clean it up slightly. The one complication ... |
First time posting and first real Python program that I use fairly frequently. I needed a way to pull a large amount of containers, re-tag them, save them (docker save) and clean up the recently pulled containers.
I did this pretty easily with bash, though depending on the container and depending how many containers I ... |
We have code that reads in a DXF/DWG file (drawing file) and then our own geometry library that converts everything into point, line, arcs, circles, and etc. objects. Then we have a Shape object which will hold one or many entities. Shapes can also contain other shapes as children and those shapes can have children.
... |
I have a directory with 'sets' of files that start with a state name followed by 4 or 5 digits (typically indicating year). Each 'file set' contains 3 files a .txt, a .png, and a .jpg.
Example of files in directory:
California1998_reform_paper.txt
California1998_reform_paper.pdf
California1998_reform_paper.jpg
Califo... |
I am working with cassandra using datastax c# driver. I need to pull data out from three different tables. Below is my code which does the job.
private const string itemMapStmt = "FROM product_data WHERE client_id = ? PER PARTITION LIMIT 1";
private const string itemSelectStatement = "FROM item WHERE item_id =... |
I test in a bash script if a variable value contains digits only.
There are two options, both give the valid results:
validate_is_pos_int(){
local value=$1
if ! [[ ${value//[0-9]/""} ]]
then
return 0 # True; $1 has digits only
else
return 1 # False; $1 contains other letters besides digits
fi}
and the second (... |
Please review my code for the problem statement below. Many Thanks.
You job is to create a simple banking application.
There should be a Bank class:
It should have an ArrayListof Branches
Each Branch should have an ArrayListof Customer s
The Customer class should have an ArrayListof Doubles (transactions)
Customer:... |
I'm solving the m-coloring problem using java. and I have following code that uses concept of recursion and backtracking.
import java.util.Arrays;
public class GraphColoring {
static void graphColor(int k, int m, int n, int colors[], int graph[][]) {
for (int c = 1; c <= m; c++) {
if (isSafe(... |
Needs
A container holds two collections: Parent instances and Child instances; their items can be searched by name;
A child can return a reference to its parent;
A parent can search its children by name and return one of them by reference;
A Child is read-only after creation, but new children or parents can be added a... |
This is a follow up for my question about optimizing solution for DNA Health HackerRank problem.
Short re-cap:
You are given 2 arrays (genes and health), one of
which have a 'gene' name, and the other - 'gene' weight (aka
health). You then given a bunch of strings, each containing values m and n, which denote the... |
I use this function in browser automation. It pings the document in the browser to check if an element we are looking for is available (useful when there is JavaScript generated async content). If it's not available, it will retry after a given interval or times out eventually.
Example usage:
function clickContinue() {... |
I've created a serial C++ code for gravitational N-Body calculation. Because I expect to have upwards of 8-71 sparse bodies (ie, where Barnes-Hut is not necessarily practical) and running for long periods of time, I want to make as much use of parallelization and vectorization as possible. I did try a method with mutex... |
I am completely new to rust. My first rust code is simple text filter application for parsing log file and accumulating some information. Here is my code:
//use std::io::{self, Read};
use std::io::{self};
use regex::Regex;
fn main() -> io::Result<()> {
let re_str = concat!(
r"^\s+(?P<qrw1>\d+)\|(?P<qrw2>\d... |
So I'm currently using python to unscramble words that are retrieved from an OCR program, and checked in the 'dictionary'.
The current code I am using to unscramble words is this:
import numpy as nm
import pytesseract
import cv2
import ctypes
from PIL import ImageGrab
def imToString():
# Path of tesseract e... |
I have a file that is written DOS format and I need to replace some characters into others. I created a dictionary for that purposes, and now I have to read everyline from my stream and replace my values as I go.
I created this piece of code in C#, however, I highly doubt that this is the way to go, since I figure that... |
I am implementing a simple recursive Depth-First Search algorithm on graphs, using StateT and ReaderT for encapsulating all the required information.
Pre-requisite definitions
type Vertex = Int
type Cost = Int
data Edge = Edge { vertex:: Vertex, cost:: Cost } deriving (Eq, Show, Ord)
newtype Graph = Graph { adjacencyL... |
I written my own calculator script in javascript! It is a basic one, but works really well. I am just wondering if there is any way to make this script more efficient & clean. On first look, I feel like I did some redundant stuff in it, however I am a beginner and in no right to judge the code on my own.
window.onloa... |
I am working on some custom rules in a time managment system and need to know how many hours in a shift have been before a certain time (19:00pm) and how many hours after. Shifts can start in the evening and finish in the morning so need to take that into account.
So far I have the below (this is just a snippet for one... |
I'm after a pythonic and pandemic (from pandas, pun not intended =) way to pivot some rows in a dataframe into new columns.
My data has this format:
dof foo bar qux
idxA idxB
100 101 1 10 30 50
101 2 11 31 51
101 3 12 32 52
102 1 13 ... |
OK, you don't really have to read it all, but I think you get the basic Idea. Does anyone have anything small that could make my code better? I just found out about "global" and "lower()". Is there any small thing you can give me that could improve my code a lot, or at least save me some time?
global myname
global move... |
We have published a product today called MMMR.js this product is licensed under the MIT license and is built by Syed Mohammad Sannan.
The uniqueness of this product is that it is built with and for Javascript though there are many libraries out there such as NumPY, SciPY, and much much more but they are built for Pytho... |
For homework, I had to parse CPUID instruction output in C, which required a lot of specific bit-manipulation like:
(eax & CACHE_LEVEL) >> 5
I calculated the mask CACHE_LEVEL and the amount that was needed to be right-shifted by hand. It was a pain, so I decided to write a couple Python functions to help with this.
Fo... |
I made this because I couldn't find any good C# classes/libraries that allow you to dump the contents of a process' memory into a file or a byte array. I haven't tested this on 32 bit systems but it works in both x86 and x64 on my 64 bit system. I've been mostly testing this on the notepad process which executes pretty... |
As told by experts, I am re-posting the code review request with the code.
Brief Description:
from outside sha256() will be called with parameter having UTF-16 character set.
then after prepareData() and initializing variables, the hash() will be called with converted binary message string (having pad and 64 bits mess... |
I'm trying to create a node editor "framework" (IDK what to call it, but essentially there is no GUI and should be implemented using these classes), similar to rete.js, blueprints(maybe an exception since there are events involved), imnodes, etc; and am creating a pin class/struct.
A pin, in this case, is the small thi... |
I would like to request iOS developer community to please review my POC i.e. [GithubUserFinder][1] which I have created as part of job screening test at T-mobile Bengaluru.
I have around 2 years of experience in programming and I got 24 hours to complete this POC.
Below is the feedback I got through mail by recruiter:
... |
Develop a smart application as Student Grade Calculator(SGC).
Create a class Student with following private attribute :
int id, String name, marks(integer array), float average and char grade. Include appropriate getters and setters methods and constructor.
public void calculateAvg() - This method should calculate av... |
This code gets detailed information about a particular game from an online database using an API Get request. The question I have doesn't pertain to the request but is more about the code itself. The code works. I just think it is long for what needs to be done though. I was wondering if this code is able to be refacto... |
I have tried to check whether the ports of a host from port 0 to port 1023 is open or not. Could someone please review this code and provide feedback.
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<sys/socket.h>
#include<sys/types.h>
#include<netdb.h>
#include<error.h>
#include<errno.h>
char *convert_... |
Given a Singly Linked-List, write a function to delete the linked list recursively.
Below is my attempt.
I am confused if I should use del keyword to delete the nodes or below method is better. I don't know if it is memory efficient this way.I'd appreciate any critique of what I could do better.
class SLLNode:
def ... |
The problem I need is to solve, is a linear optimization problem where we need to to minimize parcel delivery costs by assigning nodes as hubs, which supposedly will reduce costs.
In my code 'nodes' represents the number of nodes of a given set N. Then 'flows' is a list with the flow x_{ij} from a node i to a node j. ... |
I'm sure my question exists on the internet, i just don't know the right formulations.
I have a data-sample as input for a NN. This sample has the shape (1, 8, 28, 80).
Basically it is 80 timesteps of an image. -> y=8, x=28, time=80
i can extract the image at time=0 with:
np_img = image.data.numpy() # shape (1, 8, 28... |
I use Electron with NodeJS but this is mainly a javascript question. I got tired of build processes and being dependent of frameworks like Vue so I started my own.
Setup in index.html
<head></head>
<body>
<div id="home"></div>
<script>
var components = {};
// component(name)
var component = (name) => components[name].... |
Basically I have done a code for a project which works with a shift and ctrl selection. The program consists of a chart with specified points, which the user is able to select with the different key controls in order to move them. The highlightedIndex is a list of int. I am also working with WPF and later on I have t... |
[Base on https://codeforces.com/contest/1360/problem/G]
So my logic is to process each column at a time and find b rows such that the total 1s in them is less than a and if there are many candidates I take the rows with least 1s.
import Data.List
import Data.Array
import Control.Monad
-- i... |
Hello everyone!
I wrote a class Vector.So, I want to find out how can i upgrade it for better performance of my vector.
Here is the code:
template <typename Type>
class Vector
{
private:
size_t _size;
size_t _capacity;
Type* _data;
public:
Vector(size_t capacity = 0);
Vector(const Vector& vec);
... |
I have this python script that uses pandas read an excel sheet then to update a sqlite db it works perfectly just wondering if I can speed it up as I am at about 70k lines
"""
Created on Thu Aug 1 14:11:01 2019
@author: Shane Pitts
"""
# -*- coding: utf-8 -*-
import sqlite3
from sqlite3 import Error
import pandas as... |
Question:
You are given n words. Some words may repeat. For each word, print its number of occurrences. The output order should correspond with the input order of appearance of the word.
Sample Input:
4
bcdef
abcdefg
bcde
bcdef
Sample Output
3
2 1 1
Here's what I came up with:
n = int(input())
array = []
elements = {... |
I am currently taking an introductory course in computer architecture.
Our goal was to write a dot-product function in x86 Assembly which would use SSE and SIMD (without AVX).
I am not to that confident with my solution:
#include <time.h>
#define NUM 25600
//Example: scalarProduct using SIMD
extern float scalarProduc... |
This is a follow up of A simple definite integrator class of a single variable in C++.
I took most of the advice from Emma X and some from sudo rm -rf slash.
Here is my fully revised code:
Integrator.h
#pragma once
#include <type_traits>
template <typename Field>
struct Limits {
Field lower;
Field upper;
... |
I am new to Python and following tutorials.
This one I came across was for TKinter, and throughout I felt I re-wrote the same lines of code time and time again which I wondered if it could be better written.
I am interested to know how you would improve this code.
Thanks.
(First time posting, hope it's ok).
from tkinte... |
I had this question in an interview recently. Given a sorted array of integers, return a list of those integers squared, with the squares sorted. So given an array of these numbers:
-5, -3, 1, 2, 4
the result should be this:
1 4 9 16 25
I came up with this solution using Java 8 streams, but is there a way to do thi... |
I started learning from the book: head first design patterns. As I am trying out different programs in the book, I am compiling them in this one demo app. Below is the code for its driver function. Can anyone guide me with any improvements to the program (related to style, programming, formatting, how to test, is it be... |
The following bash script was made to retrieve some local repository information in order to be used to display a condensed git status in terminal PS1 prompt.
It performs some simple greps over (git status) --short version text to display 6 repository status: Commits ahead, commits behind, added files, modifiled files,... |
I wrote some code that reads the output of the rcon users command on the CS 1.6 console. It then notifies me of any players that are not in my whitelist.csv or are in my blacklist. The program requires 3 files as inputs:
A text file containing the raw output of the rcon users command on CS 1.6 console.
A CSV file cont... |
I have built this Generic Graph traverser, I have this implemented with DFS, I feel it will work equally fine with BFS too.
What do you think of this implementation?
I want help in reviewing the Visitor interface.
Should I have Generics in it or just use the base Object?
public abstract class GraphTraverser {
prot... |
Just for practice purposes, I written a basic client sided login/signup system that allows you to make an account, and then log into the account from my webpage. What it does is append to an object known as database for every new account made, and when you sign in, it loops through the database and see if your credenti... |
Suppose I have a vector containing n elements. I want to find out the number of previous elements greater than its element at present index i. I want to find A[i] > A[j] && i < j for all elements of the vector.
Constraints:
1 <= t <= 1000
1 <= n <= 10^5
1 <= A[i] <=10^5
My code:
#include<bits/stdc++.h>
using namespace... |
I want to calculate the correlation time. First I calculate the auto-correlation function:
$$
\begin{align}
\chi(t) = &\frac{1}{t_{max}-t}\sum\limits_{t'=0}^{t_{max}-t}m(t')m(t'+t)\\
&-\frac{1}{t_{max}-t}\sum\limits_{t'=0}^{t_{max}-t}m(t')\frac{1}{t_{max}-t}\sum\limits_{t'=0}^{t_{max}-t}m(t'+t)\\
&\sim e^{-t/\tau}
\end... |
I want to create a MVVM-C project, but also adequately test it. Naturally I want to create such a project that can access a Network Service.
Any comments or thoughts on this approach?
DependencyFactory:
protocol Factory {
var networkManager: HTTPManagerProtocol { get }
func makeInitialViewModel(coordinator: Coo... |
I have a following table in a flask app
class Price(db.Model):
__tablename__ = "prices"
id = db.Column(db.Integer, primary_key=True)
country_code = db.Column(db.String(2), nullable=False)
value = db.Column(db.Float(precision=2), nullable=False)
start = db.Column(db.DateTime(timezone=True), nullable=... |
I am a beginner in Python, as you will see looking at my notes.
This is a program that simulates seat booking in a cinema for example.
The program stores the users name as a key and the seat(s) they have chosen in a dictionary as key-value
pairs.
What are the ways I can improve this program? I have used one function. W... |
Background
About the Fleissner-Grille
The Fleissner-Grille is a really easy possibility to encrypt text.
You just have to take a grid of size n*n with (n*n)/4 holes (example). You then just write one letter in one hole. After you've filled every hole with a letter, you just turn the grille by 90° degrees and start agai... |
I am new to JavaScript so I am not sure if it's bad practice to nest a for loops inside of each other.
This script simply takes a WordPress HTML menu and restructures it into a format better suited to my requirements.
Below you can see the original HTML, the JS and the new HTML output by the JS.
The nested "for of" lo... |
I am trying to learn how to effectively use error handling in my code. To do this, I have created a class inside main.py which reads the value of a specified curve at a specified date.
I then have my file data_reader.py, which reads in the specified curve (into a Pandas dataframe) from a CSV file. The index of this cur... |
I'm new GO coder (stared this Sunday) coming from different backgrounds, I wrote the below code based on my understanding of Go within these couple of days, and impacted of my experience in other languages, I like to share for Go experts review/comments and feedback.
package main
import (
"fmt"
"log"
"sort... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.