« first day (313 days earlier)      last day (3706 days later) » 

12:00 AM
yep, using the Kernighan book
 
RELOAD!
@Andy Really? Cool. That'll make a C guru out of you one day.
@Andy Also, here is a case where recursion is faster.
 
12:15 AM
Two of our answers here were posted at around the same time. :-)
6
Q: 3D mathematical vector class

user3058865I've been working on a 3D mathematical vector class which should be as streamlined as possible for use in numerical simulations. It will be used to model 3D-physical vectors. Here, 3D-vector should be taken in mathematical sense, meaning a tuple (a,b,c). I hoped to design it in a modern and fas...

 
it's really something too simple to speed up much
 
Napalmed
 
ditto
 
@Yuushi I removed that part. I'm also glad our answers didn't quite overlap (except for the commenting stuff). So much to review.
 
@Jamal Yeah, good that we focussed on different bits and pieces
 
12:20 AM
For the record, I'm glad he wasn't aiming for a 3D std::vector. :-) I can hardly manage with a 2D one.
 
12:39 AM
hey
 
@Mat'sMug Hello
 
Incoming meta ....
 
I voted to reopen this one..
 
New monkey Meta post incoming!
 
1
Q: Where should I place the constant?

simonThe following bit of code requires a string.maketrans table that is only used inside a single function. I have written three versions of the program that place the table at different locations in the code. The differing placement of the table results in quite varying performance in the creation ...

 
12:44 AM
3
Q: Code requiring a third-party pre-processor to make it work

rolflIn this Wolves, Goats and Cabbages in Java question, Java code is presented to solve the problem. The code requires pre-processing by a third-party tool in order to function. The third-party tool adds a number of 'template' or 'boilerplate' methods that make the code complete. In Java terms, th...

 
@rolfl I think it's on-topic. Working code doesn't necessarily compile right out of the CR post. It uses methods defined in another class, in another assembly. Whether that other assembly is written by the OP, a billion-dollar company, or an obscure 3rd-party shouldn't be of interest, no?
 
    final State s = parent.data();

    ^^^^ error no such method `data()`
working?
 
The question has received 10+ votes, WTH?
 
it is a Java8 question too....
 
hmm looking at the post more closely...
 
12:49 AM
@Mat'sMug He's a well recognized user from Stack Overflow.
 
I'd suggest a tag, but I don't really feel it'd be a useful tag..
hmm 14K I see
OTOH...
81
Q: Is it safe to use Project Lombok?

TheLQIn case you don't know, Project Lombok helps with some of the annoyances of Java with stuff like generating getters and setters with annotations and even simple JavaBean like generation with @Data. It could really help me, especially in 50 different event objects where you have up to 7 different ...

 
We could ask users to "delombok" their code: projectlombok.org/features/delombok.html
 
^^ point
lol! looking at the video, it looks like a cheap ReSharper for Eclipse!
 
Comments?
0
A: Code requiring a third-party pre-processor to make it work

syb0rgAnother grey area of Code Review. I personally don't think these kind of questions are good for Code Review right now while we are in beta. They require a reviewer to install a lot of software, and the code will usually take a longer time to review due to this. And they are very localized revi...

 
@Mat'sMug nevermind, this has nothing to do with R#.
and I just managed to ping myself
 
1:05 AM
I didn't even know that was possible.
 
user image
2
I didn't know either!
 
Can you recreate it?
 
@Mat'sMug let's see...
 
@rolfl Selfie Ping!
 
another zombie down
 
1:09 AM
yep
 
(I guess rolfl giving me a kick worked) :P
 
@syb0rg Test.
 
lol
 
0
Q: Pattern for storing object of varying type

CoburnI have a situation where I need to store fields of differing types of some data structures along with some similar metadata (The application takes data from one of many sources, some data possibly coming from more than one source, and then does stuff with it). The solution I came up with was to c...

 
BRB
 
1:12 AM
@syb0rg We're a genius! We can have a conversation by ourselves!
@syb0rg This is great! But which one is the human in this conversation, and which one is the robot?
 
-1
Q: Block the ability to manually ping oneself in chat

