All Questions

Filter by
Sorted by
Tagged with
2
votes
1answer
25 views

Grid layout component for VueJS

I'm working on a vue.js / nuxt.js project, applying the Atomic Design methodology, I need to do one to set the grid layout and using CSS Grid Layout. I already did the component, but I think I did ...
2
votes
1answer
63 views

Python function to count syllables in a word

I wrote this function to count the syllables in a word using Python to complete an exercise. The exercise's text is: Return the number of syllables in the given word, according to this rule: ...
1
vote
1answer
58 views

Boolean class using shared referenced memory

To improve my knowledge I am trying to make a bool class from scratch, or derivative of. I am using MinGW g++11 compiler on a Windows 7 laptop. ...
1
vote
1answer
30 views

Showing a unique result based on options selected

I created a simple quiz in HTML/CSS and plain Javascript. There are three questions with two options each, so there are eight possible combinations of answers, and therefore results. You can only pick ...
1
vote
0answers
28 views

React.js hook to validate a form on submission

I am fooling around with hooks in React and I'm stumbling against decisions that I need to make regarding implementation. Below is the code for the custom useForm hook which can be used to hook up ...
2
votes
1answer
21 views

Throttle implementation using pure JavaScript adding and removing event listener

I am trying to implement throttle function in vanilla JavaScript. I have seen other implementations on the web, but the way I have implemented it is more understandable for myself. I was wondering if ...
-4
votes
0answers
18 views

How to fill up a function args with lines of text from a file in python? [closed]

I need help in python I have a function that contains multiple args And i have file that contains lines with the same number of args in the function The question is how can i put the lines in the args ...
2
votes
3answers
57 views

PHP recreate array if it contains certain values

I have $fruits_arr: ...
4
votes
2answers
70 views

Counting valleys traversed below sea level, given elevation changes

Problem Statement: Gary is an avid hiker. He tracks his hikes meticulously, paying close attention to small details like topography. During his last hike he took exactly steps. For every step ...
-1
votes
0answers
38 views

VB6 XML Shredder speedup [closed]

I'm working with a legacy VB6 XML shredder that extracts information from proprietary XML files and loads the information into a SQL Server database. It's working, but it's slow. I'm looking for ...
-2
votes
0answers
20 views

Runtime Error with Check Balanced Brackets Problem [Java 8] [closed]

I am struggling with a HackerRank problem. Here is the problem statement: Given strings of brackets, determine whether each sequence of brackets is balanced. If a string is balanced, return YES. ...
2
votes
1answer
38 views

Rename and move images to a destination directory based on a text file

As a followup to this question, I removed the Repository class and do the copy in the Folder class. Suppose I have the ...
-1
votes
1answer
35 views

Trying to convert struct with hashmap member

Consider a struct: struct RawData{ pub a: HashMap<String, String>, pub b: HashMap<String, String>, } which should be converted in a struct with ...
3
votes
1answer
40 views

Evaluating π using Monte Carlo methods - Serial vs OMP

I wrote this simple code for evaluating the π using Monte Carlo method. This is the serial version: ...
0
votes
1answer
29 views

Upload image with GD library

First of all I just started learning OOP. My priority is to make safe code. I think my code is safe, because I use GD to make a copy of the uploaded image and I use an image proxy to make sure nobody ...
4
votes
1answer
169 views

Console-based BlackJack in C# - Follow-Up

I have done some code-refactoring of my console-based BlackJack in C#. Finally found a better solution to solve Ace problems (double Aces should be value 22 and third Ace should be value 1). I still ...
3
votes
1answer
47 views

Pycharm plugin for imports cleaning

I have written Pycharm plugin for integrating pycharm with tidyimports. I have followed steps mentioned in Simple Pycharm Plugin Example. Below is the code that I have written, it works but I need ...
14
votes
6answers
3k views

Project Euler, problem # 9, Pythagorean triplet

Project Euler #9, Pythagorean triplet is A Pythagorean triplet is a set of three natural numbers \$a < b < c\$ for which \$a^2 + b^2 = c^2\$. For example, \$3^2 + 4^2 = 9 + 16 = 25 = 5^...
4
votes
1answer
79 views

Random password generator (Java)

I wrote this program recently to generate random passwords for myself. It works well but it's been a long time since I wrote any java and am just looking on ways to clean up the code. I'm also not ...
2
votes
1answer
23 views

Configuration parsing and verification utility for bioinformatics tools

I've been working on my first Python library which provides different utilities for a set of bioinformatics tools. I am looking for feedback on this module I made for parsing configurations needed for ...
2
votes
1answer
29 views

Project Euler Problem # 8 maximum product of sequences

Is there any room for improvement? Your feedback would be helpful. Problem Statement: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × 8 × 9 = 5832. Find ...
2
votes
1answer
49 views

Pandas updating/adding columns to rows incrementally using dictionary key values

