All Questions
2
votes
0answers
6 views
Reading file in C++ until string
I need to read HTML files and ignore the input until reaching the following tag <a class="member-modal" then print the characters between that and the ...
3
votes
1answer
13 views
Program to evaluate powers of complex numbers
I'm trying to develop a simple program to evaluate integral powers of a complex number \$z\$ , that is, \$z^n\$, where \$z\$ is in the algebrical form \$a+i b\$ and \$n \in \mathbb{Z} ^{*} _{+}\$.
...
2
votes
0answers
15 views
Spending a target sum, preferably split equally
I have a strange programming prompt. I managed to complete an algorithm to solve smaller test entries (which i'll post). One of my test cases has to complete a 200,000 int input and my algorithm isn't ...
8
votes
0answers
40 views
Chack miy spellang pleese
For my CS2 project, I am supposed to implement a spell-checker. It is
supposed to follow the following:
Prompt the user for the name of the file containing the dictionary
of correctly ...
1
vote
0answers
12 views
Imgur API implementation using Retrofit
I've recently (an hour ago) started a project for making a wrapper for Imgur's API using the REST client Retrofit.
I've only implemented a single endpoint so far as I'm questioning my design. While ...
4
votes
2answers
33 views
Eliminate copy/paste and Factor logic out of foreach loop
I have two conditions that need to traverse the same data but inside the traversal the logic changes slightly for each respective condition and in different places. If it was the same place that would ...
0
votes
0answers
8 views
Simultaneous works with multithreading
I have a case-study for an Android interview. I just wanted to get your opinion before I share the code with the company.
There are two fragments: one of them uses a thread-callback structure and the ...
0
votes
0answers
5 views
“Word-Target” Puzzle Solver in Java
Have recently been writing a few puzzle solvers in Java, this is my latest attempt. It solves the "Word-Target" puzzle found in some newspapers. You may have seen it before:
Words must be found by ...
4
votes
1answer
34 views
PostgreSQL multiple processes and queries or nested query
I have a series of tables and queries I run a process against and at times this process can take hours - if not multiple days - depending on the date range I select. I am running PostgreSQL 9.4.
In ...
-1
votes
0answers
11 views
how to set bucket sort to sort negative numbers in c++ [on hold]
I just finished the bucket sort, it works fine without a for function:
...
0
votes
0answers
5 views
Adding markers in Corona SDK for Android
I'm having trouble getting the marker added. (only tried on Android devices)
I want to add the marker inmediately after the map is loaded.
Got it working adding a delay but couldn't make it work by ...
1
vote
0answers
12 views
Asynchronous connect() with one function call, using C++11 lambdas and Boost.Asio
I've wanted to write a C++11 class for making IPv4 TCP connections and figured that it probably could be done with just one static function using some shared_ptr and lambda "magic". The following code ...
10
votes
2answers
91 views
Finding a word within a pre-defined set using a search string with wildcards
The other day I was intrigued by this question (originally from here):
Write a program that answers YES/NO search queries containing * placeholders. Example: if the data you have is (hazem, ...
1
vote
0answers
14 views
5
votes
2answers
30 views
CSS for a calculator
I've a small assignment to do: style a given HTML file with CSS.
My result looks exactly as it should. But I'm not really satisfied with my style sheet. I'm sure there are better ways to achieve the ...
3
votes
1answer
27 views
Should I pass my viewmodel to this class?
I created a class TabController to handle opening and closing of tabs. It needs some data from my viewModel, should I pass in the viewmodel via the constructor or is that overkill? It really only ...
0
votes
0answers
8 views
Table Design For Patterned Data For Variable Bucket Ranges [on hold]
Looking for table design for this scenario to be implemented on SQL Server 2012 instance.
Scenario
There are a total of seven types of reported data, each with variable number buckets of ...
2
votes
0answers
13 views
Vectorized numpy version of arange with multiple start stop
Given a single start and stop, numpy.arange is a good solution for building a NumPy array of evenly spaced values. However, given an array of start and an array of ...
5
votes
3answers
56 views
My lost password function
I'm trying to create a lost password function on my site. When a user enter their email it updates 2 columns in the users table with that email called: ...
-2
votes
1answer
21 views
0
votes
0answers
28 views
Timer for a Java game - updated [on hold]
I have a simple game that implements a TimerTask. However, when there's a popup using JOptionPane the timer task doesn't seem to ...
4
votes
2answers
141 views
Simple Chained HashMap
I am very inexperienced at C++. I wrote a Hash Map which uses chaining for collision resolution. I intentionally did not use smart-pointers, as the objective of this was to learn and showcase. I ...
10
votes
4answers
161 views
Generating an ordinal number for the day of the month
I am relatively new to programming and came across an if statement that I believe to be a bit verbose. I have tested my code and it appears to work without any ...
0
votes
1answer
23 views
Differentiate simple expressions
This is the first program I have written in Rust and I would like to know what some Rust experts think of it. I must be doing some stuff wrong, such as breaking code style, etc. The code ...
2
votes
0answers
22 views
Netty connecting to multiple servers
I am using netty to connect to multiple servers, query for an item, and aggregate the results in my Client. The code below works, but I am unsure if it is the best way of achieving my goal. Also, I'm ...
2
votes
2answers
38 views
Trie structure with three classes
I have implemented a trie in Java and I would request you to review it and suggest improvements or new features.
The code is split into 3 files.
TrieNode ...
1
vote
2answers
25 views
Pythagorean Triple Generator
I'm just playing about with Go, and am trying to solve some project euler problems to get used to it.
I've created a generator function for Pythagorean triples, using a channel which returns a set of ...
0
votes
0answers
33 views
1
vote
1answer
23 views
Multiple Wordpress metaboxes in fewer different functions
Is it possible to call multiple metaboxes in Wordpress with less duplicate functions? For instance, these are my current metaboxes (3 of them, one is a checkbox and two others are text input fields):
...
3
votes
0answers
36 views
Mapping arbitrary Int values to a linear index space
This is part of a growing "primitive" tools collection here on github, and is the initial use-case for the IntArray for review here.
Often, when processing data, you encounter unique values that you ...
-1
votes
0answers
28 views
Instead of a lot if write it in other way [on hold]
I use the following code and it's working fine,the problem is that I've lot of if statment's
and I want to know if there is better way to write this
...
1
vote
1answer
21 views
3
votes
1answer
35 views
Project Euler #8
I was doing Project Euler #8, which asks:
The four adjacent digits in the 1000-digit number that have the
greatest product are 9 × 9 × 8 × 9 = 5832.
...
1
vote
0answers
21 views
Asynchronously load and unload a queue
This code is supposed to asynchronously load a queue from a generating function.
...
4
votes
1answer
32 views
Calculator with order of operations
I am trying to make an additional option in my beginning calculator program which is based on the BigDecimal class - the simultaneous solution for the entire ...
3
votes
1answer
31 views
Acquiring indices for anagrams of an input string
I am working on an interview question from Amazon Software:
Design an algorithm to take a list of strings as well as a single input string, and return the indices of the list which are anagrams of ...
0
votes
0answers
10 views
Java duplicate message detection [on hold]
Here is some code i wrote up to detect duplicate (or extremely similar messages).
...
5
votes
2answers
181 views
Finding pairs of numbers within A that add up to N
I am working on an interview question from Amazon Software Interview:
Given an integer N and an array of unsorted integers A find all pairs of numbers within A which add up to N
I have a working ...
5
votes
4answers
419 views
Compare two doubles to N decimal places
I have a function that compares two doubles to N decimal places.
...
2
votes
1answer
18 views
Decision tree for binary classification
I want to become a good Python programmer and so I'd like to know what in my code practices I can improve. Overall I feel like a pretty solid programmer but writing this code felt very "Java" so I am ...
7
votes
2answers
63 views
Using 2D arrays to make more efficient sequential storage
This code is part of a growing "primitive" tools collection here on github
Use Case
Consider:
...
2
votes
0answers
30 views
Database Access Object Class
I learned of the Database Access Object design pattern from a friend and decided to implement it recently to my MySQL database. The code uses MySQLi to connect to the Database, and uses prepared ...
5
votes
1answer
59 views
“Laser treatment” SPOJ challenge
I am trying to solve this problem on SPOJ Brazil. I'm trying to approach the problem with a series of logical conditions and my code looks like this and it works perfectly.
...
0
votes
0answers
10 views
Circular Vector Implementation of sorted priority queue [on hold]
There's this weird error that should be in my removeMin() function. Inserting items into a SortedPQ object seems to work just fine but attempting to remove any items (I used a for loop in my main ...
3
votes
1answer
33 views
Async distributed locking with StackExchange.Redis
I have been trying to write an analogy to this approach to distributed locking with two differences:
making it asynchronous
making it work with StackExchange.Redis rather than AppFabric Cache.
My ...
4
votes
3answers
211 views
Simple Linked List that holds an int
I am inexperienced in C++. I was able to get my LinkedList to be fully functional. I was hoping to get some feedback as to whether or not I followed bad practices ...
-3
votes
0answers
16 views
C++ operator precedence [on hold]
I have the following code in my main() function:
float x = 1;
(x + 1 < x + 1 * 4 / 3) ? cout << "True\n" : cout << "False\n";
Isn't that the same ...
2
votes
0answers
22 views
Triangle rasterization using a scanline algorithm for numpy array indexing
I need to access those elements of a large numpy array that lie in a small triangular area. The brute force solutions of using ...
2
votes
1answer
91 views
PHP user account login with salt
I'm creating a user account login with PHP and Mysql which will be used by school teachers. To login there are 3 items required : school, username and password. This will allow for 2 of "MRSMITH" in ...
0
votes
1answer
42 views
Combine Mysql limit query
Is it possible to combine these queries into one query? I am trying to see and average all scores but also count and average just the last three based on the same grouping.
This is the main query:
...