MosheI'd like StackExchange to please block the ability to ping oneself manually in chat. I've been playing with that a little lately and it crashed my browser! (Safari 5, OS X 10.6.7) I'm pretty sure that that's what crashed Safari because I tried to edit a "self-ping" and Safari crashed. I looked ...

 
lol
 
TBH I've yet to see a single use case where a self-reply actually makes sense, and that's why the UI discourages it. But I don't feel strongly enough about it to actually disallow it on the server side. — balpha Apr 18 '11 at 20:10
well, I've found one!
 
No wonder I nearly punctured my skin when I super-pinged myself...
 
1:19 AM
wasn't even a super-ping! ;p
 
I think we may eventually dip under 600 unanswered. :-)
 
Interesting. I mean it's great, but at the same time I don't feel particularly thrilled with hitting 100% answered. It would mean we're kinda too active for the flow of incoming zombies, and that we need more questions. OTOH it could also mean new users are globally posting more answers than questions. I'm sure @rolfl has a query for that...
 
I don't think we'll hit 100% answered
on the front page of C++ unanswered, there are a number that I don't think will be answered any time soon
 
I'm not aiming for that, either. I just don't want to go up any percentage points.
 
Well, Wolf shot:
0
A: Wolves, Goats and Cabbages in Java

rolflCommentry So, this is not working code. I don't consider code to be working if needs pre-processing, and the pre-processor is not shipped as part of the standard toolchain. This code is nearly useless to anyone unless they have lambok. If I pull the code in to Eclipse, or any ot...

 
1:29 AM
Then the inevitable "consequence" is that our answers per question ratio starts going up.
...or that we stall.
615 unanswered. We'll dip below 500 before snow has finished melting over here.
 
What's cool is that the number of zero-upvoted-answer questions has consistently remained just slightly above the number of unanswered questions, for quite a while now.
 
@Mat'sMug That's because I've been watching over that number
 
In the above chart, the All/10 line, shows 63 on the right ... multiply that by 10, and you have 630 (or so) unanswered questions/
 
^^ err. the last data point says 63, but it's 1 week behind the last data point of every other series!
 
1:36 AM
That was the C# line ;-)
 
1:47 AM
0
Q: C Caesar Cipher

JT1I am quite new to C. I would like to be able to shift a letter of the alphabet 'x' number of times to create a basic cipher. Issue 1: An offset of 1 applied to 'Z' does not wrap back to 'A'. Instead it outputs '{' #include <cs50.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #inc...

 
Hmm, buggy code ^^^
I keep seeing this #include <cs50.h> in some code today. Someone is not teaching C the proper way.
 
@Mat'sMug Do you mind going in and debugging that for me? I never figured it out ;-)
 
@rolfl hum, ...no thanks!
 
@StackExchange is also a cross-post: stackoverflow.com/q/22208139/1937270
Welcome back @Andy
 
Thanks. Guess Safari doesnt like to work with the chat room....back to Chrome
 
1:58 AM
What iThing thing are you using?
 
switched to ipad for my ride home.
was trying to sort out why my initial code skipped the last element in the array
 
Sigh... That user isn't getting what is off-topic here, based on his most recent edit.
@Andy Off-by-one error?
 
Clearly he hasn't read the help center.
 
what help center? Sorry if I'm missing something
 
Now he is asking for pseudo-code. face-palm
 
2:02 AM
 
@Andy It's not you, it's another new user.
Maybe a bit harsh:
Also, off-topic. Read what is on-topic in the help center. — syb0rg 15 secs ago
 
Not too harsh.
 
Oh, good.
 
So, my grumpiness over wolves is done... but, the asker revised his question and included all the code. @200_success I would appreciate hearing your thoughts on it: meta.codereview.stackexchange.com/q/1616/31503
I am OK with the edits... in one sense, they invalidate the review, but, I think, overall, it is the better solution.
 
@Andy Aww, your question was put on hold :(
At least it got answered before then.
 
2:15 AM
@syb0rg didnt really have a question. Was just walking through a problem with the original code i submitted (didnt check last element in array).
 
@Andy No, the one I answered; the one you asked earlier today.
 
yes, that was great.
also saw you comment about the cs50.h
 
@Andy Yeah, have you seen that before? I've only started seeing it recently.
 
not sure why that class is avoiding scanf and *chars must be a reason. It is Harvard after all
 
2:17 AM
Harvard edx CS50 class
 
@rolfl I knew you would! :)
 
