All Questions

0
votes
0answers
3 views

Removing Dicts with Null values from Only the End of a List

Given input such as: foos = [ [], [{'a': 1}], [{'a': 1}, {'a': 2}], [{'a': 1}, {'a': 2}, {'a': None}], [{'a': 1}, {'a': 2}, {'a': None}, {'a': None}], [{'a': 1}, {'a': None}, {...
0
votes
0answers
7 views

Creating a dict with external and internal IP addresses provided a list of candidates

I created a function that finds internal and external IP addresses, returns them in dict with the keys external_ips and local_ips...
1
vote
0answers
13 views

Generate two random primes and find their totient

I am supposed to make a basic RSA encryption/decryption code, where I am only given e. I wrote this code to randomly generate two primes and then find their totient. But the totient is supposed to ...
8
votes
2answers
41 views

Converting numbers to words - Python

I'm new to programming. I tried to find a way to convert numbers into letters with Python. I would like to receive some advice to improve myself. This program works for numbers between 1 and 106 and ...
2
votes
0answers
8 views

Select members based on activity

I was asked by a friend to write a simple page for selecting members to various tasks. The members are listed in a textfile, along with how much they are willing to contribute (Usually a number ...
1
vote
0answers
12 views

Factorial Calculator with a basic BigUInt

This is my first rust program. I don't mind this being a strict review. What I want Reviewed? Idiomatic code. Performance improvements. Clean code! Program Requirements: Input a unsigned integer ...
2
votes
0answers
14 views

Cell Gradient Fill Macro

I have two functions here, each one displays the gradient slightly differently with up to 5 gradients. Function 1: ...
0
votes
0answers
18 views

Type erasure in Rust

This is a very stripped-down version of a crypto library I am writing. There are cryptographic algorithms like RSA, DSA, ECDSA, EdDSA, ... which all have a similar pattern of having a private key, a ...
4
votes
2answers
114 views

Python to write multiple dataframes and highlight rows inside an excel file

I am trying to write multiple dataframes into an excel file one after another with the same logic. Nothing changes for any of the data frame, except the number of columns or number of records. The ...
2
votes
1answer
25 views

PONG XI Platinum Edition

This is my first game. This header defines the constants: Constants.h: ...
3
votes
0answers
32 views

Find overlaps in ranges pairwise

I've wrote a function which take in a list of ranges (the ranges being tuples) and then returns a list of dictionaries which are a summary of how these ranges overlap with each other There's not a ...
2
votes
1answer
26 views

Django: Database efficiency - currently accessed twice

I have the following function that is called via signal. 1) check if incluencer exists. 2) Increase discount by +1. Currently, I hit the database twice. Is there a better way to write that? ...
-4
votes
0answers
25 views

create dictionary from a text file in python [on hold]

Below are the sample data in my text file. column name (r1,r2,r3) r1,r2,r3 c1,v1,v2,v3 c2,v4,v5,v6 c3,v7,v8,v9 the expected output is in dictionary format as below ...
1
vote
1answer
27 views

React For loop component

This is my React component for looping a component i.e. I don't want to use MAP or FOREACH in React Component's HTML. ...
1
vote
0answers
16 views

Blackjack simulator for Probability of a dealer bust for each starting card

I came up with this solution to another exercise out of John Zelle's Programming book. ...
5
votes
5answers
596 views

Checking if an integer permutation is cyclic in Java

A an integer permutation array[] is said to be cyclic if and only if we can choose an arbitrary element at position i, move it ...
-1
votes
1answer
19 views
-3
votes
0answers
22 views

What is the best way to order the parameters in the action methods in asp.net web api? [on hold]

In our application, We are injecting the [FromServices] directly into the action method along with [FromBody], and now it ...
2
votes
2answers
40 views

square the elements of a sorted list and give the output in sorted order

Given a sorted list of integers, square the elements and give the output in sorted order. For example, given [-9, -2, 0, 2, 3], return [0, 4, 4, 9, 81]. My solution 1: ...
0
votes
0answers
16 views

Implemeting multidimensional stencil in Cuda C/C++

I've constructed a system that contains multiple 2D lattice and a 1D cable all in a single vector of type double. Each 2D lattice is coupled to a site along the cable. For instance, there are 800 ...
1
vote
0answers
16 views

An attempt of replacing CRITICAL_SECTION with std::mutex and std::lock_guard

I have an older class that I am working on and I'm updating it to remove "Windows" specific code. It had some "Thread Protection Code" that used CRITICAL_SECTION. I'...
-3
votes
0answers
24 views

Cache design with eviction policies

I am trying to come up with design for different types of cache with different eviction policies but I am facing difficulty linking the eviction policy with cache. Mainly what to pass in evict() ...
0
votes
1answer
12 views

XMLHttpRequest in the browser

The intention is to implement an xmlHttpRequest in plain vanilla js while considering all possible errors and problem situations without crashing in the browser. Result and faults are to be properly ...
2
votes
1answer
37 views

User-Interactive Data Cleaning Program in Python

I'm trying to develop a program in Python that allows the user to import datasets and perform operations on them using pandas and numpy so she/he can skip writing all the preprocessing code her/...
0
votes
0answers
17 views

PHP API Query using CURL and return JSON

Fairly new to writing PHP. I want some PHP code to query an API with a post request, set specific headers and message body, and echo out the JSON response. This is the code I have come up with, which ...
-3
votes
0answers
17 views

How can I format currency with commas in C? [on hold]

I'm looking to format currency in C. I would like to place a dollar sign at the beginning, a negative if needed, commas iterating every third digit before decimal, and a dot immediately before decimal....
2
votes
1answer
35 views

Solve membership binary mask problem in Scala

Imagine you have two string sequences: val s1 = Seq("c", "a", "b", "z", "a", "b") val s2 = Seq("a", "b") You need to come up with an algorithm that generates a ...
0
votes
1answer
18 views

JavaScript shortcut to create elements

I've created a personal API for creating elements for an HTML page. I would like feedback on efficiency, particularly in creating buttons and labels. Any and all feedback is appreciated and considered ...
-4
votes
0answers
23 views

My HTML code is not working in IE while it is working in chrome [on hold]

Since my code is confidential (Company) I have 2 dropdown boxes lets say 1st Dropdown contains A B ...
0
votes
1answer
51 views

Fizzbuzz but without if

Code first, elaboration later: ...
-1
votes
1answer
34 views

Bash Script for file auditing, push information to server and be able to view in a web page

Edit: The goal of this Question was only seeking code review and guidance in learning or tips for improvement. I apologize if that was not clear or aligned properly with the goals of this forum. ...
0
votes
0answers
28 views

Wpf background task using thread

In my app I need to verify several records and the operation takes time, so I decided to use threads in order to keep the UI responsive. This is the code: ...
1
vote
0answers
31 views

Value-To-Type Map

Context For one of my projects I have to use a library which works similarly to the following code : ...
10
votes
2answers
600 views

Given the mapping a = 1, b = 2, … z = 26, and an encoded message, count the number of ways it can be decoded

Given the mapping a = 1, b = 2, ... z = 26, and an encoded message, count the number of ways it can be decoded. For example, the message '111' would give 3, since it could be decoded as 'aaa',...
2
votes
2answers
29 views

SRT caption support for HTML5's video element

With HTML5 you can add captions to your video using the <track /> element. However, only vtt files are officialy supported, while the current most populair ...
-2
votes
0answers
15 views

Ionic 1 cordova File plugin, can't write files on device [on hold]

I am using ng-cordova to upload a file from both gallery and camera using ionic 1. but my file is not uploading to my device storage. Please correct me where i am doing wrong. Please find the below ...
2
votes
0answers
17 views

Simple data analysis for forecasting

This Python script extracts data from txt files containing raw numerical data, notably the increase average, the relative evolution and the standard deviation of ...
0
votes
1answer
21 views

ImportExcel for Dataset with Multiple tables

I need to be able to create an Excel document with multiple tabs for a dataset with multiple results\data tables. I have a stored procedure with 3 selects in them, fairly simple ones pulling data from ...
0
votes
1answer
28 views

A simple clusterness measure of data in one dimension using Java

Problem definition Given \$X = (x_1, \dots, x_n)\$ such that \$x_1 \leq x_2 \leq \dots \leq x_n \$. Let \$x_{\min} = \min X = x_1\$, \$x_{\max} = \max X = x_n\$ and \$r = x_{\max} - x_{\min}\$. Also, ...
5
votes
1answer
173 views

Counting primes in a range whose digits are all prime

Codewars Kata: Given integers a and b, count all primes p where a ≤ p < b and the digits of p are all prime. b may be as large as 107. To start with, I hardcoded all valid 1903 primes in \$[1, 10^...
3
votes
0answers
25 views

Simple HTML website with CSS

I've made a simple website from scratch using HTML and CSS, for practice purposes only. I got the website to look the way I want but I would appreciate some feedback on the code, especially the CSS ...
-4
votes
0answers
14 views

Check if file absorbency/ contains a directory [on hold]

My code checks if in the path, there is a folder (../codereview/, `/stack``), Would there be a better way to optimize that and with less line? ...
0
votes
0answers
15 views

Java: avoid overwriting on a text file [on hold]

i'm a student at university and I am a beginner at Java. I had a job of writing an inventory program that add products in a list. I made a function to save and load data from the text file but ...
2
votes
2answers
31 views

Bash - Passing arguments with “$@” to either 'sudo su' or 'sh'

I have a server where shell commands to the supervisor-service must be executed by the specific user lx. I have written a bash function that does exactly that. <...
0
votes
0answers
49 views

C++ console progress display

I just figured out how to do a building menu with a progression feature in c++ console application. What this code does: It simply offers you a choice to build a building and then prints the ...
3
votes
0answers
8 views

MySQL JSON diff procedure

I'm building a procedure which compares two JSON objects and return two JSON objects with differences between each (compared keys and values). But I have relatively superficial SQL knowledge, so I ...
-2
votes
1answer
30 views

Is it good to pass dependencies as paramters? [on hold]

for example, here are two classes : ...
1
vote
0answers
21 views

Angular component for select with custom input

I'm creating an Angular widget which combines a dropdown with a custom input. I've made it generic and am preparing a blogpost explaining my setup, and would love to get a review before I do so. The ...
6
votes
2answers
667 views

Reading source code and extracting json from a url

I made a program to read the source code from a url. To reach this url I need to specify a token. After read the source code, I extract a url in json format, andIi ...

15 30 50 per page