All Questions

Filter by
Sorted by
Tagged with
4 votes
1 answer
624 views

Processes and Handling (Piping)

I basically have 3 processes which I loop through. The first process is encoding Video. It's actually 2 processes but they are connected, so I don't need to worry about how it handles the other one. ...
Zerowalker's user avatar
6 votes
2 answers
7k views

Blackjack game with classes instead of functions [closed]

To try out the concepts and tools I've been learning, I decided to write a Blackjack game. I wrote it entirely with functions, so it hasn't helped me at all with the concept I really lack ...
User1996's user avatar
  • 221
6 votes
2 answers
1k views

Simple python script to shorten URLs in specified text files

A recent question inspired me to write a script for this task: Shorten URLs in specified text files using googleapis.com Handle multiple URLs, whether on the same line or multiple lines The original ...
janos's user avatar
  • 111k
1 vote
2 answers
5k views

Testing memory usage of each function on the OpenCart extension page

Somewhere in this code seems to be a memory leak. A couple of users were exceeding 512Mb and I'm not sure how. Adapted the following SO code to try and test memory usage of each function on the (...
MikeiLL's user avatar
  • 630
23 votes
2 answers
2k views

Calculating Luhn-algorithm checksum digit

Today I decided to learn some basic Haskell, and for starters I made a program for calculating the checksum of a Swedish personal identification number. It uses the Luhn-algorithm, aka. ...
Simon Forsberg's user avatar
8 votes
1 answer
5k views

Update Map in Haskell

I wrote a function that inserts or updates a Map key value depending on whether the key is already in the ...
Kevin Meredith's user avatar
3 votes
2 answers
2k views

Convert international datestring to ISO-format

The function below takes a datestring in the form d-mmm-yyyy and converts it to ISO date format (yyyy-mm-dd). Delimiters may be hyphen, space or /, and Dutch or ...
RolfBly's user avatar
  • 827
12 votes
1 answer
744 views

Trampoline Interceptor

Aim In C#, the following method will cause a StackOverFlowException if called with parameter 0: ...
Ben Aaronson's user avatar
  • 5,734
3 votes
3 answers
102 views

Working with Classes (inheriting), @ properties and Initialization

I'm working on this Objective C programming assignment I found online. I'm not sure if I have met all the requirements, especially part C. Any help or suggestion will be appreciated. Part 6 a)...
Christopher Palmer's user avatar
5 votes
1 answer
104 views

Connected components algorithm does not scale past 10,000 nodes

I found a connected components algorithm posted here on SO and modified it for my own purposes. It runs well for small input sets, but doesn't scale as well as I would like. The largest set I've ...
Air's user avatar
  • 151
19 votes
1 answer
3k views

Blackjack Strategy

I am creating a Blackjack simulator in Java in order to better understand the language. I have written the basic strategy section for a player and it is terribly long. Is there a better way to do ...
mks212's user avatar
  • 293
15 votes
2 answers
17k views

Better option than "errno" for file IO error handling

I have the following method for opening a file: ...
glampert's user avatar
  • 17.1k
3 votes
1 answer
72 views

Return a List<MyObject> based on very similar data

I am rewriting an old VB.NET app in C#. I will not subject you to the old VB.NET code that I am writing (the original method that I have already refactored was over 700 lines long). The following is ...
Robert's user avatar
  • 583
4 votes
3 answers
11k views

Tic-Tac-Toe Game

