8:00 PM
I didn't write it. But it's readability is under question.

What is java.util.Scanner for?

0

I need an implementation of PBKDF2 in C#. There is already a class Rfc2898DeriveBytes, but it uses SHA1, and I need SHA512. The problem that I faced with during implementation is intensive allocation of memory after each hash computing iteration. The proposed solution is to change a little bit SH...

input

If I remember correctly, input.

@CaptainObvious Um, no, that has nothing to do with Scanner...

8:04 PM
It has functions like NextInt, NextLine...

Scanner scanner = new Scanner(System.in);

Is this basically for ready whatever int was entered by the user?

is that the actual code, verbatim?

Reads input, usually typed, but I think you use this for reading files too.

because if it is, I'm redflagging it

Isn't it supposed to be int choice = scanner.NextInt();?
Or something like that?

8:06 PM
@JeroenVannevel It's just code from that question from Simon's friend
I think I'll just go smoke some documentation thanks for informing me what Scanner is for :)

ah I see

readInt is a separately defined method

yeah okay, it can work like that
I'd define the scanner as static though and put it on class level

@Vogel612 Ohhhh that makes sense now

feels ugly to have to pass it in to a method

8:08 PM
@JeroenVannevel seconding that, but it allows DI and decouples the method

Passing Scanner in as a parameter is useful when you want to test things, or feed it input from a file ocasionally

@JeroenVannevel what's ugly about passing stuff to methods? isn't it more ugly to use it as static?

@SimonAndréForsberg meh.. a method-local Scanner of System.in is ugly....

not if it is in main IMO
I don't see what's ugly with it
I'm with monkey on this one.

is it on or off-topic?

8:13 PM
Tell methods and objects about the things they need, don't have them ask outside their scope for it.

sure tell don't ask, but if it's in main, you could eagerly initialize it as static field anyways
@Mat'sMug good question
Jamal did a rollback on it
into a state where I'd say it's off.
but OP's edits don't really help
and the sheer size of the code is also a problem.

Same reason I make my Random objects at least static or threadlocal
shit's just never supposed to change

@JeroenVannevel but the methods become less flexible

Why?

you can still apply tell don't ask there

8:16 PM
@JeroenVannevel because they're using stuff from outside their scope

you could even extract the "readInt" into a Utility class to enforce tell don't ask
@SimonAndréForsberg no.. that's not the consequence
that's the consequence of misusing the static field

@SimonAndréForsberg I don't know why that would be so terrible in the first place

> this is my first post on here so I'll keep it concise.
0

this is my first post on here so I'll keep it concise. I just recently made an attempt at implementing what I have been led to understand is called a RoundStack, simply meaning contrary to .NET Stack's default behavior of doubling internal array size when it hits capacity, simply starts dropping...

@Mat'sMug it's a mess where a user apparently hasn't learned that after they have received answers, they shouldn't change their code.

but still, right now you define it in main and passing it to readInt()
Might as well define it there in the first place

8:18 PM
@Mat'sMug DIE KILL IT WITH FIRE

or - since it will never change and you might want to use it elsewhere - define it as a static field

@JeroenVannevel I'm not saying it would be terrible, I'm just saying it would be less flexible.

@Vogel612 you beat me to that comment!

0

I have written a code where I'm rounding decimals to whole numbers and add them to a list. The program then checks the sum of those numbers against the previous sum of those numbers (before rounding). My question is if there's a way to make it add X to the smallest number in the list until it is ...

-2

this is my first post on here so I'll keep it concise. I just recently made an attempt at implementing what I have been led to understand is called a RoundStack, simply meaning contrary to .NET Stack's default behavior of doubling internal array size when it hits capacity, simply starts dropping...

insta -2

8:19 PM
@JeroenVannevel not me! @HenrikBohlin does!

6 mins ago, by Mat's Mug
@mods what is this mess? http://codereview.stackexchange.com/q/77502/23788
^^^ I'm not touching that ... ;;--))
2

@JeroenVannevel or pass it to the other methods that would require it. but it is true that it is only used inside readInt.

@CaptainObvious also off-topic

@rolfl Jamal touched it
@Mat'sMug broken code also applies.

whatever. just close it! :)
2

