Code Review Weekly Newsletter

Code Review newsletter

Top new questions this week:

Average time to first answer

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 …

sql datetime t-sql stackexchange  
asked by Loki Astari 16 votes
answered by rolfl 12 votes

Check a string to see if it is a palindrome

I have written two code pieces of to find if a given string is a palindrome: public static bool FirstMethod(string str) { int i = 0; int j = str.Length - 1; while (i<j) { …

c# palindrome comparative-review  
asked by kyle 15 votes
answered by ckuhn203 17 votes

Console application for providing detailed error messages

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 …

c# console error-handling  
asked by soren.qvist 13 votes
answered by Pimgd 11 votes

Simple random number generator

I have been wanting to learn programming for some time now and decided to really give it a shot today. I have edited and read lots of things in Java to fix small issues but never written from scratch. …

python beginner python-2.7 random  
asked by Dzzs 13 votes
answered by paritosh 11 votes

Unit Testing for isPrime function

I've decided that I want to take a stab at test first programming. So, before I tackled writing an isPrime function, I wrote this unit test. It's my first and I'm not sure I'm doing this right. I was …

c# unit-testing primes  
asked by ckuhn203 12 votes
answered by mleyfman 3 votes

Using a static variable inside a lambda

Is using a static variable in a lambda function ok, or considered a bad practice? The code below works as intended (fills a vector with consecutive numbers). #include <iostream> #include …

c++ c++11  
asked by w.b 12 votes
answered by Loki Astari 11 votes

Implement "Upgrades" Feature for Game

I am building a simple adventure game that has "upgrades" feature. In this game, user controls one player, that can be upgraded to increase things such as: Amount of gold earned Maximum health …

java game  
asked by topher 12 votes
answered by bazola 13 votes

Greatest hits from previous weeks:

Fast way of searching for a string in a text file

I have written this code to search for a string in a .txt file. Is it possible to optimize the code so that it searches for the string in fastest manner possible? Assuming the text file would be a …

java algorithm strings search file  
asked by Allen Savio 8 votes
answered by rolfl 6 votes

Different way of writing multiple click functions

I have the following .click() functions: $('.tab').click(function(){ $('.tab').removeClass('activeTab'); $(this).addClass('activeTab'); }); $('.edit').click(function(){ $(this).hide(); …

jquery html  
asked by Kris Hollenbeck 4 votes
answered by Flambino 10 votes

Can you answer these?

Binomial Heap in Haskell

Here's a partial binomial heap implementation in Haskell (just merge and insert): module BinomialHeap where data BinomialTree a = Tree { key :: a , order :: Integer …

data-structures haskell heap  
asked by Inaimathi 2 votes

Modification of the headline line-height in the Compass vertical rhythm module

One thing nagged me about the compass vertical rhythm module; in the case the headline is too long and it occupies more than one line the line-height between the two lines looks way too massive and …

sass  
asked by rpk 2 votes

Selecting template from database using organization ids

This is my first SQL post over here, and in fact, I have more or less the experience of a regular SQL programmer, except that the task at hand this time was way harder than normal. I am expecting, …

sql database stored-procedure mariadb  
asked by skiwi 5 votes
Subscribe to more Stack Exchange newsletters


Unsubscribe from this newsletter or change your email preferences by visiting your subscriptions page on stackexchange.com.

Questions? Comments? Let us know on our feedback site. If you no longer want to receive mail from Stack Exchange, unsubscribe from all stackexchange.com emails.

Stack Exchange, Inc. 110 William St, 28th Floor, NY NY 10038 <3