« first day (1150 days earlier)      last day (2881 days later) » 

6:00 PM
So if I'm reading this Java to C# thing right C# mostly has the good parts of Java, added some more and dropped the bad parts?
 
}))));
 
@skiwi Exactly.
 
The downsides of LINQ.
 
@EBrown That means you are abusing Linq.
 
Not at all.
Just nesting some things nicely.
 
6:01 PM
Either split that into a few queries assigned to variables, or use outright loops.
It is almost impossible to debug when you do that.
 
Why? It's just a nested string.Join and .Select.
 
@syb0rg I'm not sure. Depends on how I'd ask it. I have an interface but I can't get it to work. Might be a better question for StackOF then CR.
 
No, it is a select nested in a join nested in a select nested in a join.
 
Someone called the brace police?
 
Yes, which is perfectly acceptable.
 
6:02 PM
fn strike_out_multiples(&mut self, number: usize) {
    match self.prime_slice.first_number_in_range_with_divisor(number) {
        None => return,
        Some(mut val) => {
            while val <= self.prime_slice.last_number() {
                self.prime_slice.set_is_prime(val, false);
                val += number;
            }
        }
    }
}
 
My opinion is that you should only nest to two levels at the very most.
 
Where is @Mat'sMug or @RubberDuck?
 
@JHache Perhaps
 
@EBrown Compilable doesn't mean acceptable.
 
what's up?
 
6:03 PM
Just saw game of thrones. I can finally be on the internet again (no spoilers pls)
 
14 mins ago, by EBrown
result += string.Join(RowDelimiter, items
    .Select(item =>
        string.Join(ColumnDelimiter, properties
            .Select(property =>
            {
                var value = property.Info.GetValue(item)?.ToString();
                validateCharacters(value, ColumnDelimiter, "property value");
                validateCharacters(value, RowDelimiter, "property value");
                return value;
            }))));
Can you weigh in on that?
 
looks like a job for a StringBuilder
 
decimal looks pretty cool in C#
 
I say it is nested too deeply to be easily modifiable, or debuggable. Readability isn't too bad in this case, but could be improved.
 
@Mat'sMug I put on some new glasses
 
6:04 PM
@skiwi It is.
 
@Mat'sMug Bob the StringBuilder
3
 
@Mat'sMug I was using one, but I was told on a CR review to use LINQ.
 
@N3buchadnezzar Back at it again with the star-worthy messages.
 
@EBrown That is A) personal opinion, and B) not always good advice.
 
Linqaholism threatens us all
8
 
6:06 PM
stringbuilder is you what you should use
 
I use Linq, and love it, but just be sure to use it correctly.
 
I don't know if you guys have seen my question, but if one of you is good with ASP.NET, I'd really appreciate you checking this out:codereview.stackexchange.com/questions/132765/…
 
@MichaelBrandonMorris Sorry.. I can not help it, I am addicted to bad puns and word play.
6
 
@JHache Well, I was using it recently--not sure if I'm any good at it.
 
You could probably still find a way to use StringBuilder in LINQ code :P
 
6:06 PM
I see why people run out of stars this quick in this room.
6
 
foreach (var item in items)
{
    var row = new ExtendedStringBuilder();

    foreach (var property in properties)
    {
        var value = property.Info.GetValue(item)?.ToString();

        validateCharacters(value, ColumnDelimiter, "property value");
        validateCharacters(value, RowDelimiter, "property value");

        if (row.BeenAppended)
        {
            row += ColumnDelimiter;
        }

        row += value;
    }

    result += RowDelimiter;
    result += row;
}
That's the non-LINQ version.
 
@Hosch250 have you dealt with controllers doing too many things? I'm currently trying to refactor to have better seperation of concerns.
 
@skiwi you could use a StringBuilder inside an LINQ .Aggregate method, but that would create a paradox that would destroy the universe
 
@JHache No, I started with a pretty clean project.
 
you extended StringBuilder with a += operator?
 
6:08 PM
@EBrown I'd say use the Linq version, but split some of the queries apart and assign them to variables.
 
@Mat'sMug And a few other things.
 
