1
vote
0answers
4 views

Optimize Linq search query with multiple if statements

I have a search function in my class which checks various class property values for null or certain values and queries the database based on those properties. This how my function looks like now: ...
1
vote
0answers
13 views

Tic Tac Toe C++ with classes

After A ton of work I finally have a working Tic Tac Toe game that I am very proud of, and it works great. I would like some feedback on anything that can be improved/ needs to be changed. I had a ...
-3
votes
1answer
22 views

On Finding Coin Jams

The problem can be found [here][1] My solution was to randomly generate candidate numbers and test for compositeness across the bases. However, I am wondering if perhaps there is a better way to ...
3
votes
0answers
20 views

PHP secure login script

I was just wondering how secure my code looked and if I'm overlooking any serious mistakes. Any suggestions/critiques are welcome. This is my relevant login script. login.php ...
-1
votes
0answers
17 views

Trouble with mySQL Database's foreign keys [on hold]

I am working on a database for my class. It is to be used with a website, and has to keep track of users and their passwords, conferences and their events, and presenters. Using the mySQL workbench, ...
0
votes
2answers
13 views

Inputting multiple strings and finding their length

I need to find the length of elements within a string and return it to the user. What is the best way of simplifying this code to make the amount of string lengths equate to user input? Also, how can ...
2
votes
0answers
14 views

JavaScript AJAX page flipper

I rarely see this kind of navigating on the web. But basically I load all the content in the background and then flip pages as needed while loading user specific data via ajax. Are there any ...
2
votes
1answer
28 views

Java Bruteforcer

Just an idea I had for a java exercise. Cracking even a password like "testing" takes at least 15 minutes, so obviously it's not as efficient as it can be. What are your thoughts? I also never work ...
0
votes
0answers
5 views

Set the direction a Sprite faces based on it's velocity

I'm learning Phaser, and decided to make a Mario-type clone. I'm writing a function that ensures the sign of the Sprites horizontal scale matches the sign of it's velocity. For a Sprite that's ...
0
votes
0answers
15 views

Permutations with repetitions algorithm in R

Given a string of length n, print all permutation of the given string. The code bellow generates all permutations (with repetitions) for the given string and stores them in object ...
0
votes
0answers
13 views

Copy a stream to a file using Universal .NET

I have answered to a question on Stackoverflow where Andy struggled to cancel a Stream copy to file operation using the Universal .NET Framework: Apparently, cancelling the cts CancelOperation token ...
2
votes
0answers
16 views

Compiler for grond, a language-in-the-making

I'm working on a language called grond (see it on GitHub); the compiler is so small it is included in this post. My gut tells me that this code is awful, but it works. I am hesitant to change things ...
-2
votes
0answers
16 views

Tracker to track time spent on a website in JavaScript [on hold]

This is a stripped down version of the functionality I'm building. It's going to start tracking estimated time spent of a user on a page. It's going to start at the 5th second and gradually increase ...
0
votes
0answers
22 views

Using T type parameter to clone a collection

I want to clone a collection with the following method and I want to know if it can be optimized ...
2
votes
0answers
15 views

Modal component in Angular 2

I've recently started to check out Angular 2 and TypeScript that comes with it, and I guess I'm kinda into it. However I'm not too sure about the whole "TypeScript way" of doing things, specifically ...
0
votes
0answers
14 views

Dynamic create items in view

This script is for creating / selecting / deleting items dynamically. As I am at the beginning of my studies. I wonder if this is the best way to do this. JavaScript ...
-2
votes
0answers
14 views

Assigning values to variables with subclasses [on hold]

I have this snippet of code which is supposed to simulate going to a car dealership. The goal is you input a number corresponding to the following choices of: Sedan, Coupe, or SUV. Selecting a number ...
1
vote
0answers
12 views
-2
votes
0answers
15 views

Javascript model class, should I refactor it using methods in prototype? [on hold]

Usually I am using code below as boilerplate for my JavaScript models (jquery plugin or knockout one). Looking to bootstrap sources (and many other) I see that it uses methods definition in object's ...
0
votes
0answers
11 views

Current .NET session username injection in SQL Server stored procedures

I have a legacy WCF service that is ported from a security model using database logins and roles to a custom security. One effect of this change is that stored procedure are no longer executed using ...
1
vote
0answers
25 views

Parsing US addresses without regular expression for performance

Looking for some constructive feedback on Parsing an Address without using Regular Expression in C# for performance purposes. My aim is to clean the data and to separate it into its respective ...
0
votes
1answer
18 views

Create a binary search tree from a sorted array(increasing order)

Description: Since the input array is sorted, we can take the middle element of the array to be parent and recursively do the same on the left and right halves to create left and right sub trees of ...
1
vote
0answers
14 views

Parsing .PLY file using F#

I'm fairly new to F# and have written a program to parse PLY files - this is however done in an imperative way with mutable values and as far as I know that should be avoided in functional languages. ...
2
votes
2answers
51 views

Reading in data from a file and then assigning vals and then creating object

So I have some code which I created from the top of my head. But in all honesty I know it can't be the most efficient way of doing it. I have some data in a file all positioned 5 values per line ...
3
votes
1answer
38 views

Cloning Entity Framework entities

I'm currently writting piece of logic which copies entities from one user account to another. My current strategy in doing this is like that: Consider the following code: ...
7
votes
1answer
625 views

