All Questions

Filter by
Sorted by
Tagged with
3 votes
0 answers
49 views

React and D3 Alignment Histogram

I'm reasonably new to D3, and I've put together a class based React component which outputs a genomic alignment visually. The ...
Sam's user avatar
  • 332
1 vote
2 answers
64 views

Django: App based at PolymorphicModel

I'm building a simple Django app for reviews of different objects (restaurants, car services, car wash etc). I started with the app, but soon I faced first problem. Every object has features (but ...
MorganFreeFarm's user avatar
1 vote
1 answer
45 views

query optimization and indexing

database relations can be found here http://www.tpc.org/tpc_documents_current_versions/pdf/tpc-h_v2.18.0.pdf ...
Steven Choi's user avatar
3 votes
0 answers
124 views

Create one class to perform all type orm functionalities

I'm trying to create a separate package in a monorepo to handle TypeORM functions. So if I have two APIs (User API, Admin API), both can refer to the same package ...
THpubs's user avatar
  • 81
34 votes
3 answers
14k views

Match blood types in C

I have written a solution to the blood-type matching problem, as described at https://projectlovelace.net/problems/blood-types/. The problem is to determine whether a given recipient (in this case, <...
oleskiewicz's user avatar
4 votes
1 answer
89 views

Properly read integer in a range in C

I wanted to write a C function C99/POSIX compliant that read an integer from the user input. I wanted this function to be safe and robust but I feel it is way too complex for such simple task. I am ...
nowox's user avatar
  • 1,099
2 votes
0 answers
316 views

socket.io / jwt [closed]

I am studying socket.io and ended up making a connection using react as front end js and how to back end node js I was successful but I have a question as to how I made my code I don't know if it's "...
gabriel 's user avatar
1 vote
1 answer
118 views

Returning search results based off checkboxes

I use the following code to filter data from SQL and it works fine. However, below code is vulnerable to SQL injection, but all the ...
sanoj lawrence's user avatar
5 votes
1 answer
2k views

Mapping Excel rows to model

I have an Excel file and each row within the sheet represents an employee's data. I am trying to find a cleaner way to map each row to a model object: ...
R4nc1d's user avatar
  • 361
2 votes
1 answer
623 views

Tic-Tac-Toe with changeable board size (Part 2)

Part 1: Tic-Tac-Toe with changeable board size (Part 1) I just revisited all my previous questions and saw that I hadn't updated my Tic-Tac-Toe code. So, I improvised my code as per @Austin Hastings ...
Sriv's user avatar
  • 2,730
4 votes
2 answers
2k views

Alternative code to classes in Javascript?

I'm new to JavaScript and came across classes in ES6. Though they are great, I don't want to learn something that can be done in other ways. So, I created this code that does somehow similar job to ...
Ram Alsaifi's user avatar
3 votes
1 answer
118 views

Linked List implementation in python 3.x

I took this as a challenge and implemented linked list data structure in python ...
Sriv's user avatar
  • 2,730
1 vote
1 answer
716 views

Password hashing (PBKDF2) and RSA encrypt + AES 256 in Java

Here's what I could comprehend in C code: Generates a key using PBKDF2 Generates an IV which is MD5 of PBKDF2 key in step #1 Does AES-256 encryption on customer-id - which is one of the output RSA ...
stack123's user avatar
4 votes
2 answers
464 views

Run length encoder decoder

The code works not only as a normal run length encoder and decoder, but it also works for values like 3ABC (Prints ABCABCABC), ...
Sriv's user avatar
  • 2,730
3 votes
2 answers
208 views

Morse code encoder decoder

I created this morse code encoder and decoder. ...
Sriv's user avatar
  • 2,730
5 votes
2 answers
671 views

Scrabble Scorer in Python

I made this Scrabble with care since it will be mainly used by family that will not understand the error codes so that is why I catch basically every possible error, to make it user friendly. I have ...
unkn0wn.dev's user avatar
4 votes
2 answers
97 views

Python Friendly Form

The 'friendly form' of a number is written as a sum of reciprocals of distinct positive integers. eg. $$\frac{4}{5} = \frac{1}{2} + \frac{1}{4} +\frac{1}{20}$$ I have written a python program that ...
Melkor's user avatar
  • 181