virtual whack
 
5
Q: An extension to the StringBuilder

EBrownThis is another pretty basic class I wrote for a library as I hate the way the default StringBuilder in .NET works. Essentially, I wanted to have the + operator, as well as implicit conversions to strings. (Rather than needing .ToString() all the time.) It's pretty small and simple, so there ma...

 
@Hosch250 I was following the Contoso University tutorial and ran with that for my application. Now I regret it
 
@ardaozkal I'm already out of stars :/
 
6:08 PM
Is there some consesus on whether to comment on the code OP posted. versus writing a better solution?
 
@JHache You have to be careful with tutorials.
 
Now it has a HasBeenAppended which indicates whether or not any Append method has been called.
 
But, I know how that goes--I did the same type of stuff just two years ago.
 
It's implicitly convertible to a string as well.
 
mkay
 
6:09 PM
@EBrown You could probably make a NuGet package of that.
 
@skiwi I run out of stars only in this room and Maid Cafe. I guess I mostly star devhumor and japanese drawings.
 
@Hosch250 trials and tribulations of a new junior developer tasked with building a prototype
 
Java really seems old...
 
@Hosch250 No idea how.
 
The argument is often backwards compatibility, does C# have backward incompatibility at times?
 
6:10 PM
@Mat'sMug You seem disturbed my friend.
 
@skiwi it matters
Do you mean older devices or frameworks?
 
@ardaozkal Would you star japanese devhumor drawings?
 
I think language evolution is more important than 99.9% backward compatibility
 
@N3buchadnezzar I'd star twice.
 
@MichaelBrandonMorris yeah.. I like my StringBuilder vanilla-flavored.
 
6:12 PM
@Mat'sMug Why?
 
because... if it needed additional members, they'd be in the BCL by now.
 
"Use StringBuilder!" "But I don't know how!" "Well the ExtendedStringBuilder can be used just like a string." "Oh cool, that's easy."
 
Why would you ever want the vanilla taste? It does not taste bad but there are so many different flavours to try.
 
@Mat'sMug Bull.
Look at NodaTime.
 
0
Q: Optimizing time and space complexity of recursive solution on string manipulation

Santhosh ChaitanyaTask is basically: Given a string, compute recursively a new string where all the lowercase 'x' chars have been moved to the end of the string. endX("xxre") → "rexx" endX("xxhixx") → "hixxxx" endX("xhixhix") → "hihixxx" Here's the initial idea I've had: public String endX(String str) { Arr...

 
6:13 PM
Reading about value and reference types I like Rust even more though, the complexity of Rust makes it a lot easier than the simplificity of Java and C#
 
The BCL needs all those extra features, instead Jon Skeet had to implement them.
 
I never needed NodaTime. I'm sure it's great. Say, did Jon Skeet extend the StringBuilder?
 
@Mat'sMug Why would he? He never needed it.
I did.
 
When Jon Skeet wants to build a string he just tells the pieces to assemble themselves.
 
You're invalidating my extension of the StringBuilder because I'm not "Jon Skeet?" That's nice of you.
 
6:15 PM
Skeetman, bopido
 
@EBrown looking at the code now... it's not too bad actually.
It's even pretty good
 
@Mat'sMug There's no "fluff," it's just designed to make life slightly easier.
All it does is wrap the StringBuilder with a few convenience methods.
Now you don't have to remember to call sb.ToString() (or esb.ToString()).
 
it just comes as a surprise when you come across it in code. it blurs the line between += string concatenations and StringBuilder usage when you're glancing at the code
 
Just implicitly convert it.
The += is not mandatory.
 
I saw that
 
6:18 PM
You can strip out the operator + methods and it's just a normal StringBuilder.
Except for the conversion at that point, really.
And I just today added a HasBeenAppended method which indicates if the ExtendedStringBuilder only contains the initial string/buffer, or some Append method has been called on it.
 
IDK, IMO there's a reason the BCL StringBuilder doesn't implicitly convert to a string
@EBrown I'd make that IsDirty
 
@Mat'sMug Yeah, it was written in .NET 1.1.
 
C# supports goto statements?
 
@Mat'sMug Why? Not sure what IsDirty would symbolize.
 
@skiwi sigh yes
 
6:20 PM
@skiwi Please don't.
 
@Mat'sMug
I have no words
catch up on the GoT episodes
 
shhh
 
you may resume your reviews
 
goto hell;
3
 
HAVE MAT NOT SEEN THE LATEST EPISODE, BUT THEN HE DOES NOT KNOW THAT ******
 
6:21 PM
@skiwi I guess that may be the only time goto is good practice, since there's no coming back
 
@MichaelBrandonMorris applied for you
 
@DanPantry Thanks mate.
 
Does SE chat support ★ as user name? If so then would be a good name for a bot
 
@skiwi We could try it out
 
6:22 PM
Or give us unlimited stars ;)
 
