« first day (225 days earlier)      last day (2108 days later) » 

12:08 AM
That question is currently the 4th hottest question on the SE network right now.
4
Q: Vending machine implementation

RobHow would one optimize this code? import java.util.*; public class VendingMachineAssignement { public static void main(String[] args) { Scanner keyboard = new Scanner(System.in); double item1 = 1.25; double item2 = .75; double item3 = .90; double it...

 
@syb0rg That's typical on Code Review. The worst code always gets the most attention and the most upvotes
 
So if I post terrible code, I get more reputation...
 
@syb0rg Not if you post it in an answer
2
 
@SimonAndréForsberg True.
 
1:05 AM
Yeah, that does have a lot of redundant code.
 
1:16 AM
Good night folks, way too late here
 
 
2 hours later…
3:40 AM
0
Q: Optimize text to ascii lookup map and scalability

Mr. PolywhirlIs there a more optimal way of retrieving the character for the letter? I would assume that I would just replace my Entry set loop with another map, but I do not want to bloat the code, because it will reduce scalability. import java.util.HashMap; import java.util.Map; import java.util.Map.Entry...

 
 
2 hours later…
5:40 AM
0
Q: Holding server response header data after parsing it

2013AskerI'm creating a program to retrieve web content in order to learn how these things work. I would like it to be as correct as possible, ideally fully compliant. But I'm not sure this is the right approach to the problem. Is the following structure an appropriate way to hold server response header ...

 
 
2 hours later…
7:17 AM
0
Q: Pythagorean triplet

Dark MirrorI am a beginner in programming, especially Python. I got the answer for the problem, but how can I optimize it? A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52. There exists exactly one Pythagorean...

 
 
1 hour later…
8:35 AM
0
Q: Depth system for game, could this be improved?

LemonyI am still new to c++ and don't have a great insight on my coding yet, so I would be very grateful to anyone and everyone that gives advice. Also, this code is meant to: keep all of my objects in an ordered fashion based on depth. I have a couple functions that allow for easy management and I ma...

 
 
4 hours later…
12:11 PM
0
Q: Create an alternative wait in javascript

MistersIm creating an single page application with not reload or redirects so I display all my contents with partial view(since im using MVC4 and angularjs ) and modals. But I came with a situation, and that is that in some cases when i request a view with ajax to the server I need to perform some acti...

 
 
2 hours later…
1:42 PM
0
Q: Decrypting Text Effect

Maximilian FuchsI would be glad if someone takes a look at my code and maybe improves it. I wouldn't mind if it would run with jQuery. I uploaded it on jsbin.com. It's all about the effect and not about encryption or decryption. I've written the following JS Code: var got, chars, decrypted = document.g...

 
1:54 PM
0
Q: Memory Pressure Crash

user3104325My app has problems with memory management. I have used instruments and have noticed that allocation just builds itself up until it crashes. I am using ARC. When I open the app it starts with 97.13 mb memory. I also noticed that the action of displaying the carousel and going back to view contro...

 
2:06 PM
1
Q: How can i reduce this code?

soundwave1337I have a problem. This code works great, but i think it can be reduced. @if (Session["Success"] != null) { <text> <div class="alert alert-success">@Session["Success"]</div> </text> Session.Remove("Success"); } else if (Session["Error"] != null) { <text> <div class...

 
2:42 PM
0
Q: Sudoku using exact cover solver

Gareth Rees1. Introduction This is a solution to Weekend Challenge #3: a Sudoku solver in Python. It works by translating a Sudoku puzzle into an exact cover problem, and then solving the exact cover problem using Donald Knuth's "Algorithm X". The code should be self-explanatory (assuming you've read and u...

0
Q: Reading Multidimensional arrays

BabbleshackI am building a cypher program which uses a matrix of numbers and letters. A message is encoded according to the row an collum each letter of the message is found in the matrix. I am trying to find a nice way of itterating over the 2D matrix (6*6), i have already got for char in range (0, len(...

 
3:00 PM
0
Q: Feedback on logic implementation of PyQt4 based Image gallery using QTableView

sanI have made an application to display images in the form of gallery, from terminal if you are standing at the same location then it will open those images in the gallery if it does not have it will prompt to select the directory. below is the module: gallery.py import sys import os import utils...

 
3:48 PM
0
Q: Memory pressure Crash

user3104325My app has problems with memory management. I have used instruments and have noticed that allocation just builds itself up until it crashes. I am using ARC. When I open the app it starts with 97.13 mb memory. I want to see if this piece of code is efficient, if there is something that is causing...

 
4:06 PM
0
Q: STL and Dijkstra's Optimization

user2058841http://www.spoj.com/problems/SHPATH/ This is the problem and my solution to this is #include "iostream" #include "stdio.h" #include "algorithm" #include "math.h" #include "string.h" #include "time.h" #include "stdlib.h" #include <list> #include <vector> #include <string> #include <queue> #defin...

 
4:31 PM
0
Q: UIGraphicsImageContext Memory Spike - Reducing Footprint

SamI have a UIImage Category for iOS Objective-C which tints an image based on a given UIColor value. You can take a look at the method below: - (UIImage *)tintImageWithTint:(UIColor *)color withIntensity:(float)alpha { CGSize size = self.size; UIGraphicsBeginImageContextWithOptions(size, ...

 
4:49 PM
0
Q: switch (true) as alternative to else if

user33563I've seen multiple times usage of switch(true) and have used it today myself instead of multiple else ifs. Here is the case I used it for: var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') != -1; var isSafari = navigator.userAgent.toLowerCase().indexOf('safari') != -1; var isFir...

0
Q: Sudoku Week-End Challenge - Brute-Force Recursive solver

rolflThis is part of my attempt at the Week-End Challenge #3. The overall problem is larger than will fit in one question. This is a well-contained subset of my larger program. The goal of this part is to brute-force all possible (if any) solutions to a puzzle. The input to this algorithm is a 2-dime...

 
5:48 PM
0
Q: C Sudoku Solver

syb0rgThis is my first attempt at a weekend-challenge. I would prefer if reviews contained suggestions on how to improve the algorithm, but all suggestions are acceptable. Here is the code: #include <stdio.h> int isAvailable(int sudoku[][9], int row, int col, int num) { int rowStart = (row/3) *...

 
 
2 hours later…
7:36 PM
0
Q: Checking sucess on functions in C/C++

ConfusedStackI am trying to understand best practices for C\C++ functions which retrieve data but must also give success/failure information. Which is better, or is something different all together the correct way to go about such a thing? Under what conditions would one way be preferred? some_object_type...

3
Q: Hello Java World ~> Parsing a Sudoku Grid

retailcoderThis is my first, very-very first attempt at java. I haven't started tackling the actual resolution of the sudoku puzzle (not even sure where to start, haven't looked at other weekend-challenge entries yet). I don't have much to go over here, but I'm sure it's filled with beginner mistakes alread...

0
Q: Whats wrong with my code?

user2981256I have my sign up form that works and now I have my log in form. When ever I try to log in it tells me that the password and user is incorrect even though its correct. Any suggestions? PHP: <?php $dbhost="X"; $dbname="X"; $dbuser="X"; $dbpass="X"; $pass = crypt($_POST["pwd"]); $username = $_P...

 
 
1 hour later…
9:07 PM
0
Q: Python generate random HTML color grid

kyle kThis is a python script that generates a grid of random HTML colors, it works by reading random data from /dev/urandom and then encoding it as a hexadecimal string, this string is spit into individual vaues that will be represented as a color. I am wanting to know if this is the best way to gene...

 
9:37 PM
0
Q: Risks related to overriding attribute access

John DoeI have written ExtendedConfigParser class that adds ability to dot access config values like ExtendedConfigParser().section_name.option_name: from ConfigParser import SafeConfigParser class ExtendedConfigParser(SafeConfigParser): def __init__(self, config_file=None, type_conversion={}, *a...

 
10:25 PM
1
Q: SudokuSharp Solver with advanced features

Simon André ForsbergEven though it's the first time I'm writing something this "big", it feels like I know C# quite good. It's been nice to learn LINQ also and I am very impressed by the features, and perhaps I have overused it here (if it's possible to do that). SudokuFactory: Contains static methods to create so...

 

« first day (225 days earlier)      last day (2108 days later) »