I want to populate columns of a dataframe (df) by iteratively looping over a list (A_list) generating a dictionary where the keys are the names of the desired columns of df (in the example below the ...
1
vote
0answers
21 views

Segmented (Bit) Sieve of Eratosthenes in Java

I am trying to create an efficient implementation of the segmented sieve of Eratosthenes in Java, similiar to the one in C found here: https://github.com/kimwalisch/primesieve/wiki/Segmented-sieve-of-...
0
votes
1answer
31 views

Python script takes input of four elements and outputs a valid 4 × 4 Sudoku grid in O(n) time, but only when given non-repeating elements

Introduction I've found a clever and fun thing to do after solving a n2 × n2 sudoku puzzle. I can take a grid as such as this one and hard-code its indices as constraints to output other 4 × 4 latin ...
2
votes
0answers
18 views

.htaccess file to enable compression, send security headers, and set cache expiration

This is the current .htaccess configuration for one of the website projects that I am working on, just as a learning exercise. This is working code and everything in it seems to be ok, My hosting ...
-1
votes
2answers
68 views

Project Euler problem # 3 is this the most efficient approach in Python or can I do better?

The problem statement: The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? This code takes 9 seconds!, is there a better way? ...
11
votes
6answers
2k views

HackerRank: Electronics Shop

Challenge from Hacker Rank - Monica wants to buy a keyboard and a USB drive from her favorite electronics store. The store has several models of each. Monica wants to spend as much as possible for ...
-3
votes
0answers
24 views

Perl: Print the lines of the file in order of length, lines of equal length should be sorted alphabetically [closed]

Our task is to write a perl program that sorts lines in a file according to their length, lines of equal length should be sorted alphabetically. Below is what I have tried. I'm not exactly sure about ...
2
votes
1answer
38 views

Finding the number of times the code will generate an alert depending upon whether the transaction is fraudulent

Please refer to this problem from Hackerrank HackerLand National Bank has a simple policy for warning clients about possible fraudulent account activity. If the amount spent by a client on a ...
9
votes
3answers
492 views

School House Points (Python + SQLite)

I am creating a database to store house points for our school running events. I would like to be able to tally all the points for the houses and it is working fine, however, I think it may be a bit ...
-1
votes
1answer
26 views

iterator that iterates over a file by paragraph [closed]

I wrote the following iterator to tackle the following problem. I have the following string contained in a file called "example.txt": ...
-1
votes
1answer
21 views

Optional transformation of list with 1 item [closed]

I'm creating a method that returns an (Optional) value, only if there's 1 String in a List<String>. If there is exactly one element in the list, and it ...
2
votes
3answers
124 views

Modeling, view and projection transformation using vector and point in homogenous form

I know this is horrible code. This program is for performing modeling, view and projection transformation. The program reads input from scene.txt and outputs the <...
4
votes
1answer
47 views

Account automation through Python (with Flask) and javascript

This is my first time doing a code review so I expect a ton of criticism on this from all you professionals. What am I doing? I'm using python with flask to create a service for my web server. My ...
-4
votes
1answer
380 views

The HEADING should have 2 SPAN elements [closed]

1: Create a DIV and give it a data-cart-info attribute. Inside the DIV, create a HEADING with mdc-typography--headline4" as its CSS class 2: The HEADING should have 2 SPAN elements. The First ...
2
votes
1answer
28 views

Find articulation points/ cut vertices in graph

I would like to get some feedback on my completed code that finds and displays the articulation vertices in an undirected graph. I included a test case within the code, it should (and does) print <...
-1
votes
0answers
23 views

Counting co-occurence of a file encoded in UTF-8 [closed]

I need to write a script that can count co-occurences in a UTF-8 encoded file. The length of the co-ocurence is between 2 to ...
3
votes
4answers
77 views

Java program to manage animal data and store them in text files

I made this program as a baby step to creating an animal shelter management system that will be used in a real life animal shelter. The goal is to move from text files to an online database, and from ...
3
votes
1answer
39 views

Bin Numbers from stdin

I often like to get a feel for a text file containing a lot of numbers quickly by making a histogram. One can do this in plotting software like Gnuplot, but sometimes having something in the terminal ...
2
votes
1answer
63 views

Join and pivot multiple tables of securities data in MySQL

I'm interested in a way to join three (or more) tables in a way that is more efficient (both in terms of conciseness of code and in terms of generating the results) than what I have currently. ...
2
votes
2answers
46 views

Implementation of enumerate

I'm trying to implement the enumerate built-in using iterators. So far it works but for unordered objects, such as sets or dictionaries, I'm not sure if this implementation is considered valid, ...
-3
votes
0answers
25 views

almostIncreasingSequence CodeSignal [closed]

I have this issue. 35/38 sample tests passed. Execution time limit exceeded on test 36: Program exceeded the execution time limit. Make sure that it completes execution in a few seconds for any ...
4
votes
2answers
119 views

Creating custom objects with custom properties using generics

I have two base classes: City and Building: ...
2
votes
1answer
52 views

Loading in two CSV files and storing them in two separate arrays

As the title says, I'm loading (or at least trying to) two CSV files and store them in two separate arrays. What I have so far worked, but it isn't the most elegant, no efficient solution. The end ...
6
votes
3answers
763 views

Password maker in C#

I need to generate semi-complex throw-able passwords (just one use) in my application. I want it to be: at least 8 characters long; contains at least 1 digit, 1 [a-z] char, 1 [A-Z] char; I generate ...
5
votes
4answers
206 views

Reverse the word order in string, without reversing the words

I was tasked with using C++ to turn this "Hello Jarryd, do you like socks?" into: "socks? like you do Jarryd, Hello"; Edit: The condition was to reverse this in place. Here's what I came up with, ...
3
votes
0answers
28 views

Simple Kivy App for Bootstrap Algorithm

I have a very simlpe app built using Kivy, for performing bootstrap algorithm (statistics). We must input some samples in the form x1,x2,...,xn (these will be ...
6
votes
3answers
289 views

Bishop game - python

A bishop can capture any other bishop if it lies along the same diagonal line, so long as no other bishop is in its path. Given a list of coordinates of the bishops locations, and a board size, ...
3
votes
2answers
130 views

Simple Number to Words using a Single Loop String Triplets in VBA

As an update (conversion) to my article “Simple Number to Words using a Single Loop String Triplets in JavaScript” in JavaScript, I have converted the code to work as a VBA function using the same ...
3
votes
2answers
89 views

Calculate mean and standard error of a generator in Python

The goal of the following code is to calculate the mean and the standard error of vectors of randomly-generated numbers. I am looking for feedback both on the correctness of the calculation, and on ...

15 30 50 per page