@MichaelBrandonMorris That could have fatal consequences
 
it would have to be ★★ but that would break pings, which require 3 characters
 
@N3buchadnezzar Okay, fine, just moar stars
@Mat'sMug What about ★★★?
 
try if you will. if it works you're stuck with it for 30 days
 
6:24 PM
But think of of the benefits!
 
thinks of the benefits, draws a blank
 
what would the bot do anyways?
 
@JHache Star interesting things.
So, basically, star the first 20 messages it saw.
 
"Display Name can only contain letters, digits, spaces, apostrophes or hyphens and must start with a letter or digit"
 
FWIW toybots in this room will get kicked.
 
6:25 PM
Does C# support const vs mutable on the class/method level? Like if I in Rust have a let vec = Vec::new(); then I cannot call vec.push(value);, for that I'd need let mut vec = Vec::new();
 
Yes, I tried it. I would have been embarrassed for thirty days had it worked.
 
toybots?
 
@skiwi No.
Well.. sort of
 
@Duga and other bots in this room, are tools, not toys
 
I don't think it supports what you mean, though.
 
6:26 PM
@N3buchadnezzar Things the IsDirty @EBrown plays with ;)
 
Well it would be a tool for running out of stars.
 
@MichaelBrandonMorris No, @Mat'sMug was the one who wanted it named IsDirty.
@N3buchadnezzar We have enough of those.
 
You could probably make a (very) complex tool to do it with attributes and a custom parser
 
hey I just said I'd call it that, you do what you want with it ;-)
 
@EBrown Did you just call us tools?
 
6:27 PM
@DanPantry Let's not do that then ;)
 
@MichaelBrandonMorris Possibly.
 
Funny that the creator of Bob the StringBuilder calls us tools.
 
Following the question edit, perhaps on CodeReview - with the code ;) — Weather Vane 19 secs ago
 
@N3buchadnezzar *Bob the ExtendedStringBuilder
 
6:29 PM
A pointer to Bob?
 
@skiwi No, I was using * to mean correction
 
Should have used sic then
 
@MichaelBrandonMorris Oh...
env::current_exe().unwrap().file_name().unwrap().to_str().unwrap()
 
Woo just reached 1k ^^
 
import Hell;
 
6:35 PM
where is the Don't migrate crap link?
 
@N3buchadnezzar gz
 
@ardaozkal from Hell import ComicSans as TimesNewRoman
 
@N3buchadnezzar ★
 
@N3buchadnezzar well played, have your star.
 
6:36 PM
@JHache What's up with making a prototype?
 
@Malachi oh well
 
Really like this comic on XKCD about python xkcd.com/353
2
 
@Mat'sMug I was just letting you know, that you weren't the only one saying it out loud
 
@skiwi can't you do env::current_exe().map(....)
 
@DanPantry Right, I probably can
 
6:39 PM
for you @Mat'sMug
@DLeh, Don't Migrate Crap. — Malachi 2 mins ago
 
that's a bit mean... but yeah.
 
DMC = Dat's Mah Codereviewer!
And also Don't Migrate Crap
 
@Hosch250 I got an internship at a pretty big company and management wanted to explore better ways of tracking their hardware (embedded systems) so who is using what for which project. They didn't want to just make work, so they got me developing something they hoped would actually be used. I got the job, they liked the prototype and now I have code ownership on it. Only reviews I got from senior were regarding the database.
 
