« first day (330 days earlier)      last day (3694 days later) » 
00:00 - 20:0020:00 - 00:00

Please do not edit your code after it has been reviewed so that it could make any reviews irrelevant. — syb0rg 6 secs ago
 
#define true false // Happy debugging suckers.
3
 
@nhgrif I always preferred #define struct union. Helps them save memory.
2
 
If there is another question in the future where there is a Singleton-pattern in an Android application, feel free to direct them here:
0
A: Sound manager for Android

Simon André ForsbergUnlike Ocelot20, I have quite a lot of Android experience, and this answer will focus on only one thing, namely: Getting rid of the Singleton pattern in Android In your Android.XML file there is the tag <application>. This tag can have the property android:name. This property can be set to a cl...

Luckily, I can say "Been there, did that, don't do that anymore"
 
@rolfl ... you're a mod?
;)
 
8:07 PM
Oh hello, @hichris123
 
Hi!
 
2 new mods.
So that means I can go on a flagging binge, good!
 
Lol @syb0rg that was not op...
But I somehow cannot mark the edit as invalid...
 
hey h@hichris123
 
8:10 PM
@Vogel612 No, the last edit was (#4).
It invalidated part of my review.
 
flags everything @rolfl says
 
@hichris123 Unleash Blaze on us!
 
@syb0rg You asked for it. :P
 
@hichris123 You could have it run in this room:

 CR Answers

RSS Answers Feed
 
Oh lol... well rev 2 also was not a good edit...
 
8:12 PM
You guys have good answers. :(
 
@Vogel612 Yeah, I could have made some comments on spacing....
 
goes to comments
There, 3 comment flags. Not so painful, eh @rolfl?
:P
Where art thou mods?
 
@hichris123 - flag handling is one of those things which require due-diligence and consideration ;-)
 
@rolfl LIES! I've gotten a flag handled in 1 second once. :P
 
@rolfl Due diligence (NSFW).
 
8:21 PM
in Charcoal HQ, Mar 26 at 21:32, by Undo
You flagged one second before I nuked it, @hichris123 :D
Just sayin'
 
Hm. I've just come across an old Hangman game I've made some time ago. It still sucks (using namespace std and raw pointers), but I'll refactor it and post it for review sometime.
 
Reminds me: I totally need to abuse use your site more often.
2
 
@JerryCoffin Despite the warnings .... I had a look, and .... thanks... it was more than worth it ;-)
 
@rolfl You're certainly welcome.
It was rather popular in the Lounge for a bit, especially since one of the residents there goes as Catplusplus.
 
0
Q: Ruby script to load xlsx files into mysql db

analyticsPierceI put together this Ruby script (1.9.3) to load data into MySQL from many xlsx files that contain data entered by people. These files typically have many illegal characters and it has been difficult to handle the different errors. I have tried a multiple rescue and character escaping approaches b...

 
8:38 PM
@rolfl Just thought of something... Your Zombie-over-time-query, perhaps that should be adapted to show the percentage of Zombies over time... I mean, for sites such as SO and Programmers, there's no doubt in increasing Zombies. As number of total questions goes up, so does the Zombies. But if a site is able to keep it's incoming Zombies in check so that the percentage of Zombies remains the same, that's another question...
 
9:06 PM
Figured I would try my hand at golfing for a bit:
0
A: Sort-a-number. Sorta

syb0rgC - 117 characters, 117 points c(void*a,void*b){return(atoi(a)-atoi(b));}main(int a,char**b){qsort(*(b+1),strlen(*(b+1)),1,c);printf("%s", *(b+1));} You might wonder how I get this to work without any headers. Simple, compile with: gcc -include stdio.h stdlib.h string.h test.c -o test --std=...

 
9:23 PM
@JerryCoffin: What would be a good way of selecting a random element from a std::vector, using <random>? I've found one SO question about this, but it uses std::rand.
 
9:35 PM
Something on the order of:
size_t index = std::uniform_int_distribution<size_t>(0, array_size-1)(std::mt19937());
Depending on the situation, you may prefer to define objects for the generator and/or distribution before using them, but that's kind of the general idea anyway.
 
So, you still have to get a random index and then return that element separately?
 
@Jamal Oh, you can combine it if you really want:
return v[std::uniform_int_distribution<size_t>(0, v.size() - 1)(std::mt19937())];
Just makes for a rather long and ungainly line.
 
I'll revisit it, then. I'm still working on other parts of my Hangman game. I don't even want the original working version reviewed as it no longer represents my best work.
 