but they actually teach that to the actual univesity students
 
Hmmm, it looks like something that shouldn't be used. And teaching students to use it only creates bad habits.
 
hey guys
 
Hey @Malachi
 
2:21 AM
what is similar to a HashSet?
oh hey I have stars again!!!!
 
@rolfl @syb0rg I'm sorry to disagree with you:
0
A: Code requiring a third-party pre-processor to make it work

James KhouryWhat is code but instructions to a compiler? Would we allow an obscure language that no one here has a compiler to? I would hope the answer is yes. You might not be able to answer it but another person might. I can currently think of more than one example that we would accept but requires an e...

 
@JamesKhoury Perfectly fine. Let me read it and see if I agree with you.
I may end up deleting my answer actually once I considered having to review code that used external C libraries.
 
@syb0rg You're going to agree with me disagreeing with you?
 
@JamesKhoury Perhaps ;)
 
@syb0rg I think you should leave it there and see what the community says
 
2:25 AM
@JamesKhoury Aww, I was making an edit to it.
 
@Mat'sMug Help me with the `.Any` is it a Linq Keyword or something?
return _defeats.Any(x => x.Equals(gesture));
 
@JamesKhoury - I am trying to find the right analogy for this..... but, I agree with much of what you are saying....
If I say the code is not Java, then it is all fine ... and somone who knows lambok can review it.
as it stands, right now, I think the best analogy is to say it is 50% pseudocode.
 
@rolfl its not java its lombok-java ?
 
@Malachi it's a linq extension method (extends IEnumerable<T>). Takes any Func<bool> and returns true if any of the elements in _defeats have a true return value for the Func<bool>. Use if (!_defeats.Any()) over if (_defeats.Count != 0); the parameterless overload returns true if _defeats has any items.
 
essentially.... About half of the actual Java code needed to run the program, is 'compressed' in to a few lines of 'directives' telling the lombok processor what needs to be fleshed out, and how.
 
2:30 AM
basically.
 
Specifically use `.Any()` instead of `.Count()` and `.Any(x => x.something)` instead of `.Where(x => x.something).Count()`
`.Any()` doesn't need to iterate through the whole enumerable if it hasn't already.
 
yeah... that's it.
 
@JamesKhoury yeah... that's it.
 
@rolfl i fixed code in question. Can it be taken "off hold" ?
 
@JamesKhoury - have a look at the before/after code.... codereview.stackexchange.com/posts/44115/revisions (use the side-by-side markdown view).
 
2:32 AM
?
0
A: Is it bad practice to pass a DTO into a static domain 'Create' method?

WellingtonRegards, Particularly not see how inadequate practice. The concept, use and advantage of working with DTO is to have the flexibility to modify only be setting the data transported without changing the method signature. hugs

 
@rolfl I'm not a Java person.
 
You don't need to be .... the red stuff on the left is magically transformed in to the green stuff on the right ;-)
2
There's not much red. There's a lot of green.
 
have you seen less-css ?
 
no, but, is less-css an industry accepted practice?
is it 'common' ?
lombok has 83 questions on SO.
 
@Andy It's not recommended that you edit in changes to your code once they have been reviewed.
 
2:36 AM
@Andy you are caught in a bit of a bind.
For a start, I can't single-handedly reopen your question....
 
I would be willing to modify my answer a bit if that line were removed.
17
Q: Can I edit my own question to include suggested changes from answers?

ChrisWI posted a question with code, which one or more people answered with a code review. Should I edit my question, to include the changes which were suggested in the code reviews? To show the finished code? To avoid getting more of the same answers on the old code? To get new reviews of the new c...

 
@rolfl what would be the Java equivalent of IEnumerable<T>?
oh nevermind
18
Q: Java Arrays & Generics : Java Equivalent to C# IEnumerable<T>

Winston SmithSo in C#, I can treat a string[] as an IEnumerable<string>. Is there a Java equivalent?

 
@syb0rg in the instructions about why it was put on hold, it said to edit the post. Seems to be some ambiguity.
 
