1:01 PM
Out of interest, @skiwi - I would recommend you play with the recursive model too, and convert it to an iterative one.
It is not that hard to create a 2D array of char, representing the SymbolChoices...
char[0][0] is the the first choice for char 0.
char[10][3] is the 3rd choice for char 11.

0

I am solving the well known problem Remove Nth Node From End of List: Given a linked list, remove the n-th node from the end of list and return its head. Example: Given: 1->2->3->4->5, and n = 2 Return: 1->2->3->5. This is my solution: public ListNode removeNthFromEnd(ListNode head, i...

@rolfl Plot twist: The OCR can return multiple chars as one symbol
It's all those little dirty edge cases that make the whole calculation so annoying
docs.oracle.com/javase/8/docs/api/java/util/… Does it not specify whether it sorts ascending or descending? Strange

Well, not really, it compares 'double' values, which must be based on their natural ordering, is there any other way to compare double values?

Weird, Eclipse have trouble finding my classes define in a library! I had to do a manual import...

Well, is sorting numbers assumed to be ascending then?

1:06 PM
@skiwi always... it is defined as the 'natural order'...
unless specifically modified, it will be in that order, with special considerations for things like NaN, etc.

Ah okay, well that makes sense yes

@rolfl it got the attention it needed and was deleted. if the edit on the other one is bad it can be rolled back, but I will leave that up to people more qualified to make those decisions.

@Malachi - it did not need the attention.... it was closed already. Did it need to be deleted?
and there is a natural order of things too, closed posts get deleted naturally, after a process of 'decay'.

so you were asking me a rhetorical question when you asked me if there was something that could be done with the title to make the question on-topic? I missed the tags around the question....

Your suggestion that it needed to have an accelerated path to deletion is contrary to your edit and reopen vote.
@Malachi - it was not a rhetorical question, it was a statement:
15 hours ago, by rolfl
And certainly, there's nothing you can do with the title, and make it on-topic, right.

1:15 PM
hence the " ,right."

Except, I guess I was wrong.
you can completely rewrite the intentions of the person asking the question.

it looked like a follow-up. if it was a bad edit then it should have been rolled back, but it wasn't. was it a bad edit?

I might need to go back to the drawing board completely on this @rolfl, right now there does not seem to be any way I can test the full graph, nor ensure that the algorithms will return in a moderate time (10 seconds max)

@Malachi I don't know...^^^

Greetings, Programs.

1:18 PM
If it was in the suggested edit review queue I would have rejected it as too radical.
But, the question now has 3 reopen and 1 undelete votes.

I see a comparison of red apples to green apples and you see a comparison of red apples to yellow bananas
the user could have meant for a follow up with a question in the content of the question asking about the ability to unit test. but they didn't give us any textual content
yes the title is completely different from what it was, but it is logical when looking at what little the OP wrote based off their last question, or the question that it's supposed to be a duplicate of
I don't really care, and it shouldn't bother me, it's one question where the code has already been reviewed twice, and no one wants to review the code again, so it was closed and now deleted.

> but it is logical when looking at what little the OP wrote based ....
To me, what's logical is to read what he wrote in his title.... which was very clear, and specific.
Now that we no longer have the asker's stated intentions in the title, the question is completely different.
Now, I know that we are supposed to review the code "as presented", and the text is secondary, but, there has to be a line somewhere.
So, you have essentially created a new question.
The one question was: "I need unit tests for the following code", and the new question is: "this code is slightly different to a previous question, are my changes OK?"
If the OP wants the second question, then he should ask the second question. If you want to know whether the revised chanegs are OK, then you should post the question as a rags-to-riches

Is it okay to specify an or-clause inside a regex, or would that give trouble?

The or-clause in the regex is typically faster than an or-clause outside it.

You can do that... how else are you going to say "character OR digit"

1:29 PM
It does potentially introduce a back-tracking problem... but no worse than the alternative.

I more meant to separate regexes of different country IBANs

That should be fine.
The logic becomes ugly if nested, and stuff.
You are compiling the patterns, right?

@rolfl Yes

If the logic has to be done, it is better to do it (performance wise) inside the regex, rather than outside.

we shall see what the user says when they come back online in 2+ days (estimated)

1:31 PM
if you can skip the logic, then that's better.

I'm still not happy with this solution, but I've got to deliver something

@Malachi crystal ball?

customized 8-ball

Monking

Monking @Phrancis

1:33 PM
@Malachi - the bigger problem I see here, is that your edits have take a clear question, and made it uncertain, and this confusion happens when old things get dredged up, and the most interested people are not around to answer questions.

Monkingb @Phrancis

@rolfl The biggest issue with the whole problem is that a naive check (without using alternatives) is O(n), where n = length of sequence to check; However if you want to restrict it to two alternatives it gets O(n^2) already, and then it goes out of hand
It depends on `n` though, but how would I figure out what `n` would be at maximum allowed with two alternatives?

Yes, but, the alternative is to check for those country codes outside the regex... right?
which would involve a loop, right? also On^2
The regex automaton is optimized to make those decisions fast though.

@rolfl I wasn't meaning that I knew what the user was going to say, I meant I don't care anymore and we will see if the user cares or not and what they meant, or if they are going to fix the question and vote to undelete or write a new question.

@rolfl Country codes? Where do you plan to use those

1:36 PM
guess I misplaced some explanation tags as well...

I realize something just now though... Maybe I've been stupid all the way along

@Malachi Your edits have created a mess.... you are not allowed to say "I don't care any more".

Say I want a simple pattern: 4 digits, 2 letters

Ahh, the country code was a carry over from an earlier discussion.

Can I not just slide over the window of symbols, and select the most likely one?

1:38 PM
a 'simple' or condition in the regex will not suddenly make it On^2

No, not in the regex, I meant about checking the alternatives to the symbol there

If you start building the regex based on the actual symbols in your Words, then you will have to compile it each time as well.
that is not an option.
The regex compile is significantly more expensive than the comapre (hopefully).

@rolfl like you have said, there are things that I can do and then I must wait for nature to takes its course, whatever that may be. I have edited (right or wrong its done), and I voted to reopen and I voted to undelete (which I can't take back). so what more would you have me do, should I flag it so that it can be declined, I know where you stand on the issue, that I should leave things be and let smarter more qualified people handle this sort of thing, so that is what I am doing.
what more conversation is needed?

@Mat'sMug there you go ;)

@Malachi Malachi, you have 'championed' this question, going against the community consensus at each point. You obviously feel strongly about it, and I have spent.... a half hour or so in total trying to see it from different angles, and to see what I am missing, and talk about it. Now you are saying that you have stirred up a bunch of stuff, and are going to walk away ...
This happens.... often enough... to be a concern.

1:44 PM
there is nothing more for me to say. I did what I thought should be done and then let the community have it's way with the question overnight and it's dead deleted, if 2 more people want to undelete it, then there is the issue of reopening and then an answer to the question. you have given me options and advice for the future, and I have heard them and will not stir the pot more on this question.

K, past is past.

@rolfl I consider that cruise-control question a duplicate of the previous question btw.

LOL
2

@Vogel612 The close reason was a toss up between duplicate, and too-broad.
I would have gone with too broad, or asking for code to be written.
the question was 'how do I unit test the code'.
I never considered the option of 'edit and change the nature of the question'.

0

1:47 PM
I can understand the community voting, comments, etc at each point. They all made sense.
even the current undelete and reopen votes make sense.
It's a completely different question now.

I hear a but there...

I just don't think it is the question the OP wanted to ask.
He does not want a follow-on.
now he has one (potentially).

I don't think the changes justify anything like a follow-on..
as mentioned in my comment, I read through the "old" question and compared a little.

C#, not my domain of expertise.

and I found no significant changes..

1:48 PM
which was why you closed as duplicate to start with, I know.

@rolfl I didn't..

Oh, ..'

it was hammer-closed by the mug.
which was why I put the last del-vote in there.
That aside, I find the wording of the banner-message of "dupe" problematic..

yeah.

@rolfl I may end up creating my own regex-like-thing though

1:51 PM
Anyway, I imagine this question, that should not have existed, has cost the community a few hours of time. I think it will stay deleted, I don't know if it is any review queue now.

duplicate for codereview is a difficult one to figure out, they could have the same code but ask for a different review, right?

@Malachi that would be less of a concern IMO, because as of "Any or all aspects" we can ignore specific requests.

Is it okay to slot maximum t seconds for an algorithm and kill it after that? Assuming that every sub step takes like 10ms, and every substep is an attempt to improve the result of the previous substep.

If the code is the same, line by line it's definitely a dupe imo.

@Vogel612 agreed
@Vogel612 FYI the Ship class doesn't do the same thing in the questions in question
the Logic is flawed in the deleted code

1:53 PM
@skiwi Genetic algorithms.

0

I would like to see how would you write this code for best practices, it will help me to learn from you this is my jquery code i use on scroll event to addClass and animate div element \$(document).on("scroll", function() { var about = \$(".media-about"), info = \$(".media-info"), ...

@CaptainObvious you could refactoring the title while you're at it

I have refactoring title the for practices best

Much better :)

hmmm. lowest-voted answers today: 0, 0, 0....
and in the last 30 days: -2, -2, -1
damn we don't shoot the downvote gun often..

2:00 PM
It's hard to be wrong about improvements for ugly code.
4

And when we are wrong it's because someone tried to rewrite it... and introduced new bugs.

@HassanAlthaf nice find..

Well, if it were less of an ad....

2:08 PM
0

First, here is the full challenge description: Watson gives to Sherlock an array: \\$A_1, A_2, ..., A_N\\$. He also gives to Sherlock two other arrays: \\$B_1, B_2, ..., B_M\\$ and \\$C_1, C_2, ..., C_M\\$. Then Watson asks Sherlock to perform the following program: for i = 1 to M do fo...

@CaptainObvious we had that in python earlier IIRC.

Someone please tell me that this can be refactored to use regexes (I'm aware the method returns no result as of now)
```private void forceFitPattern(final List<Symbol> symbols, final String pattern) {
if (symbols.size() < pattern.length()) {
return; //no match possible
}
Map<Symbol, List<SymbolChoice>> allowedSymbolChoices = new HashMap<>();
for (int i = 0; i < pattern.length(); i++) {
char character = pattern.charAt(i);
Symbol symbol = symbols.get(i);
switch (character) {
case 'd':
allowedSymbolChoices.put(symbol, symbol.getSymbolChoices().stream()```
And it's horribly optimized

y u no use group matchers??

Say with a pattern like `ddddll` in my format, `\\d{4}[a-zA-Z]{2}` in regex, I want to be able to individually address every element in the pattern
If that's possible with regex, then I'd surely go with that, but I'm not sure

`^.*(d\\d|l[a-zA-Z]).*\$`

2:15 PM
Regex is just code golfing that made its way into public use
5

did the cool stack snippets get bigger buttons?

lol
3

@Vogel612 And what does it help?

@skiwi what the crap are you even doing??????

do the buttons on my snippet look really big to anyone else? codereview.stackexchange.com/a/41557/18427

2:17 PM
@Malachi Yes, definitely

Yeah they are huge

is it just on this question? do you have any questions with Snippets that we can compare?

@Vogel612 Given a `List<Symbol>` (which stand for symbols like letters in a word), I want to do specific actions on whether the pattern requires the nth symbol to be a letter or a digit
So I want to iterate over a specified pattern

so you want to find the first occurence that violates the pattern?

no

I do not want to use regex matching at all
I just want to be able to specify some kind of pattern, and then use my own methods for me
Nicest would be though to be able to specify that pattern using regex, instead of cryptic `d` and `l`

@Malachi I think it may be because the code snippet tag is on the same line as the bold tag

@Marc-Andre yeah that was it

I can reproduce it in the edit preview

2:21 PM

@Malachi good ! Will you tell David or not ?

why does a simple "lol" get stars? and why are there stars for two different "lol"s? That's redundant!

@skiwi how about a `Queue<Constraint>`? I think that's better than using something that unobvious...

@Vogel612 Yeah well specifying something as minimal as possible (in String-form) is also nice here

15

Meme: LOL - AutoStar Originator: Mat's Mug / Jamal Cultural Height: The 2nd Monitor Background: "lol" somehow got targeted at this point here (the first starred lol): retailcoder: lol (darn, again) Followed shortly by: Jamal: lol (don't star that) And then the tradition was cement...

@Christoph ^^

2:25 PM
Currently I only plan to support 1) The character needs to be a letter and 2) The character needs to be a number

@Christoph lol != LOL

reading through the memes I come to the conclusion that the people my parents warned me of are here in the CR chat
20

I came to the conclusion that I am one of the people my parents warned me of.

is there a hitchhiker's guide to stackexchange chat rooms? could be entertaining

I briefly considered driving around in a van handing out candy to kids, but then I realized it would be far tastier to just eat all the candy myself.
Also, I don't have a van.
Yet.

2:34 PM
@Vogel AWSUM!
...say it out loud: "valid 8 moov"
;)

