« first day (788 days earlier)      last day (3446 days later) » 

12:00
[Zomis/CodeReview-Shield] Zomis created repository
@Duga Is it going to protect us?
@dewe [CodeReview](codereview.stackexchange.com) might be better suited for this, they offer critique and suggestions to improve code that's already working. I might be misunderstanding your question though, so please read their site tour before asking there. — SuperBiasedMan just now
Anyone around to talk dependency injection?
Does someone want some Objective-C upvotes on Code Review?
9
Q: BiDirectional Dictionary (and its Mutable friend can come too)

nhgrifI've attempted to implement a 1-to-1 dictionary in Objective-C. I'm probably missing some convenient methods that one might commonly want to use. These are both declared in the same .h file and implemented in the same .m file. I think if much more code is added to either of these, splitting th...

This pre-Swift 1.2 question's code has room to add Objective-C-Nullability annotations:
9
A: How to create class methods that conform to a protocol shared between Swift and Objective-C?

nhgrifIn Objective-C, we were always passing around pointers, and pointers could always be nil. Lots of Objective-C programmers made use of the fact that sending a message to nil did nothing and returned 0/nil/NO. Swift handles nil entirely differently. Objects either exist (never nil), or it is unk...

More specifically, how to deal with tons of dependencies bubbling up through the classes?
And the massive constructors that ensue....
12:06
Example?
( a simple one... I'm not that familiar with this concept of "dependency injection" and I've never had massive constructors...)
Okay, so I have this plugin architecture.
Where there's a single point of entry into a class that is responsible for doing a little bit of work, but mostly, just delegates to other presenters that know about how each piece of the system works.
Which was great. It kept all of the business logic nice and neatly separated.
But now I've ended up with this terribly monster ctor. One sec will paste it in.
@RubberDuck You want to inject some stuff?
What about autowiring things? The Spring MVC in Java has an @Autowired annotation that removes the need for injecting it in the constructor
public SourceControlPresenter(
    VBE vbe,
    AddIn addin,
    IConfigurationService<SourceControlConfiguration> configService,
    IChangesView changesView,
    IUnsyncedCommitsView unsyncedCommitsView,
    ISettingsView settingsView,
    IBranchesView branchesView,
    ICreateBranchView createBranchView,
    IDeleteBranchView deleteBranchView,
    IMergeView mergeView,
    ISourceControlView view,
    IChangesPresenter changesPresenter,
    IBranchesPresenter branchesPresenter,
    ISettingsPresenter settingsPresenter,
@skiwi go on. How does that work? I'm sure there's something similar in the C# world.
@RubberDuck Let me dig up an example
12:11
@RubberDuck Holy mother of cows!
Yeah... I know
It all bubbled up to the top and now I don't know what to do with it.
@RubberDuck What about don't touch it?
Well
How many of those classes exist in your application?
Should there always be only one, or can there actually be multiple?
@skiwi certainly an option. It is the entry point.
Entry point. There's only one of each and they get created just outside of this class and injected in.
12:13
That's your candidate for an Autowiring/Beans architecture
So... I have this
@Controller
@MessageMapping("/api/user")
class UserController {
    UserService userService

    @ControllerMethod
    @MessageMapping("/create_user")
    def createUser(CreateUserMessage createUserMessage) {
        try {
            userService.createUser(*createUserMessage.values())
            def builder = new JsonBuilder()
            builder {
                success true
            }
        } catch (CreateUserException ex) {
            def builder = new JsonBuilder()
            builder {
Here the UserService userService is autowired via Grails/Groovy (but it uses Spring MVC in the backend)
I have an UserService class and Grails automatically creates an instance of that on startup and saves it as a Spring Bean
A Spring Bean is a class/instance you can always inject in your application
so.... where the heck does userService actually come from?
@RubberDuck Nobody knows...
But I can define my own class if I want to do so
I could have defined it in my resources.groovy file as:
beans = {
    userService(UserService)
}
(UserService in Groovy is UserService.class in Java)
But Grails is configured to automatically beanify everything in the controller directory (and a few more)
No , no ! I would like you to tell me if this is a good way of doing it ! Actually, here is the source code on codereview : codereview.stackexchange.com/questions/95275/…MattMatt 42 secs ago
0
Q: Unit testing a homework assignment

user7610I wrote NUnit tests for class CharGrid from this homework assignment. I am a beginner with C# and NUnit. My goal here is DRY: I want to keep the testing code as short and simple as possible. In addition, want to run every test independently, as opposed to having a single method with a lot of as...

Oops... found this gem
> My role in this project was also to resolve conflicts if they would happen because using this system alone does not guarantee that everyone will go as it should, someone should be taking care of that.
Yes... I wrote that
12:21
@RubberDuck - you could create some parameter objects. E.g. group all of your views together into an ISourceControlViews object with a CreateBranchView property, a DeleteBranchView property etc. Then simplify your constructor to take the aggregate instead
@RubberDuck What kind of C# framework are you using right now?
@RobH that's not a bad idea. Could simplify things a bit. I had considered it before, but it felt like moving the problem.
Maybe it's not. Could be a useful abstraction I suppose.
@skiwi Plain old class objects.
@RobH welcome to the 2nd monitor btw! You write great answers. It's nice to "meet in person".
@RubberDuck Uh... no framework?
:) thanks. I ocassionally lurk here without actually saying anything. The joys of being at work
I need to find some inspiring figure about Version Control for this write-up...
I hate mandatory figures
12:26
@skiwi Nope. Pure DI up till now. Just installed Ninject to see if it will help, but I can't see how it really will. Maybe if I do what RobH said too...
@RubberDuck But I mean for the MVC part? Or how is the application structured?
Oh... Winforms.
So, it's MVP flavored MVC. No framework.
@RubberDuck - If you use StructureMap you can use a convention to scan all your asssemblies and autowire single implementations of interfaces
Thanks. Will look into it.
@RubberDuck Ok...
12:29
0
Q: Fade and eye detection algorithms for opencv

user3530803i'm working on face and eye detection (no recognition needed) using opencv , and i've found some algorithms that i can use : Viola–Jones object detection framework : This algorithm is implemented in OpenCV as cvHaarDetectObjects(). https://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detect...

(btw. What's this Nth Monitor?)
@skiwi QPaysTaxes and Ethan were prattling on like a couple of seagulls squabbling over some french fries. It was annoying and inconsiderate, so they were moved over to there.
4
@rolfl Some specific event or you mean what they're doing for a week already?
Ugh, how do I explain version control to 16 year olds of general public?
They crossed the line a while ago, but this part is where I figured I could step in and explain it without "grey areas":
in The Nth Monitor, 8 hours ago, by QPaysTaxes
Thanks, but I already have a girlfriend...
What's "SNR"?
12:40
@nhgrif Signal to Noise Ratio
Signal to Noise Ratio
That ^^
@rolfl I also had that feeling, but it's difficult to address it
They were like two peope talking loudly to each other on cell phones on the same bus.... that's about as close as I can get to an analogy .... and, they now have their own bus
And they're the only ones on that bus. And they're still talking to each other loudly on their phones?
12:44
They are calling eachother on their phones, or talking to someone else?
each other
Okay... that's yeah, well, no words for that
Reminds me of a certain group of regulars in the local supermarket, yelling like there's 200m between them while they're standing next to each other.
and everyone else on the bus is irritated, but too polite to tell them to shut up .... and they say: well, "noone else is talking, so we may as well".
but their conversation is not about general-interst things, or specific bus needs
@skiwi Version control is the string you use when you walk in to a maze and need to find your way out again
2
Perhaps I'm too curious, when when is something considered 'not general-interest'? I could think of a couple of examples, but I suppose there's a line somewhere.
12:48
it tells you where you have been, what you have done before, and, if you are a group of people, it allows you to explore different paths as individuals, and merge them back together.
@Mast That's the hard part.... there is a line somewhere.... but, if the conversation is only of interest to the two people talking, then it is no longer "general discussion"
If the conversation could be held in a different room, and no-one in this room would miss it, then it does not beong here.
2
Of-course, but does that mean as long as at least 3 people are interested in the conversation it's still valid? It can't be that simple.
No, it's not that simple.
that's the problem.
And, it goes in swings and round-abouts.
"I was shopping today, there is a sale on in blah" vs "I was shopping today, I got a tshirt"?
Would that be an example?
@Mast if it makes a circle where it's happening because nobody's talking and then nobody's talking because it's happening, the line was crossed.
so, it has swung too far in to the banalities of the lives and transgressions of people, and it is time to clamp down, and maybe go too far in the other direction.... to define the limits.
12:52
@Mast That's the problem. When there was only one teenager in the room, there was never 3 or more people interested in talking about teenager things. Now there are 3 or more teenager regulars.
There are far more non-teenager regulars that don't want to hear about teenager non-sense and silliness.
I think labeling it as "teenager" issues is an injustice.
Maybe.
Even if it was a tutorial between two or a few people, they would get a new room
Depends on how in-depth and on-going it was.
Yes, which is why this issue is complicated
12:55
But the distinction I'm trying to make is that if two people are going on-and-on about something programming related, I could skim the conversation or pay half attention, and I might accidentally learn something.
there's a big grey area, but, it was pretty black/white with QPaysTaxes and Ethan at the point I stepped in.
@nhgrif Yes, or you could see they were in a different room, and then go in to there and listen.
Hard part there would be defining when it's a short occurrence and when it's a 'going on and on'
Right, but if they were talking about programming stuff and nothing else was going on, I wouldn't be that bothered. I'd count almost any programming conversation as "signal" and not "noise"
Not if they are just chatting to fill the space.
There was a conversation earlier today about electrics and LAN parties of which I later realized it may have been an edge case.
12:57
@rolfl So everything related to code is per definition of interest, even if only two people are talking, kind of?
Hmm... then rolfl, you're going to explain with much more depth what you mean exactly then...
For the record, I think it was a good decision
Are you saying that you and I couldn't have an hour long conversation about iOS development in this chat room (assuming it wasn't interfering with anyone else... no one else was chatting, etc.)? I've never seen anyone have a problem with cross-conversation chat or interrupting an on-going conversation. As a general rule, if you and I were bothered by the interruptions, we'd go to another room to continue our conversation uninterrupted.
But if there were no interruptions and we were discussing something unquestionably on-topic for the site... is it really a problem for two people to go back & forth for so long?
I agree on moving those two out, yes, but I'm completely confused by what you're saying...
6 hours ago, by QPaysTaxes
...Man, people like copy/pasting from Wikipedia without attribution
Spouting out on irrelelvant crap just to create conversation
That was actually a discussion about my tag edit spree
@rolfl Yeah, it got fairly bad
Sometimes the line is a little blurry and you gotta know when to step out
My rule: If in doubt, step out.
13:04
0
Q: Recognizing number representation (and convert to decimal) from the base prefixes?

simplicis veritatisHere is what appears to be a fairly easy problem: Write a program that prompts the user to enter several integers in any combination of octal, decimal, or hexadecimal, using the 0 and Ox base prefixes; interprets the numbers correctly; and converts them to decimal form. Then your program...

5 hours ago, by QPaysTaxes
@Mast Does ice cream count as meat?
@skiwi Like drafting assessments in high school, I guess
2 mins ago, by Quill
@rolfl Yeah, it got fairly bad
So
Hmm, perhaps its best to just resign myself to not understanding.
@nhgrif nhgrif while programming is more ontopic than ice cream meat, sometimes it might be best to make a temp room
Depends on the potential size of the conversation
I feel like I am picking on @QPaysTaxes - and perhaps I am, but he's using this chat room as his own personal twitter-flood, relating and retelling every event of his life.
13:07
@rolfl Maybe some kind of rule of thumb could be that you are of course free to come here and ask code review/programming related questions, but you cannot really joke around until you're an accepted member?
It does create a nuance of that we have a group in here... not sure if we should avoid that, or just face reality?
Because I think these particular examples are unfair.
It's not a matter of picking on, or unfairness.
It's a matter of topic and relevance
@nhgrif I jsut scanned this morning's transcript
Unfortunately, previous transcripts are so large and full of general mayhem that there's too much to go through ;-)
Sure, but did you read the conversation leading up to the comment?
There's a level of detail you should go into things about, and discussing your life like you would with a familiar friend should not be done here.
I think we need to define General in 'General discussion about Code Review -> codereview.stackexchange.com'
13:09
As far as I'm concerned, if "does ice cream count as meat?" is the problem, then how is Quill's "isn't it 4 am there? you should sleep?" (which started down the path to "does ice cream count as meat?") okay?
To be fair, he sleeps, chat can return to topic
If Quill's comment about the time & sleeping is okay, then why isn't the line back when QPays mentioned having caffeine?
And if that's okay, then why isn't the line at Mast recommending meat over caffience?
note the flow of the conversation, someone says something, QPaysTaxes responds with a witty 1-liner.
next person, next 1-liner
son on, and so on and so on,
it's a peanut gallery
each time also slightly diverting the conversation too
It's a bit chatty, to be honest, it should be If you having something to contribute, then contribute, but a one liner not worth anything below five stars shouldn't be posted
A joke is relevant here and there, but not as a constant
@rolfl So you're saying it's not black & white, but a gray area.
13:12
very grey.
it is not just one incident, but a collection, and profusion of them too
I don't know what "very gray" means.
I agree.
chat in general is a very very grey area
but it's not black & white
@nhgrif it almost never is....
@rolfl he accepted my answer without giving us any further information on the database structure ►► codereview.stackexchange.com/q/95231/18427
13:13
yes, it is somewhere between #000001 and #ffffffe
3
Perhaps enforcing nth monitor as a thing, with 2nd monitor being from comments everyone can appreciate
Monking
breakfast .... something useful!
finally?!
Who is to judge what "everyone appreciates"
13:16
That is grey, also
@rolfl, perhaps you should make a temp room when you're all online next and discuss/lay down the law with them
@Quill I don't see a reason to change a lot, we've been fine up til now, I'd change nothing that hurts the people who have been around since... forever
@Quill meta 2nd monitor
@Mat'sMug If it comes to that
0
Q: Longest Increasing Subsequence in javascript

GauravGuptaAs i am learning Dynamic programming, so i have written down some code for Longest Increasing Subsequence. I would like to know have i missed any case or any area of improvement in the terms of optimization/programming style. /** * LIS = Longest increasing subsequence. * Input = [10, 22, 9, 33...

I think the phrase give them an inch and they'll take a yard applies too
13:21
Not on meta lol, I mean that discussions about The 2nd Monitor technically belong in a room about The 2nd Monitor
@Mat'sMug Yes, I figured
also a lot of sites have normal site rooms and meta rooms
often named similar things
meh.
the problem is, killing idle chatter categorically makes a chatroom die
after all chat is intended to be the "third place"
main for "business", meta for "about business" and chat for ... "the rest" or something like that
2
They're getting increasingly banned lately too
Q while I've been idling at least four to five and Ethan twice or so
hrmph.. this is devolving into a mudslinging...
@Quill What's that?
13:25
@skiwi Being kick/muted from offensive chat posts
auto kick-mute?
Kick-muted is gentle
I mean a "ban" is something more serious
@Quill you guys have been banned from chat?
ban is actually worse than a suspension, since a ban is permanent
@Malachi Not me, and sorry @all, I meant to say kickmuted
13:27
but that's technicalities...
you can't run for Moderator..... it would unban you from those rooms
@Vogel612 I like them as people and they're becoming good answerers, so it's not like I want to sling mud and I don't think @rolfl does either.
oh in that case, Carry on...
lol jk
It's a dangerous line to tread ...
@Malachi that's why candidates must be in good standing ;-)
13:32
What do you think @Mat'sMug, you were <lurk>ing earlier
I think moderating chat is harder than many things
5
I agree with @rolfl and I'm glad he stepped in.
And yes, maybe it's time to take a swing into the opposite direction. I don't think killing this chatroom is going to happen.
Should these two questions be combined, they're part of the same solution, and without the other they could probably be closed for missing code
@Quill no why?
@Mat'sMug Hold up, Wait a minute, what happened, how far back to I have to go in chat?
a model implementation can stand on it's own
13:40
@Vogel612 Thanks for the clarification :-)
@Malachi depends. today 6:12 ..
@Quill working != runnable
1 hour ago, by rolfl
@skiwi QPaysTaxes and Ethan were prattling on like a couple of seagulls squabbling over some french fries. It was annoying and inconsiderate, so they were moved over to there.
There being here:

 The Nth Monitor

Conversations that don't quite fit in The 2nd Monitor
@Quill gotcha, I did catch a little bit of that
Greetings, Programs.
0
Q: Code for Gmail Data Analysis

arshpreetI am using Imaplib to fetch data from Gmail and getting the number of Emails Each day. I am going to login using imaplib two times for fetching Emails for INBOX as well as for OUTBOX(Sent mail). Is it possible that I have to login only once and get result as I need? from imaplib import IMAP4_SSL...

0
Q: Please check the code quality of the OOP beginner

To dOI'm new in OOP but I enjoy it. I have started with oop around 1 week ago and I would like to ask you to check my code and give me some tip's and advice's but also tell me what I'm doing completely wrong.I'm giving you code of my User Class, Switch Class,Init and Views/login.php (I'm using there ...

13:48
@Vogel612 Exactly...
I'm still just entirely confused by what's been said about what happened...
I just made a bunch of suggestions and statements and rolfl went quiet, ask him what's happening if you want absolute
No, no, no. Please for the love of everything, don't use things like π for variable names... — nhgrif 31 secs ago
@Donald.McLean Greetings, User
> I also Know that my code is not protected against SQL Injection
Honesty, at least
@Donald.McLean You've Got Mail!
13:55
@Malachi I like that movie too.
0
Q: PHP session_set_saver_handler with session timeout

Jacob HallasI have developed a class that utilises the session_set_saver_handler function so I can store sessions within my DB. The class works just as I would like. However, my only concern is the way I have approached the session timeout. Current the _read() function code looks like; /** * Read ...

3
Q: Shielding your CodeReview on Github

Simon André ForsbergIn response to a feature-request on meta, I spent a few hours today creating the feature in php. This adds a 'review shield' to your GitHub repository (or wherever else you want it). It looks like the following: To use it, use something like this: [![Code Review](http://www.zomis.net/codere...

0
Q: Tokenizing a simple mathematical expression

RobHSo, I decided to learn TypeScript for... reasons. I decided to start off with a simplish exercise that I generally do for this sort of thing - parsing and evaluating a mathematical expression (numbers and +-/*). All I've written so far is a tokenizer/lexer but looking for feedback now before I wr...

@CaptainObvious This is really really cool
Hahaha, I needed to include a figure in this assignment, so I pulled some random figure of decentralized version control, and it got accepted

« first day (788 days earlier)      last day (3446 days later) »