No one in the building does ASP, which lead to senior's on my team congratulating me for getting my self job security so early.
 
6:40 PM
@ardaozkal *snorts loudly*
@JHache I did this with Node in our project. And ES6. And Angular 1.5 components.
 
now back to work...lol
BTW.Work();
 
None of those are hard and they're best practice, just no one bothers to read wikis these days apparnetly
 
@JHache Couldn't you just have used Excel for it? hides
 
@ardaozkal Kill the bears and start over.
 
Oh, I thought you were referring to my internship for a sec.
 
@skiwi that's what they were using
 
If you want a review of your code you should probably try codereview.stackexchange.com. If you want to ask about the exception, try being more concise rather than copy pasting hundreds of lines. — dabadaba 11 secs ago
 
@Pimgd I noticed him too
 
@DanPantry the same type of project you mean?
 
6:42 PM
@DanPantry CR leads me to believe nobody has ever read PEP 8
 
@JHache Those were all on the same project, yes (they're all JS technologies).
@Pimgd are these duplicate users or something?
 
@JHache Uh oh okay
 
@skiwi yeah hahah nobody had the time to do anything about it
 
it's from suggested edits
 
It's so lively in here recently, did something big happen? Not that I'm complaining, it's nice to see new (and old) faces
 
6:43 PM
@DanPantry I totally misread that at first. So you got code ownership yourself by using various things nobody knew?
 
@JHache Practically, yes
 
@N3buchadnezzar I actually didn't know about PEP 8 before hanging out on CR.
 
@DanPantry I was invited by @syb0rg last week when I was looking for help. Been opening it up every day at work since
 
Also because no one wants to touch JavaScript except me
@JHache That's how it starts. Then you start running out of stars.
Crap. I'm out of stars.
Well, there you have it, I guess..
 
@200_success And people poston hereto learn, so I guess thats a great thing!
 
6:45 PM
> PEP 8
I read today
 
@DanPantry I find it's been hard to run out of stars lately.
 
Start with one chatroom, end up with 4 chat rooms
 
the "pythonic way" to check for empty list
 
@Pimgd I often have a PEP talk with the new users.
 
if not myList:
 
6:46 PM
@EBrown Ironically, I ran out of stars while trying to star J Hache's last message lol
 
you fking wat
 
Mostly because I work 2nd shift, so as soon as things start getting lively, I have to go to work.
 
@DanPantry How does it end?
 
@N3buchadnezzar It never ends. You can never escape the 2nd monitor.
 
You can definitely escape.
I can think of at least two users that have escaped.
 
6:47 PM
1470
Q: Best way to check if a list is empty

Ray VegaFor example, if passed the following: a = [] How do I check to see if a is empty?

like why would you do this
 
"you can leave, but you can never check out"
 
@Pimgd if empty return True what is wrong with that?
 
@DanPantry Our monkey has escaped our closure though...
 
ha, yeah that's "easy". C++ always looks like car accident. — James K Polk Feb 10 '10 at 19:12
lol
 
I'm curious how his work is Go-ing ;-)
 
6:48 PM
@DanPantry it's actually the other way around
> You can checkout anytime you like, but you can never leave
 
@Mat'sMug Look, I'm not very cultured. Me even knowing the lyrics is a big thing for me. That song is older than I am.
 
Why would you use write-only properties in C#?
 
@DanPantry yeah but the Guitar Hero version of it, isn't
 
@N3buchadnezzar it's not if isEmpty(myList): or if len(myList) == 0:, which would be readable
 
@skiwi If you wanted your property to have a side effect (don't do that)
 
6:49 PM
no, it's if not myList:
 
@skiwi Side effects. (Not a good reason.)
 
@Mat'sMug Only thing I played on guitar hero was this
 
and you just gotta know that it'll work
 
@skiwi for property injection with an IoC framework that can't property-inject otherwise (looking at you Ninject)
 
I prefer my code to be readable first
 
6:49 PM
@Pimgd You live a good life if these are your troubles young padawan.
 
@Mat'sMug That even sounds reasonable
 
still, it's ugly
property-injection would be a last-resort
 
@Mat'sMug But it's write-only - how would you observe that property (unless you want to use a side effect for that :S)
 
well I dunno about whether what's in there is good, but my data point for today was bad
 
@DanPantry you don't. the side effect is that a dependency is injected and that the code works
 
6:50 PM
@Mat'sMug ew
last resort, indeed
 
Oh right... if you can't get then you can't read
 
Holy carp
C# totally let's you follow the Java get/set philosophy, but with properties instead of methods.
 
@EBrown yep. Was that a penny dropping I just heard?
 
including all of the bad parts too :D
 
6:52 PM
private string _name;
public string SetName { set { _name = value; } }
public string GetName { get { return _name; } }
Hah, that's awesome.
 
@EBrown wat...
 
And that's why I love this room. You always learn something new ^^
 
I gotta program in C# Unity 3D for a private project; hoping to just code generic Java and PascalCase everything
 
@skiwi Completely valid.
 
@skiwi That's basically getName/setName from Java (but with a backing field instead using the property itself)
 
6:53 PM
yeah, well... for that specific case you just do public string Name { get; set; }
 
Just, not a good idea.
 
@EBrown wait a sec
 
@Mat'sMug I know, but you can totally separate them out like that.
 
faints
 
@Mat'sMug Yeah!
You got it.
One is a write-only property, one is a read-only property.
 
6:53 PM
wakes up shotgun in one hand, axe in the other
 
@Mat'sMug TS.
 
@Mat'sMug I prefer clubs so you can make people see stars
 
Latest news report from Quebec: A mug has gone on a murderous rampage, killing many C# programmers. Sources indicate it is due to bad get/setter code.
 
@Pimgd We see them in this room every day.
 
no, just those pretending to write fugly JAVA with C#
 
6:55 PM
This is glorious.
I have found a new anti-pattern for C#.
And it's brilliant.
Simply brilliant.
 
welp I'mma write Java in C# because I can
 
@EBrown you should be ...proud?
 
This reminds me of the brexit thread on reddit. The top comments were basically @Mat'sMug and @EBrown
2
 
except for the collections API
 
@Mat'sMug Absolutely.
 
6:55 PM
I hope it's not too different
 
"We're all going to die" "This is great"
 
@Pimgd Learn LINQ, it will save lives lines
 
... can you use LINQ in Unity?
 
If you can use the System.Linq namespace, yes.
 
@DanPantry Hmmm...I wonder if I can get all the anti-patterns in one class.
 
6:56 PM
I'm not sure, but if you hack enough it should be doable
 
I looked away for a minute 50 new messages. What are you all so happy to talk about?
 
@N3buchadnezzar Antipatterns in C#
 
> Don't use the default LINQ if you plan to publish an iOS build. Methods like OrderBy and alike may produce AOT/JIT errors.
riiiight
 
Try and find a way to use something like Linq. The lazy evaluation is seriously amazing
 
It'll work, but it will eat memory because Unity made a shitty linq implementation.
 
6:57 PM
Reactive Extensions might work, but there's a bit more cognitive load because that's based around lists over time (streams) rather than lists
 
FWIW I reviewed the Guitar Hero bot, and there doesn't seem to have much room for performance improvements beyond making these arrays static rewriting the whole damn thing
 
@Mat'sMug Sounds like my job
 
@Mat'sMug I'm going to have to ask you to stop writing star-worthy things because I'm out of stars. :P
 
@Mat'sMug Damn it, I was reading that in a positive tone and you just murdered it
 
lol x3
 
6:58 PM
> 1011011(0) swapouts
 
@DanPantry b-but teeeee-eeeees
 
Damn, Qwertee doesn't save your checkouts across browser sessions. :(
 
Can't tell if binary, or really convenient number.
 
@DanPantry checkouts?
 
@skiwi baskets
 
6:59 PM
@EBrown I was trying to see what binary it would represent too
@DanPantry Oh... I'm glad my tabs at least save
 
shopping go-karts
 
My 995 tabs as of now
 

« first day (1150 days earlier)      last day (2881 days later) »