All Questions

Filter by
Sorted by
Tagged with
7
votes
2answers
321 views

Reading three rows of six tab-separated numbers

I've just posted this solution in my review of @adrienlucca's question, which is to read three rows of six tab-separated doubles. ...
1
vote
3answers
11k views

Telling the user the number of days it's been since January 1st

You will prompt a user for a month, a day and a year. You will then tell the user how many days since January 1 of that year the input date is. For example if the user inputs a 3 for the month, a ...
10
votes
3answers
19k views

Project Euler Question #2: Sum of even Fibonacci numbers under 4 million

The question is: Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be: 1, 2, 3, 5, 8, 13, 21, 34, 55, ...
8
votes
3answers
7k views

Caesar cipher in Ruby

I must implement a simple Caesar cipher class. Initializer takes two parameters - number of positions to shift the alphabet (integer) and the alphabet used (as string, not necessarily the standard ...
5
votes
1answer
6k views

JavaScript Module Pattern with AJAX

I have an application which currently uses AJAX for CRUD operations on a simple Person object. The following script works fine, but I'm looking for some pointers ...
4
votes
2answers
97 views

Writing a user's profile image to disk using nested Node.JS closures

I am writing non-blocking code as it should be in Node.JS. If I want run function A after B I do it using callback. But I find this style guide: Use closures, but don't nest them. Otherwise your ...
2
votes
1answer
1k views

SQL database query wrapper

How can I write a better database query wrapper? ...
-2
votes
1answer
1k views

Best way to print the value of a variable? [closed]

Which of the following is better coding style and why? print("We have x = %i" %x) print("We have x = "+str(x))
2
votes
1answer
630 views

Applying Dijkastra's algorithm on a graph of five nodes

Last week I posted a piece of code to apply Dijkastra algorithm to calculate the shortest path between to nodes in a graph. Now, I've made some improvements, but I am still having difficulties. I ...
1
vote
3answers
1k views

Find all consecutive sequences in an ordered set

I have the following set. a = [1,2,3,4,5] and i want to find all of the following sequences of consecutive elements: ...
1
vote
1answer
132 views

JavaScript text editing webapp

Please review this JavaScript text editing webapp. Review the code quality. Give me suggestions to simplify the code. ...
6
votes
1answer
518 views

Reporting quarterly changes for each department

This code works 100%, but I am trying to see if I can use a for-statement to make my second method less-cumbersome and more efficient instead of making so many ...
4
votes
2answers
3k views

Mixed number fractions class

I'm looking for bugs. I tried to test all functionality in a variety of ways. ...
4
votes
1answer
12k views

Writing integer to binary file

I wrote a python function that writes a integer to a file in binary form. But are there any ways that I can reduce the number of steps, is there a more efficient way to write a integer to a file? <...
2
votes
1answer
121 views

Better importation of variables from .txt file

I am an artist and a total beginner in C++. I would like to find a better method of importing my variables from a values.txt file, which may contain 18 values in ...
1
vote
2answers
3k views

HTML5 File API Demo

I recently wrote a small demo that allows users to send and receive files from an HTML5 Javascript application. It's all client-side. I thought this would be a good place to get feedback about what ...
3
votes
2answers
11k views

Successful Encoder and Decoder for messages

I recently wrote a code for a encoder and decoder that works off of a key and the only way to decode the message is with this program and the case-sensitive key. I have yet to incorporate punctuation ...
2
votes
1answer
105 views

Platform game rendering method

This copies the level graphics but uses a scale parameter. If the scale is 1, it copies a screen size segment. If it's 2, it copies a half-screen size piece and scales it to the screen size, etc. How ...
1
vote
2answers
964 views

Critique Requested on PHP Pagination Class

I did most of my PHP coding back with PHP 4, and among the projects I did was a popular pagination class. I've been meaning to bring it up to date with PHP 5 and OOP practices. I've also been working ...
7
votes
2answers
9k views

Roulette game in C++

I'm kind of new to C++ and was just wondering if anyone could give me tips on how I could make my code more efficient (I added some comments to the code to help you understand it better). Is it a ...
5
votes
1answer
5k views

Looking for advice - Dependency Injection over Service Locator in Mef

I'm wondering what people think about Dependency Injection vs Service Locator patterns. Specifically I'm using Prism with MEF. I'm also using the MVVM pattern. So I have a service which I export. I ...
7
votes
4answers
3k views

Shorter way of prompting for a height of x feet y inches?

I'm currently working on a BMI calculator and just wondered if there was a shorter or more condensed version of doing the if validating statement. I have currently ...
4
votes
2answers
4k views

Test if two IDictionary objects contain the same values

I'm adding a function to my test library to assist in testing if two IDictionary objects contain the same keys/values. I need the method to be generic and support ...
0
votes
1answer
511 views

Creating a singleton container class for intrer-class messaging

My question is for validation of my code (any loop holes / bugs) and guidance the best methodology to implement for my requirement. I am developing a Python application that will have many classes. ...
4
votes
1answer
150 views

Weekly flex calculator

This is one of the first RSpec tests I've written, and I'm not really sure what the best practices are etc. My question basically is: what would you do differently? What is good? What is bad? The ...
4
votes
1answer
747 views

Getting display size compact class in Android

I have written a common class for finding display sizes in pre-honeycomb and for the latest versions of Android. Could anyone review my code and suggest possible modifications for this code? ...
13
votes
2answers
29k views

Perfect Hashing Implementation

I'm building a hash table for this problem: Implement a class for storing a set of integers: ...
2
votes
2answers
1k views

In-order Predecessor BST review

I was referred here from StackOverflow, so here is what I posted over there: So, for an assignment, I have to construct a binary search tree, plus an assortment of related functions. I have them all ...
5
votes
1answer
452 views

Script for concatenating delimited text files

I need to concatenate a bunch of delimited text files. In the process, I need to add a new column to the data based on part of the name of one of the directories containing each file. The script works,...
1
vote
1answer
117 views

Reducing number of blank spaces

This program takes blank spaces before some chars like > < />, and if there is more than one blank space in the line, it will reduce to one. ...
20
votes
0answers
2k views

Building a good C++11 template library - compile-time checked enum array [closed]

The task is to add data or values to members of a given enum class. The compiler should check if a value for each enum member is ...
4
votes
2answers
4k views

E-commerce database design

I am new to database design but am fairly familiar with SQL and its syntax. I want to create a database for an e-commerce website that will sell a single product type such as a shirt. They could be ...
-5
votes
2answers
994 views

TV guide program and client server with sockets [closed]

I am fairly new to Python coding, although I have been coding on and off for 30ish years. I am sure I am writing Python with too much influence from the other languages, such as REXX, VB, and some ...
0
votes
1answer
347 views

Reading and writing an unknown character into an appropriately named file

I would like to refactor this code a bit further and make it better and more generic. As of right now, it is doing what I want it to do (reading a list of URL's, splitting the query and the ampersand ...
1
vote
2answers
69 views

Building a string made easier?

I have these lines of code in my view: ...
8
votes
1answer
1k views

Generic pure functions memoization

I like to create tools for memoization since it can sometimes be useful. I recently created a generic tool for memoizing the results of pure functions. Here is an example of how it works: ...
5
votes
1answer
482 views

Python Leafly API

Just wondering what I did bad/could have done better. It's a simple script for pulling information from Leafly about cannabis strains. I've also added in a function to search. I am fairly new to ...
2
votes
1answer
171 views

Using RSpec subject to setup a test

I find myself using subject blocks in my tests to setup example because it is succinct. However is this considered bad form and can it have undesired consequences? ...
2
votes
1answer
362 views

Optimize python script for speed

I am working on the following script for python2.7 which "works" on small files. I ran a sample on an input file of 188kB and it took approx. 1.15 min to complete. However, I need to process a 5GB ...
2
votes
1answer
882 views

Solution for swapping ArrayList data members with another

Two possible solutions but which one? Or is there a Better? I have a class MP3Track with members: Track number (int), track name (String), artist (String), in faourites (boolean) etc. My catalogue ...
3
votes
1answer
14k views

Implementation of Prim's minimum spanning tree

Feel free to tell about every possible issue (style, errors, inffective solution etc.) you found. Here is the main part of what I want to be reviewed, through there is some related code on GitHub. ...
2
votes
0answers
1k views

Data pipeline processing framework

I'm trying to build a framework similar to Scrapy ItemPipelines or Pipeless. The motivation is to be able to build generic data pipelines via defining a modular collection of "pipe" classes that ...
5
votes
1answer
4k views

Small backup script in Python based on 7-Zip

Is this reliable? While there are many backup programs out there, it is still hard to find free software that allows unattended differential backup on Windows. Completely rolling something from ...
3
votes
1answer
71 views

Improving my invoice generator

In this function, the copy (Write XML) is inside, but I want it to be separated from the function. How can I improve this function? ...
3
votes
2answers
809 views

Improve my script to organize a video collection

I've made this script the other day, and I need some input from you telling me how could I improve the code / style. There aren't problems with the code (it does the job) but I want it more organized ...
2
votes
2answers
141 views

Reduce duplication while accessing Visual Studio services

If you write a VS extension, you can get access to VS services with the IServiceProvider interface: ...
5
votes
3answers
2k views

How to split this Bingo game into 3 separate classes?

I have a single file of a java Bingo program that I want to split into three separate classes (BingoMain, BingoGUI, BingoCard). Extending a program across several files is something I have never ...
2
votes
1answer
28k views

opening a text file and building a dictionary

Need to write a function that takes an open file as the only parameter and returns a dictionary that maps a string to a list of strings and integers. each line in the text will have a username, ...
5
votes
1answer
772 views

Robopurging expired files

This script uses robocopy purge with list command to out what would be purged it then parses that log file and checks each file and only deletes files older than 7 days. Is there way it could be ...
2
votes
1answer
723 views

Barnes-Hut implementation of the N-Body problem translated from F# to C#

I am after a peer review of a C# implementation of the Barnes-Hut algorithm which I have translated from F#. The F# version is the base for comparison, therefore the C# version is suppose to reflect ...

15 30 50 per page