@Mat'sMug silly me ...

Hey @Mat'sMug!

but why does your validation then have an assignment in it??

Hi @Marc-Andre!
@Vogel because I'm mapping "C" input to "CHEEZ" output..

@Mat'sMug but why is it named "validate" then?
because it's not really a validation, or at least not only.

2:43 PM
Because if user enters an invalid move ... yeah
SRP in lolcode is ...rather painful!

I CAN HAZ UR SRP CODEZ?

hai
Can somebody help me answer this query?

HAI 1.2

2

I call the SList class an Abstract Data Type because it satisfies following 6 invariants: Multiple users of SList class should be consistent in usage with same SList instance. For example multiple users may insert items in same shopping list. No runtime exceptions while using SList class when ...

ah yeah @overexchange regarding your question-in-comment

2:46 PM
@Pimgd hai

```HOW IZ I VALIDATEMOOV YR MOOV
ANY OF ...
BOTH SAEM MOOV AN "B" AN BOTH SAEM MOOV AN "b" AN ...
BOTH SAEM MOOV AN "C" AN BOTH SAEM MOOV AN "c" AN ...
BOTH SAEM MOOV AN "W" AN BOTH SAEM MOOV AN "w"
O RLY?, YA RLY
FOUND YR WIN
NO WAI
FOUND YR FAIL
OIC```