@Andy - question: Would you change more than just that one line now that it has been reviewed?
 
@rolfl no. that one line was just a bad copy and paste on my part from my editor
 
2:41 AM
 
That's not what I am asking... I am saying that @syb0rg has given a fair number of suggestions for things that can be improved.... do you think they you can/will apply some of those suggestions?
Will you be able to improve your code?
 
@Mat'sMug Ha!
 
@rolfl yes, I can definitely improve it with his suggestions.
 
Then, perhaps the best solution would be for you to make the changes you think would be beneficial to your code, and then post a follow up question.... with the improved code.
That way you have two questions, the better code gets reviewed (again), and everyone gets upvotes.
3
 
@rolfl I wouldn't want to go down the rabbit warren of defining "common" or "industry accepted". I would personally say it should be tagged as a language superset/subset and let an expert in that language flavour handle it.
 
2:44 AM
@Andy Edit the question to make it so the code can compile, but so that it doesn't fully invalidate my answer. I can adjust my answer so that it compensates for the bad copy-and-paste.
 
The edit has been done already ;-)
(it's the one-liner).
@BenVlodgi - I deleted my comment so you can delete your Urgh! now ;-)
 
@rolfl That edit invalidates my some of my review.
 
Oh.... yeah, @Andy - that is a much bigger edit than I thought I saw the first time.
Did you double-edit it? (twice in 5 minutes... ?)
 
@rolfl I know a one-liner: Two elves walk into a bar. The dwarf laughs and walks under it.
5
 
Yeah, the horse walks in to the bar... the barman says: "Hey, why the long face?"
2
Guess everyone ran out of stars at the same time ... huh?
 
2:49 AM
crickets
4
 
@Jamal, you make snarky comments like that, and I will target [badge:marshal]
 
@JamesKhoury for some reason MonoDevelop doesn't like it. I figured out how to make it like the HashSet but it doesn't like the Linq stuff. @Mat
 
Visual
Studio
 
@rolfl I was very confused. It is now back to the original but without the one line that was causing it to not compile. So all subsequent responses will make sense
 
@rolfl How can you get Marshal when I can just reject? :P
 
2:52 AM
@Malachi I haven't used monodevelop
 
Feel free to reject .... more work for you ;-)
Think I will target Obsolete-Jamal again... ;-)
 
Nah, not really. I hear there's now an automatic flag ban system in place.
 
This code now works, and didn't invalidate my answer completely: (needs your re-open votes)
6
Q: Can this recursive binary search in C be made more concise?

AndyCan someone please let me know if they see glaring issues with this code? I tested a handful of cases and it seems to work but in other threads. I often see much more concisely written versions of this. I just want to know if anything I have done is superfluous or just stylistically poor form. ...

 
@JamesKhoury it is open source Visual Studio, Kind of.
I will look for a work around to get LINQ to work in there
 
@syb0rg thanks for helping. Not a big deal, question was answered and now I know the posting rules.
 
2:58 AM
@Andy Yeah. If you have other C code, or you revised your code, you can post it as another question.
 
reopen vote in
@Andy kinda is - closed questions are bad press ;)
reopened, more users can post new and better answers!
 
Afterwards, @Jamal may need to do some comment cleanup on that question.
 
(napalm'd)
 
@Andy FYI, there is a rollback feature to undo edits.
 
@Mat'sMug well in that case, let's reopen!
@syb0rg really? where?
 
3:03 AM
@Andy Underneath the yellow text: codereview.stackexchange.com/posts/44199/revisions
Do you see it?
 
I found it, after I added System.core to the references for the HashSet I needed to add using System.Linq; to my using statements.
 
> Stack Overflow is currently offline for maintenance
 
NOOOOOOOO!!!!!
 
@syb0rg i dont see it. I think i broke it (down for maintenance). Too much editing I guess :)
 
@Andy All of Stack Exchange is down right now. You didn't cause it ;)
 
3:13 AM
Good thing there is a chat system so we can gripe about SO being down ;-)
It's because they effed up my reputation today/yesterday ;-)
 
Looks like it's back online
 