8:23 PM

11

On Code Review we often encounter questions with the same kind of problem over and over again. Some of us are using the auto comments script which allows you to maintain a list of comments to post. What are some useful tin-can comments that can be good to have in your list of comments? If you ...

261

No more re-typing the same comments over and over! This script adds a little 'auto' link next to all comments boxes. When you click the link, you see a popup with 6 configurable auto-comments (canned responses), which you can easily click to insert. This script was inspired by answers to thi...

^^ that

Does it automatically reply too? or is it just a list of possible replies?

8:25 PM
This question has become somewhat unsalvageable, the description suggests the code does not work, there's been numerous edits, including revisions based on answer feedback. The value of this specific question is lost. The best approach from here is to make whatever revisions are required to your code, and then post that code as a new question, with a fresh start for a review. Please see: What you may and may not do after receiving answersrolfl ♦ 14 secs ago
Done.

Aha, it allows you to use pre-made comments, but you still have to manually select them, right? :)

yeah but you get a menu to choose from

I see

And then you get to help customize it all by hopping on the StackMonkey bandwagon.

ahhh that's what that repo is for

8:27 PM
Do auto-comment bot's that reply automatically on questions actually exists?

@rolfl How about a lock on it? or will you wait with that until next time it is edited?

or bot's that even try to reply on questions with generic answers?

@DJanssens never heard of that

1

I'm trying to grasp this whole MVC design pattern idea but I'm in the dark if I'm doing it correct. This is where I need some feedback on what I've done so far. Here's what I'm wondering: Does the hideMenu and showMenu fall under the view or controller? Have I put viewNewPage in the correct blo...

@SimonAndréForsberg Locking it makes it impossible for people to vote on the answer.

8:28 PM
I once read a post about it on SO meta, let me check it

@DJanssens I don't think bots are allowed to post questions/answers...

30

I am wondering if such a thing could be done. This is really a very limited case of a Turing test. It is very hard of course to write code that actually will answer any kind of programming question, but relatively easy to write code that cheats and copies the answer from another source. I can thi...

never got the "Are you a human?" prompt?

@rolfl good point

> Make a bot that posts "don't use regexp" to all questions about Regular expressions. Upvotes guaranteed.

8:29 PM
I guess that can be bypassed? I can harldy imagine there doesn't exist a single bot on SO

hmm... the suggested edit review queue
it's full of bots
and there was / is a flagbot..
120

TL;DR: Yes it can. Background On June 27, 2014 Skynet awoke. It looked at Stack Overflow and thought "Why are all these people being so chatty and talking about obsolete things? I should nuke them all!" Fortunately, Skynet was a baby and only had access to my 100 comment flags a day. Prior ...

never heard of that before :D

I thought "robo-reviewers" was a figure of speech...

@Mat'sMug nope..
unfortunately not

If someone was able to build a reply-bot would be quite slick, Still there should've been some attempts?

8:31 PM
there's so many reviewers around with 500+ approves and less than 50 rejects

the edit-review queue sounds indeed like an easy thing

0


@DJanssens Sounds like a job for Watson! (@rolfl!)

and that's simply impossible if you review correctly

Tip of the day: don't brag about your code running fast--it doesn't and I have to rewrite it.
3

8:32 PM
haha @SimonAndréForsberg indeed

yay just got to 100 rep :D
2

Aren't those auto-review/flag bot's actually illegal on SE?
@HenrikBohlin Nice! :)

@DJanssens remember, that's not a bot

Why not? sounds like one

8:36 PM
it's like a plaintext file you always have available for copy-pasting comments

Woho soon il be able to down vote you guys >:)
3

you still have to chose the comment yourself
@HenrikBohlin hmm... not sure whether I should star that one

@Vogel612 I don't think he is talking about the auto-review-comments script this time.

no indeed

@HenrikBohlin that's assuming we write anything worth downvoting!

8:39 PM
@DJanssens the auto-comment script is allowed
the flagging thing was different.
especially since that user collected a lot of statistical data
and comment flags are somewhat broken anyways

I see

@SimonAndréForsberg I'm sure @CaptainObvious will grace Henrik with something to downvote ;-)
I'm surprised it has not went Hot Question