abstractions are something completely different IMHO
@Vogel612 ANY OF... valid syntax?

per the specs ... is just a line-continuation

because else the System.EOL is command terminator

2:47 PM
@Vogel612 I meant ANY OF conditional AN conditional AN conditional

@Pimgd it has been taught in the class that has well defined interface but the implementation details are hidden from other classes and also enforces list of invariants.
As per this definition, dont you think SList is an ADT?

I haven't heard of the term ADT before.
I have heard of abstractions before.

abstract data type

@overexchange what is abstract in this context??

the type

2:50 PM
because abstract as I know it means, non-instantiable, not fully implemented class.

I know what yellow star, black star and hollow star are...
but what's black-edged-but-filled-with-yellow-star?

@Marc-Andre David?

@Malachi The Stack dev of Stack snippet

0

I'll start by saying ddlDivision is cascaded from ddlLeague @Html.DropDownListFor(x => x.LeagueId, Model.LeagueSL, new { id = "ddlLeague" }) @Html.DropDownListFor(x => x.LeagueId, Model.DivisionSL, new { id = "ddlDivision" }) Now when the view is rendered Model.DivisionSL == null, and whe...

2

I'm testing an application which is not exactly an e-commerce application but which behaves enough like one that you can think of it as an e-commerce application for the purposes of understanding this code :) This code relies heavily on the Selenium Webdriver library. The code comes from the P...

