All Questions
0
votes
0answers
12 views
Python: Create an algorithm that receives a dictionary, converts it to a GET string, and is optimized for big data
If you were on a technical python interview and asked the titled question, which option would you consider the best answer? Any other comments on the code below are welcome..
Common
...
0
votes
0answers
14 views
Alphabetical order
Problem: There are n Strings and these should be ordered in an alphabetical way and then be written in a consecutive string.
In the first line we get n and in next n line , n strings.
Sample Input:
7
...
0
votes
0answers
8 views
0
votes
0answers
16 views
Swapping elements in an ArrayList without using collections.swap method
Develop a method to swap two elements with specified valid indexes I and j:
...
0
votes
0answers
7 views
1
vote
0answers
12 views
Shortest possible JS code to get ids of all elements of a given tag
I want to gather all the ids on a page for foobar elements into a comma-delimited string. For example:
...
2
votes
1answer
11 views
Shopping cart java design patterns
I want to create a shopping cart project with discounts for products. Eg. If you buy 2 books, you can get 10% off Parker pen.
I created a shopping cart example, but without exception handling in this ...
2
votes
2answers
74 views
Finding the distance between two points in C++
I made a program in C++ where it calculates the distance between two coordinates. Is there anything to improve? Add? Make it more user-friendly?
Code:
...
0
votes
1answer
12 views
SmallVector - std::vector like container on the stack
SmallVector is almost same as std::vector except it keeps its data inside a large array. Similar to std::array, its size can not ...
1
vote
0answers
10 views
Get a Floating Point Number from a String with a Finite State Machine
I wanted to restart the big-float project I had paused the moment I suddenly realized that the implementation of the main four rounding modes (which I postponed so long, that I got all of the IEEE-754 ...
1
vote
0answers
23 views
DAO for fetching organizations and departments through a REST API
I have the following class structure:
...
2
votes
0answers
5 views
Refactoring App launch sequence using reactive programming
In the SplashActivity of my Android Application, the following sequence of events occur:
Check Google Play Services is installed
If Google Play Services available, start ...
2
votes
1answer
25 views
C++ Tic-Tac-Toe Game
I decided to make a simple tic-tac-toe game in C++ as a small project. All help and suggestions are greatly appreciated!
main.cpp:
...
-2
votes
0answers
14 views
Game like ingress, I mean, exactly ingress [on hold]
I had some discussion on a forum about how hard to develop a game like ingress.
I've sad, the game itself is not so complicated. So I've decided, I will do it myself in HTML5 with jQuery and google ...
1
vote
0answers
9 views
Project Euler - #5 smallest multiple [Ruby using a hash table]
Why will this code will work for a smaller multiple like 10 but time out for anything over 13?
Can this code be refactored to work for larger numbers?
(p.s. I have an alternate solution but wanted ...
1
vote
1answer
22 views
Verify if meeting datetime ranges overlap in an IEnumerable list of meetings
I have an assignment where I need to find out if any of the meetings in a list of meeting class object have overlapping datetime ranges. What I have so far is this.
...
-2
votes
0answers
14 views
Beginner here, need help making my form submit the info to an email [on hold]
I have a form I've made, which when submitted I want the info sent to an email. As you can tell I'm not professional, but know enough that I'm working on a new website for my business.
...
3
votes
2answers
42 views
ATM Machine Program for a Project
I'm a novice C++ coder, taking my first class this semester, and we have a project coming up. I get the program done early and it works as expected, but I don't know if it's too messy and can be ...
0
votes
0answers
19 views
0
votes
0answers
24 views
All combination of character alphabet
I write this code to find all combination of an alphabet z={A,B,C...N}.
In DNA case,we use z={A,C,T,G},then the function Words and ...
0
votes
0answers
9 views
Google maps directions: per-state distance traveled calculation performance issues
I'm trying to calculate the distance traveled per state with google maps directions service. This script does the job, but is slow to the point of being unusable. (It takes anywhere from a few minutes ...
0
votes
0answers
18 views
Select random IDs from a table, using MySQLi
I've created a "simple" function that receives a MySQLi resource and, using a custom where query, will fetch random IDs from a provided table.
Some caveats on this:...
-1
votes
0answers
16 views
2
votes
0answers
11 views
Adding vector functionality to TI Calculators
Although TI-83/84 calculators support multiple data types, such as real numbers, complex numbers, 1D and 2D lists, fuctions, etc., there is no data type for vectors. This program is my attempt to take ...
5
votes
2answers
268 views
Find and display best Poker hand
This code is intended to choose the best poker hand of five out of a set of cards. The cards are represented by a list of strings, where each string contains the rank and suit (e.g., 'AC' represents ...
0
votes
1answer
18 views
Shifting an array with less touches
I have an array that I am shifting by a certain number of spaces. I am wondering if there is an better way to do the shift with less touches. Here is my code
...
1
vote
2answers
36 views
C++ 14 thread pool executor design
With a few experience of python and golang, I tried to make (simple) thread pool executor. Tasks of the executor must be copy-...
1
vote
1answer
49 views
MVVM - ObservableCollection & Entity Framework DbContext
I'm trying to catch WPF using MVVM pattern, where my set of models is implementing ObservableCollection as well as Entity Framework's ...
0
votes
1answer
19 views
Android - handle navigation to multi activities from list view
Here is my case I made list of items when I click at any item it should navigate to certain activity.
Here is my I am done First I set number of constants to distinguish between each activity
...
-1
votes
0answers
35 views
Ramanujan's formula to compute Pi [on hold]
This is the code in Python 2.7 to compute PI. I am comparing it against math.pi with a certain tolerance
...
0
votes
0answers
16 views
how to design sql tables for event with two types of participants? [on hold]
I have entities:
Event, Person, Team and Character.
One Event can has persons and teams as participants. Participants are ordered. Each participant can has many characters.
I am going to use this ...
0
votes
0answers
23 views
Avoid indexing results from a SELECT statement [on hold]
What is the best way to avoid situations where you need to hard code the index of the item in a list, like the following example?
...
3
votes
0answers
19 views
Split big PDF into smaller documents and insert text at specific position
I’m new to Java programming and uncertain if I used the right approach to solve my job.
This little program uses the iText library to split one big PDF into smaller documents. The trigger for this is ...
1
vote
0answers
34 views
A BaseActivity to render toolbar and navigation drawer
I'm new to Android programming and this is my first project so I'm not sure if this is the correct method of rendering the toolbar or the navigation of the drawer on the screen:
So I have a ...
1
vote
0answers
26 views
Calculating some worst-case values for angles in an interval
Sadly enough I have a bit of code that is really slow and being a newbie in programmation, I don't have the faintest clue on how to optimize. Is there any way to make those calculations faster?
This ...
0
votes
0answers
28 views
Code for calculating best possible combination in an array
The problem here , requires me to find the best possible combination of values in an array which is nearest to 0 and are adjacent to each other , here is an little excerpt from it,
The government ...
0
votes
1answer
12 views
Locate a number in an array with a special ordering
Below are two examples of arrays (with a special ordering with odd numbers on one side, and even number on the other side) I have, with some given len:
For some ...
5
votes
1answer
25 views
Concurrent task pool
My use case is to dispatch multiple long-running tasks to execute concurrently. The expectation is that the tasks will be IO-bound (e.g. network requests), but importantly each task is different. This ...
3
votes
2answers
52 views
Callback system for events in a window
I have written a simple window event capture wrapper that gets events that happen to the window, and can be checked anywhere in the program through a global class. I wanted to be able to create a ...
1
vote
0answers
14 views
Django REST custom methods for generic views
I'm intern and work on a project where I develop DRF API that need to interact with mobile app written by my colleague with Ionic framework.
We are creating new user. My view method is following:
<...
9
votes
2answers
126 views
Google Foobar Challenge: Lucky Triples
Note: Since my time has passed for this challenge, I do not remember exactly the stipulations but will attempt to recapitulate them to the best of my knowledge.
Essentially, the challenge was this:
...
2
votes
1answer
20 views
-3
votes
0answers
19 views
Can anyone help me with this blackjack game? [on hold]
" Write a program to play the game of Stud Black Jack. This is like regular Black Jack
except each player gets 2 cards only and cannot draw additional cards.
Create an array of 52 integers. Initialize ...
1
vote
0answers
25 views
Gulpfile for building a resumé book
I have this hurriedly written Gulpfile that does quite a few things for my project resume.
How can I optimize my Gulpfile.js both for performance and writing style? It'd be awesome if someone can ...
5
votes
0answers
54 views
A small “TODO” app built using a modular pattern
I am just beginning to learn JavaScript and although I feel I am starting to grasp the language, I don't feel I know how to structure an app properly. I decided to start small and build a "TODO"-app ...
0
votes
0answers
52 views
Find all possible sumation numbers to a specified sum
This is a problem that I had in mind for a loong time and today I decided to give it a go, the basic idea is you enter a number/sum and the program outputs all the possible ways this sum can be formed ...
1
vote
2answers
99 views
Calculate the total items used, if for every x items used, you get one additional item to use
I am looking for a way to optimize this code so that it runs faster. I am trying to calculate the total items used, if for every x items used, you get one additional item to use.
This is the code I ...
1
vote
1answer
30 views
Find valid triples for a sorted list of integers (part 2)
Have some ideas to improve code from this discussion (Find valid triples for a sorted list of integers), and post new code in a new post.
The new idea is, trying to remember where low bound searched ...
2
votes
0answers
25 views
Waiting for all task to complete while catching exceptions early
I'm working on simulating a number of processing elements (nodes) which do some work in parallel and communicate by exchanging messages. The message exchange is not in the scope of this post, but it ...
0
votes
1answer
18 views
Reverse the order of a list in Racket
I am using the SICP book. There is an exercise in which you need to create a function that will receive a list as an argument and return a list with the same elements in a reverse order.
I know there ...