All Questions
3
votes
0answers
11 views
Generating DOM from a complex strings via arrays
This is a revised and expanded version of Transforming complex strings into simple arrays
My function grabPerson turns strings of user information from multiple ...
0
votes
0answers
10 views
Controller web interface security
I'm designing a web interface to a controller for my school's bell. Are there any security flaws in this code?
The source code is available here.
Front End:
...
0
votes
0answers
15 views
Panagram Solution - Best approach?
I want to check if the given string is a Panagram or not.
A Panagram is a sentence containing every letter of the alphabet at least once.
This is what I've come up with as solution:
...
1
vote
1answer
16 views
Implementing an open/close function in Prolog
I'm going through the Adventure in Prolog tutorial and I'm trying to implement an open/close rule for each of the doors I have.
Add an open/closed status for each of the doors. Write open and ...
0
votes
0answers
13 views
Builder for a simple observer class
I mean the Builder presented in Effective Java by Joshua Bloch.
OnStopScrollingObserverTask is using to detect when scrolling a ...
1
vote
0answers
13 views
MySQL natural search and like search
I have written two queries for searching, but I want to simplify them as it seems needed.
...
2
votes
1answer
26 views
3 textboxes with multiple value combinations to one output
I would like if someone who has more experience in JavaScript reviewed this. I went through and tried to minimize this as much as possible, but I still feel this could be smaller and more compact.
I ...
9
votes
1answer
93 views
Finding Local Maxima
The following function finds all local maxima.
A local maxima is an element of a list such that it's greater than either of its neighbor elements. An element with 1 neighbor is not a local maximum.
...
3
votes
0answers
17 views
Metalsmith plugin for stripping UTF8 BOM from files
I've been developing a metalsmith static site and I came across an issue where Visual Studio was automatically adding a BOM to the pages.
I wrote the following plugin for metalsmith (it needs to be ...
4
votes
2answers
215 views
“Guess the number” game
Any tips on how to improve my code and make it cleaner to read for other programmers? Formatting, spacing, etc.
...
3
votes
3answers
213 views
Determine if a string has all unique characters
I'm practicing algorithms (for future interviews) while learning about Big O notation and was wondering if there's a faster or more optimal way of writing an algorithm to see if a string has all ...
0
votes
0answers
26 views
Performance enhancement for collection manipulation
I have below snippet of code which gets all the available menu items for a zone(top or left)and adds the widgets for which user has access to an ArrayList collection. For now the ...
-3
votes
0answers
21 views
Get input of integers with space between [on hold]
How do I get input of 3 integers with white space inbetween from 1 line?
For example,
I would prompt ...
a,b,c? 1 2 3
...
3
votes
0answers
18 views
Ruby Repository Pattern
I am trying to teach myself about repository pattern in ruby. Could you please review my code.
adapter.rb
...
7
votes
3answers
212 views
Count number of ways to paint a fence with N posts using K colors
A friend sent me this question, and I'd love somebody to review this and give his opinion.
The question:
Write an algorithm that counts the number of ways you can paint a
fence with N posts ...
1
vote
2answers
315 views
Best way to insert multiple rows in MySQL
I am building a store. When a user decides to make a purchase I need to store it in the database ( you don't say? Duh! ) but since the purchase might be of more than 1 item I'm wondering which way is ...
0
votes
0answers
14 views
How to handle state in Angular?
I am working on a project in Angular where I have a number of similar data objects. When you click on anyone of them it's state and amount of data shown will change. All of the objects start in the ...
-2
votes
0answers
13 views
Having issue keeping variable value in code [on hold]
I am trying to create a thread acts as a timer, which can be interacted from the command line. However, I cannot get the time variable value to stay after I set it: it seems to be resetting to 0.
My ...
4
votes
1answer
31 views
“Vaishnav and Pizzas” challenge
I am trying to solve the below mentioned problem from HackerEarth.
Although the results are fine, the code takes extraordinarily long time to run execute. I am pretty sure the problem is because of ...
2
votes
1answer
38 views
ComponentManager - Entity-Component-System architecture in C++
Lately I've been working on a small C++ Entity-Component-System framework.
Like most other ECS frameworks the internal data is presented as a table where an entity is a simple row index and each ...
5
votes
2answers
39 views
Noughts and Crosses WPF app
I've been learning C# and was looking for some feedback on my latest project, which is a standard Noughts and Crosses game. Two people are required to play (no AI yet).
MainWindow.xaml.cs
...
3
votes
1answer
20 views
Time complexity of anagram solution
I have written code to return anagrams from a list of words. I'm a newbie in time complexity analysis so pardon my ignorance if this is a blatantly obvious question. Am I right in thinking this is in ...
3
votes
1answer
21 views
PHP framework building: MySQL Connection and query class
I am building a PHP framework and would like to get some feedback on a few different sections of the project so far. I consider myself still a neophyte in PHP so I would like to ask if I'm going about ...
1
vote
1answer
21 views
Speed up anagram method in Ruby
I'm working on a project to find anagrams of words. My goal is to figure out the longest anagrams out there. I took a look at my code and it works but is woefully inefficient.
I have two arrays, each ...
1
vote
0answers
20 views
Extension methods for safely firing events
I wrote a set of extension methods for the EventHandler class that add the method Fire, which raises the event after creating a ...
2
votes
0answers
21 views
Performing a background task and managing battery notifications for Android
I'm just starting out for the first time in Android Development and my code is a giant mess.
Here are my attempts so far. I've included it in a Pastebin. Feel free to ask me if you would like to see ...
0
votes
0answers
5 views
Assigning UIImageWithData to array [on hold]
I am having a problem, I query facebook api for the profile urls. They get received no problem. I then assign a string to the url (profilePhotoUrl). I log profilePhotoUrl and the correct amount of ...
2
votes
2answers
28 views
Multiple uses of $window.scroll
I'm using $window.scroll twice in a jQuery script for different uses. Should I try and combine them?
...
-4
votes
0answers
23 views
Div not showing properly [on hold]
Here: http://www.doublecentre.org/continue.html
you see two collumns, the lower one seems not to show itself properly.
It appears when you scroll down.
can anyone help me?
5
votes
0answers
29 views
1
vote
2answers
48 views
C library that converts integers to string and vice-versa
I've created this little library to help ease myself (and for others, hopefully) with the pain of having to convert integers to string and vice-versa. It's written in C, and for maximum portability I ...
0
votes
1answer
48 views
Encryption with many algorithms using Crypto++
For the last few days I have been working on this code to develop a class that allow me to crypt a block of byte with many algorithme.
One block will be divided into three equal blocks and every ...
1
vote
1answer
55 views
Transforming complex strings into simple arrays
Some time ago I wrote a series of functions for turning a string of user information from multiple users an array containing the information needed: Name, username and location. The raw ...
7
votes
1answer
38 views
Improved manipulation of a 2D array for a game map
I have a 2D array (or rather, an array of arrays) representing tile maps in game. The 'world' map array holds smaller arrays representing individual map parts which I am calling 'rooms':
...
2
votes
2answers
50 views
Concatenating rows in CSV files and removing old CSV files
I have written my first Python script that will go into live use at my workplace. I am relatively new to Python and I think this script is pretty good but I would like your input.
It runs very fast, ...
3
votes
1answer
37 views
Dirty XML-to-JSON parser
I have that XML-to-JSON function based on ElementTree. It looks very simple but until now it does what it's supposed to do: give a JSON description of the ...
4
votes
2answers
145 views
Converting numeric (month/day/year) date inputs to regular format (month day, year)
I'd really appreciate some general formatting/style/performance tips, as well as any ways I could improve this code in general that I wrote for an assignment (title) that's due at the end of the week. ...
-3
votes
0answers
23 views
How to merge two pdf files in a single pdf? [on hold]
I have two different pdf namely "diff-1.pdf" and "diff-2.pdf" and a "single pdf" namely "common.pdf". Now, I want to merge the content of "common.pdf" to "diff-1.pdf" and generate a new file named ...
-1
votes
0answers
34 views
C++/C++11 one-to-many multiplicity pattern [on hold]
The following working C++11 code demonstrates working code for a pattern for representing one-to-many relationships between objects: https://github.com/codecurve/parentChildCpp.
(The code is also ...
2
votes
1answer
32 views
Configure AspNet.Identity to allow for either username OR email address on login
I am wondering if there is a more efficient route to take here. Using AspNet.Identity I would like to allow the user to sign in to the same text box using either ...
2
votes
2answers
28 views
Executing a task at a particular time in the morning using ScheduledExecutorService
I have a task which I need to run every 6 in the morning. I have the below code which does the job and uses ScheduledExecutorService.
...
0
votes
0answers
15 views
Rails Controller vs Service Object for Application Logic
I have a #change_account action in the accounts controller that verifies if the user has access to the requested account prior to changing the current_account which happens via setting the ...
3
votes
2answers
408 views
Convert number into words
I am trying to implement a program which can convert number into words. My code can convert numbers between 0 - 999. It uses recursive function calls and simple arithmetic operations. Can you please ...
0
votes
0answers
10 views
Validating constant assignments in C at compile time [on hold]
This is a way to check constant variable assignments for meeting conditions, e.g. exceeding limits at compile time. That is, anything the compiler can optimize to be constant. The Program should emit ...
1
vote
0answers
19 views
5
votes
1answer
55 views
Unit Testing - The Final Solution
Following-up on the Automagic testing framework for VBA review, I've refactored much of the TestEngine static class, and introduced a ...
6
votes
3answers
2k views
Foreach within Foreach loop - is this code poor form?
I am using the following code poor form. I am interested in how I can optimise this and use the correct methods. I understand the DRY concept and will look to employ that throughout my code. However, ...
3
votes
1answer
27 views
Analyse an Nginx access log with awk and produce a report
I'm looking for your opinions on anything that I am doing wrong in the application below, such as best practices, glaringly horrible errors or even just your own personal opinion.
Task: Grab an Nginx ...
6
votes
2answers
210 views
Simple key-value store in C, take 2
Followup to Simple key-value store in C.
Response to previous reviews
You may want to hide the KVSstore structure
Done.
Add a comparison function pointer to KVSstore. If this pointer is ...
5
votes
3answers
93 views
Bell Triangle computation in Java
From the Wikipedia article:
In mathematics, the Bell triangle is a triangle of numbers analogous to Pascal's triangle, whose values count partitions of a set in which a given element is the ...