That was quick.
 
@Malachi
0
A: Can I edit my own question to include suggested changes from answers?

JamalAdding the changed code below the original is okay, but it's also best to not request review of those updates. That will just make it harder to compare the question to the answers, plus there's not telling when the post will stop being updated. It's okay to post new questions for iterative review...

 
@Jamal - is that supposed to be directed at @Andy ?
 
@rolfl @Jamal I assume that was directed at me. Thanks for the tip
 
3:17 AM
I'm not sure. This used to be a comment, but Malachi told me it should be an answer.
 
@syb0rg I see the revision list. So to roll back, click Edit and then there is a drop down at the top with the various versions
 
@Andy Yep, and then you should see something like that ^
 
@syb0rg Y U NO Use RED?????? !!!!
 
@rolfl I tried! It wouldn't change colors for some reason!
 
@Jamal it was aimed at aseem bansal
 
3:27 AM
0
Q: How can this Ruby format analyser be improved?

MohamadI have a requirement to validate file names related to architecture after they are uploaded. Once they have been uploaded I must warn the user if the file name is not standards compliant. What's in a name To be standards compliant a file name must consist of 7 parts after the extension is remov...

 
50 more rep till 5K!
 
Not going to work this time ;-)
 
Have a nice evening @syb0rg @rolfl - appreciate the help. Talk again soon.
 
@Andy Bye!
 
you're welcome.
 
3:30 AM
863 more rep till 5K!
later @Andy
 
@rolfl Bah, Sim already milked that one dry :P
 
Yes, but we reviewers just can't resist reviewing the revised code! — 200_success 2 mins ago
 
lol
 
@syb0rg - Just 59 votes short of populist:
2
18
A: Nesting versus GOTO: which is better to avoid?

