0
votes
0answers
2 views

convert between hex, ascii and decimal

I frequently need to convert between decimal, hex and ascii characters. I wrote a Tkinter program to do the conversion, mostly, but I ran into a bit of a problem. If I convert random hex bytes into ...
1
vote
0answers
6 views

Python - insertion sort

Series post - I am reading through Introduction to Algorithms, 3rd Edition implementing each algorithm as I read them. Pretty basic insertion sort. Only considering numbers initially - how could I ...
1
vote
3answers
23 views
1
vote
0answers
16 views

C# implementation of authenticated encryption

My application needs to implement authenticated encryption using C#. There is a dot net class called encryptAndAuthenticate, but it is only supported on windows 8 or later, and I need the code to also ...
1
vote
1answer
20 views

Reduce nested loops needed to compare Strings

I have an ArrayList which contains Strings with a size of 1000. I am looping through that ArrayList and finding words and trying to form a square from them. For example as follows: ...
1
vote
0answers
29 views

Checking for win in a Tic Tac Toe board of 9 picture boxes

I have created a Tic Tac Toe game, the board being made out of 9 picture boxes. I need improvements for the if statement in turn_click method to check winning combinations. ...
1
vote
0answers
11 views

Handling errors in a PHP class

I am trying to handle errors in a class written in PHP and using curl. This class uses 3 functions (init, ...
1
vote
2answers
33 views

Algorithm to rotate array elements in Ruby

I wrote this algorithm to rotate elements in an array. It's not very efficient, but it works. It has another disadvantage that it doesn't rotate right (it would be nice to pass it negative steps, for ...
-3
votes
0answers
17 views

doubly LinkedList something wrong in my code i dont know what it's [on hold]

Add the following changes to the doubly LinkedList Class: Override the toString() method. Implement getSize() method, which returns the current size of the linked list (remember that you need to ...
5
votes
1answer
75 views

TeX preamble for theses and short books

I recently joined the tex community and had quite a fun week texing. (I migrated this question to codereview, as it seems to be the better place for code-review samples). The result is some ...
1
vote
1answer
23 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: ...
4
votes
2answers
41 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 ...
-1
votes
1answer
78 views

On Finding Coin Jams

The problem can be found here and is essentially asking us to generate J many numbers containing N many digits, where these digits have to be either 0 or 1. The catch is that the these numbers that we ...
3
votes
0answers
21 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
19 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, ...
1
vote
2answers
16 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
19 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
34 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 ...
1
vote
0answers
9 views

Set the direction a Sprite faces based on its 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
24 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 ...
1
vote
1answer
20 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 ...
1
vote
0answers
20 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
19 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
26 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
18 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
18 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
13 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
1answer
30 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
19 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
54 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
43 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
628 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
14 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
52 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
38 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
13 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 ...
-3
votes
0answers
39 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
34 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 ...

15 30 50 per page