9:59 PM
TTGTB, nighty night
 
Good night!
 
Goodnight!
 
0
Q: Did I properly encapsulate this package?

user2738698My goal is to make File_Path_Handler constructor the only thing a user can access. The handler: package file_path_handler; //| File_Path_Handler //| - a component that lets the user pick a file, //| then the file path will be displayed accordingly //| imports import javax.swing.JPa...

 
10:16 PM
0
Q: Does this code satisfy Single Responsibility Principle in C?

hlegiusTask: Given comma_separated.txt file with string: 1,2,3,4,5,6,7,8,9,10,11,12...,n - calculate the average value. For example: 1,2,3 should be equal 2 (float) as result. Here is my solution in C: #include <stdio.h> #include <stdlib.h> #include <string.h> int element_counter; float* all_e...

 
10:30 PM
This doesn't quite sound on-topic:
0
Q: Boost filesystem exists always returning false on windows

user3478719Here is my code: main.cpp #include "game.hpp" #include "texturemanager.hpp" #include "spritemanager.hpp" #include "imagemanager.hpp" int main() { //Texture manager to hold all textures for the game. TextureManager::GetInstance().LoadContent("Data/Images/Sprites"); //Sprite manager to h...

(it was migrated from SO)
 
Doesn't sound on topic, no.... but reading it more....
 
I guess "everything compiles fine" were the magic words.
 
0
Q: Article voting schema

Igor PantovićSystem I'm building has Users and Articles. Users can upvote/downvote Articles and cancel their votes if they want to. Each vote changes article's score. Score equals to sum of all vote values together. So I created three models: User, Article, ArticleVote. Even though the most natural way for m...

 
Comments?
0
A: Does this code satisfy Single Responsibility Principle in C?

syb0rgThings you can improve Variables/Initialization Floating-point math is challenging in surprising places. It's easy to write down a reasonable algorithm that introduces 0.01% error on every step, which over 1,000 iteration turns the results into complete slop. You can easily find volumes fill...

 
10:53 PM
0
Q: Searching in a sorted 2D matrix

bazangIf I was at an interview, and wrote this code, what would you think? Please be brutal. Time it took to wrote it: 13 minutes Problem: Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties: Integers in each row are sorted fr...

 
11:12 PM
Sorry for all the edits I've been making you do Jamal. :)
 
Hello!
 
Hi!
@Pivo You can post new messages instead of editing old ones you know ;)
 
Yes, thanks.
 
@Pivo Nah, it's alright. I enjoy it, though I can be quite picky about some edits. Though, with yours, you seem to have trouble formatting code correctly. The Markdown Help should be helpful.
 
Yep, that's helpful.
Man, I've never felt so slow before. Writing code is much more involved than I ever thought.
 
11:20 PM
It gets easier with experience.
 
I'm just a student, so I have a long way to go. I only know one language fluently enough, which is C++.
 
I've been thinking of taking a second language after learning my first, java. Which one to take, I'm unsure of though. Something to research in my spare time.
 
0
Q: PHP : Test 2 time ranges to see if they overlap (function)

JimmyI am doing a project for school and had to create a function to check if 2 time ranges overlap . I searched the net a bit but failed to find a simple function to do that . I played around a bit with my code and i think i created a working one . Note , it works for 24 hour times only & don't forg...

 
Hey @Pivo - thanks for joining us here.
 
Hello. I didn't know the chatroom existed.
 
11:25 PM
it's the hidden not-so-secret of CodeReview. There really is a social aspect to it as well. ;-)
Anyway, this room is linked to CodeReview, and there's normally a crowd of sorts in here to run things past.
 
I'm noticing. :)
I'm from Vegas. Where's everyone else from?
 
Austin, TX
 
Oh, @rolfl ...I got your message about my code. This problem, I've been working on for two days now.
 
I'm Canadian, British and South African.... you pick.
Yeah, there are some real problems with your code, but it is not far from being working.
1
Q: Read 10 numbers and display distinct numbers

PivoI'm within my first few weeks of programming and this is my 1st language. Should I be using different code than what I already chose to write? Problem: Write a program that reads 10 numbers and displays distinct numbers.(i.e. if a number appears multiple times, it is displayed only o...

 
@rolfl You're British?
 
11:30 PM
yes.
and Canadian.
and South African (why do I feel like I have said this before....?)
 
I'm going to add some methods after I get it running to help organize it, but I think my problem lies in understanding for loops and storing the unique number to the array properly.
 
