« first day (298 days earlier)      last day (3718 days later) » 

12:00 AM
Oh, I'll still be editing and moderating (moderating, at least). I still have school tomorrow anyway.
 
+1 for putting the effort in - and not running away with all those downvotes! Keep answering, CR needs you! — Mat's Mug 16 secs ago
2
 
dang I didn't run out of stars before crossover time
I don't have to work tomorrow. evil laugh @Jamal
 
At least I have my two "easy" classes tomorrow. And I'll also get myself some Chinese food.
 
alright I got enough hours in today I think
gotta backup my computer and then head home
got to fix someone's Xpath mistake today, wonder how long that went unnoticed....
lol later
 
Happy B-Day @Malachi & @Jamal
7
 
12:08 AM
@Mat'sMug thank you
 
(you're twins?)
 
Thanks!
I suppose that's possible... we were the only ones who ran in CR's unofficial mod election.
 
lol maybe we were meant to be twins but some force of life had other plans that we should one day Meet on Code Review (Stackexchange.com)
seriously though I have to get going, catch you all in a little while
 
Later!
 
+1 (late, I know, I ran out of ammo early today!), but despite the upvotes, this is pretty much a SO-Style answer; on CR we prefer answers that review the OP's code - not necessarily long answers redacted in 2 hours, but while addressing OP's performance concerns (for example), consider commenting on any aspect of the code, including naming, formatting, best practices, etc. That said, welcome to soon-to-be-500 milestone! — Mat's Mug 1 min ago
I'll be back in a little while, gotta be a dad right now ;)
 
12:15 AM
go gettem!
There, pinned!
 
Thanks, Santa!
 
:P
 
@Jamal I answered it too. I didn't comment on global variables: global variables are no little different from making everything a data member of a Game class.
 
My comments on those things were separate, with the global variables mostly being general. With the Game class, they won't even be there.
 
12:32 AM
We probably get a lot of 'Game' questions, in which everything is a member of 'Game', where we don't say, "global: bad!" ... even though global data and members of a top-level class are more-or-less equivalent. IMO the 'OO' win in this question would be from 'encapsulating' smaller pieces: Ball, Paddle, etc.
 
I'm still not so keen with classes/OOP, so I didn't want to go too much into it. It would've taken some time to really tear apart that code and recommend the best path.
 
@ChrisW seen this one?
8
Q: How can I solve my constructor injection code architecture?

Patrick MageeThe current code solves the issue I had when trying to use property injection. Problem: Every module must use constructor injection because of a circular reference that occurs when not using constructor injection with my factories and trying to use property injection Reason: A module requires a...

+100 bounty :)
 