Pong-like game in C++ and Allegro5

I've been working on this pong game for the last 10 days, and I'd like to know of your opinions about it, what could I change to make my code better? ...
-1
votes
0answers
23 views

Find different possible ways to add up to a given sum from an array sorted in decreasing order with repeating elements [on hold]

For example, from an array consisting of 6,5,4,4,3,2,2,1 and required sum 10, there are a total of 8 ways: ...
0
votes
0answers
12 views

Ruby Program - Order Processing

I have recently built a plain old Ruby program using TDD with RSpec to model the below - I wanted to post it up on CodeReview to get feedback. Link to repo: ...
-3
votes
0answers
18 views

C code for sum of all primes only valid under 200000 [on hold]

do you know what's the bug of the following code? it gives the correct result for N under 200000, but buggy for greater then 200000. ...
2
votes
2answers
52 views

C++ server socket “wrap” functions

This is small socket library I made to avoid complicated C boilerplate code and several #includes for connecting sockets, bind, ...
0
votes
1answer
38 views

Shuffle array without duplicates

I made a function about random backgrounds And those images will unique as possible. (Shuffle again after all gone) My steps is : Setup the array Shuffle it Do function (check if ...
2
votes
1answer
50 views

Editing HTML based on instructions in a data structure

My getExtend() function, which will be included via require.js, has two inputs and one output: HTML file content config object which determine how to ...
-5
votes
0answers
21 views

Returning a resolved promise from the error handler of a catch block in one of the promises in Promise.all [on hold]

I'm looking at this piece of code and whilst it works, it feels wrong to me. I'm wondering if I am looking at an anti-pattern? The code starts with two promises, ...
3
votes
1answer
36 views

Template for PHP service (/etc/init.d) script

I wanted a template for a service script that is versatile and easily configurable. Along with producing similar outputs to the SSH and Samba daemons, I request the code to be as clean, simple and ...
1
vote
1answer
12 views

SICP 1.3 Sum of Squares of two largest numbers

Define a procedure that takes three numbers as arguments and returns the sum of squares of the two largest numbers. I'm using just the machinery that was developed so far in SICP to be true to ...
-2
votes
0answers
37 views

finding two strings in a set of data

**does anyone know how to create a code to solve this question ** **cough cough this is on bluej ** How many URLs on this website end with either ".com" or ".com/"? ...
4
votes
2answers
33 views

Copy Constructor for a linked list with self-referential pointers

I came across a coding challenge that looked something like this (recreating from memory, sorry) Suppose you have the following interface for a linked list. Implement an efficient and correct ...
-2
votes
0answers
9 views

week by week countdown, need a process for php to store information to mysql db [on hold]

I have this script and i need to go with php to store the infos to the db, and a form to setup the countdown date for my users. thanks! Script: ...
-3
votes
0answers
16 views

PHP voting script [on hold]

I have this PHP voting script, and I guess it could be much better as it's messed-up right now. I also want the winner, if possible, to be added in a new row called Winner and to echo the winner on ...
-2
votes
0answers
16 views

Linked List in the form a a stack [on hold]

I created a stack using a linked list, and while most of the code works correctly, I am having issues with the pop method. The program pushes in numbers correctly, and while it can pop values if they ...
4
votes
2answers
38 views

Bucket sort in Haskell

As a first step in learning Haskell I am solving this problem, which involves finding the Rith-ranked numbers, given some input list and many Ri. In an imperative language I would make a zeroed array ...
2
votes
1answer
45 views

Stack and Queue implemented with a LinkedList

I am looking for feedback on my implementations of Queue, Stack, and LinkedList using Java ...
-2
votes
0answers
30 views

Wanting a better MVC to Javascript pattern to get Resource Files from C# mvc into Javascript [on hold]

Currently Resource Files in asp.net mvc c# are the typical file.resx MVC controller method: ...
-4
votes
0answers
19 views

Starting C++ and working through some problems in a book [on hold]

Write a program that declares a two-dimensional array of integers with four rows and four columns and uses a loop to initialize the array in the pattern below. Study the pattern of the numbers in the ...
8
votes
1answer
50 views

Top 10 editors partitioned by year

I wanted to get some stats on who has done the most edits on Code Review, so I wrote the following query on SE Data Explorer. All improvement suggestions are welcome. Note that I used a cursor to ...
0
votes
0answers
16 views

Python for HPC: Parse file, generate statistics, record output

I have a program which is designed to be highly parallelizable. I suspect that some processors are finishing this Python script sooner then other processors, which would explain behavior I observe ...
1
vote
2answers
113 views

My favorite privacy settings

I'm looking for general feedback on this module. Here is what it handles on the page: This is a private "class" meaning none of its properties are available outside of it. ...
1
vote
0answers
29 views

Sparse table implementation

I wrote C++ implementation of Sparse Table (I wrote it for an arbitrary function) and I want so much to ask for a review. I'd like to know how I can make it better, especially the consistency of the ...
-3
votes
0answers
19 views

Sorting an array, even numbers first, using recursive method [on hold]

Write a short recursive Java method that rearranges an array of integer values so that all the even values appear before all the odd values. When I use ...
0
votes
1answer
19 views

Skipping Google search results that point to certain sites

I have the following code that will skip certain URLs if needed: ...

15 30 50 per page