rolflI find it strange that the zero-length line problem has not yet been pointed out: for(String line : lines) { if(line.charAt(0) == '#') { .... The code above assumes a non-empty line in all cases, otherwise you get IndexOutOfBoundsException. This is the sort of issue that should...

 
@rolfl You already had my vote on that one :)
 
3:36 AM
But-seriously... here are some answers I feel deserve more eyes: codereview.stackexchange.com/questions/44054/…
Was hard work, low-recognition.
Aaaannnnddd bed time.
 
@rolfl Napalmed.
Good night!
 
Goodnight!
 
4:18 AM
ugh. that was LONG!
0
A: Suggestions needed after modification of Simulation of an Ocean

Mat's MugCritter Your Point class is, as @RoToRa pointed out, underused. This constructor: Point location; public Critter(int x, int y){ location = new Point(x,y); } Could be simplified to this: Point _location; public Critter(Point location){ _location = location; } Also in this snippet:...

(actually deleted half of it)
'night! (and thanks @Santas!)
 
Good night!
 
4:35 AM
0
Q: Why would this python script end after one run through the loop?

evamvidFirst off, here's the code. This is a simple Pomodoro timer I wrote. Theoretically, it will run itself infinitely, alternating between timing for 25 minutes and 5 minutes. import time import sys import datetime import winsound def ring(sound): winsound.PlaySound('%s.wav' % sound, winsound.S...

 
Hello @user36915
 
4:55 AM
Anyone here?
 
I am.
 
@Donald.McLean on my way to bed
 
technically in bed.
 
This is like The Room That Never Sleeps.
8
 
so, basically, no-one here ... ;-p
 
5:09 AM
It sleeps on occasion...
But not often :p
 
I think I'm usually still around after all you Americans have gone to bed :P
 
I'll be going to bed very soon. I just had a midnight snack and will finish up with CR stuff now.
 
0
Q: reversing a string test cases

LiondancerI am trying to create a method that reverses a string that will handle every case. So far the cases I have come up with are "" "abcdef" "abbbba" null I haven't been able to handle these conditions however escape characters "\n" "\t" Not sure how to make \n or \t into a string special char...

 
6:06 AM
I'm usually up pretty late on Monday/Wednesday/Friday, but I tend to forget I have CR chat open after a while.
 
 
2 hours later…
7:55 AM
hey
 
8:24 AM
0
Q: Event Handling system in Java

user3033745I have written a system for handling the dispatch of events between objects. (I need this functionality for a larger project I am working on. Objects should be able to dispatch events without knowing anything about the objects that will receive them. If this indicates that there is something seri...

0
Q: Composite repository with plugins for multitenant app

Alexey AnufriyevIm working on an app that has flexible storage configuration. For example: public class Repo1:IRepository { public void DoSomething(int tenantId, string someKey) { ... } } This repo can be combined in Aggreagate or Composite repositories. Also there are connectors to exter...

0
Q: Domain modelling with Repository

SnapsensI've been struggling with some architectural problems which I'm having a hard time figuring out myself. Im trying to construct a basic structure of a project with the domain model and repository pattern. It's easy enough to construct the POCO classes and repository when I want to implement some...

 
 
1 hour later…
9:26 AM
0
Q: Validating an entity using a dynamic list of predicates

Andrei VI have a generic extension method for validating my entities. The main idea is to be able to specify at runtime (context related) the criteria for validating a specific entity (with the end goal of saving it in the data base). public static Boolean IsValidEntity<T>(this T entity, List<Predicate<T>>

0
Q: Handling packets and peers in a reliable UDP library

Umair AhmedI am refining my reliable UDP library, its at its 3rd iteration now. It is quiet a bit multi-threaded with almost all major operations having dedicated threads. I need your opinion on the following critical worker methods. Legend TAgUDP : Indy UDP Server derived class. TAgUDPPeer ...

0
Q: Does this code follow Javascript conventions and idioms

doughgleI'm using the Game of Life Kata to help me learn Javascript. I've picked up the syntax through Codecademy tutorials, but my current skill level is Novice. The example code has working functionality for initialising a World with live cells and asking it to 'tick'. All suggestions for improvement...

 
10:16 AM
0
Q: Django API Implementation

KDExI am building a backend to a mobile application that will be hosted on a Django site connected to a PostgreSQL database. I have never built anything to accomplish this before and this is my first go at it. I have not studied this type of application before so please let me know if the below cod...

 
10:35 AM
0
Q: MS CA2202: Object can be disposed more then once

DavidWhen running Code Analysis on my project I get the following warning: CA2202 : Microsoft.Usage : Object 'fs' can be disposed more than once in method I don't see the problem, and the code compiles fine and produces the expected results in all test cases. If I remove the fs.Dispose(); state...

 
10:47 AM
0
Q: Reading a config file Perl

alexisI am relatively new to Perl and would like to check that the code I am writing docent have any major flaws in it or any bad practices. This is a fairly simple sub but one that gets used often. Seems to work OK. Simply reads a text file that has parameters in it set by the user. Config.txt #cuc...

 
11:15 AM
Afternoon!
 
noon!
 
12:13 PM
Mornin'
 
12:29 PM
Mornin.
 
Is there any chance in the future of Java arrays will become normal objects? >.<
Arrays.stream(directory.listFiles()).forEach... is not nice
and morning @rolfl
 
0
Q: Which approach is preferable string parsing

NaveedI want to find total word count in string. I have two methods as mentioned below. public static int Wordcount(string strName) { bool wordfound; int ctr = 0; for (int i = 0; i < strName.Length; ) { wordfound = false; while ((i < strName.Length) && (strName[i] ==...

0
Q: Multiple Sites Same Loading Script

iambriansreedI have built a custom CMS on ASP.NET. I have a multiple sites all with a virtual directory pointing to the CMS's shared files. For example all the sites point to the same loading page, /_includes/load.aspx. Should I be concerned that this could cause a bottle neck? Note: Outside users don't s...

 
Morning everyone
1
Q: Does this code follow Javascript conventions and idioms?

doughgleI'm using the Game of Life Kata to help me learn Javascript. I've picked up the syntax through Codecademy tutorials, but my current skill level is Novice. The example code has working functionality for initialising a World with live cells and asking it to 'tick'. All suggestions for improvement...

anyone else want to change the title of this question?
 
12:44 PM
Done
 
damn... i was submitting my title and got "this title already exists. please be more specific"
 
goodmorning
 
'morning
 

« first day (313 days earlier)      last day (3706 days later) »