@Mat'sMug I don't understand that question: a) how to use Ninject (I've never used it) b) what "circular reference" he gets when he tries it.
 
I don't quite understand it either :/ ...Ninject works like any other IoC container (configure, compose, release) ..I'm not sure about the circular reference either. I do think there has to be a way to write this code "correctly" though.
I'm quite ashamed of not having been able to solidly tackle that one actually, it's right on my playground.
(hence the bounty)
 
I don't know what his (specific) problem is. And, I don't even know what IoC is for: what an IoC container is or why I'd want one.
 
12:44 AM
664 unanswered? Is that our lowest so far?
 
@Jamal totally
smells like 95% approaching!
@ChrisW you never tried Dependency Injection?
 
We might be approaching that as well! Just keep watch for more zombies.
 
I'm starting to think we need more zombies - they're not keeping up!
 
I can't really find anything to answer, although perhaps that's just me being lazy
 
^^ see?!
 
12:47 AM
There are still some unanswered ones on the front page, though. We need to keep up with those first.
 
@Mat'sMug I don't think so. Not by that name, anyway.
 
Perhaps that's just him not finding any C++ zombie he can answer. I'm in the same boat.
 
@ChrisW it's the "D" in SOLID ;)
 
I've used interfaces.
 
The idea is to move all usages of "new" to the composition root, which is ideally the app's entry point. By "injecting" dependencies in types' constructors, you get to "compose" the entire app's dependency graph at startup. The IoC container is just a tool that facilitates resolving the dependencies.
It literally forces your code to be testable and to follow all the principles of SOLID.
If you start breaking SRP you'll know because your constructor is going to start taking in 4, 5, 6 or more dependencies / "services".
 
12:58 AM
C++ or C
I should browse python again
and I've kind of been ignoring Java, because there are people better suited to answer than me
 
^^ and monkeys!
 
@Mat'sMug So it's primarily to make it testable?
 
it's kind of a side-effect
new creates coupling
it's a dependency
so instead of newing it up, you ask for it in your constructor.
and you ask for an abstraction, an interface.
 
I don't see the harm in coupling; except when I specifically want to avoid it.
 
I think there's a happy balance to be struck
 
1:07 AM
The goal is to write code that resists to change. You want low coupling and high cohesion.
 
Iff I want to avoid coupling (e.g. to use 2 different database APIs) then I can hide that module behind an abstract interface.
 
that's it. DI pushes it all the way.
If you push it all the way, you have full control over all dependencies across your entire application. Any class can be taken and tested with mock implementations of dependencies. TDD-enabled.
(I'm don't do TDD, but I find it nice that it's possible to do it that way)
 
does "all the way" mean that every class implements an abstract interface which defines/duplicates its public API?
 
Not if it's not needed.
 
I prefer to test with real (not mock) dependencies.
 
1:14 AM
Your tests hit the db?
 
Yes.
 
Ah, that's something I can't do ;)
 
You can't have a scratch DB?
 
we have a .......weird environment. 1 SQL Server instance with a 450GB production database, a copy for test & dev, another copy for replicating tons of XML data to the production database (the "model development and testing" database), and there's no room for another copy. We're all sharing the same instance and dev/test database.
 
Hey @jarnbjo
You responded!
 
1:19 AM
(I know, we're asking for Murphy's law to strike)
 
I have an SQL server (MS SQL Express) on my own dev machine.
 
Me too, but I can't fit 450GB!
(although I probably just don't want to spend the effort scripting that monster)
 
1:40 AM
I've seen that when Conway's Law is applicable, it implies the need for 'unit' tests before integration tests. And when unit tests are necessary then testing against mock dependencies may be necessary.
But (e.g. if the team is small) continuous integration and automated system testing can IMO be used instead of unit testing.
"Dependency Injection" seems to me (though I've barely read about it) to be a technique that's mostly for unit-testing.
 
one of the best books I've read: manning.com/seemann
 
Thanks for the recommendation.
 
we're rewriting a massive VB6 spaghetti monster in C#, I'm the one pushing for DI & testability. There's no documentation, the specs are unknown (will have to be inferred decyphered from the broken code), and every change can break something else. Unit tests make a documentation for all those countless business rules.
 
I prefer automated system tests.
 
they're not mutually exclusive with unit tests ;)
and that still requires a certain level of testability in the code doesn't it?
 
1:52 AM
I just hit 300 profile views!
 
[badge:kid-kodak]?
 
2:05 AM
Urgh, I have one of these last few bugs in my UTTT game I can't figure out...
 
@Mat'sMug Thanks for the chat. Sorry to break off: I've having a real-time interrupt.
 
no problem, I'm working on a meta post ;)
 
1
Q: Using jquery Callbacks.fire method as a event handler

Andy SmithSo I've got a jquery project where I'm using an external class that has callback style events. Meaning, it has an "onSave" property that takes one function. However, I need to more than one other component to hook into it. What I've settled on for now, goes like this: var saveCallbacks = $.Call...

 
user image
3
 
So I don't really pay too much attention to my profile all that much, but @syb0rg was commenting on his profile-views, and I went to look. What's suprising, is that I have apparently only been a member for 3 months.....
 
2:12 AM
Yay! I'm a monkey! :-)
 
s/there/their/ nidgits.... even monkeys can spell
2
s/modraters/moderators/
 
Can someone else take a look at my logic loop to see if I'm missing something? I can't seem to figure it out for some reason.
 
Much better.
 
Basically, the horizontal checks work, but the vertical and horizontal checks don't.
 
@all
Attention please
 
2:22 AM
!!!
 
CR is now 95% answered!!!
4
 
And 3 answers from 21K!
 
@Jamal Won't... sleep.. till... 95%+...... — Mat's Mug Nov 17 '13 at 3:58
(collapses)
 
Go to sleep!
 
nah, busy!
and look who's talking!
 
2:24 AM
This is true...
 
wow this is beautiful. I can't take my eyes off the "95%" and can't help thinking "guys, we did it!"
 
@syb0rg - want to get a hint, or you want to figure it out yourself?
 
Hint
 
board[x][y] != '-' ... compare with
board[x][y + line] ==board[x + 1][y + line]
now, when line > 0 .... what happens?
 
But we still have to maintain it! It can go back to 94% at any time.
 
2:26 AM
indeed!
 
@syb0rg - make sense?
(your logic is broken for rows as well).
 
@rolfl I'm thinking.
 
You use line to cheat on checking rows/columns properly
(and you check the diagonals 3 times).
But, only one of the rows, and one of the columns has position board[x][y] as part of it.
 
@rolfl I know that, I just had two similar for loops, so I combined them knowing that.
 
And that's the only thing you check for ! '-'
 
2:30 AM
@rolfl I'm cheating huh?
Hmmm
 
Just checking... you are trying to identify a winning row/column/diagonal, right?
 
Yes
The comments at the far right.
Maybe I should be clearer with them.
 
Well, if your right column is the wininning one... and it looks (amazingly) like:
--X
--X
--X
You are getting in to your if condition, and you are saying:
if (board[0][0] != '-') .....
 
Oh, I'm a moron.
3
 
Uh-huh
3
(cheaters never prosper) .... ;-)
 
2:35 AM
I have closed one C++ zombie, and I may be able to answer another.
 
If you are going to cheat..., consider the following:
private static final int[][] offsetchecks = {
        {0,0 , 0,1, 0,2}, // left column
        {1,0 , 1,1, 1,2}, // mid column
        {2,0 , 2,1, 2,2}, // right column
        {0,0 , 1,0, 1,0}, // top row
        {0,1 , 1,1, 1,1}, // mid row
        {0,2 , 1,2, 1,2}, // bot row
        {0,0 , 1,1, 2,2}, // tl->br diagonal
        {0,2 , 1,1, 2,0}, // bl->tr diagonal
};
That's a 2D int array, each row represents 3 pairs, the first value, and the matching 2 values....
You could loop over the inner values, and say:
    for (int[] triple : offsetchecks) {
        if (       board[triple[0]][triple[1]] != '-'
                && board[triple[0]][triple[1]] == board[triple[2]][triple[3]]
                && board[triple[0]][triple[1]] == board[triple[4]][triple[5]]) {
            /// Winner!
        }
    }
^^^ java style ^^^^
Note, the // top row is wrong there....
Can't edit it.... the values should be {0,0 , 1,0, 2,0}, // top row
 
What would be the non-cheaty way?
 
What I wrote above ... ;-)
 
Bah, C doesn't have "enhanced" for loops.
 
There are 8 winning triples 3 rows, 3 columns, 2 diagonals.
yeah, but it has 2D arrays.
It can be a constant in the method, really fast, (make sure you fix all the rows to have the right values.
You can adjust it to be:
if (       board[x + triple[0]][y + triple[1]] != '-'
 
2:49 AM
@Yuushi: I'm looking at this zombie now:
1
Q: Producer consumer frameskip?

MikhailI have a producer consumer that simulates the interaction of threads controlling a hardware device. I have 1 thread controlling the device, 1 thread reading, and 1 thread outputting. The read is synchronous on the thread while the controlling is asynchronous. My producer is the thread contro...

 
sorry, busy debugging something atm
 
Are the use of global variables justified in this situation? I have a feeling they are.
Okay, okay!
 
1
Q: Int stack implementation - critiques?

dysruption#include <stdio.h> #include <stdlib.h> struct Stack { int value; int is_empty; struct Stack *next; }; int pop(struct Stack **stack) { if ((*stack)->is_empty == 1) { printf("Stack is empty!\n"); abort(); // not sure what this does } else { int value = (*stack)->value; /...

 
@syb0rg ... consider:
const int nTriples = 8;
const int xStart[nTriples] = { 0,  0,  0,  0,  1,  2,  0,  0};
const int yStart[nTriples] = { 0,  1,  2,  0,  0,  0,  0,  2};
const int xDelta[nTriples] = { 1,  1,  1,  0,  0,  0,  1,  1};
const int yDelta[nTriples] = { 0,  0,  0,  1,  1,  1,  1, -1};
int startx, starty, deltax, deltay, count;
for (int trip = 0; trip < ntriples; trip++)
{
    startx = x + xStart[trip];
    starty = y + yStart[trip];
    deltax = xDelta[trip];
    deltay = yDelta[trip];
    if (board[startx][starty] != '-' &&
 
0
A: Int stack implementation

syb0rgThings you did well: Overall the code looks very nice and well organized. You used comments well. Things you could improve: Syntax: typedef your structs. struct Stack { int value; int is_empty; struct Stack *next; }; The typedef means you no longer have to write struct all over ...

@rolfl Why didn't you use a matrix?
 
3:01 AM
readability
 
Ahh.
 
The values in different places mean different things
it will all compile out the same anyway.
There's a count variable in there that shouldn't be.
It is also neither C nor C++, not sure what it is.
And, it's not my code... it's yours ;-)
 
0
Q: Listen to multiple RabbitMQ queue by task and process the message

MaheshSingle app which listen to multiple RabbitMQ queue and process the message. Does this implementation is right or I am missing something. //Message subscriber implementation public class AuditSubscriber : IMessageSubscriber { public IList<string> SubscribedRouteKeys { ...

 
@rolfl I'm trying to think of a shorter version somehow...
But I'm not sure how to without mapping them beforehand like you did.
 
Why does it need to be shorter?
It will be faster.... it does a couple of things better than what you had (apart from actually working that is).
First, it short-circuits the ` != '-'` test.
second, it saves 12 comparisons... (only checking diagonals once).
third, it is DRY.
fourth, with all the consts, etc... you will probably find the compiler can do a really good optimization.
 
3:28 AM
@rolfl Though there were a few issues with your code, I managed to implement it ;)
Thanks for your help! (and I don't blame you for the issues, you don't program in C)
 
meh, I typed it in to a java file I had open....
You get what you pay for, right?
 
Hey, those 2 upvotes were very costly :P
 
Thanks, santa... one of them scored me a Necromancer ;-)
I think, in fairness, you got more than what you paid for... right?
 
Yeah, you're right. Your method was better. I just have to try to understand it more deeply so I can convert it to a matrix, and comment the block of code for clarity.
 
3:44 AM
0
Q: Program that asks the user to enter 2 inputs and a limit. It finds the sum of the multiples. Please help

user3354072The user must enter x, y, and the limit. The program must find the multiples of these numbers that are below the limit that the user set themselves. The program adds up all the multiples and prints just that number at the end, and not all the multiples. For some reason it just isn't working for m...

 
@StackExchange Off-topic: non-working code.
 
@Jamal would we get fewer of those as a graduated site?
 
@Mat'sMug I think we would actually get more, since that would be added to SO's migration options...
Right now we are not added to SO's migration options since we are a beta site.
 
Yeah, but we could make it clearer that we only review working code
no?
 
We'll keep getting them as long as SO users are unaware of what's on-topic on their own site...
2
 
3:53 AM
lol
 
I mean, how often do we send working code to SO?
 
nice
turns out it's also a rep-score-improving answer ;)
 
Hey @Corbin
 
Hey @syb0rg. How's it going?
 
3:56 AM
Good, how are you?
 
Hey!
 
Sick, but otherwise not bad
 
Aww, sorry :(
I hate when I see a question that I answered receive an upvote, but then my answer doesn't...
 
Yeah, that dreaded honest answer to the 'how are you?' question
 
thanks lol. luckily not too bad. just a cold
 
3:57 AM
That's OK, then.
You can take time off work, and answer on CR.
2
it would be inconsiderate of you to infect your colleagues....
 
eh, if only. still gotta do uni stuff :/
and i work from home
 
I have midterms next week. :-( I'd rather do stuffs here.
 
:(
 
Well, I apparenly only open my mouth to swap my feet ... oh, that does not really work in a typed chat place....
Hey, all... thank you ... ;-)
I think, I am at [gold:java] now.... codereview.stackexchange.com/users/31503/rolfl?tab=tags
just needs to catch up.... which will probably only be in 23 hours...
 
Thanks, Santa!
 
4:09 AM
Happy birthday!
 
Thanks, monkey!
 
It's your birthday? Happy birthday!
 
I thought it was tomorrow?
 
In under 2 hours...
right?
 
The 26th, technically. I assume some of you are from the future. :-P
 
4:11 AM
Ah
 
Corbin, no recent answering.... uni got you stressed?
 
It's weird how many people have birthday's in February. I'm sure it's just some kind of weird bias since mine is in February too, but I swear I've come across at least 9 trillion people with Feb birthdays recently.
 
"welcome to the world of tomorrow"
 
Eh, just been busy with traveling and class, and stuff. And I only like answering certain kinds of questions, and none of those have come along.
 
If you're canadian it has something to do with the May-24 weekend.
or is it just 'spring fever'... IDK.
 
4:12 AM
"Easy" ones, you mean? ;-)
 
And sometimes when there are other answers, I'm dissuaded from answering because I would have to explain what's wrong with the other answer, and blerh...
Just been lazy lately
 
If I was any better, I would kill all those C++ zombies myself.
 
Well, no more upvotes for you then.
2
 
I tend to hover around C++ and PHP questions. Unfortunately a lot of C++ questions exceed my knowledge, and most PHP questions are either hopeless, already have a few answers that have terrible misinformation in them, or are too short to be meaningful.
PHP is not a pinnacle of question quality, I'm afraid :(
 
Check out this query, by the way... may be of interest:
 
4:14 AM
@Corbin That would be C that is the pinnacle of Q&A quality ;)
3
A: Int stack implementation

syb0rgThings you did well: Overall the code looks very nice and well organized. You used comments well. Things you could improve: Syntax: typedef your structs. struct Stack { int value; int is_empty; struct Stack *next; }; The typedef means you no longer have to write struct all over ...

 
It has some high-ranking questions with low-ranking answers.
All the askers of those questions are still active on CR.
 
@syb0rg typedefing structs is a bit of a contentious issue
 
Actually saw that earlier, @syb0rg. Despite my lack of answering, I do very actively creep on what others are up to. Gotta vote. I want CR to graduate already :(.
Yeah, I thought about mentioning that earlier too, Yuushi. But... Laziness. And sickness. Which causes a terrible kind of laziness.
 
@Yuushi It depends on the struct and what it does. It could have gone either way here I think.
I try to explain as best as possible why I think typedef is better in my answer though.
 
Next question asked is #21K
 
4:18 AM
@Jamal Who can review this though? I can't see any error in it.
 
There's a lot of die-hard C people who believe in never using a typedef on a struct. They think it hides detail.
 
18
Q: Yet another C++ Json Parser

Loki AstariThis is a framework for a json Parser I put together last night. Any comments appreciated. JsonLexer.l: Breaks the input into lexemes JsonParser.y: Understands the language syntax JsonParser.h: Header file to bring it all togeter main.cpp: Test harness so it can be tested. Makefile: S...

 
I strongly disagree with them, but.... yeah. That's the other side.
 
I don't know Lex or Yacc well enough
 
@Corbin Use the argument of declaring typedef structs with a name such as node_t.
 
4:19 AM
(or Flex, as the case may be)
 
@syb0rg: I can't review any of his. :-( It'd be nice if some more experienced SO people could review his questions.
 
@Jamal I tried recruiting people from SO, and failed.
 
I'd better hit the books the Internet, then.
 
@syb0rg Fun fact: _t is reserved in POSIX :0. But I get what you mean. I'm sure they would just argue back something about just putting the struct instead of trying to be lazy with a two character suffix. Personally, I don't get their argument. I think really it comes down to opinion. After all, at the end of the day, it doesn't affect much. There is a certain value to struct in some situations. It's just redundant 99.9999% of the time.
2
 
1300 profile views!
 
4:22 AM
[badge:jetset]?
 
waits for 1337 profile views
 
hehe
@Jamal - apparently there is an SEDE for that: data.stackexchange.com/codereview/query/159861/…
 
I'm just going to assume Jon Skeet is on top of that
 
Nope, Loki
Jon is not on CodeReview at all, actually (AFAIK)
 
If only... We should all try to get him.
 
4:25 AM
yes , he is a member.
Rep 351
Jon Skeet, Reading, United Kingdom
351 1 3
 
ah
 
oh, that's for CR
I thought it was for SO
 
#24!
@rolfl All his reputation came from answers that were migrated from Stack Overflow.
 
Yeah, and they were answered before the migration
Oh, that's what you said.
 
I think a lot of the 2011 questions came from the Big Bang, when questions in the tag on SO were mass-migrated over here.
 
4:30 AM
Is that how CR was seeded? I never knew that
 
at least part of it
I think they were somewhat/somehow cherry-picked
 
ok, that's the 3rd time that's hard locked the OS
I'm going to not do that again.
or actually, I am.
 
Insanity....
> Insanity: doing the same thing over and over again and expecting different results. .... Albert Einstein
2
 
meta-post coming
 
@Yuushi still there?
 
4:43 AM
yep
someone introduced a bug that hard-locks the OS, and I'm trying to track down why
at least I can chat on here while the system is rebooting.... :)
 
@Mat'sMug really good meta post
 
@rolfl thanks :)
 
I'll update the tags.
 
@rolfl can you do something for the time to answer query?
I didn't post it on CR
 
What wre the parameters you had? answer had to arrive within 30 days or ignore it?
Hey @PatoSáinz
 
4:52 AM
I just made everything up, had no clue where to start
if it doesn't make sense, dump it ;)
 
Anonymous
sup @rolfl
 
Anonymous
just checking this new beta, a Q&A for QA is really a good idea, we lack a lot of it in the world...
 
Hello @PatoSáinz
I think I saw you in the Raspberry Pi chat room before.
 
4
Q: 100 days later: what's up?

Mat's Mug November 15, 2013. 6:30AM UTC. Community Manager Grace Note posted How is Code Review doing right now?. We are 100+ days later. Rewind Since mid-November 2013, a number of things have happened: A fun tag was created on Meta-CR. CR users answered the Call of Duty; incoming, as well as m...

 
About time @StackExchange.
 
Anonymous
4:54 AM
@syb0rg Raspberry Pi?
 
Anonymous
Maybe I asked about power consumption
 
Anonymous
did I?
 
I'm not sure. I've seen you before, and that's where I thought it was.
@PatoSáinz What's you language of choice?
 
Anonymous
@syb0rg please don't crucify me Perl.
2
 
Anonymous
Yours?
 
4:56 AM
 
@PatoSáinz No need to crucify you. You've decided to do that to yourself :P
 
Anonymous
@Yuushi I think it may be the most dreaded language in QA after PHP and C++
 
0
Q: Using record class operators for version

Jerry DodgeI was inspired to come up with a record type which is flexible enough to handle various scenarios of versions. I was clever enough to come up with this... type TVersion = record Values: array of Integer; function Count: Integer; class operator implicit(aVersion: TVersion): String; ...

 
@PatoSáinz I'm just kidding anyway, since I generally quite like C++
 
Anonymous
user image
3
 
4:58 AM
anyway, we can all just gang up on the PHP people
2
 
Anonymous
well, when you see perl code that begins with include('cgi-lib.pl'); instead of use strict;, use warnings; and a shebang you now you must run away
 
I used to write things like that in perl.... now I must get back to SEDE
 
honestly, I only really know Perl from the reputation, I've never touched it, and only read snippets here and there
 

« first day (298 days earlier)      last day (3718 days later) »