instruction stringlengths 71 95.1k |
|---|
I have written the below python function which is working fine but there are lot of code which looks redundant to me and hence i want to make it better by using best coding guidelines.
Basically I am trying to build either a gcloud command or a simple bash command to execute a python script which depends upon the spark... |
Wrote this (and others not here) as an exercise to explore how generics could be implemented in C.
Question -- if I were to support out-of-band error setting, how would that look like for dynarray_len()? There is no wrong value to return and requiring the user to check the error after every call seems cumbersome; I don... |
This question is ideal in my case: Ludisposed's python-scapy-tcp-port-scan-of-subnet - At codereview stackexchange
But this is not Scapy; nor Python(it might get used in the future though but that is another question! - it is in bash - and as he(or she) stated:
Will be working on Threading later on, so that is not und... |
I'm trying to learn python by building an image detection bot for a 2d game.
The bot checks to see if it can find any one of a number of images within a cropped section of the game window. If it finds something successfully, this triggers the bot to move the mouse and click a button while logging what's been found into... |
I am a beginner programmer with not much experience, the little I do have is with Python specifically.
With all the fuss going around about the popular word game "Wordle" I wanted to challenge myself with the task of creating my own clone version of it. I have all of the functionality I wanted working, for example, bas... |
I have, after years of excuses, started programming. Well honestly, I was not able to find any one interested in helping me with my start-up idea. So I had no choice but to ask myself 'How hard can this be?' and here I am.
Here is a Python program for a simple calculator of my own budgets and savings. I have used basic... |
I have written a hashtable that implements a set interface. With JUNIT all my test goes through, however I am unsure if they are written correctly based on what their description is. Down here I have The test class, set interface class and HashSet class.
Please Look at the two test that is written in the testclass that... |
Background
Just got started with C and now am testing a few pages and simple problems to get the syntax right.
On Programiz they provide a few very easy problems with solutions.
This program checks if user input is a Vowel or a Consonant or none of those. I solve slightly different, but would be glad to see criticism t... |
(See the follow-up question.)
I have this program that shows a small window and that window shows a rectangle whose color is the same as the color of the pixel under the mouse cursor. Note that it will show the color of the mouse cursor pixel even outside of its native window. As additional fun, I have coded the clipbo... |
This is a well-known problem from a HackerRank challenge:
Given an array and a number M, output the maximum of all subarray sums modulo M, M between 1 and 1E14.
A number of solutions are discussed on stackoverflow.com and geeksforgeeks.org. All of SO solutions seem to use some built-in mechanics, and I don't see how th... |
Edit: The end objective is to monitor the movement of severe weather, determine its vector and make a prediction.
I'm working with a GeoJSON FeatureCollection from the National Severe Storms Laboratory. The dataset is publicly available here.
Here is a portion of a single JSON file.
{"source": "NOAA/NCEP Central Opera... |
I have a small function that I would like to make cleaner and/or more efficient.
There is a directory that contains files in the format of <name>-<counter>-<datetime>.xml.
When a new file is added to the directory, I have a function that reads the counter part of the file name of every file. Then it increments this val... |
System/Language: I'm using plain Javascript to write this algorithm. Environment: Node 17.4.0 with a system that has ~7000 MiB of Memory and ~400GB of Storage.
Input Data
An (AoP) Array of Pairs (a Pair is an array of two elements) where the first element of each Pair is a String and the second element is a Number.
Th... |
So I have the data frame below, and I'm trying to creat a new Data frame which show me the name of the department which have the highest and the lowest employee turnover. The code that I write is correct, but is too big, so I am wondering how can I simplify it. Thanks
My data:
df = data.frame(
department = c(... |
I wrote a code to fetch the data present and store it in Array format but I thing I have wrote code multiple times can It be possible to minimize the code as its too long
let topicsValue = ["requiredType.*", "Entry.*", "token.*", "RestAPI.*"];
let Topic = [],
rest = ["required", "unrequired"],
final = ["createIn... |
Is there a way to make the following code more maintainable?
public static DtoNumOrderedNumDone GetNumOrderedNumDone(int jobTaskId)
{
const string selectList = "Quantity, NumDone";
var sql =
@$"select convert(int,numordered) as Quantity , convert(int,sum(isnull(numDone,0))) as NumDone
from... |
I'm writing some function tests and wrapping a Microsoft Playwright (it's similar to Selenium for those unfamiliar) IPage with a page object containing some helper functions to simplify the test code.
The following function reads a table on the HTML page and makes the data available in a format that is easier for test ... |
I'm wanting to reduce the amount of code in this set of statements, as it seems quite repetitive:
if ($('#Size').val() === 'extra-cab' && $(this).attr("id") === 'canopy-17x-select') {
$('.rack-kit input[type="checkbox"]:checked').prop('checked', false).trigger('change');
}
if ($('#Si... |
I want to concat two strings, by sub-stringing each one with same length, and concatenation should happen like I mentioned below
for suppose,
I have str1 = raines, str2 = bowls, and LENGTH as 2, then my output should be raboinwless.
edit: starting from leftmost alphabet, identify LENGTH number of letters from str1 and ... |
(See the previous question.)
Now I have incorporated some suggestions by Barmak Shemirani.
See what I have:
#ifndef UNICODE
#define UNICODE
#endif
#include <windows.h>
#include <stdio.h>
const int DEFAULT_WINDOW_WIDTH = 300;
const int DEFAULT_WINDOW_HEIGHT = 200;
const int TEXT_LINE_HEIGHT = 30;
LRESULT CALLBACK Wi... |
I have the following code. I have made a complicated approach to calculate apple's price. Thus, I put this approach in a separate class called PriceUtl. The code below is an simplification. I want the user of the Apple code can just call apple.set_price(new_price) to set the price of apple. Thus, I made a method set_pr... |
So the program below will move the mouse cursor in a circle all 360 degrees for 2,5 seconds (after 2,5 seconds, the program exits and the user can use his/her cursor normally).
#include <Windows.h>
#include <math.h>
const double RADIANS_PER_DEGREE = acos(-1.0) / 180.0; // acos(-1.0) = Pi
const int SLEEP_DURATION = 250... |
I am making a pvz simulator. We have a game board with 1 = peashooter and 2 = zombie:
[[(1, <__main__.Plant object at 0x0000011F0FDDA4C0>), (2, <__main__.Zombie object at 0x0000011F0F73D100>), 0, 0],
[0, 0, 0, 0],
[0, 0, 0, 0]]
When the peashooter object shoots a pea ten times, the zombie is defeated and disappears.... |
The Problem
I'll be extracting up to 4 parts of a String that come from user-input.
All 4 parts need to be in order i.e. (1-4) below in that order
The first capturing group is required and the last few are not.
The named capturing groups are described below
KEY (This can be either CONF|ESD|TRACKING and needs to be fol... |
I'm practicing js, unit testing, and algorithms, so implementing some of the common sorting algorithms and doing some basic unit testing on them seemed like a good exercise.
I'm also trying to use modern ES6+ features along with longer variable names to make the code more concise, hopefully without sacrificing too much... |
A single string consisting of comma-separated pairs in the format <key>=<value>, like
ABC=https://host:443/topic1,DEF=https://host:443/topic1,GHI=https://host:443/topic3,JKL=https://host:443/topic3
must be converted to a line containing the unique set (for which the order does not matter) of values, separated by an em... |
A few days ago, I uploaded my first version of my calculator app I made in android studio. I got some great some feedback on it and tried to improve my app as much as I could.
changes/new featres:
Implemented a delete button
optimized the way, everything is calculated
Made a seperate class for the calculator
Here u c... |
Coming from JavaScript, I needed to learn C++ recently, so I thought a great way to start is to create a simple terminal-based tic-tac-toe game. I encountered some difficulties especially with multi-dimensional arrays. I got it to work, but I don't think it was done very elegantly. I also experimented with the OOP C++ ... |
I have two functions in Python that do the same thing: they partition a set of items of different sizes into a given number of subsets ("bins"), using an algorithm called greedy number partitioning. The algorithm works as follows: it loops over the items from large to small, and puts the next item into a bin that curre... |
I am seeking a review of my command line wordle game.
Having only recently started exploring functional programming, I expect that there will be no shortage of areas to improve. This is my first simple project outside of reading textbooks and solving exercism puzzles.
I am keen to discuss all improvements, however some... |
I made previous post here, relating to this topic.
The class uses now uses some additional 3rd party libs nvector & pygc.
and again the full dataset is available here
from __future__ import annotations
import json
from typing import Any, TextIO, Iterator, Union
from glob import glob
import os
# 3rd party
import numpy ... |
This code is meant to send an object (any object) over a connection to a recieving program. I want to make sure that i haven't made any red flags. It seems to work fine, i've sent tuples with data (bools, strings and lists with other lists) and it gets recieved fine.
import pickle
packetsize = 4096
def send_msg(conn,... |
I have watched a few youtube videos, and I am trying to learn a little bit more by doing. I had a blast trying to figure this out. I know it has issues such as not being able to go below 2001 and using an average for months. I'm not seeking to improve its capabilities, although i would certainly appreciate any ideas, s... |
The following code convert csv to ascii table.
#!/usr/bin/env python3
import sys
import argparse
import logging
import prettytable
import csv
parser = argparse.ArgumentParser()
parser.add_argument("infile", nargs="?", type=argparse.FileType("r"), default=sys.stdin)
parser.add_argument(
'-d',
'--debug',
he... |
I have a pattern that I have been using for a few lookup functions that I feel could be done in a better or more pythonic way. I am looking for guidance on how the following function could be improved. The list of patterns that I have for each type of lookup can be long - I have shortened it here but it is usually 50 ... |
I'm trying to create a hash function for my own custom class. It uses a string value of 4 chars as a key, which is unique to every object, which I then encode using getBytes(), the part actually used to calculate to the hash value
public int hashCode() {
String fixedISBN = getIsbn().toString().replace("-", ... |
How might chain_apply() be improved?
auto chain_apply(auto&& a, auto&& ...f)
{
auto const execute([&]<auto I>(auto&& self)
{
if constexpr(I)
{
return std::get<I>(
std::forward_as_tuple(f...))(
self.template operator()<I - 1>(self)
);
}
else
{
... |
Below is an exercise project I was doing on a certain educational site.
It is supposed to parse a given (static address in this example) URL for html data, search articles of a given type there and then save their text data on your drive.
It is working fine but since there're no code reviews on this site, I'm sort of w... |
I have written a code of Binary Search tree that extends comparable and implements an interface. The code for leaves and the helper method countLeaves, makes sure that all of the test goes through except for one, heightIsLogOfNumLeavesTreeIsPerfect().
// TODO: Look at the Leaves and helper method in the tree class and ... |
I am writing a script using Julia (calling my functions from the REPL) to compute the matrix representation of certain Hamiltonian. After I run my script I see that the memory allocations count is considerably high:
julia> @time hamiltonian(40, 20);
5.860412 seconds (76.33 M allocations: 2.085 GiB, 23.78% gc time... |
My attempt at a observer design pattern (I know using namespace std isn't good). I'm very new to design patterns. Everything is inline with class definition. Please tell me if I'm doing anything wrong or if there is anything that can be improved. Does subscriber (observer) need to store info from update function? Also,... |
I want to make the following function a function template that supports all the integral types:
#include <iostream>
#include <utility>
#include <charconv>
#include <string_view>
#include <concepts>
#include <limits>
#include <optional>
// header file
std::optional<int> to_integer( std::string_view token, const std::p... |
Follow on from this codereview:
generic implementation of median
As before the vector2 class is just for illustrative purposes and not the focus.
I have incorporated all the excellent feedback from G.Sliepen from previous codereview linked above:
2 versions median() and median_in_place(). The former makes a copy.
cons... |
I am fairly new to C++ but ran into a bit of a performance issue.
To counter this I am trying to optimize parts of my code.
This part is reading a text file and storing the first two values of a line foreach line in the file.
This works but I was wondering if it is possible to do it faster and cleaner.
See code below:
... |
For practice, I've been playing with calculating median values. This time, I wanted to make something that works well without copying the input values (perhaps because they are bulky, or of a type that's not copyable) and without reordering the container.
My implementation is split into two parts - find iterators to t... |
So everytime a neighbors is discovered with an improved distance, it is added to the priorityqueue with the new distance (so it can be used in the right order). This means however that the old entry with the old distance remains in the queue and is processed later on.
This does not seem to be an issue, since all neighb... |
Is there anything I could do better in this Dijkstra's Implementation. This is my implementation of Dijkstra after understanding the concept. I used hash table wherever possible to have faster access
#include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
string lowestnode(unordered_map<st... |
I've stored a set of theme related configuration in a config file.
config/theme.php
// ...
$component = [
'componentA' = [
'size' => 'componentDefaultSize',
'color' => [
'default' => 'componentDefaultColor',
'success' => 'componentSuccessColor',
]
'background' => [
'light' => 'compo... |
Below is the Blackjack program code. How do I make the code look nicer?
I feel like the code is super messy and I was wondering how I could make it look better or if there are better ways to write some parts of the code.
(I have been running the code on replit.com and in visual studio code.)
#include <iostream>
#includ... |
I recently learned about the Hamming distance. The use-case I found it through was actually working with integers instead of strings, yet its implementation was using string comparison. I was pretty sure it could be done with bitwise operations, and from what I can tell, my implementation is successful.
public int Hamm... |
Below is a snippet that uses array_reduce() to calculate totals from a detailed dataset. The data shown is representative of a larger dataset.
This code outputs the expected results. I'm seeking some peer input on how this array_reduce() is written because this is my first time using it in PHP. I'm more familiar wit... |
I recently started learning Python and the first program I've made is a program to determine the best 5 card hand from seven total cards and then to be able to compare two different hands to determine which would win. I just wanted to ask if you would be able to have a look at it and give me any thoughts on how I could... |
I have written a text-based tic-tac-toe game in C. Are there any ways I can further improve the code?
It uses an ENUM to indicate the player type and two bitfields to indicate the board.
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
#include <ctype.h>
#include <limits.h>
#define FULL 0777
typedef unsig... |
The objective of below code is find longest common prefix from trie DataStructure which is written in Java.
Code:
public String longestCommonPrefix(String[] words) {
var commonPrefix = getCommonPrefixOf(words, 0, "");
if (contains(commonPrefix))
return commonPrefix;
return "";}
private String getCommonPrefixOf(St... |
I have a usecase where I want to prevent unexpected duplicate Http calls. I'm wondering if I can have a custom operator which can be used in pipe for any API as shown in below example 1.
Even better if I can use this operator in Angular's HTTP_INTERCEPTOR as shown in example 2.
Code for customer operator
class RxJsUtil... |
My goal is to write a CLI utility that aggregate (appends) many CSV files in a lightweight and performant (my use-case involves output files in the 10s of GBs) manner.
Specifically, the utility should look for CSV files of a provided filename in one or more provided directories, aggregating all contents into a single ... |
I have implemented the Barnes-Hut algorithm for \$n\$-body-simulations (in this case "sort-of" 3D-gravity - see below). I'd appreciate any comments for improving my code (especially concerning speedups). I used the pseudo-code of this site https://beltoforion.de/en/barnes-hut-galaxy-simulator/ to implement it (nice for... |
Random Astronomy Photo
About the project
This is a React app that generates a random photo from NASA's Astronomy Picture of the Day (APOD) API along with some interesting facts about it. This is my first React app and my first major coding project that I did entirely on my own.
You can visit a live version here: https:... |
I know this may be a silly question, but... is it really necessary to add the parameter name (int <parameter_name>), instead of just (int) in a definition of an operator function to overload "++" ( post-increment) ? or would it be optional?
example:
/* function prototype */
friend Cylinder operator++(Cylinder&, int);
... |
I'm writing a minimal C runtime targeting an old 32-bit Windows XP machine as a personal project. The C runtime provided by compilers is quite bloated. I wouldn't mind some library bloats up to several megabytes if this was some paid project, since even a very old PC would load it very fast anyway, but as a personal pr... |
I am trying to optimize the following (now C) radix sort code for use in my game engine library. The basis for this code was inspired by this youtube video on a C++ implementation called skasort that used templating to sort STL containers. The current first pass code sorts in-place in most-significant-byte (MSB) order ... |
Here we have the following code.
let i = 1
while (i <= 256) {
log(i)
i++
}
function shape(n) {
let p = greatestPowerOf2(n);
if (p >= n) {
// The only cases where there are no subarrays
return [n];
}
// Try with one subarray
for (let sub = 2; sub < n && sub <= 256; sub *= 2) {
let top = n -... |
I made a really basic number guessing game based off a list of recommended projects, and i want to see if it follows the normal coding conventions before I aim to improve it(with lives, or hints, ect). This is also my first attempt at loops. I am wondering if this follows the normal coding conventions, if i was unneces... |
Hey I started programming in python few days ago and decided to write a programme without any tutorial. You give it a list and then my programme erases last item of list until there's only one item. I know my code can be improved easily and also I dont know how to display text like "Ok, fine" when user chooses "No" in ... |
I have 1000 dictionaries (grid_1, grid_2.... grid_1000) stored as pickle objects and one original dictionary that I need to compare each of these 1000 dictionaries to. The 1000 dictionaries are generated by a process. My algorithm has below steps:
grid_1 example : {'143741': {'467457':1,'501089':2,'903718':1,'999216':5... |
I have the following function where data may not exist during the many nested steps
to obtain data. To prevent errors, doing the checks as follows.
Is there a more elegant way to do this?
Please note that Optional chaining is not an option due to the project structure
and difficulties in upgrades at this stage.
Somet... |
The following is my usage of the Memento Pattern when one class uses the copy constructor of a sister class (a separate derived class of the base class) and wishes to revert to the previous class. Note that allMementos is a map of Mementos instead of just a single Memento because of possible multiple conversions betwe... |
So the problem is as follows: given a list of prices, what is the max possible PnL? so to buy low sell high what is the max profit possible?
right now my solution involves making a copy of the list, traverse the both lists and compare the diff in the price movements.
things to consider: you have to buy first then sell:... |
My code finds the prime factorization of numbers, ordering the prime numbers from least to greatest.
It prints a list of 999999 prime factorizations (which can be changed if you edit the function call in the main method).
I'm thinking that maybe the string concatenation is the most expensive operation because Java Stri... |
Problem
A business process requires me to read two different text files (raw and processed) into R as data.frames, with each column being read as a character type. Both files contain the same information, though the numeric columns are formatted slightly differently.
I need to convert the column types of both data.fram... |
The basic "running averager" is familiar, both in embedded as well as real-time applications such as games, eg for fps. This algorithm is implemented in many microcontrollers (notably the PIC series) for analog input averaging. This is a software replacement.
Usage: We feed sample values using operator() and the curren... |
How can I improve my login script and how to check for any possible injection?
PS. the script must run on multiple platforms, so I need empty arrays for cases such as the Android ones.
user_table:
CREATE TABLE `user_table` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_type` varchar(255) NOT NULL,
PRIMARY KEY (`us... |
The public code is SaveAsFile(). It takes a URL, checksum and authentication info, and downloads the artifact and its hash using HTTP. It saves the content as a file and returns the file's path on success, otherwise an error.
As I'm fairly new to Go I would like to get some feedback on the error handling and on any w... |
In my asp.net web API, I have a couple of controllers. In one of my controllers, I am using basic authentication and in another one, I am using bearer token authentication. It is working as it is expected, I wonder if are there any improvements to make it better. So I would be glad if you can share your comments.
Contr... |
This code takes two times as input and then calculates a random time between the two inputs.
def randomTimeRange():
print('Get a random time between two times')
start_time_input = '01:25:00'
end_time_input = '23:30:43'
start_time = start_time_input.split(':')
end_time = end_time_input.split(':')
... |
Exponential damping is a type of "moving average", but it's not an arithmetic mean. The latter has the disadvantage that it requires storage of the last N samples in a std::deque or similar.
Exponential damping has constant, and very small, storage costs of just 3 or 4 primitive types, no matter how "slow moving" or "a... |
I got feedback from an interview test where they wanted me to prove that I've got a grasp of OOP php programming. This file especially I got feedback on that it's more functional than it is Object-Oriented so I'm asking all the PHP gurus if they have any tips on how I can turn this into more of an OO component.
The fir... |
I'm currently inserting chars into a string with the given position.Unfortunately at this stage I was unable to create a regular expression that would allow me to achieve the following.
Nevertheless, while the code is working, I'm not particularly happy with it, any advice?Thanks.
Input Text - A12123456789012
Output ... |
I'm using the shelf package from Dart to implement a backend for the realworld-example-app. According to the specs, some routes require authentication, some don't, and in others the authentication is optional. My idea is to write a middleware that would decode and validate the token and put the User in the request cont... |
I am trying to work out the best way to go about a task which relys on multiple long running tasks taking place.
My use case is that I want to have multiple events running for set periods of time, where I have websocket connections to each event for that period.
My thoughts were that I keep a conurrent list of all acti... |
For my haves:
I want to find the key values for the maximum value whilst grouping by g1 and g2 to get these wants:
This is my current possibly (?) clumsy code:
df = pd.DataFrame({
'value': [0, 1, 1, 3],
'g1': ["b", "b", "c", "c"],
'g2': ["a", "a", "a", "a"],
'key': ["1", "2", "3", "4"]
})
print(df)
s... |
I have this update fx for my Player object in game loop, game is top-down in-space thing with boom-booms and such. Me being weak at maths is huge understatement so my implementation is concoction of varied tips on internet and help from friend. I was wondering if I could get any tips for implementation while I want to ... |
I'm new to programming challenges and I'm attempting the following Kattis challenge Sim.
This problem is an extension of another Kattis problem - backspace. In that problem, every time we see a character ‘<’, it actually means that the ‘Backspace’ key is pressed and we undo the last character that was just typed.
The ... |
I am trying to implement an optimal and fast running matrix in C++. I need some review of the code and ideas on how to improve the code quality if it shall be.
class Matrix {
// Some static assertions and useful types
static_assert(std::is_arithmetic_v<T>, "Matrix template parameter type must be ar... |
The VBEMenuButton class simplifies creating menu items in the VBE Editor. When Excel opens, the Auto_Open() routine in my Personal Macros book is triggered and my commands are added to the VBE Editor Menus.
The example code adds two menu items to the Menu toolbar Tools popup menu: "Backup ActiveWorkbook" and "Update A... |
I wrote the following prototype:
import xlsxwriter
import numpy as np
import pandas as pd
import random
import uuid
workbook = xlsxwriter.Workbook('test.xlsx')
worksheet = workbook.add_worksheet()
companyissuearray = ['3001', 'Test1', 'TestCat1', 'TesSubtCat1'],
['3002', 'Test2', 'TestCat1', 'TesSubtCat1'],
['3003', ... |
I am still practising object oriented programming and I decided to do the rock-paper-scissors game as a project.
I listen to constructive criticism to improve the program.
#!/usr/bin/env python3
# Rock, Paper, Scissors
from os import system
from random import randint
from sys import exit
class rock_paper_scissors:
... |
I have the below function get_status_time which calculates the start time and the end time of the spark job which has already completed its run (status could be either fail or pass).
It's working but the function is too complex; I want to fine tune it to reduce cognitive complexity.
def run_sys_command(cmd):
try:
... |
The Problem
I'm relying on plaintext entry to capture dates.
End users are urged to enter as MM-DD-YY, but it'll be great to account for as many possibilities.
US Date Format is assumed
I.e. MM-DD-YYYY, M-D-YYYY,M-D-YY, MM/DD/YYYY, MM/DD/YY, etc..
Current Code
//'1 or 2 digits...and then a single hyphen or forward slas... |
First of all, my knowledge in C++ are very limited but I have a good background in C.
I'm currently writing firmware for an STM32 MCU using C++. I have to code a driver to communicate with an IC using the SPI interface. The IC has many registers. The registers are accessed like a memory, each of them are addressable. U... |
I have implemented a simple version of the median cut algorithm. It takes a vector of Color structs representing pixel in an image. I also use the ColorChanel enum representing RGBA channels.
pub struct Color {
pub r: u8,
pub g: u8,
pub b: u8,
pub a: u8,
}
#[derive(Debug)]
pub enum ColorChannel {
R... |
Similar to C++ int_cast<> function for checked casts?, but C++20, and with target type deduced from context.
The goal is to implement a runtime check that the value being converted can be represented in the target type, and throw an exception if it can't.
This basically works for my use case, but I wonder if there's an... |
I'm having trouble making WHERE IN query work, I was only able to make it work as a foreach loop.
My payload looks like this:
sku[]: BOOK0002
sku[]: BOOK0003
My API file code is as follows:
public function deleteProduct($prdt_sku)
{
try {
$this->db->query("DELETE FROM products WHERE product... |
I used Python and a little bit of JavaScript using the (Python) modules Dominate and Flask to create a web app that somewhat resembles the Jupyter Notebook though with very basic functionality. I would like my notebook to execute only Windows command prompt commands. I have tried to implement the basic functionality of... |
I need to format a number with space as thousand separator in my Java code for Android.
How can these functions be improved?
What are the pros and cons to the first recursive method?
What are the pros and cons to the second substring method?
Is there maybe an even better and easier way to solve the problem?
Java ... |
I am working on this Python project, and I pretty much have it done, I just wanted to get a second opinion, to make sure it looks good, and to see if anyone had any tips for it. I also was a little confused by the instructions I was given by my instructor for the project, so I want to make sure the program I wrote actu... |
I have written this shell script to backup MySQL database to disk. It works fine but I am not well proficient in shell scripting. So what do you think can it be improved?
#!/bin/bash
#For taking backup
APPEND_CLI=$3
DIR=/media/storage/backup/db_backup/
DATESTAMP=$(date +%d-%m-%y-%H-%M)
DB_USER=backup
DB_PORT=$2
DB_PAS... |
I made the changes that were suggested to improve the program in the previous version. I would like to know if it is decent now or is there something to tweak.
class MatchsticksGame:
def __init__(self, initial_matchsticks=23):
self.players = ('Player 1', 'Player 2')
self.player = None
self.t... |
How can I improve/secure my login script and how to check for any possible injection?
PS. the script must run on multiple platforms, so I need empty arrays for cases such as the Android ones.
user_table:
CREATE TABLE `user_table` (
`user_id` int(11) NOT NULL AUTO_INCREMENT,
`user_type` varchar(255) NOT NULL,
PRIMARY K... |
I have created a contact management class for practicing, and I want to know your opinion about it.
I know there are a lot of example of contact management class, but I tried to make this one a bit different by adding some functionality to avoid initializing a contact with wrong data.
For example, if you try to initial... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.