« first day (175 days earlier)      last day (3851 days later) » 

12:04 AM
0
Q: How to speed up this kNN code?

Nicolas ZhongI have wrote a kNN code as follows. But it is very slow. I want to get a exact k-nearest-neighbor, not the approximate ones, so I didn't use the FLANN or ANN. Could you give me some advice to speed up this code? Thanks. struct Pair{ int id; double value; Pair(int id,...

 
12:23 AM
0
Q: Double Upvoting

retailcoderThis is certainly going to make everybody frown, but let me lay down the idea here... I know there's the bounty system for rewarding awesome answers, but 50 or 100 points is a rather intense rep hit to take when all you want is to reward an outstandingly good post. How many times have you read ...

 
 
2 hours later…
1:55 AM
0
Q: PHP Application, attempting to restructure (Massive case/switch, ajax calls)

tmacbackground A little over a year ago I was given the creative freedom to develop on the side of my primary responsibilities. I want to move into development, but am not currently in that role. I was given the resources to develop a PHP application that handled a lot of the reporting functions for...

 
 
1 hour later…
2:57 AM
0
Q: Shortening my code (Help for a newbie)

Neil HeRnandezFirst post Feedback would be Greatly welcomed. Now is there any other way to shorten this code without sacrificing readability. I am Fairly new to C# let alone programming and i wanted to know if this is as short as this code can possibly become. Side note was Questions.Questask Used properly her...

 
 
3 hours later…
6:03 AM
0
Q: Recursive GCD using a lambda

Bogo Sortmore of my code to review! It works just fine, however the assignment was to write a recursive "function". Curious if this should count. Any comments / suggestions/ stuff I should watch out for... appreciated. Thanks for taking a look. #include <iostream> #include <functional> #include <cctype>...

 
6:58 AM
0
Q: Port Python graph traversal code to Java

wulfgar.proI'm trying to find all paths from vertex A to N in my graph. The Python to do this is: def find_all_paths(graph, start, end, path=[]): path = path + [start] if start == end: return [path] if not graph.has_key(start): return [] paths = [] for node in graph[sta...

 
7:47 AM
0
Q: C++ File handling, inserts ÿ character while copying contents

Tarun[Please don't comment on using Turbo C++. I know that it's obsolete but we are taught this way only.] #include<fstream.h> #include<conio.h> void main() { clrscr(); char ch; ifstream read; read.open("Employee.txt"); ofstream write; write.open("Another.txt"); while(!read.eof()) { r...

 
 
2 hours later…
9:20 AM
0
Q: custom win32_file_streambuf

wilxI am looking for a review regarding C++ streams behaviour conformance. I have made this win32_file_streambuf so that I can use it in log4cplus project. I basically need it so that log files can be renamed when they are still opened by another process logging into the same file. This can be done ...

 
 
3 hours later…
12:19 PM
0
Q: Basic Pong game in Pygame

LewisI have just wrote this Pong game in Pygame: import pygame import sys import math class Ball(object): def __init__(self, x, y, width, height, vx, vy, colour): self.x = x self.y = y self.width = width self.height = height self.vx = vx self.vy = ...

 
1:15 PM
0
Q: How can this code be made more efficient?

Akshat TripathiSo, I was working on a problem set and I came across this problem: "Assume s is a string of lower case characters. Write a program that prints the longest substring of s in which the letters occur in alphabetical order. For example, if s = 'azcbobobegghakl', then your program should print Long...

0
Q: PHP - Can't seem to get the validate function to work right

user2922696Can anyone tell me what am I doing wrong? It's a simple pay calculator that multiplies hours and wages to get the total pay. Can't seem to get the validate portion right though. <?php function inputRequired($fieldName) { echo "The field \"$fieldName\" is required.<br />"; } function validateIn...

0
Q: String Formatting using C / C++

PrabuThis is my first post to code review. I have already asked this question in stackoverflow and was asked to repeat here. Here is the link http://stackoverflow.com/questions/19607062/string-formatting-using-c-c Recently I was asked in an interview to convert the string say "aabbbccccddddd" to "a2b...

 
 
6 hours later…
7:20 PM
0
Q: Optimize this piece of code

mr5I need to optimize this piece of code I made because this will run in real-time mode. Its a matrix shifter that pulls downward and will neglect any transparent element. Code: void shiftDown(int col) { int x = 0; //transparent element int N = 5; //size int i,j,k,l; for (i = N...

 
8:09 PM
0
Q: N grams Generator in Java? Looking for efficiency

MrAI recently had programming challenge. The challenge was to create the N grams the description as follows: Trigram analysis is very simple. Look at each set of three adjacent words in a document. Use the first two words of the set as a key, and remember the fact that the third word followed that ...

 
8:58 PM
0
Q: Minesweeper, Bombcount method

BabbleshackI have a method which checks all of its surrounding squares and returns the number of bombs around it. The problem is it uses a long list of if statements, which is pretty ugly and probably inefficient. public int countArround(){ int bombNum = 0; //x=0 y=1 works if(((SmartSqu...

 
9:35 PM
0
Q: Maze problem, code review for code clean up and optimization

JavaDeveloperMaze, assumption - single point of entry and a single point of exit. Also directions to travel in maze are North South East West. Request for optimization and code cleanup. import java.util.LinkedHashSet; import java.util.Set; final class Coordinate { private final int x; private fin...

 

« first day (175 days earlier)      last day (3851 days later) »