@Pimgd I pinned that comment.

2:51 PM
oh gosh, I need to find that Meta Post
found it

I guess abstract in this context is, classes that use SList do not bother of how insertEnd()/insertAt()/insertFront() work internally and the logice of these methods can be changed independently without effecting the users of this method.

> Starred messages appear in the room sidebar, ordered by number of stars and last time of starring. (Room owners can also pin messages, which permanently affixes them to the top of the room sidebar for up to 14 days.) The room sidebar is intended to be a collaboratively created mini-timeline of interesting room events for people who don't have time to read the entire chat transcript for that particular room.

becasue users just give item or position as input

@overexchange That sounds like a good abstract interface

the whole logic is written in SListNode which is not visible to classes from other packages

2:53 PM
I didn't find it, that was a blog post

classes from other packages will not be able to use SListNode class

But they still use `SList`

@overexchange isn't that what they call the "Principle of information hiding" or "Law of Demeter" ?

Law of Demeter = "`A.getB().getC()` = BAD"

and using SListNode class tampers the list becasue SListNode class methods return node

2:56 PM
@Pimgd so `new SList(items).get(1).getValue() = BAD`

using = use by classes in other packages

@Vogel612 yes

Oh so my question is not clear?

@overexchange rather, the term you are using is not clear..

2:58 PM
am using the terms that have been taught in the class
literally
only the code i wrote is on my own