I want recommendations on how to improve this code. JSFiddle for you to play in (It's laggy, so it would be better if you download the images and try it in your own PC). ...
Abandoned Account's user avatar
4 votes
1 answer
2k views

Data Access Layer method with transaction handling

I just want to know whether I've done transaction handling well. Also what about the other types of transactions available in .NET with regard to this code snippet? Also are there any redundant ...
CAD's user avatar
  • 1,753
1 vote
1 answer
1k views

Service class for Archiving and Mirroring Files and Directories

I am writing an application that either mirrors a file/directory into another location or creates a zip file "snap shot" of a file or directory and stores it in another location. The user is able to ...
aaronmallen's user avatar
10 votes
4 answers
216 views

Adding two sides of an array

The purpose of the program is to add 2 sides of an array starting from the bottom and top of both ends and to find the lowest difference at equal decrements of iteration. The program functions but it'...
Ernie's user avatar
  • 101
8 votes
1 answer
4k views

Best way to create a daemon in a JavaWeb application

I have a purpose for an application to run a daemon in my web application. The application is running with Struts1 on a tomcat7 server using Java7. This is what it does: Launch itself when the ...
Damounet's user avatar
3 votes
4 answers
22k views

WPF Calculator Code

I've coded a calculator in C# with WPF as the UI. I wish to know mainly about these points: Ways of optimizing Better techniques, tactics and ways of coding this All flaws on the surface as well as ...
Abandoned Account's user avatar
5 votes
2 answers
139 views

Parsing Websites and transferring Data between Objects

I have a DiningHall class that has the 3 properties: openingTime, closingTime, and ...
Mahir's user avatar
  • 361
2 votes
2 answers
6k views

Validate multiple regexes without a for loop in JavaScript

For a project, I need to validate a VAT number against the correct algorithm. I found a library for this here (freeware, so I should be able to reuse it) that I'm grateful exists. However, I feel like ...
Nzall's user avatar
  • 1,538
10 votes
2 answers
1k views

Animal choir simulator

I got a PHP developer interview test to solve for a company. I didn't get the job but I would like to know where I was wrong. Did I understand the test completely? ...
Aleksandar Andrijevic's user avatar
5 votes
3 answers
820 views

Repetitive controller with all methods nearly identical

I have an API with the following code ...
Luiz K.'s user avatar
  • 195
3 votes
2 answers
2k views

Multiple loops versus multiple stringbuilders

I've come across the following piece of code in a Razor view ...
Pete's user avatar
  • 641
12 votes
3 answers
2k views

Finding largest prime factor from inputted number

This is my first C# console application. This program asks for an input of a number, and finds the highest prime factor of that number. Please review my code. Have I used things right? Is my code ...
Abandoned Account's user avatar
7 votes
1 answer
268 views

Chat using commands

I have been learning Python and was trying to make a chat system which can be run by commands. This is my first attempt to write the code. Does this make sense or is it wrong usage of classes? There ...
Paritosh's user avatar
  • 2,638
15 votes
4 answers
368 views

More German overengineering™ - Class mappings and factories

Goals: So the plan was simple: Provide a factory to instantiate implementations of a certain interface (ModelConverter<T>), depending on what model-class you ...
Vogel612's user avatar
  • 25.2k
3 votes
1 answer
262 views

Selenium Java: errorRecovery

I have the following code to select an image using Selenium, only now I have added an errorRecovery. Is there is a better way to right the code in the ...
Apjuh's user avatar
  • 103
12 votes
2 answers
4k views

Mapping enum to function - request / response library encapsulation

I'm writing code for an embedded device - specifically, a camera. The idea is different camera manufacturers can implement the code so it properly works with their camera. Here, I'm encapsulating the ...
Pimgd's user avatar
  • 22.3k
6 votes
1 answer
828 views

Base generic DAO optimizations

I have base abstract GenericDAO class that executes CRUD operations with different kind of objects. Customer and ...
Viktor M.'s user avatar
  • 369
10 votes
1 answer
186 views

Good performance when predicting future game states

This question is about my answer to this king-of-the-hill challenge on Code Golf. In short, the purpose of the challenge is to code a slime that, trough various possible moves gains control over an ...
overactor's user avatar
  • 654
10 votes
2 answers
779 views

Sending SMS through twilio from play framework

I am trying to send SMS using Twilio with Scala 2.10 in Playframework 2.2, but this code is looking odd to me, maybe due to lots of conditions. I'm sure it needs some important reviews. ...
Govind Singh Nagarkoti's user avatar
7 votes
1 answer
5k views

Rotating Text in Circular Pattern Using JavaFX

Just wanted to see what you all thought about my program, I basically have two different classes that I designed to allow for automated wrapping of text in a circular pattern. This is my first bit of ...
John Conner's user avatar
3 votes
2 answers
3k views

Deepest left leaf node in a binary tree

Given a Binary Tree, find the deepest leaf node that is left child of its parent. This question is attributed to GeeksForGeeks. Looking for code-review, optimizations and best practices. ...
JavaDeveloper's user avatar
4 votes
4 answers
234 views

Advice needed in refactoring/cleaning up my javascript code

I am fairly new to Javascript. I have written a website that works as designed. However, I have a strong feeling that my code could be heavily refactored. Can anyone see anything, besides line spacing,...
kinezu's user avatar
  • 67
11 votes
2 answers
874 views

Checking conditions before allowing a play button to become visible

I have this code to check a couple conditions before allowing a play button to become visible. Is there anything to do to consolidate this code? ...
user avatar
47 votes
2 answers
4k views

Tired of FizzBuzz yet?

There have been many FizzBuzz questions lately, and here is one more! Granted, it is pretty straightforward to do FizzBuzz with SQL using calculations. So instead, I'm going to do a FizzBuzz which ...
Phrancis's user avatar
  • 20.4k
13 votes
1 answer
1k views

Abusing Excel VBA... to maintain data stored in a database

I need to build a little UI to allow easy maintenance of some data stored in a MySQL database, and the end user wants to do that in Excel (I know, I know). The code I came up with comes pretty close ...
Mathieu Guindon's user avatar
3 votes
1 answer
49 views

Separation of code into functions and use of patern matching in Haskell

In the following: ...
gsnedders's user avatar
  • 131
3 votes
0 answers
111 views

Use of die() in flow control - proper and sensible?

Designed for OpenCart, vQmod places or replaces bits of code based on XML files. The following three versions of the code achieve the same goal, which is to ...
MikeiLL's user avatar
  • 630
2 votes
2 answers
32k views

Efficient way to iterate over elements of array for matching contents of another array

Using jQuery I'm trying to find an efficient way to iterate through an array excludeMe and check if elements from another array ...
MannfromReno's user avatar
6 votes
2 answers
2k views

Flatten a multilevel linked list

Given such a structure the output should be 10->5->12->7->11->4->20->13->17->6->2->16->9->8->3->19->15. ...
JavaDeveloper's user avatar
7 votes
3 answers
19k views

Codility Frog Jump solutions [closed]

Problem details from Codility: A small frog wants to get to the other side of the road. The frog is currently located at position X and wants to get to a position greater than or equal to Y. The ...
Jay's user avatar
  • 271
11 votes
2 answers
3k views

Parse HTTP header using Python and tcpflow

I wrote a program that reads a pcap file and parses the HTTP traffic in the pcap to generate a dictionary that contains HTTP headers for each request and response in this pcap. My code does the ...
Raghda Hraiz's user avatar
7 votes
1 answer
408 views

Perfect game loop

I've been working on development for an Android game, and this is the game loop I have so far: ...
Josplode's user avatar
7 votes
4 answers
225 views

Use a Java Array like a List

I'm saving string values in an array one at a time so I cannot initialize the array with the values all at once. After I'm done with the array I need to pass it to another class that is expected a <...
Kyle Bridenstine's user avatar
2 votes
2 answers
467 views

Calculating the number of prime numbers to solve the puzzle

How can the following program execution time improved? I have used dynamic programming in both "recursive" as well as "prime" function, but I'm not getting the efficient execution time. There is a ...
Torrtuga's user avatar
3 votes
1 answer
2k views

Multi-user server connection handling

I'm writing a program and I have a server that needs to be able to handle multiple client connections at once doing many different things. I'm using the Qt library, so I handle new connections like ...
ozzymado's user avatar
  • 131
12 votes
5 answers
596 views

Categorising a number in JavaScript

I've written a function that takes a number and returns a value depending on where that number lies on a pre-defined scale. That's probably a little confusing so I've put the code below and added a ...
Sam Beckham's user avatar
7 votes
2 answers
1k views

Improving nested for loops for sub menu creation

I have a nested loop which creates a drop down with 3 levels. Works fine on modern browsers but on IE8 it hangs and takes several seconds when there's even a moderate volume of data. It creates a ...
Hulaz's user avatar
  • 73

15 30 50 per page