All Questions

Filter by
Sorted by
Tagged with
-2
votes
0answers
31 views

How to make knn algorithm more efficient in python [on hold]

I'll have to make the following algithm more efficient. The train data set can include up to 20000 point. The test data set has 5000 points. At the moment the algorithm need up to 10 minutes. ...
5
votes
2answers
101 views

PLINQ code analysis in terms of efficiency of cryptographic hashes generation

I have the following code that I wrote in order to find the correct password by generating hashes out of all possible combinations and comparing each of them with the target. I'm trying to make ...
-4
votes
0answers
25 views

How to replace multiple substrings in a string in C#? [on hold]

I have to replace multiple substrings from a string (max length 32 of input string). I have a big dictionary which can have millions of items as a key-value pair. I need to check for each word if this ...
-4
votes
0answers
22 views

I need to show if a triangle is a right triangle, using a boolean with three in-command arguments in java [on hold]

When I go to import numbers, it says some numbers are false when they should be true or viseversa. For example, when I put in -3, 4, -5 it comes out as true when it should be false. ...
-4
votes
0answers
17 views

variables in FullCalendar [on hold]

hello i'm using fullcalendar and i want to declare event.date as a variable to use it like this: ...
2
votes
1answer
26 views

Find the next predicted time a satellite is going to take picture of place

create a function which predicts the next time a satellite image will be taken of a certain location. When there is enough data to do so, the function should print a prediction for when the next ...
3
votes
1answer
26 views

Get list of new questions from Stack Overflow

I would like to write a little pet project using Clojure to study it, something like Stack Overflow client. Here is a my first code to get list of new questions from site. I am in the very beginning ...
1
vote
2answers
45 views

Constant Time implementation of String Uniqueness Algorithm

I've written what I think is a constant time implementation of a uniqueness check. I've seen many algorithms online, which run in linear time, but was wondering whether my conclusion that this runs in ...
-1
votes
0answers
13 views

PHP PDO Uploading Image to Database & directory Template so far [on hold]

I have written out the following code to upload image files to a directory called Uploads on my website server, the image upload part is working and has been tested(So this is working code). But I ...
1
vote
1answer
42 views

Generate a large block diagonal covariance matrix with exponential decay

I am implementing Kalman filtering in R. Part of the problem involves generating a really huge error covariance block-diagonal matrix (dim: 18000 rows x 18000 columns = 324,000,000 entries). We denote ...
3
votes
2answers
166 views

Parser for STL stereolithography data files

I'm parsing STL files to load the coordinates. My code is: ...
2
votes
1answer
23 views

Naive implementation of sort inplace

I had the following assignment for the Python 101 course I'm taking in my university. ...
-3
votes
0answers
22 views

What is the exact alternative of rand() % vector.size() in c++ to java [on hold]

I am facing difficulties of converting rand() % TDx.size() in c++ to java. I convert this as ...
-5
votes
0answers
29 views

Defining Rule Factory for Transformation of one Json string to another json string c# [on hold]

public interface IMappingRuleFactory { IMappingRule Create(string mappingRuleName, dynamic parameters); } Interfaces.IMappingRule: ...
3
votes
2answers
34 views

Checking the strength of a password using regexes

I'm a beginner in Python and I made a password checker. I'm following these rules: I have to use regex password must be at least 8 characters must have at least one lower case character must have at ...
12
votes
4answers
1k views

Project Euler # 25 The 1000 digit Fibonacci index

The Fibonacci sequence is defined by the recurrence relation: Fn = Fn−1 + Fn−2, where F1 = 1 and F2 = 1. Hence the first 12 terms will be: F1 = 1 F2 = 1 F3 = 2 F4 = 3 F5 = 5 ...
2
votes
2answers
23 views

Project Euler # 24 Lexicographic permutations in Python

A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we ...
2
votes
0answers
11 views

Error handling in express without middlewares and using class structure

This is a simple implementation of Django's sample project "Poll" using and express. The controller code: ...
3
votes
0answers
24 views

Optimizing throughput when writing millions of rows with Parquet's row group

I'm building a basic data pipeline in .NET to extract data from tables in our RDBMS systems, that exports into columnar storage using Parquet. I'm using Parquet's row group to batch up the writes into ...
2
votes
0answers
29 views

Simple react app to fetch and display data

This is my first react app and it was for a job interview challenge. The app is really simple and it works, but although I don't think I'm gonna get it, could I have some feedback about what is wrong ...
3
votes
1answer
57 views

Sim game and it's my first program

This is my first program and I had fun making it and learning new things! Please let me know what I can do to improve this code! The objective of the game is to survive as long as possible. You have ...
1
vote
0answers
15 views

Update join table using list of checkboxes in Rails

I have Gig and Singer Active Record models (standard--no customization just yet) with a many-to-many relationship through a ...
2
votes
1answer
27 views

CodingBat: without_end

Link To Question Given a string, return a version without the first and last char, so "Hello" yields "ell". The string length will be at least 2. without_end('Hello') → 'ell' ...
3
votes
2answers
55 views

Finding unpaired number in an odd Array of integers

A non-empty array A consisting of N integers is given. The array contains an odd number of elements, and each element of the array can be paired with another element that has the same value, except ...
3
votes
1answer
48 views