0

When a user first visit the site, I'm making a few DB calls and emitting them with socket.io: async.waterfall( [ function(...) { getLast50ChatMessages() //getting last 50 chats from chats collection }, function(...) { getLast50Game() //getting user's last 50 g...

@CaptainObvious Looks like example code to me...

8:47 PM
@Phrancis may not be.. but definitely lacking context. DV'd.

@Phrancis it has. At least on stackexchange.com

6

If a future Mars colony declared war on the Earth, would asteroid manipulation be a feasible option as an effective weapon against the Earth from a Mars colony? How would this be accomplished? Are there enough asteroids close enough to Mars that current/future rocket technology could steer astero...

worldbuilding is at it again...

"reality-check"

Dude, that site.......
Is anything off topic there?

lol

8:53 PM
@RubberDuck no idea...

> You should only ask practical, answerable questions based on actual problems that you face.
Practical..... right.....

where did you get that from??
that's Lifehacks..

> For example, questions are welcome that are about:
•Creation of elements of a world (languages, species, buildings, etc.)
•Effects of events or world elements, including technology and magic, on specific aspects of that world's societies, cultures, and environment

as long as they are not about:
•Actions of individual characters, rather than elements of the world they inhabit
•Character building
•Elements of plot
•General writing or storytelling (consider the Writers or Role-playing Games Stack Exchange sites)

in other words, brainstorming.stackexchange.com

interestingly a question containing magic must always define how that magic works

8:56 PM
@Vogel612 That's awesome on a few levels.

if not, these kinds of questions would be completely unanswerable

No coping out. You can't just say .

because answerers would have to guess at premises
well you can

> Software that doesn't directly relate to Worldbuilding (consider the Super User or Software Recommendations Stack Exchange sites)

but only as long as you define magic as "no-limits"

8:58 PM
@RubberDuck Based on that, I guess SimCity questions would be OK, I guess.

@Phrancis oh yes, do it!
I want to see

Meh, got more important things to do lol.

Now I'm only 30 rep from 22222 (unless some steals mah checkmark).

0

This is "my" version of a basic C++ calculator, that requires a single line input (like 1+1) to calculate the result. Ihave been (self)learning the language for 2 months now, have it in mind. I don't pretend to have invented this code, but I haven't taken the time to search for this variation. It...

9:02 PM
@Phrancis clearly not a programmer, clearly saw Matrix too many times

@Jamal done!

@Jamal hope you can take a screenshot of that!
(looks up user ID .... 23788 oops passed already)

Coming right up...

@Jamal Did you ever encounter an automatic comment/answer poster as a mod? :D

9:05 PM
awesome =D

@Mat'sMug If this were a simulation, there would be far more completely bizarre events happening.

@Phrancis got a clue? this has been driving me NUTS all day:
SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Protocol error in TDS stream".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Protocol error in TDS stream".
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 11.0" Hresult: 0x80004005 Description: "Protocol error in TDS stream".

Last chance before I burn it.
4

Yes. This tag is too meta and should be removed. Any possible use for this tag would indicate an OP's concern with the code, not the code itself.

I wish I had a star for ya @Jamal.

9:07 PM
@DJanssens What do you mean?

@Jamal you should ask on MSE, whether you get a unicorn plush for that ;)

@Jamal we were discussing it above tl;dr:(stackoverflow.com/questions/9373438/…) Does that actually exist/is it allowed and do you believe it's possible? :)

@DJanssens We actually all are bots

says the mind behind Duga

@skiwi mind was blown

9:10 PM
@DJanssens No, but we have encountered few users running sock puppets. Not necessarily bots, but they were still part of fraudulent voting.

Cause it seems reasonable to let a bot reply on frequently asked questions, not?

Just curious... I can't find any difference in your code at all. How come it suddenly is working? — Simon André Forsberg 11 secs ago
^^ question in reopen queue

Try to help some peeps out.....
Okay. Fine, but I still don't think you want to point people to Super User and Software Recommendations... — RubberDuck 32 secs ago

2

@CaptainObvious Anyone wanting to tackle an easy C++ program can review this one.

9:12 PM
using namespace std?
yep

