Code Review Weekly Newsletter

Code Review newsletter

Top new questions this week:

Counting number of 1's and 0's from integer with bitwise operation

Is there a better way of doing this? // Definition: Count number of 1's and 0's from integer with bitwise operation // // 2^32 = 4,294,967,296 // unsigned int 32 bit #include<stdio.h> int …

c bitwise integer  
asked by user2109547 11 votes
answered by Filipe Gonçalves 18 votes

Weekend Challenge - Belle's Christmas

My entry for Weekend Challenge #5. In scope : Old Skool green on black text adventure Keyboard handling A story with 2 mini-quests 2 endings Virtues ( Hi Ultima ) save the day Out of scope : …

javascript weekend-challenge  
asked by tomdemuyt 6 votes

Dynamic Strings in C

I wrote this code for dynamic strings and would like to know what mistakes I've made. It's just a struct that gets filled on the first call to ds_allocate and freed on the first call to ds_free. It …

c strings  
asked by 2013Asker 6 votes
answered by William Morris 4 votes

Can this FindString function be optimized further, in terms of speed?

int FindStr(char* str, int strsize, char* fstr, int from) { for(int i=from, j=0; i<strsize; i++) { if(str[i]==fstr[j]) j++; else {i-=j; j=0;} …

c++ optimization strings search  
asked by Hex4869 6 votes
answered by William Morris 4 votes

HTTP Stream A stream that opens an HTTP GET and then acts like a normal C++ istream

Needed a quick stream to get json objects. #ifndef THORSANVIL_STREAM_THOR_STREAM_H #define THORSANVIL_STREAM_THOR_STREAM_H #include <istream> #include <mutex> #include …

c++ socket stream curl http  
asked by Loki Astari 5 votes

Updating a file through C++ streams

The following code is my answer to a Stack Overflow question: #include <string> #include <vector> #include <fstream> #include <cstdio> #include <assert.h> struct …

c++ file stream  
asked by Liviu 5 votes
answered by jliv902 2 votes

Refactoring chart generator in Linq

I'm kinda curious how I'd refactor this in the best way. I've only used Linq for simple queries. What it does: Depending on the type that is submitted, we're grouping events or payments by …

c# refactoring linq  
asked by NicoJuicy 5 votes
answered by retailcoder 7 votes

Greatest hits from previous weeks:

Simple calculator in Java

I've been learning Java for about 3 weeks now, and I was hoping someone could check over my code for me, and let me know how to improve. I am aware that the maths class could be removed (I could've …

java beginner  
asked by Jim 6 votes
answered by tintinmj 5 votes

Comma delimited string from list of items

Is there a simple way to create a comma delimited string from a list of items without adding an extra ", " to the end of the string? I frequently need to take an ASP.NET CheckBoxList and format the …

c# asp.net  
asked by Josh Earl 27 votes
answered by pdr 35 votes

Can you answer these?

Project Euler #82 - path sum: three ways

Here's my solution to Problem #82 on projecteuler.net: def main(): matrix = [ [131, 673, 234, 103, 18], [201, 96, 342, 965, 150], [630, 803, 746, 422, 111], …

python project-euler matrix dynamic-programming  
asked by eugene y 1 vote

Quickly fixing unmaintainable SCSS code in Rails

I've been working on a website and Rails and am fairly proud of my HTML semantics. However, my CSS code has become enormous in size, which is largely unnecessary for such a small website. How could I …

optimization ruby-on-rails sass  
asked by Dillmo 1 vote

Bresenham-like line algorithm

I implemented an algorithm that gives me a list of points that should be drawn in order the get a line between two points. Please note: it works only in a coordinate system whose origin (0,0) is in …

algorithm beginner haskell graphics  
asked by Paul 2 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