To be honest, schools don't use the best of terms
or sometimes they use outdated practices

(cough) sometimes (cough)

I heard "bench-checking" or "desk-checking" like a year ago

lecture 8 of this course link

@Marc-Andre where should I post it? is David his username on Stack Exchange?

3:00 PM
@Pimgd check the lolcode spec boolean section

apparently that's "manually verifying the working of your code by writing down the values of variables as you execute your code"

Haney ♦, United States
1.5k 8 19

@Vogel612 lacking MKAY

ok that is what I was thinking, I found a SE.Meta question.

@Malachi I guess you could add an example of the "bug" here meta.stackexchange.com/questions/239456/…

3:01 PM
@Pimgd aaaah

@Pimgd Can you please update the query if you are clear with the query?
not*

@overexchange The thing is...
An abstraction is not a good abstraction on it's own. Such a thing is impossible.
It's a good abstraction OF something else.
I don't know what "something else" is here, so I can make a few mental checks where I insert various random objects that seem appropriate in the "something else" slot
and then it looks pretty okay

i think SList is an abstraction of maintaining list of items with those 6 invariants
user just need to provide theitem
as input

@Pimgd - not a bit harsh, is it? :
1

Bug: n < 0 leads to you removing the last node. Your solution should have comments: I have NO idea how it works. And that's after reading it a couple times. If this was production code, I'd have wrapped it with unit-tests, thrown the implementation away and rewrote it.

3:12 PM
uh
Uhm... I guess it's pretty harsh actually.
Bah.
0

http://codereview.stackexchange.com/a/63248 How do I review honestly, without being overly harsh? I have a tendency to post an answer like that, and it's only after rolfl mentions it that I notice.

time for the bus

Do you have this on GitHub? I want to fork it so bad! — Malachi 13 secs ago

@Pimgd Well, I was not expecting the meta post, but, it could lead to some really interesting discussions.... travel safe.

I wonder how many unicorns I have killed? the Narnians wouldn't like me much.....
@Marc-Andre the buttons don't get super big on Meta.
0

I found something that may interest you. in one of my questions on Code Review I added in Stack Snippets to an old question and used the fun header formatting and it made parts of the stack snippet bigger because of where the comment for the begin snippet was located. Just because snippets are ...

2

from Remove Nth Node from End of Linked List: Bug: n < 0 leads to you removing the last node. Your solution should have comments: I have NO idea how it works. And that's after reading it a couple times. If this was production code, I'd have wrapped it with unit-tests, thrown the impl...

3:35 PM
Hmm, discussion on soft skills... I think I can contribute :)

It says that I have been mentioned?
Ah, @Malachi has pinged me

@Malachi Weird!

@SimonAndréForsberg I commented on your Minesweeper code.
I am going to fork it, alot!

I'm going to fork my food
3

@Malachi Soon I have it on Github.

3:46 PM
@SimonAndréForsberg I will be keeping a close eye on your Repos!

Good meta answer monkey. I posted one as well

I've seen, and +1'd

@Malachi If you your own room, we can make sure the repo keeps a good eye on you!

@skiwi ????

> If you your own room,
confusion ensues

3:50 PM
If you own a room*

I still want to jump on that bot you are working on too @skiwi but I haven't had time yet.
@skiwi like a chat room?

@Malachi Yes
I doubt we want that spam here ;)

BlueCheese Monster's Home

place for Debugging Cheese Monster
I have a Javascript one that I should probably look up the Github for and fork that as well so that I can make that one better too.

Though you need to talk to @Simon about connecting it there

@Malachi You should. I have a lot of interesting things.

3:56 PM
@SimonAndréForsberg I am following you

@Malachi Here you go: github.com/Zomis/Minesweeper-JS