All Questions

Filter by
Sorted by
Tagged with
-1
votes
1answer
100 views

Distance on a ring [closed]

I work with objects that are marked by sequential unsigned numbers. When number reaches max value, it becomes 0 again. To detect breaches in the numbering, I calculate distances between them (b is ...
-1
votes
1answer
2k views

SQL connection string builder, initialized in two ways [closed]

For a while now I have been using string builders in my code. The way I currently do this is using the code below: ...
-1
votes
1answer
817 views

Reading bytes from file to compute its SHA256 hash

I need to get text hash (sha 256), so I need to convert file to its type representation. Is this a fast way to get a byte representation of a file? ...
-1
votes
1answer
103 views

Is my code Declarative (RxSwift) ? Please help me to explain why not?

I'm newbie in Swift and Rx programming. Is my below code is declarative ? If not, please rewrite it and explain to help me more understanding about declarative :( (my English is so bad) ...
-1
votes
1answer
114 views

Searching for topic categories using mysqli [closed]

Is this code safe from injection, xss and whole other attacks or no ? The below code is for search box : ...
-1
votes
1answer
3k views

ASP.NET MVC multi language website

What is the best way to make an ASP.NET MVC multi language website? The following code is what I use, but I need to make sure from your real-world experience that my code is the best way for ...
-1
votes
1answer
56 views

Improving User Class structure/design [closed]

I recently got into OOP, because I'm working on a big project and want to make sure my code is easy to maintain & scalable. My question is - how could I go about properly structuring the ...
-1
votes
1answer
1k views

Cartesian product in Scala

I'm using this code to compute a cartesian product: ...
-1
votes
1answer
728 views

Simple PHP SSH2 Class

I've written a simple PHP SSH2 wrapper class. Please review the code and point out mistakes. ...
-1
votes
2answers
120 views

PHP Dependecy Injection Container

A few weeks ago, I asked for another DIC review, but didn't get any response (but only for one about my error handling). So I tried to rework my DIC without any outside insight on it, and the first ...
-1
votes
1answer
336 views

EF Code First BaseContext-class [closed]

I've seen a tutorial where a dbcontext base class is created like so: ...
-1
votes
1answer
42 views

Class for Managing Office Details [closed]

...
-1
votes
1answer
168 views

Python 3 code for a binary search tree [closed]

I am working on a python3.6.5 question about BST: Binary search tree (BST) is a binary tree where the value of each node is larger or equal to the values in all the nodes in that node's left ...
-1
votes
1answer
57 views

Login to a school system and get account type

I'm new to MySQL database design. My question is this database is correctly built or not. We used the users table to login and get account type and here the code to login ...
-1
votes
1answer
152 views

Why does this scala code only execute the last future when necessary? [closed]

From https://www.chrisstucchio.com/blog/2013/actors_vs_futures.html: A very nice feature of Futures is that they are highly composable. Consider the following problem. I want to return an HTTP ...
-1
votes
2answers
8k views

Randomize a jQuery object list

Well this was a simplest code competition at my work. I tried a couple things, they accepted but none of them is I wanted. Because both are always giving same result. I tried to randomize like this <...
-1
votes
1answer
1k views

Mysql flexible insert record with bind_param or bind_value

I want to insert rows in a database table with the precaution of SQL-injection. I'm using below flexible MySQL insert function, which enters a record in a given table. Is this the best approach or is ...
-1
votes
1answer
76 views

Open/Close Principle in front GUI element [closed]

I'm working over project for my studies. It's a simple program about brewing coffee. I'm thinking about solution for showing single parameter in GUI. I have a source brew parameter class: ...
-1
votes
1answer
92 views

Reduce repetition in SCSS for panels of various colors

I have the following SCSS and I'm curious as to how I can improve it, and reduce the amount of repetition... I plan on adding more colors, but I don't wish to keep copy/pasting the same block over ...
-2
votes
2answers
2k views

“ChocolatesByNumbers” challenge

Here is a problem I have attempted: Two positive integers \$N\$ and \$M\$ are given. Integer \$N\$ represents the number of chocolates arranged in a circle, numbered from 0 to \$N − 1\$. You ...
-2
votes
2answers
90 views

Using a lot of IF in loop WHILE to print information

I made a code and it is doing what I want. But, I would like to know if I am doing it right or in the best way. Could you please give me your thoughts about it? Thank you. ...
-2
votes
5answers
1k views

Finding dice roll results in a combinable list of numbers

This code takes a selection of numbers between 1 to 9 which could be 1,2,3,4,5,6,7,8,9 or 1,2,4 or ...
-2
votes
2answers
791 views

Pascal's triangle with memoization

Problem: Pascal’s triangle is a useful recursive definition that tells us the coefficients in the expansion of the polynomial (x + a)^n. Each element in the triangle has a coordinate, given by ...
-2
votes
3answers
2k views

An exit condition for a do-while loop using lists [closed]

I have an integer list l and a predefined integer value row (which is never manipulated inside the code). If value of row is 5, then I want the loop to exit if <...
-2
votes
3answers
216 views

Find and replace a string in C/C++ without using standard library [closed]

I'm solving a problem with find and replace a substring in a string. I've solved it using Python with a couple of lines, in C++ using std library and now solved it with C by using allocation on the ...
-2
votes
3answers
76 views

Translate a day in year to month and day 2nd method

Take an integer representing a day of the year and translate it to a string consisting of the month followed by day of the month. For example, Day 32 would be February 1. I've already submitted my ...
-2
votes
3answers
162 views

Simple Python script seems to stop when N >> 1

Edit : So I let the code run for 70 hours and it did not return. Thus I stick to my point, it does get stuck on something, fails silently and let the bash hanging. From the time increase compared to ...
-2
votes
2answers
246 views

Euclidean distance between documents

For each function, I am manually adding another case. Can this be somehow shortened? Case and function names are the same. For example, the Euclidean_Distance case ...
-2
votes
3answers
7k views

Comparing 2 ints without using comparative operators

I was looking for questions that might be asked in a technical interview and I found this one: Write a function that determines if two integers are equal without using any comparative operators. I'...
-2
votes
2answers
182 views

Is this correct way to use loops or should it be in LINQ?

The results variable is coming from an API that have a arrays in arrays, etc. I have made a foreach with ...
-2
votes
3answers
131 views

Optimizing this seemingly slow Query

...
-2
votes
2answers
230 views

How can I refactor this code in order to not repeat code?

...
-2
votes
2answers
138 views

volatile variables and parallel streams in Java [closed]

For the Below code want to know whether the correct procedure is followed for the java code , are there any missing points according to the java standards ? ...
-2
votes
3answers
553 views

Setting up tab bar, navigation, and view controllers in iOS

I am new to iOS development. I wrote this code, but the company said that this is bad architecture and is not acceptable. I want to improve this code. ...
-2
votes
2answers
95 views

Array to function to int arithmetic

I want to get the value of an integer from within a struct pointer. Simply: int cool = *(*(&(coolPtr->map)) + x); can this be simplified? The rest of the ...
-2
votes
1answer
814 views

Euler totient function in JavaScript [closed]

...
-2
votes
2answers
452 views

Assigning movements to counters for a board game, using die rolls. [closed]

I have finished writing a program, and was wondering if I could make it any more efficient or generally more sophisticated that the current version. The below section of code is where I think ...
-2
votes
2answers
673 views

A struct within a class [closed]

I have a struct lying in a class as below, which I think is not good. Structs should be in a separate file, however, in this case, this struct is only used in a ...
-2
votes
1answer
137 views

How does this refactored code make my code better? [closed]

According to my lecture notes, there are benefits to refactoring the code from original code to refactor code. Reasons for refactoring: Replace Temp with Query You are using many temporary ...
-2
votes
3answers
164 views

Find target sum of 3 from and array

Input is a sorted array and a target sum. Find all sets of 3 unique elements that sum to a target. Looking for lowest order (big O). A, B, C are the indexes on the sorted array. A < B < C ...
-2
votes
2answers
71 views

Python sub-process scripts

...
-2
votes
1answer
168 views

On Finding Coin Jams

The problem can be found here and is essentially asking us to generate J many numbers containing N many digits, where these digits have to be either 0 or 1. The catch is that the these numbers that we ...
-2
votes
2answers
439 views

Palindrome, isalpha and character counter program

...
-2
votes
2answers
7k views

Brute force script for printing a password

I wrote a script that reads a file containing a password ("password"), loops each character in that file to see if it matches a character in the alphabet, and when every letter has been found the ...
-2
votes
1answer
56 views

Formatting a long filesystem path in Python [closed]

This is a follow up to Log probe requests of WiFi devices focussing on a specific element of the code. I have this line of code: ...
-2
votes
1answer
694 views

Retrying to read a file [closed]

I have a piece code which retries 3 more times to open a file (see below). Are there potential problems or side effects with the way it is written? How can it be improved? Also, why would one use <...
-2
votes
2answers
98 views

How pythonic is this code? [closed]

Here is the code: ...
-2
votes
1answer
182 views

Simple Python tic tac toe [closed]

I'm a beginner in python so I decided to take a simple challenge and wrote tictactoe How to write it better in future? What's wrong with my code? ...
-2
votes
2answers
159 views

Faster mapping/modifying values in a large list of Python dicts? [closed]

I have some code that I'm trying to speed up. Maybe what I've got is right, but whenever I ask on StackOverflow somebody usually knows a clever little trick "Use map!", "try this lambda", or "import ...
-2
votes
1answer
96 views

How to make this code more compact and readable

My below code is working fine but I want to make it more Pythonic. Furthermore, I want to get rid of nested ifs and make the code more compact and readable. Any suggestions? Here project_id and ...

15 30 50 per page