Set a specific bit to a specific value

This is the code I came up with: ...
1
vote
0answers
17 views

check condition with userdefaults value exist or not

I am check first time userDefaults will not save value return 0 else get value from userDefaults I am checking if userDefaults will not save the value, and If it ...
4
votes
1answer
31 views

Project Euler # 22 names scores in Python

Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. ...
2
votes
1answer
38 views

Toggling the background color of a page using JavaScript closures

This question is to see if I can get some input on the "design pattern" I tried to implement here. I'm just learning about closure in JavaScript and I think I'm starting to get it. I'm wondering if ...
-4
votes
0answers
35 views

Code knowledge against simplicity when looping on a list, what is the best practice? [on hold]

Context On StackOverflow, a user ask: How to make last element of list finish with a dot and the others with a comma? ...
-3
votes
0answers
16 views

Check list of password requirements using Regular Expressions [on hold]

Python program to check the validity of password input by users using re module. Following are the criteria for checking the password: At least 1 letter between [a-z] At least 1 number between [0-9] ...
-1
votes
0answers
15 views

Boolean expression order [on hold]

I have a simple question about how I should be ordering the elements in a boolean expression. Imagine I have an equality operation, should the expected value be in front or the actual value? ...
2
votes
1answer
41 views

Coding Challenge: Kattis

Short problem description: A sequence of numbers are antiarithemtic if there exists no three numbers a_i, a_j, ...
1
vote
0answers
13 views

Example Multiple Async Await Calls Javascript

I need to make an unknown number of api calls, up to 5 max probably. But most samples I've seen show only a couple of async calls so are effectively hard coded to the number of calls being made. This ...
4
votes
1answer
46 views

Porting stemming algorithm from Java to Python

I have ported Stempel stemmer in Java (Apache Lucene) to Python. I come from Java world, so I'm afraid my translation might not be "pythonic" enough. I would like to hear your feedback on quite ...
3
votes
0answers
27 views

Double pendulum real time plot

Double Pendulum I made a little application that embeds a matplotlib dynamic plot into tkinter that enables control through the ...
3
votes
2answers
59 views

Importing data into PostgreSQL from remote text file using ftplib class

I need to read a remote file using FTP and process it and insert the processed data to a PostgreSQL database in another server. The below code is working fine, but i want some advice to modify few ...
1
vote
0answers
69 views

Object-oriented calculator

I have solved an assignment (Exercise 3) from the MOOC Object-Oriented programming with Java, part II, but I'm not enrolled in said course. Assignment Summary: Make a simple calculator. You ...
7
votes
2answers
72 views

Function invocation every second time

Recently I got test task at the project, it is fairly simple: ...
2
votes
1answer
28 views

Python Turtle implementation of the 15 Puzzle

Please can I have some feedback on my Python Turtle implementation of the 15 Puzzle? I have deliberately avoided using OOP as my aim is to develop a clear and clean coding style suitable for teaching ...
8
votes
1answer
295 views

Detecting existence of a class member

I wanted to detect if I have a member in a simple POD struct and after some searching and merging some methods I found on the web I've come up with this solution: ...
1
vote
1answer
37 views

Project Euler # 21 amicable numbers Python

Let \$d(n)\$ be defined as the sum of proper divisors of \$n\$ (numbers less than \$n\$ which divide evenly into \$n\$). If \$d(a) = b\$ and \$d(b) = a\$, where \$a ≠ b\$, then \$a\$ and \$b\$ are an ...
3
votes
3answers
59 views

Unit tests for a function that calculates demerit points for speeding

I'm currently working on a unit testing course (NUnit 3.x). I've been tasked with a simple class to test all edge cases. ...
-3
votes
0answers
28 views

How to create an autocomplete method that search an existing trie in python [on hold]

I am new to python, I found different codes that implements trie, like this one example below, but I have hard time understanding how to search the trie.. ...
3
votes
1answer
33 views

Project Euler # 20 factorial digit sum in Python

n! means n × (n − 1) × ... × 3 × 2 × 1 For example, 10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800, and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27. Find the sum of the ...
2
votes
1answer
33 views

Project Euler # 19 Counting Sundays in Python

You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have ...
4
votes
2answers
57 views

Letter case permutation

The question can be found here https://leetcode.com/problems/letter-case-permutation Given a string S, we can transform every letter individually to be lowercase or uppercase to create another ...
1
vote
1answer
30 views

Integer field in Python with extra constraints (Testable class)

I am trying to write an integer field in Python with the following attributes: Minimum Exclusive minimum Maximum Exclusive maximum Multiple of Value Basically, given the constraints and the value, ...
4
votes
0answers
25 views

Wavefront 3D Obj parser/viewer

For learning Rust I decided to make a 3D .obj viewer. I wrote a simplified OBJ parser without materials that only supports triangles. Considering I'm completely new to Rust and don't really know ...
-1
votes
0answers
26 views

Exact same code but there's an error? [on hold]

I've been following this video:https://www.youtube.com/watch?v=YXZX_6RfHjk For some reason my code for the javascript portion is this: ...
2
votes
0answers
22 views

Java file transfer through sockets

I am making a program that transfers files from one client to another. Right now I am just working on sending the file to the server and then later I will work on transferring it to the other client. ...

15 30 50 per page