Top new questions this week:
|
public static int min(int a, int b, int c)
{
int result = 0 ;
if( a < b && a < c && b < c) result = a ;
else if( a < b && a < c && b > c) …
|
Just trying out my T-SQL foo.
Wrote a script to get the average time (in seconds) to first answer for a specified language.
-- Could not get this so that the user entered
-- the language in a box at …
|
I'm writing a console application where I need to provide detailed error messages in case anything goes wrong. As a result of this, I find myself splitting up my code into many pieces and making sure …
|
Should I be putting Linq statements inside of an objects properties? Is that a best practice or is that a no no? Also if that is ok, where do I draw the line with this? I assume db access is …
|
I built a custom HTML5 video control bar, and for each second, it updates two readings:
Time Elapsed
Time Remaining
in hh:mm:ss notation, like so:
Because of how often this function runs, I …
|
I thought of this algorithm today. It seems fast, but how can I know?
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
/*
* Reverse a string
* …
|
I have got the following C code and I feel it is crazy stupid and there must be a better way to do this, but just can't think of one and have yet to learn algorithms.
/*generates 1000 random numbers, …
|
Greatest hits from previous weeks:
|
I have this class which is used as part of a game. It needs to generate Random Even values, which is done by generating random numbers until the result is even.
Is there a better way to do this?
…
|
I wrote John Conway's Game of Life in Java:
class GameOfLife {
static int countSurrounding(int[][] board, int a, int b) {
int count = 0;
int[][] surrounding = {{a - 1, b - 1},
…
|
Can you answer these?
|
I have the code bellow, which is supposed to be used inside a larger program.
Please see notes about the requirements below the code.
from __future__ import print_function
from Crypto.Cipher import …
|
I am trying implement the distance measurement between two distributions. The detail is described in here and input image . Let short summarize the idea of the paper:
The input image is divided …
|
I'm trying to simplify this code. It seems everything runs as it should; however, when in the refresh loop from iMacro, it seems a little inefficient and can take up to 7 seconds to fully execute (it …
|