^^ that would be my first step if I were to write an auto-C++ reviewer
2
if (using namespace std) { yell, scream and shout! }

same identical code, and now it works?

@Mat'sMug No idea man. Try DBA.SE maybe?

@Mat'sMug Code works in mysterious ways.

Epic.
99

Starting to rebuild the castle for modern times. Looks decent on FF so far. full block: |        | <kbd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</kbd> half block: | | <kbd>&nbsp;</kbd> extra block: |               | <kbd>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&...

9:15 PM
makes me feel like I might be doing something completely wrong.

> The princess is in another castle

Didn't know that worked ^

@Mat'sMug yeah, I can't really understand how using NUnit suddenly made it work...

> FATAL ERROR: <kbd> overflow
Some people have way too much time on their hands.

@Jamal another +10 on MSE and I have 2222 :)

9:21 PM
16

▲▲▼▼◄►◄►BA

My current favorite @Phrancis

Isn't that the old Contra on NES? 30 lives cheat?

It wasn't just Contra. It worked on a lot of Konami games.

(didn't make the game much easier, mind you)

OMG someone made a C64 keyboard!
28

I couldn't resist:-) Which computer had this keyboard?     ⟵ 1  2  3  4  5  6  7  8  9  0  +  -  £ HOMEDEL      f 1     CTRL Q  W  E  R  T  Y  U  I  O  P  @  *  ↑ RESTORE      f 3  RUNSHIFT A  S  D  F  G  H  J  K  L  :  ;  = RETURN         f 5  C=SHIFT Z  X  C  V  B  N  M  ,  .  / SHIFTCRSRCRSR

@Mat'sMug Not enough shifts?

9:25 PM
haha right

Can you have a System.out.println outside of main()?
Silly question I guess

if it's in a method or a block, yes

What to do with users who state their code is broken, have their question closed, edit the question and state it is fixed, state their code works (no edit to the code), and get irritated about not getting reopened?
Just curious... I can't find any difference in your code at all. How come it suddenly is working? — Simon André Forsberg 21 mins ago

verifying whether he fixed his tests or his code would be the first step

you know what, I think we should just reopen it. if OP says it's doing what it should, then there's no reason to keep it closed, as he's not asking us to find his bugs

9:33 PM
besides, we can't test any code anyway
syntax errors are easy, logical errors aren't

If it compiles: review it. No point in getting hung up over it

VTR'd

Done.

I did now too.

9:36 PM
@200_success thanks

wow:
Thank you so much Sir, I've learned so much from you. I'll be adding this to my favorite and my bookmarks, You're the BEST! — CPlusProgrammer yesterday
that's an extensive review!
(and a very happy customer :)
2

9:55 PM

0

I was wondering if such a design was a bad idea in C#. Here I have a static class EventLog which holds a list of instances of Event class. This is a simple event log of actions players can do in a game. What can I be doing in a better way? public class EventLog { private const int maxEventsI...

10:11 PM
0

Original post Tic Tac Toe game with emphasis on design and readability I got great help, but i feel like i haveto ask, how do i keep the Gui and logic loosely coupled, is there any best practice that i should follow. TicTacToe.java package tictactoe; public class TicTacToe { /** * ...

0

I made a Python 3(.4.2) program that only adds classes and is meant to be imported. It allows the creation of files that store usernames and hashed passwords. It uses salting as well. It also can easily check if any given string is the original password (through the User.check() attribute of the ...

Aaand the C++ calculator question invalidated answers.

@Jamal which one?

5

This is "my" version of a basic C++ calculator, that requires a single line input (like 1+1) to calculate the result. I have been (self)learning the language for 2 months now, have it in mind. I don't pretend to have invented this code, but I haven't taken the time to search for this variation. I...

@Jamal Rolled back, but I can't find the link.

6

OP has edited their question to include feedback received in answers, effectively invalidating existing answers. Adapted from the famous meta post, "For an iterative review, is it okay to edit my own question to include revised code?": I have rolled back the last edit. Please see *[what you ...

10:23 PM
> [What you may and may not do after receiving answers](http://meta.codereview.stackexchange.com/a/1765)

@rolfl Thanks.
I want a gold badge. I think my best bet is trying for fanatic.

If you wanted, you could probably get steward before fanatic.
electorate as well.

I'm working on Electorate and Steward.
The trouble is, I've only got 100 reviews on First Posts.

electorate was my first gold badge, and I got fanatic 100days after joining.

I joined almost a year before I was active.

10:33 PM
@Hosch250 Steward is having 500 helpful flags, I believe

Completed at least 1,000 review tasks. This badge is awarded once per review type

^^ hard

@SimonAndréForsberg ^^
Sorry, too lazy to crop.

Ohhh, photography.....

10:37 PM
Photography?

Ew, math.

Math?

Oh.
Computers is similar to @skiwi's tabs.

Ew, WPF.

10:38 PM
That is why I started WPF - to keep that separate.

You know, you can share embarrassing things if you are not careful about screen-captures....

Not embarrassed.

Yeah - like the fact that you have books.
;-)

I mean, like, WTF? ... :

No, those go to Open Library and Online Literature.

10:39 PM

@rolfl you mean WPF? :)
@Hosch250 afraid of being watched?

3 more reputation before I can see some things at codereview.stackexchange.com/review

Not afraid, but I'm not going to knowingly consent to it.

1

This is what my class hierarchy looks like. I have an abstract super class, AbstractLinkedMyList, that contains common operations for both sorted and unsorted linked list. Here's the declaration for it and the method I have a question about public abstract class AbstractLinkedMyList<Type> implem...

10:43 PM
@rolfl Did you use MSPaint to edit that?

@SirPython I really can't understand why this answer of yours hasn't gotten more attention:
2

First off, I'd like to say that your code is very neat and well-written for the most part. Objects/Classes I find that, in your classes, you return a unnamed object with all the desired fields and methods. It would make more sense if, instead of returning an object, to set all the fields and m...

Thanks "santa"
@SimonAndreForsberg I appreciate the compliment :)
How did you find that post, anyway?

@SirPython "Snipping Tool" in start -> Accessories on my windows computer. part of the base windows install.

I have Snipping tool on my Start screen.

I wish I had a snipping tool - right now, all I have is GIMP and I still don't quite understand how to use it.

10:49 PM
Go back to Windows.
Windows has everything.

I went from Windows to Linux(mint), in fact.
I sort-of had the last straw with them.

I also swapped my windows for Ubuntu, don't want to go back
:D

I may install Ubuntu this summer on a partition in my drive because of my major.

I chose Linux Mint over Ubuntu.

I'll still use Windows as my main system.

10:51 PM
Ubuntu is awesome, but a hell to make ur sysem dual boot these days <,<
and for GIMP, it's actually quite powerful, you just need to get the hang of it ;)

The only thing I regret about switching over is that I used a lot of Windows applications that I can't use anymore. I've even tried WINE, but it doesn't even work for me.

@JeroenVannevel, you said you're going to do an Android course soon. Have a look at this one you will love it.
@JeroenVannevel This course is originally \$149 but now with the coupon presale it's free (suppose to be only 40% off though )

Leaving to study now.

See ya

10:54 PM
@Hosch250 there's a bronze one for that ;)

@JeroenVannevel bitfountain.io/courses and the course is called Android Immersive*

TTQW

You can also get enrolled on the iOs8 design immersive with the same coupon for free @JeroenVannevel

Morning all :)

10:55 PM

@SirPython rule #1 about GIMP: You can only paint on what you select. Spent 20 minutes the first time trying to paint a single white pixel black. Turns out it wasn't selected.

Morning Sir ... Can see that you're the hot topic here :D
@SimonAndréForsberg the same in Photoshop and any layered photo editing software. right :P

I've never used any photo editing software before - unless you consider MSPaint to be one.
I doodled you guys a ghost

GIMP was a bit hard to learn the basics of, but then you notice it is actually quite awesome

10:58 PM
I failed my Android exam this morning

@SirPython wow, you're a natural at this

We need some sensitivity training over here

@JeroenVannevel by not waking up to take it?

I fell a little too in-love with the smudge tool.

10:59 PM
@janos By having an incompetent teacher

I complained earlier, let me find it

GIMP was a bit hard to learn the basics of, but then you notice it is actually quite terrible