All Questions
2
votes
0answers
4 views
Extracting substrings from a 4-string conbination
I have the following code which works perfectly fine but taken an enormous amount of time with long files. The main program basically takes a series of 4-string combinations and extracts substrings ...
0
votes
0answers
4 views
Linked list order reverse program efficiency
Here is my function which convert linked list in the following order:
Example:
Inputs: 1->2->3->4->5->6->7->8->NULL and k = 3
Output: 3->2->1->6->5->4->8->7->NULL.
Code:
...
0
votes
0answers
6 views
Ticker Tackor Soldier Spy
This is a Tic Tac Toe game with a "new game" button. I'm after a general review of the code with some tips on how to make it simpler and tidier.
[GitHub[(https://github.com/Olleorm/TickTackToe)
...
0
votes
0answers
5 views
Stack with Array
Just coded up a simple Stack using an Array in Java for practice. Other than the lack of JavaDoc (still need to learn that part), did I cover all the bases?
...
0
votes
0answers
7 views
minMax for checkers-like game
I have this minMax function for a zero-sum game similar to checkers:
...
1
vote
0answers
10 views
Search/sort/create functionality, implements bubblesort and sequential search
I've moved my main() to the bottom of the code block in order to fit it all in one class for this submission. If there is a better way to do it?
...
1
vote
0answers
6 views
Radix sort with integer divisions
Here's a perhaps naive but simple implementation of Radix sort in Java.
It works with any radix, and both positive and negative numbers.
...
2
votes
0answers
14 views
Asynchronous Conditional in Javascript
I'm trying to figure out the most elegant solution to do the following asynchronously using JavaScript (specifically node):
Given a destination file name, check if it is a directory
If it is a ...
9
votes
3answers
167 views
TicTacToe AI needs optimization
How do I condense this gigantic monster into something more manageable? I heard about command pattern but I can't figure out how to use it. What other solutions are there?
...
-3
votes
0answers
9 views
Can't display variable and text inside a TextBox. Visual Studio [on hold]
I'm trying to display a variable which is altered by some input, and a string inside the TextBox.
This is using Visual Studio, and I'm awfully new, so sorry if the answer is very simple and I don't ...
0
votes
1answer
6 views
-4
votes
0answers
23 views
Design C Executable and Shared Library Project [on hold]
I'm designing a Linux C project which is composed by two binaries: an executable and a shared library.
I have the following project structure using Eclipse-cdt:
Main Project Executable
...
-2
votes
0answers
24 views
How can I optimize this curl script? (PHP) [on hold]
When I run var_dump($title), I get results really quick, but my script fetchs the whole page in order to get one result, then do it again, again. How can I do this ...
2
votes
2answers
28 views
Rapid color replacement for in-memory BMP
A function that relatively quick replaces one color with another, in a memory-buffered BMP.
I am trying to improve the performance as much as it is possible. The previous implementation of this ...
0
votes
0answers
18 views
DRYing out my Sass, looping through selectors
Need help with DRYing out my Sass... there is just so much repetition in here:
...
2
votes
1answer
24 views
DRY rule and Accesing function within function JavaScript
I've asked this question recently on Stack Overflow but I was advised to look here, so there goes...
I got this piece of code below which is not DRY. What i want to do is to cut it,so everything ...
6
votes
2answers
231 views
Is this use of comparison and indexing “too cryptic”?
This is a very subjective question, but I'm curious as to other people's opinions.
Would you find this bit of code distasteful? Is it cryptic and unreadable, or is it using features of the language ...
4
votes
1answer
39 views
TicTacToe game needs optimizing
I'm new to programming and want to check if I'm using best coding practices in my program, any suggestions, or tips, are greatly appreciated, thanks in advanced.
...
4
votes
2answers
83 views
TicTacToe GUI needs optimizing
I've been working on a TicTacToe GUI. While the game works with a proper restart, exit and win conditions; I feel that it could still be better optimized.
I'm not particularly concerned with the ...
4
votes
1answer
18 views
Replace keys in values with key->values from same dictionary
I have a dictionary whose values may contain keys that are already in the dictionary. What we are actually talking about are parameters. Sometimes a parameter is defined by a number plus another ...
1
vote
1answer
42 views
URL checker is very slow
I have +-645 IRL links I need to validate. The code below is my attempt, but my problem is that it takes forever to check all links and sometimes times out. Is there a better way of validating so many ...
2
votes
2answers
40 views
Sieve of Eratosthenes JavaScript implementation - performance very slow over a certain number
I've been playing around with the code challenges on projecteuler.net. A few of them involve prime numbers, so I've created a function to find them based on the sieve of Eratosthenes.
It works fine, ...
3
votes
1answer
21 views
Android Compound View Usage
I have 2 buttons for Terms and Conditions in my project, that I need to implement in multiple activities. I created the following class:
...
5
votes
2answers
160 views
Simple survey application
I've completed the application and it works against all tests I've thrown at it. Now, I'd like to see if there's a way I can optimise the application and lower the code footprint.
The application is ...
1
vote
1answer
29 views
Naive primality test and summation
I am starting to learn Haskell, so I coded a naive solution to the primality test and summation of primes (Project Euler Problem 10: sum of all primes under 2 million) . As I have an imperative ...
0
votes
0answers
8 views
I am having trouble styling my map [on hold]
I have 2 google maps that I want to add to my page, they show up fine but I can't style them, what am I doing wrong?
here is the code:
...
0
votes
1answer
21 views
All-purposes AJAX handler made with PHP and .htaccess that speaks JSON - Part 2
Earlier, I've posted a question about a file used to handle AJAX requests.
I've followed some of the advices given and made some changes on the code itself.
You can go on "All-purposes AJAX handler ...
1
vote
0answers
11 views
Most efficient way to remove specific items from a slice
Given a slice of unknown length (potentially very small or very large), and another slice containing (unique) integers indicating indices to be removed from that slice, the most straight forward way ...
0
votes
1answer
17 views
Generic list heapsort in Java
This is an implementation of heapsort as seen on Programming Pearls, adapted for java List collections. It is working on a copy of the list passed-in on purpose at the moment.
...
0
votes
0answers
15 views
Divide all elements in the column of a sparse matrix
I am trying to divide all numbers in all columns of a sparse matrix (400K X 500K, density 0.0005), by the sum of the squares of all numbers in a column.
If a column is [ [ 0 ] , [ 2 ] , [ 4 ] ], the ...
2
votes
1answer
28 views
LRU Cache Design using LinkedHashMap
This is a follow-on qestion from: LRU cache design
Revised Implementation
...
1
vote
1answer
21 views
Swift 1.2 Singleton Implementation
I am pretty new to Swift, as a solo developer I was wondering if somebody could pass comments on the singleton implementation below. The code does work, but being new to Swift and knowing that there ...
0
votes
1answer
44 views
Queue like system to check existence of email
I have a table in my database containing email and email_state amongst other values.
Email is the email of the contact, and ...
2
votes
1answer
19 views
Max heap implementation
I have implemented a max-Heap data structure backed by an array. I wanted to know whether this is an acceptable implementation or not.
Any improvements or suggestions are welcome.
...
2
votes
1answer
18 views
Summing 3 jQuery modal dialog functions
I am getting better with jquery day by day, but there are still things I don't know how to sum up several functions to reduce some code.
So I am using three jquery modal dialog popups and I have ...
0
votes
2answers
27 views
All-purposes AJAX handler made with PHP and .htaccess that speaks JSON
In a project I've started, I decided to implement some new code to handle AJAX requests.
The requirements are that it can ONLY access the /ajax/ folder, load ...
1
vote
0answers
10 views
Pagination handlebars helper
I've build a handlebars helper that takes n total pages and currentPage and returns the HTML for the page number links, skipping ...
3
votes
2answers
35 views
Java MVC model for large scale GUI using annotations
I'm trying to make a good MVC model using annotations, which I will use it in a large scale GUI project. I want to respect the maximum of rules and guidelines, and be able to decorrelate every parts ...
0
votes
0answers
20 views
CAPTCHA reader and maker
I've made some CAPTCHA reader and maker in Python using Tkinter. Do you know if it's possible to keep image and output files in "memory" not writing them on disc? Because right now everything is ...
0
votes
3answers
43 views
Mixing business logic and presentation layer in enum type
Let's assume I have an enum type with currency:
...
3
votes
1answer
19 views
Functional-style linked list written in C
For my Operating Systems class, I needed a linked list data structure and didn't have one already written. During the course of thinking about how to implement a linked list again (it had been a ...
3
votes
1answer
13 views
Simple file locking wrapper command in C
A simple command that wraps another command, locking a file first. It is similar to flock, just simpler.
...
-2
votes
0answers
13 views
3
votes
1answer
33 views
Concurrent LRU cache using sychronizedMap() or ReadWriteLock
Trying to implement a simple, thread-safe LRU cache that's meant for "read mostly" use.
Collections.sychronizedMap()
Clean, simple, not much else to say.
...
1
vote
1answer
15 views
Removing duplication in AngularJS Factory
I have multiple API calls so I created a service however I would like to find a way to remove the duplication
...
2
votes
2answers
41 views
Given a digit sequence, print the possible decodings of the given digit sequence
Examples:
12 gives:
'AB' and 'L'
and
123 gives
'ABC', 'LC' and 'AW'
Here is my attempt:
...
0
votes
1answer
31 views
Creating a Generic Template Interface/Class and injecting into another object
I would like to create a generic template class for my document processor. Assuming the template has a source file path and a "content", here's what I came up with:
Template
...
3
votes
2answers
43 views
Small library for logging to MySQL
I've thrown together a utility for my programs to log to a database, but the code looks like a mess and I don't know how to clean it up. This library is going to be used from all of my other programs ...
2
votes
0answers
32 views
Code snippet for a method dealing with IDs from multiple threads [on hold]
I have multiple threads calling a method, passing in an ID and value.
I have two constraints I need to place on this method:
Only one of the same ID can be processed at a time. Additional threads ...
2
votes
0answers
25 views
URL-finder using a lot of memory
I'm trying to get the URL of the browser with Mac OS X app. I wrote some AppleScript and am trying to use it in Cocoa. The problem is, when I watch it with instruments, memory is increasing, and at ...