First things first, how do we get that question to be back on topic.
The issue is that it is not doing what it should be doing.
 
I live in Vegas now. I've lived in 23 states...haven't had the chance to travel outside the US much but I want to.
On topic, meaning...it should compile and be storing the distinct numbers, right?
 
correct.
There is a 'jurisdiction' thing, if things are not working, they belong on StackOverflow, not here.
 
Ya, I get it now. Had a crash course on that recently.
 
11:36 PM
So, you have to be able to get distinct numbers out of your input values, and your code does not cross that threshold just yet.
 
Here's what I know...
 
There are two versions of code in your question right now, the first version does not compile, and the second version does not produce meaningful results.
Oh, the first version compiles, it seems.
 
@rolfl Because there's been a glitch in the Matrix.
 
If the input is 1,2,3,4,4,5,5,6. The output will be 1,2,3 but doesn't recognize 4,5, or 6 as a distinct number.
 
Off-topic question incoming...
 
11:38 PM
lol
After this question, I dont think any of my questions or reviews will be off topic.
 
It will be worth it once you get it right.
 
Agreed
 
Oh no, I'm not referring to yours. A new question was posted, and SE is taking its sweet time to post it here.
 
Right, so the first version compiles (now that you added a semicolon to the else).
 
I just want to make sure I understand what's going on.
So the output of the 1st version will store the numbers that appear once, but Im having trouble storing a number that has appeared more than one time.
 
11:40 PM
@Pivo SO is for making non-working code work. We concentrate on making working code good (or better).
...or did you mean understanding what's going on in your code?
 
Going on in the code ... ;-)
 
Yes, I learned that recently. I was invited here, to get this sorted out. Now my future questions will be on topic.
 
@Pivo Wish you were using C++, so you could just call std::unique to do most of the work (or, as I mentioned in my comment on the question, use a set).
 
@Pivo in the first code, the real problem is this line here:
  if (countList[b] == 1) {
 
Maybe next semester @JerryCoffin :)
 
11:43 PM
0
Q: What is the bug in my code (beginner trying to display values from text file as arrays)

VistonAm doing a project for by beginner C programing class that requires me to have the code read the values in a locally saved text files, A3.txt and B2.txt; A3.txt 50.21 62.42 74.63 86.84 // All the values are separated by one space 99.05 111.26 123.47 135.68 147.89 160.1...

 
@Pivo ^^^ That's the off-topic incoming question.
 
Gotta love when we've already closed the question before Feeds manages to post about it here...
 
Speaking of C++, @JerryCoffin, I'm in the process of retagging questions as . I'm looking for valid questions by searching for "auto" and verifying each question.
 
@Pivo - can you see the problem with that line?
 
Oh, because it should be running and they should want to know how to better the code. This is a Stack Overflow question, correct?
 
11:45 PM
CodeReview is not a debugging service ;-) StackOverflow is.... (often).
 
@rolfl I think so, yes. That line is saying, it it appears one time...
 
exactly, but 4, 5, and 6 appear twice.
 
@rolfl What if I changed the array being reviewed to my finalList? That may work.
 
You need to be more structured in your thinking....
 
One other thing I noticed is that if I enter 4,4,5,5, and 6. 6 isnt stored in the finalList either.
 
11:47 PM
Read the description again.... it is actually telling you exactly how to do it.
 
You think I should start the question over entirely?
 
> hint: read a number and store it to an array if it is new. If the number is already in the array, ignore it.
 
@Jamal Other potentially useful searches: [], [&], [=] (catch many uses of lambdas). <random> (new PRNGs), and wish for regular expressions so you could do something like for\w([^:]+:
 
Probably. I am OK to work though it with you... probably hit a different chat room though.
 
So, store the number no matter what...unless its appeared once.
 
11:48 PM
Let's start up a different chat room... hang on.
 
@Pivo What if it's appeared two or three times?
 
Ok, I dont wanna push anyones buttons.
 
Feel free to join if anyone wants ;-)
 
@JerryCoffin Right. I'm going with auto first as it seems to be most common. I'm going by this so far: codereview.stackexchange.com/…
 
@Jamal Yup--that certainly looks like it's turning up a solid percentage of hits.
 
11:54 PM
Of course, I'll be making my usual edits as well, while only bothering with the questions that I will retag.
 
@Jamal I like how you just take for granted that they'll need editing. :-)
 
Most of them do. :-) Especially some of the titles.
Hey, Loki!
 
00:00 - 20:0020:00 - 00:00

« first day (330 days earlier)      last day (3694 days later) »