2 votes
1 answer
56 views

Python - Automate code involving suffix [closed]

I am trying to automate this portion of code in python (code shown for 2 polygons, I am trying to do the same for 10 000 polygons). Any ideas on how to implement this using ...
Tina's user avatar
  • 29
10 votes
2 answers
197 views

System design - Jaipur board game learning agent

Link to my previous question. I've implemented the other features of the board game, and made a simple learning method that stores state values and makes optimal moves based on that. I've used some ...
Thirupathi Thangavel's user avatar
3 votes
0 answers
192 views

Rust 2D grid class

This is the first time I‘ve used Rust, and I'd like to have some feedback on this project. The Grid class should be able to store objects of any type; it's a simple ...
Stud's user avatar
  • 786
10 votes
1 answer
424 views

Resizable containers with VueJS

A month ago I reviewed the code in Resizable split DIVs Vue.js, suggesting that the OP use computed properties and bound styles to simplify the code (at least reducing the need to use ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
2 votes
1 answer
163 views

How to properly write code for Java Swing

basically I'm learning Java Swing by myself and I'm wondering what is the correct way to wrote code for it? I don't want to have a big class with everything in it and I want to do in the most "correct"...
TheBleccbird's user avatar
4 votes
1 answer
139 views

Save points cloud in PLOT3D format

I have the following function to save points cloud in PLOT3D format: ...
s.ouchene's user avatar
  • 145
6 votes
1 answer
2k views

Recursively listing the content of an FTP server

Today I found myself in need of programmatically getting a recursive list of the files on a remote FTP server to look for some data archives. Much to my surprise, I could not find this functionality ...
AlexV's user avatar
  • 7,250
4 votes
1 answer
221 views

Code to fetch BitBucket repos

This actually works nicely (we have > 2k repos) but I would really like it to start producing results right away as soon as it has any. Mostly so it seems faster than it is (by being more responsive). ...
Christian Bongiorno's user avatar
4 votes
0 answers
78 views

Extracting cycles from directed graph with max degree 1 and then performing set cover on cycles

I'm trying to solve P1243E in an efficient manner. The problem in simple words is: Given \$k\$ boxes, \$i\$-th box with \$n_i\$ numbers. All numbers are distinct. We need to select one number from ...
RE60K's user avatar
  • 1,456
13 votes
3 answers
2k views

Hough transform algorithm - Idiomatic c++

I've got some working code to compute the Hough transform for circles: ...
nz_21's user avatar
  • 1,041
1 vote
2 answers
852 views

String to Integer (atoi)

I was doing following question on leetcode: String to Integer (atoi) Question: Implement atoi which converts a string to an integer. The function first discards as many whitespace characters ...
iRohitBhatia's user avatar
9 votes
3 answers
1k views

Counting without zeroes

Below is a python script that generates the sequence ['a', 'b' .. 'z', 'aa', 'ab' .. 'az', 'ba', 'bb' .. 'zz', 'aaa', 'aab', ..] This is essentially counting in ...
Grismar's user avatar
  • 243
7 votes
3 answers
4k views

Parsing molecular formula

Is it possible to improve this code in terms of efficiency / line number ? (avoid nested code ...). It comes from a test I failed. I don't know how I could have done it better. ...
a.cou's user avatar
  • 89
5 votes
1 answer
373 views

Roman Number to Integer

Problem Definition Roman numerals are represented by seven different symbols: I, V, X, <...
Igor Soloydenko's user avatar
0 votes
1 answer
36 views

Correctness and Performance of graph plotting on R

Current State: I have two CSV files, their sample attached below: FileOutputWithoutBuffer-Metrics.csv ...
surajs1n's user avatar
  • 103
2 votes
1 answer
1k views

Quadratic "Complete the Square" Solver in Python 3

I quickly wrote this program to transform quadratic expressions in general form into vertex form. \$ax^2 + bx + c \;=\; a(x-h)^2 + k,\quad\text{where}\quad h = -\frac{b}{2a} \quad\text{and}\quad k = ...
nokko's user avatar
  • 43
7 votes
1 answer
376 views

Hill Climbing Egg Holder function - escaping local extrema

Here is the Egg Holder function for \$m\$ dimensions: $$\displaystyle f(x)=\sum_{i=1}^{m-1}\left[-(x_{i+1}+47)\sin\sqrt{|x_{i+1}+x_i /2 + 47|} -x_i \sin\sqrt{|x_i - (x_{i+1}+47)|}\right]$$ I am ...
gator's user avatar
  • 455
2 votes
1 answer
166 views

User authentication, management

I have recently started studying JavaScript, nodeJS, and reactJS on the front-end, and I have some questions about best practices to apply in this JavaScript world. I would like to ask for opinions ...
gabriel 's user avatar
1 vote
0 answers
63 views

Function that provides callback for promise or non-promise

Below I created a use function that wraps a promise or non-promise, providing the a value callback all-while preserving the original function type. ...
ThomasReggi's user avatar
4 votes
1 answer
1k views

Better way than setInterval to wait for an image load?

This is really a simple affair, I just wonder if there is a better way to do it: ...
martixy's user avatar
  • 253
5 votes
1 answer
50 views

Adding users for login

I have some questions about best practices to apply in JavaScript. I would like to ask about my code and how I could improve. Starting with an example, I have 2 functions with different ways of ...
gabriel 's user avatar
3 votes
2 answers
2k views

Validate if either or both of two fields has been provided, as a ValidationAttribute

I have a binding model where at least one of two fields must be specified. I can't just set them both as [Required]. Here is what I came up with: ...
MPelletier's user avatar
6 votes
1 answer
155 views

Spread values to an object (Computed property names)

I would like to get a review of something, I have a function that creates an array of objects for a Drop-Down component (react-select). The function gets data, <...
zb22's user avatar
  • 161
5 votes
1 answer
343 views

Writing a BitTorrent client in JavaScript

I'm trying to write a JavaScript BitTorrent client in Node.js to get more familiar with the language and ecosystem. I don't know how often people use classes in JavaScript since I feel like the ...
calvines's user avatar
5 votes
1 answer
111 views

Compiling Go with python

I've made a small script to compile Go code with Python. The result is not something I'm happy with, because: It seems overly complicated I'm worried the nested if-else with f string are unreadable ...
Ludisposed's user avatar
  • 11.5k
2 votes
1 answer
491 views

Number of unique substrings of particular length of a binary string

Question: A binary string is given with only 0's and 1's. A number n is also given as the length of a sub string to be considered. It is to find the number of unique substrings. Here, n=3. My ...
Nehal Samee's user avatar
2 votes
0 answers
110 views

Property typed lodash compose function

Here I created a typed version of lodash flow that offers more specific typing. I'm curious if this exists in any other library, which optimized in tying any way —...
ThomasReggi's user avatar
4 votes
1 answer
700 views

Iterate through Expression Tree

I'm trying to build an iterator (enumerator) that can select specific elements in an Expression tree by traversing the tree and deferring further iteration until ...
Rhaokiel's user avatar
  • 141
-3 votes
2 answers
95 views

Which is faster, (n==0 or n==1) or (n*(n-1)==0) [closed]

This is the first time for me to ask a question in this site. Recently, I was learning python 3.x and I got a question... Which is faster ? if n==0 or n==1: or ...
MafPrivate's user avatar
1 vote
1 answer
52 views

How to check list of environment variable in python? [closed]

I have requirement to check list of environment variable in Linux. Based on environment variable, exit code will be different. how to optimize the below code? ...
BEPP's user avatar
  • 165
2 votes
1 answer
53 views

Reporting progress using a Follower

My goal is to implement a function that accepts a Follower object that will be used to report progress through a complex function (a depth-first traversal of a ...
Rich Apodaca's user avatar
5 votes
1 answer
262 views

Turtle controller with simple instruction set

I've made a controller for Python's Turtle. The controller essentially defines an 'instruction set' so that commands can be recorded in a text file and then executed sequentially by the turtle. It ...
mattrea6's user avatar
  • 163
3 votes
0 answers
40 views

Retrieving Registry nodes for HKLM

I am using the below code to retrieve nodes and values. It is taking 20 mins to retrieve the nodes and values of HKLM. I'm expecting to reduce the retrieving time ...
Sankar S's user avatar

15 30 50 per page
1
326 327
328
329 330
1552