All Questions
0
votes
0answers
6 views
Compute the probabilities of getting each of the possible sums when throwing 2 dice, n times [on hold]
I'm struggling with some coding-inexperience. The code I've written below, is extremely inconvenient and ugly to look at.
My question to you is:
How can this be done more efficiently? The way I've ...
0
votes
0answers
5 views
Array Menu Switch Options, Black Executing Program
This is some code put together using an array to store numbers using a menu to let the user input, delete, and sort data. The compiler doesn't seem to have any issues, but executing the program ...
2
votes
1answer
13 views
HackerRank Strange Counter
I wrote a solution to HackerRank Strange Counter:
The counter counts down in cycles. At t = 1, the counter displays the number 3. At each subsequent second, the number displayed by the counter ...
2
votes
0answers
20 views
Text-based Adventure-Game Engine
I wanted to create some kind of generic text-based adventure-game
engine to see if I could build an interesting puzzle out of it.
The idea was to define a mini-language to be able to define the
...
1
vote
0answers
12 views
Battleships Player vs Computer Algorithm
I am a Year 12 student studying CS for my A-Levels. I have had previous Python experience but it is obviously not to professional/industry standard. Therefore, my goal for this review is for my code ...
1
vote
0answers
14 views
Code that uses reflection to validate arguments
I wrote an answer to this question on the Software Engineering SE site and was hoping to get it critiqued. (I'm told that it's acceptable to do so).
Essentially, this code uses reflection to check to ...
3
votes
0answers
19 views
Slot Machine Simulator with JAVA
I'm studying alone, so I don't know if I'm writing efficiently. Could this SLOT MACHINE SIMULATOR code be improved? How?
...
1
vote
0answers
7 views
How to make query run faster when using sub-query
First part of the query grabs Policy's Premiums, Effective and ...
0
votes
0answers
19 views
2
votes
0answers
9 views
REST API integration test
We have a (Spring) REST API that I was tasked to write integration tests for. I wrote various ways to test our REST API and then just decided to make 1 integration test class that processes all JSON ...
2
votes
1answer
31 views
Simple class to mimic a dynamic array
for my c++ class I was asked to write a class with the following characteristics:
Implement a vector replacement that operates only on integers (you don't need to use templates like the normal STL)...
2
votes
1answer
32 views
List abstraction using array
Following this reference, below is the list abstraction implementation using array,
...
0
votes
1answer
15 views
Sort the input file text by most frequent and alphabetically [on hold]
The input file is a long .txt file that is indicated by a path. The program should be able to find the most frequent words in the file. As well as the output should be sorted, if 2 words appear the ...
0
votes
0answers
6 views
Delete Matching Records in Fact Table
I'm new to SSIS and T-SQL and have perhaps a noob question. I'm editing this SSIS package and there is an Execute Sql Task called "Delete Matching Records in Fact Table"
My question is, can this ...
1
vote
1answer
30 views
Python program for testing the Collatz Conjecture
This is a simple program to test if integers will follow an interesting, improvable statement that if disproven, calls for a bravo.
But, ignoring the pretentious poetry, this code allows the user to ...
-2
votes
0answers
16 views
What is better rejected promise or throw an error when you perform a async request [on hold]
Hey guys was discussing with my team this two approaches we wonder what would be the best for this function that performs a request. First example it will gracefully return a rejected promised. The ...
2
votes
0answers
10 views
Parallel and Sequential array looping with async/await
Are these good implementations of parallel and sequential "extension" methods, and do they accomplish what I think they do?
My understanding is that the first one is parallel because the await ...
4
votes
0answers
22 views
Parsing cron expression
I'm building my own scheduler and I took the first step by creating a cron expression parser.
To test it I used this expression to cover each case. (I guess the 52W is wrong but this doesn't matter ...
3
votes
0answers
13 views
Code for neuroscientific testing
I have written the code below for the following experiment:
Subjects get simultaneous stimulation of left and right thumb and have to tell which one was stimulated "stronger" (with higher intensity, ...
1
vote
1answer
48 views
Random number guessing game in python
I just started learning Python this week and put this together for my first program (outside of a Hello World one). Does anyone have any feedback/suggestions for improvement for this? I've tried to ...
0
votes
1answer
14 views
Print Connected Components Scala
Given a file containing adjacent IDs:
i1, i2, i5
i3, i4
i2, i6, i7
i4, i8
i9, i3
I would like to print each of the connected components:
...
-1
votes
0answers
11 views
How to create dynamic excel VBA range using integers in a fill down line? [on hold]
I'm trying to fill down a column but it's a looped operation and has to be dynamic. In a simplified sence
Works:
Cells(3, 8).AutoFill Destination:=Range("H3:H" & 30)
How do I change "H3:H" so ...
3
votes
0answers
31 views
Box-Triangle intersection algorithm
So recently I wrote an algorithm to generate decals.
To do so I used code from https://www.geometrictools.com/ for an algo to find if triangles intersect with an aligned box.
I was wondering how/if I ...
-1
votes
0answers
13 views
Creating function, if dictionary and list contain same element [on hold]
Im trying to create a function that returns true if one or more items in the dictionary are the same as the list Deliverynish. Ive created this so far but when i run it it prints false. As you see in ...
1
vote
0answers
18 views
Small camera app in react-native for Android
I'd like you to help me review a small camera app. Most of the code comes from here; I just changed it a little bit.
I started dabbling with react-native for the first time. It seems kinda neat but I ...
-2
votes
0answers
23 views
How should I write my function that returns true? [on hold]
Can someone help write a function that returns true if vector A and vector B contain the same elements with each element occurring the same number of times in each vector?
...
0
votes
0answers
16 views
Django Notification Model with a generic relation
I wanted to implement notifications for my app, so that a user would know if another user, liked, commented on, or followed another user. It works, but I feel like it's very limited which I need to ...
4
votes
1answer
200 views
Converting HEX values to Unicode characters
I have a small bot for social network, which accepts message "unicode XXXX XXXX XXXX ...", where XXXX - HEX values which I ...
-3
votes
0answers
11 views
3
votes
3answers
27 views
Presenter creating Views in c# MVP
I have a c# WinForms application in which I have tried to implement the Model View Presenter pattern with Passive View. I create new Views in the Presenter of my 'home screen'. I was wondering if this ...
5
votes
1answer
47 views
Text search in Python
Whilst self-studying algorithms, I came across the Karp-Rabin rolling hash search algorithm here. I decided to have a go at implementing it in Python:
For ease of reading; the data-structure ...
0
votes
1answer
18 views
Parsing HTML in Node.js with regex
I'm looking for an effective way to parse html content in node.JS.
The objective is to extract data from inside the html, not handle objects.
It is a server-side thing.
I tried using jsdom and I ...
0
votes
0answers
17 views
Elegant Pascal's triangle in mit-scheme
As suggested by the name of source file(ex1.12.scm), I just started learning mit-scheme by reading SICP. In Exercise 1.12, I'm asked to "compute elements of Pascal'...
5
votes
5answers
200 views
Another DataGrid (ObservableCollection) Filtering Method
I have re-written my DataGrid filtering method to try to improve performance and I feel that although this is the fastest yet, there is still room for improvement ...
4
votes
1answer
29 views
Generating double linear sequence in Haskell
Need some comments on making the below code more effective. I'm pretty new to Haskell.
The sequence in generateSeq is generated by the rule that if ...
1
vote
1answer
52 views
Printing a list to a file then reassembling said list
This is a GCSE practice problem, to practice for the actual coursework. Computing's my passion and I'd like to impress the examiners (note: any tips would be appreciated)
Essentially, this is simply ...
0
votes
0answers
21 views
Animate div positioning rearrangement [on hold]
I am building a simple push-down effect which affects the position of two containers. So far I have managed to achieve a near-desired effect using fixed positioning for the hidden container, while ...
0
votes
2answers
62 views
Header only c++ singleton pattern implementation
I want to implement the singleton pattern in a header only c++ library. (Please refrain from sharing your opinion on the pattern itself!) This would be trivial if I could rely on the compiler ...
2
votes
0answers
17 views
Codewars kata : reverse and rotate
I just started to learn Elixir and to train on Codewars.
I solved this kata but I'm not very satisfied of my code and I have no clue (literally) how to improve it.
Recursion seems the way to go here, ...
-4
votes
0answers
14 views
Writing the concat function just with List comprehension [on hold]
How could i write the concat function, just by using list Comprehension?
2
votes
2answers
36 views
Tiling an nxn grid with L-shaped Trominoes
This is some code I wrote in order to see if it was possible to tile a 9x9 grid using trominoes that are shaped like this:
_
| |_
|___|
(They can be rotated.)
One issue I had while ...
4
votes
2answers
176 views
Recurrent action on concurrent collection
I have a bunch of concurrent threads carrying out operations which return alerts. The alerts have to be persisted to a DB, but this cannot be done concurrently as it may cause duplicate alerts being ...
5
votes
1answer
281 views
Find all strings in list which have keywords in it from another list
I a list of strings A and a list of keywords B. Now I want to return all strings from list A which have all keywords from B in it as a new list.
...
2
votes
0answers
21 views
File copy in Python for slow networks (version 2)
This is a follow up of a previous question
I have written a file-copy routine, as I experienced unreliable results using standard Python when copying file over very slow networks.
The requirements ...
-4
votes
0answers
17 views
Merging of nested arrays based on key value [on hold]
I have to merge 2 arrays with key value as follows:
...
-1
votes
0answers
35 views
Subtract from line and move to next
I want to subtract from the line with oldest date and where counter > 0, and when it reaches 0 I want to subtract from the next oldest line with the same itemId and ...
3
votes
1answer
30 views
Getting the three next days
I'm simply getting the 3 future days from an array of objects based on the current day to display for a weather component.
This is the first time I've attempted using ES6 and it's features so please ...
0
votes
0answers
17 views
Return path between graph nodes using breadth-first search
This code is meant to implement a Graph class which has a method that returns a path between 2 nodes using breadth-first search.
I'm doing this to improve my style ...
-5
votes
0answers
14 views
Error while Saving pandas dataframe to msql database [on hold]
I have a table in pandas dataframe df.
i want to write this to database. so i am using df.to_sql, but getting error.
i am using MySQLdb.
...
2
votes
2answers
37 views
Printing log messages with varying length fit into screen width
I'm writing a simple sanity tool for a simple USB driver.
The customer is directly facing the output so I have to care about how it looks.
The log messages that I need to print are varying length, ...