« first day (1161 days earlier)      last day (2847 days later) » 

Makes your blood boil in a good way?
 
@N3buchadnezzar ...................................No
 
@JoeWallis What's the context?
 
@MathiasEttinger It's easier for me to link to it, it's this answer
I just wanted to check that the translation is correct, :) Due to the OP being unsure
 
Yep
seems good
 
2:03 PM
Thank you!
 
At least that's what I would have typed if I wanted to say « sans tenir compte de la gestion des tableaux ».
 
@MathiasEttinger Not a major difference though.
 
And now, I'm returning to TNBing. If you still notice me in that list, it's because I don't exit favorite rooms. ;)
 
@MathiasEttinger Oh, I assume that to be a translation of what they said...
 
@Mast 29% speedup or 23% slowdown depending on how you look at it…
It can make a difference…
 
2:10 PM
It definitely can, but it's not enough to be the deciding factor up front I guess.
 
GRAH
I have to go get an oil change in my car in a few minutes
The dealership has absolutely nothing to do
I guess I take my laptop and work on this month's ?
6
 
Do you even need to ask?
 
Nope. It was implied. :P
 
Zak
@Mat'sMug If you want to suggest better naming, here you go codereview.stackexchange.com/questions/134274/…
 
2:16 PM
Muahahahaha
 
@Malachi Hey. Do you know what day it is?
 
@N3buchadnezzar yeah I pinned the video....lol
 
oh god no
@Malachi you did what!?!?!
 
fixed that ...
 
2:19 PM
3 mins ago, by Malachi
Muahahahaha
 
GUYS I NEED YOUR HELP
 
@Vogel612 oh come on, not even for one day?
 
@Vogel612 beat me to it
 
@Malachi not even if that day was a million years after i died
 
@EBrown with what?
 
2:20 PM
not even for one day. I don't care about stars, but no not even for one day
 
How do I explain "community challenge" to a woman who knows nothing of Code Review?
 
@EBrown You do not.
 
with a link to the first one?????
 
@EBrown it's not a CR thing, it's a community thing
 
@EBrown Group brainteasers
 
2:21 PM
1
Q: CopyOf2DArray (Values Only)

Zak Purpose: Given a 2-Dimensional Array, return a copy of the Array. In VBA, if I just Set newArray = oldArray then newArray is simply a pointer to oldArray rather than an independent copy, hence this function. Method: Assign Array bounds. Create identically-sized Array. Iterate over Array ...

 
I told her I was going to the car dealership, and I was going to be working on a community challenge from a group I work with, and she's upset.
 
@EBrown One does not simply explain to female specimen.
 
sharing solutions helps consider other points of view
 
20
Q: CR Weekend Challenge

Mat's MugThose of you that weren't following what's going on in the chat room might have been taken by surprise by a recent avalanche of Rock Paper Scissors Lizard Spock posts. This is how it started: OK, weekend challenge.... we all solve the Rock Paper Scissors Lizzard Spock problem with our 'favou...

 
"Why won't you call me and talk?" "I mean, nothing says I can't do both."
 
2:22 PM
after that came the community challenges
 
That's too much work.
I'm just going with @Quill's answer.
 
calling, and talking. I agree
 
obviously the better you are at doing these challenges, the better you do your work, and the better your jobs will be ;-) everyone likes money, right?
 
OK, so I'm in the clear.
"Group brainteasers" worked.
Phew.
Crisis averted.
 
Zak
@EBrown What on earth did she think you meant?
 
2:25 PM
RE: USABILITY: MAKE THE ADS BRIGHT AND FLASHY ENOUGH SO PEOPLE ON THE DARK WEB CAN SEE THEM
3
 
@Zak She doesn't understand why one would do such boring things. (Her words, not mine.)
 
@N3buchadnezzar this is borderline offensive
 
"They actually challenged you...to build a Monopoly game in a computer?"
"Here's the thing about us: we're awesome, so yeah."
3
#Rekt
I might be single here shortly, again.
 
@Quill WHY ARE EACH AND EVERY POST OF THIS DUDE ALL CAPS?
 
because he's an angry CEO
 
2:28 PM
@MathiasEttinger His handle is PHP_CEO, does that not explain it?
2
 
@Quill Step away from the internet!
@EBrown Try to explain everyone has a different definition of fun and boring.
 
YOLO, so don't just code solo … Or, why we built collaborative editing in HyperDev https://hyperdev.com/blog/yolo-dont-just-code-solo/ 👭👫👬
that's the blog title....
 
@Mast I'm having problems not just ignoring her to begin with, now.
 
I didn't have too much trouble explaining challenges to my wife.
 
She called my hobby "boring". :(
 
2:30 PM
That's a tad insensitive. Is she human by chance?
Humans make mistakes.
 
Yeah but still.
 
Cry me a river, build a bridge and get over it.
2
 
Programming is not boring.
 
@EBrown get angry... that's the correct reaction
 
It's exciting.
 
2:31 PM
@EBrown Crush her in monopoly
6
 
@Vogel612 Nah, I don't honestly care that much.
 
right </relationship-issues>
Hi @Wally
 
@N3buchadnezzar That's evil and very fitting.
Welcome @Wally
Don't mind us bantering around. It's Friday.
 
She thinks it's neat that we challenge each other.
 
Ok
 
2:32 PM
@N3buchadnezzar First star I've used in a bit of time, worth it.
2
 
@Mast This explains a pretty good strategy youtube.com/watch?v=0PtUxdA35Zs.
 
Blech, time to go. I'll probably be on my phone when I get there.
 
@EBrown Good luck
 
Did she expect like skydiving or driving race cars? Get real, 99% of hobbies are "boring". People should just have the respect to acknowledge you have one
 
@N3buchadnezzar To be honest, it's not that difficult.
@Quill A colleague of mine is heavily into woodworking. Another colleague of mine thinks he's nuts, but we all respect each others oddities.
 
2:34 PM
@Mast Yeah. Just build houses and buy properties after prison
 
I've had a supervisor in the past with NSFW hobbies. Made for odd discussion at the lunch table.
 
Extreme programming
 
@N3buchadnezzar Ohh, that's simple. Now I'll challenge my friends to Monopoly the next time we play Tabletop Simulator! :)
 
Welcome @mathERSI
 
I spent too much time on this answer, looks like I didn't even do much: codereview.stackexchange.com/a/134276/27623
 
2:40 PM
Is that post classified as a zombie, but not longer?
 
@EBrown I doubt she could do it
 
@user2296177 It's a killed zombie now it has an upvote on the answer.
 
@user2296177 My answer?
 
Answers are never zombies.
Questions can be.
 
@syb0rg You're a zombie killer.
4
 
2:43 PM
A mechanized zombie killer.
 
@user2296177 I'm a zombie killing machine
 
I've got a couple of zombies.... maybe you can help at some point. I killed a baby yesterday, mere hours after it was born.
 
I know babies can be terrifying, but zombies are way worse.
 
@user2296177 Sadly, you look more advanced in C++ than I am
I am quite rusty in my C++ usage
 
0
Q: Guess how many are in the jar game in Java

Nilzone-I reading up on java and have completed a fairly simple console game. I'm unsure on my own structure when considering maintainability, separation of concerns and best practices. Any tips or suggestions is appreciated. import java.io.*; import java.util.Scanner; import java.util.*; class Prom...

0
Q: String building attribute selectors

zzzzBovI'm dynamically selecting elements in jQuery, how can I make it more resilient? $('[data-example="' + exampleData + '"]').each(...); I'm concerned that the data might contain special characters.

0
Q: Custom list to avoid out of memory exceptions

TheLethalCoderThe following class is a helper to avoid OutOfMemory exceptions being thrown when the whole list is to large so that it is added onto the Large object heap. To do this it adds the items onto the heap as smaller arrays contained inside of a list. using System; using System.Collections; using Syst...

 
2:59 PM
How important is the debugger for you guys? Can you replace a lot of it with printing statements to console?
 
debugger is pretty important
otherwise you have to change the printing, compile and run all over again
 
@JoeWallis Did you test your answer to my XML parser yet?
I'm getting a NameError
 
@syb0rg Oops, no, ):
I will now, :)
 
Perfect
Line 21 (in walk_branch()) we pass the parameter node, but it isn't in scope
 
@user2296177 Depends on whether your IDE automatically enables the console in debug mode and how long compile time takes ;-)
 
3:06 PM
@Quill She stopped giving me crap for it. :)
 
0
Q: Code to ask for user string, then display the output

user93696# printstring.py # 7/8/2016 import sys # ask for user input s_string = input('Enter a string: ') # if no string, then exit() if s_string == '': sys.exit() # display the output print(s_string) Also wondering how to get "raw" input and output the text properly formatted with line breaks, ...

 
@syb0rg Yeah I'll look into that, I changed tree to node but there's no tree in that function, :O
 
@EBrown :)
 
@EBrown What's so cool about what she does that she says programming is boring?
 
@JoeWallis Yeah, I'm not too sure on how to change it either haha
 
3:07 PM
I bet she spends time watching make-up videos on youtube too.
 
@user2296177 I saw some girls do this. Is that really a thing?
 
I bet I've messed up more than this, I'm just setting up a folder to test it, :)
 
@N3buchadnezzar Oh yes, it's a thing... I experience it first hand.
 
@user2296177 Depends on the language. In Java-like language? No way. You want stacktraces.
 
@user2296177 First hand, or face?
 
3:08 PM
these comments are sounding awfully close to being sexist, which we reaaaaaaally don't want on here, so please try to avoid making comments like that guys
 
But you get those anyway, I guess. Just like in Python.
I've only needed debuggers in C and C++.
 
Half of the people here don't have their "About" section filled out for their chat profile
 
@Quill Sexist? Not my intention, just talking from personal experience.
 
@CaptainObvious ... This is an awfully simple program
 
3:11 PM
@user2296177 Absolutely nothing, her hobbies are boring too.
 
Reference to Kid Ink there, for those who know
 
@Mat'sMug What's in the mug, Mat. What is in it?
 
@user2296177 right now, ..dust :)
 
MONOPOLY TIME
 
3:14 PM
Do energy drinks work if you drink 5 cups of coffee a day? I had my first energy drink yesterday and I didn't feel anything.
 
@user2296177 You can make coffee with energy drinks instead of water
 
ew
 
Benefits are being awake, downsides is that you can taste colors and not fall asleep for a few weeks.
 
I always liked it, especially when I could taste sounds with the colours.
 
Drank coffee for a bit and stopped when I started falling asleep standing up.
 
3:15 PM
Coffee made of Scotch instead of water is even better.
 
Guys, are we still talking about coffee or did we move onto illegal substances?
 
@user2296177 It doesn't exactly work like that.
Energy drinks are guarana, which is a fast hit, Caffeine is similar but it takes longer to wear off
 
@EBrown You should try that and let us know how lit goes.
 
You can also make coffee with vodka instead of water. insert soviet russia joke here
 
@Matt It's worked out pretty well every time so far.
Also: just watched the weirdest commercial in this waiting room.
 
3:17 PM
It just sounds like you are ruining two drinks at once
 
Mimosas are where it's at
 
Rye and gingerale
 
@Matt It's not about the taste my friend, it's about the effects.
 
Not worth it.
 
Some woman was wearing skin-tight outfit (full body, excepting her head) and it was all skin-coloured, then there was a picture of a digestive track on it.
Really bizarre.
 
3:18 PM
@EBrown Go on...
 
sales of the dress skyrocket
 
She was in a board meeting.
 
@Quill Does racing cars, in a game, count? :P
 
And the commercial was for some medicine thing that's supposed to cure some thing with digestion.
 
Because everyone could see her digestive track without the medicine. I get it.
 
3:22 PM
is it just me or the logo for aviation.se looks like a... picnic table
oh, it's better with the wings
but the favicon is only the circle
 
@Mat'sMug Lol indeed
It's a flying picnic table!
 
@Mat'sMug This is one of the worst logos I have seen.
 
@Mat'sMug No, I thought the same thing.
I thought it was the icon for a sight-seeing SE or something.
 
hmm.. their meta yields no search results for "picnic"
 
@EBrown You drink the coffee first and the Scotch after. Scotch coffee sounds weird.
 
3:26 PM
1
Q: Exporting unread mail details for further processing

MattAs the result of some expert procrastination I have over 4000 unread mail in my gmail box. While that does not hold a candle to what some people likely have I wanted to try and do something about it. Namely unsubscribe where I can, create filters and labels or delete. I wanted to gather data on...

 
@Mat'sMug You could totally fix that.
 
if I had an account
 
@Mast Try it. Then we'll see who's laughing. ;)
 
37 secs ago, by Mast
@Mat'sMug You could totally fix that.
 
if I wanted to
 
3:27 PM
Well now if someone makes a flying picnic tables a51 proposal we can close it as a duplicate of Aviation
 
@Quill You mean we can close Aviation as a duplicate of Flying Picnic Tables?
2
 
Project name: "CR Monopoly"
I HAVE IDEA
If I make this networked multiplayer, who's going to play with me?
That would be dope.
 
@EBrown I shall
 
:D
 
3:30 PM
I've never played Monopoly, I'm disadvantaged.
 
Until my coworkers notice I've done nothing productive today
 
Make a neural network to beat us
 
@N3buchadnezzar OMG that would be awesome.
 
@user2296177 you're not missing out on anything
 
@syb0rg It won't be today.
 
3:31 PM
@N3buchadnezzar How to train?
 
@user2296177 Do you know how to be a sore loser, or cheat?
 
@user2296177 I'll give you a handicap.
 
@user2296177 except for stealing bank notes while ur friends aren't looking
 
@EBrown I'm totally in.
We could stream it somewhere.
 
@syb0rg It would train on the data from the networked multiplayer, possibly?
 
3:31 PM
@Mast I totally have a Twitch.
 
@N3buchadnezzar You could use "one-shot learning" I suppose
 
@syb0rg Play 20k matches and feed it the results :P
 
@user2296177 beginners' luck, you have the advantage
 
@Mast That's more like it
Would we be playing the game pre or post review?
@EBrown Also what language are you using to make this game?
@Edward Callback ping
 
@syb0rg Well, we have two options: C# with XNA, or C# ASP.NET with client-side JS.
OR, C# with XAML.
Not sure which I want, now.
Hard decisions...
 
3:33 PM
Drop the # and I can help lol
 
I'd suggest that you move this post to Code Review (and possibly add here a link to this post on code review). On that site they focus on best-practices, improvements of existing code it in terms of speed, security, sustainability, and longevity. Give it a try. They're good and you might get a lot of additional advice. — Ralph 39 secs ago
 
Didn't XNA lose support?
 
LMAO I need that #, the # in C# means "LINQ"
 
You can always try Assembly, the original Rollercoaster Tycoon was mainly written in Assembly
 
@JoeWallis How's testing going?
 
3:34 PM
I've heard that C is basically assembly with a nicer syntax.
 
@skiwi ಠ_ಠ
@user2296177 Portable assembler
 
@user2296177 Mostly.
@skiwi I want it done this year.
 
@syb0rg I've tested the code, but I need to change my review slightly as a fix is changing a function from set_parent_count(ElementTree, int, str) -> None to set_parent_count(ElementTree, int, str) -> Element ):
 
@skiwi And it was awesome.
 
3:37 PM
The Fast and the Forklift Tokyo Warehouse Drift
 
@Mast I wish we had those at my job, I'd have fun all day long.
 
@JoeWallis Are you editing the answer now? Or later?
 
@syb0rg Now, but once I make the code a little nicer
 
jrh
@user2296177 I've done both assembly and C, the "C is portable assembly" saying never really made a lot of sense to me
 
Hey @Phrancis
 
3:38 PM
@syb0rg That's even spacier than TRON.
 
jrh
I'd say il is closer to portable assembly
 
@jrh Not really.
IL requires an interpreter on the target machine that can read it.
 
@Mast Now they just need to invent a car for that wheel to go on
 
At that rate, Java Byte Code may as well be considered "portable assembly", we all know that needs the JVM to run.
 
@syb0rg howdy!
 
3:45 PM
@syb0rg Do we need a now?
 
Zak
@EBrown I will.
 
Ditto^
I <3 Monopoly
 
@syb0rg Fixed the answer, :)
 
I'm assuming I'll have time for the game, which may not be the case
I'll let you know when this is further planned out
 
@syb0rg You rang?
 
Zak
3:50 PM
UK National Student Boardgaming Champion. Hate monopoly with a passion, but will play it regardless for nostalgia reasons.
 
@Edward I saw you popup in the pingable chat user history, so I thought I would
Long time since I've seen you in here
 
Yeah, I'm toiling away. I was actually here just yestterday.
 
@Edward Hm, I must have missed you
Toiling away at what?
 
@JoeWallis I tried to implement the logic in this answer of yours in C# but I don't Python and this line confused the heck out of me: if not any(divisor % d == 0 for d in new_divisors)
 
@JoeWallis appears to work, one sec while I do a bit more testing
 
3:51 PM
At the moment, I'm trying to figure out how to use github with 2 factor authentication turned on.
Not intuitive.
 
@Edward For commiting? Or just signing in?
 
@Phrancis Yes, in C#, you wouldn't do that on one line.
 
@syb0rg That's the confusing thing. Signing in is easy and logical. Pushing code (from the command line) is not.
 
@Edward I still screw-up committing with SSH hooks every once in a while, so I wish you luck.
 
Yeah I think you are right on this. I'll post this on code review, thanks! — Luis Garnica 7 secs ago
 
3:53 PM
@Phrancis I don't know linq, ): but it's a generator comprehension. I'll write you an alternate way to do it in Python, one sec
 
With new_divisors being an empty list it doesn't make sense to me to foreach over it, so it must be some Python sorcery
 
@Mast I just need to change to SSH keys and save myself the aggravation.
 
new_divisors is only empty initially.
 
11
A: Git Clone from GitHub over https with two-factor authentication

NitsewFind out how to fix this here: https://github.com/blog/1614-two-factor-authentication#how-does-it-work-for-command-line-git How does it work for command-line Git? If you are using SSH for Git authentication, rest easy: you don't need to do anything. If you are using HTTPS Git, instead o...

Are you doing this?
 
every element in divisors gets tested for divisibility of the items in new_divisors, if it is not divisible by any of them, then it itself gets added to new_divisors. Please correct me if I'm wrong.
 
3:55 PM
A clone is different than a push, but same principal
 
Python looks like a nice language.
 
def divisable(new_divisors):
    return any(divisor % d == 0 for d in new_divisors)

def divisable(new_divisors):
    for d in new_divisors:
        if divisor % d == 0:
            return True
    return False
 
jrh
@EBrown This is sort of semantics but I guess I sort of thought of any compiled bytecode for a runtime as assembly language. Where the runtime /is/ the architecture, though maybe that's too flexible of a definition for assembly language; admittedly Microsoft does have ILASM and ILDASM (IL assembler, and disassembler) but I think I might stop calling IL assembly language and reserve that for the real bytecode ran by a processor
 
@JoeWallis It's generating a slightly different XML than mine was
 
@user2296177 Part of the problem I ran into with C# (and probably would also with Java and some others) is you can't modify a list while you are iterating it with a foreach, could probably work around that with a simple for loop I suppose
 
3:57 PM
@Edward Anyways, the main reason I called you back in here was for Khronos
A while back we discussed working together on it, I was wondering if you were still possibly interested
 
@JoeWallis OK that makes more sense to me, thank you!
 
Yes, I'm doing exactly that. It makes little sense.
Steps to do a command-line push:
1. log in via web with password and phone-generated token
2. generate "personal access token" and copy to clipboard
3. use personal access token to log in
However, now that I have the personal access token generated, there's no further need for 2FA.
 
@Edward Email Github devs and ask about it would be my recommendation
 
@syb0rg It's still interesting to me, but I'm absolutely swamped by work at the moment.
 
@syb0rg NOOO, hopefully just some bad C&P in there.
 
4:00 PM
@JoeWallis C&P?
 
Copy & Paste
 
Ah
I don't think so? Idk tho
The XML parser I'm using isn't liking what your program output, something to do with ClientDataSet
I'm trying to narrow it down now
 
@Phrancis I don't know much C#, but can you do something like this?

foreach( divisor d in divisors )
{
if ( !new_divisors.Any( /*LINQ magic*/ )
new_divisors.add( divisor );
}
 
@Edward Understood, I've been doing more development on it lately (mainly Windows support) and have been laying out the foundations for contributors to easily add stuff
 
"I am looking for a more elegant one" -- what makes you think there is one? Maybe your specific implementation could be improved, but it seems unlikely anyone can improve on the general technique. And no one can offer suggestions about making your code better if you don't share a good Minimal, Complete, and Verifiable example. And even if you do, questions about improving working code are usually better addressed on codereview.stackexchange.com — Peter Duniho 29 secs ago
 
4:04 PM
@syb0rg I'm hoping it's just me copying the wrong constant, or somming. From the sounds of it, that's not the case...
 
0
Q: Using JSON-LD.. Am I doing it right?

Luis GarnicaI am relatively new to extending regular JSON to JSON-LD. I am currently working on a project where our Mongo Collections will be available as open data and at the same time want to add semantic notation to those collections (sensor networks and datasets). Here is a sample of a device document th...

0
Q: Easily add Accessibility to your app as an afterthought. Yes, as an afterthought

Christopher RucinskiAccessible apps allow more users to use your app; however, it is usually an afterthought for developers, and it makes your XML layout files messy whether Accessibility was a forethought or afterthought. This hopefully-soon-to-be-a-standalone-library-but-now-part-of-another-app-that-is-not-related...

 
@jrh I can get by that definition. I was being arguably pedantic about it.
 
0
Q: ASP.Net architecture problem or memory leak?

c-sharpPlease review the following question and find flaws if there are any in the architecture (C# code). http://stackoverflow.com/questions/36311852/asp-net-applications-memory-leak-and-architecture-problems

0
Q: LINQ-to-MongoDB - Return list only when values between 2 columns match

inquisitive_oneI have a MongoDB collection. Here's a grid (excel) view of the source data. I only want to return a list if the values from "fstick" column matches the values from "sedol" column in the same collection. In the end, I want this: Here's what I've tried so far: var list1 = collection.AsQuerya...

 
4:19 PM
@CaptainObvious Uh, what?
 
@user2296177 Possibly, I don't know much LINQ either yet
I'm using pretty much vanilla C# at the moment
 
jrh
codereview.stackexchange.com/questions/134279/… I think he's missing a Finalizer, it doesn't look like the GC calls Dispose when his list goes out of scope
 
@syb0rg this should work I get the same xml out
 
@JoeWallis where does that divisor variable come from? I don't see the function taking it as parameter, nor it being declared inside the function
 
@JoeWallis What did you change?
 
4:25 PM
@syb0rg I missed one of the things you change in walk_branch, name_.text = name_text + str(val) as before it was name.text = 'Osiris_Local_Data_' + str(val)
@Phrancis Oh, I forgot to pass that to the function, it comes from the loop just before it
 
@JoeWallis Accepted by XML parser
Edit that code into the answer and you've earned yourself a checkmark
 
@JoeWallis Gotcha
 
@syb0rg Sure thing, :) But now looking back at it passing 8 variables to a function is a bit much...
 
@JoeWallis Perhaps combine name and name_text into some sort of structure?
Same with source and source_text
 
I'm going to use a dict, ;P
and add all bar node and num to it
 
4:31 PM
public static List<int> Divisible(List<int> newDivisors)
{
    var i = 0;
    foreach(var d in newDivisors) // InvalidOperationException: Collection was modified; enumeration operation may not execute
    {
        newDivisors.Add(i);
        d.Dump();
        i++;
    }
    return newDivisors;
}
 
0
Q: Converting a decimal into a fraction

Martin TuskeviciusI have written a small program that converts a decimal number into a reduced fraction representation. I also designed this little program to be fairly robust, so that it can give the correct output for various inputs. For example: > ./a.out 3,000.375 > 24003/8 > ./a.out "3 000,375" > 24003/8 > ....

 
@user2296177 see above ^^ for reference (note I didn't try your idea yet)
 
@Phrancis That's because similar to C++ (I assume), modifying the collection invalidates the iterator.
You need a separate list to add to.
 
Right
 
4:44 PM
@Phrancis This is my attempt at translating @JoeWallis code in C#, please don't hold it up too the light, I don't know much about C#; it should give you an idea though.

public static List<int> fn( List<int> divisors )
{
List<int> new_divisors = new List<int>();
foreach( int i in divisors )
{
if ( !new_divisors.Any( d => i % d == 0 ) )
{
new_divisors.Add( i );
}
}
return new_divisors;
}
Now if only I could figure out how to make it a code block...
 
15
A: Remove/Add items to/from a list while iterating it

svinjaRemoving multiple elements from a list 1 by 1 is a C# anti-pattern due to how lists are implemented. Of course, it can be done with a for loop (instead of foreach). Or it can be done by making a copy of the list. But here is why it should not be done. On a list of 100000 random integers, this ta...

 
Return IEnumerable<int> and use yield return; instead of an intermediate list
 
Ah-ha, the answer of course is LINQ
 
@user2296177 You need to paste your code block as a separate message and then click the "fixed font" button on the right
(works only for multiline messages)
 
4:47 PM
It's not LINQ -- it's just an extension method. Small difference: LINQ doesn't modify the underlying collection. Others, like IList.RemoveAll() and IList.ForEach() are just extension methods
 
I read it was suggested to try something like
        listB = listB.Where(x => x % 2 != 0).ToList();

        listB.RemoveAll(x => x % 2 == 0);
 
what is it you want to do?
 
Add / Remove elements from a List while iterating it
Was trying to replicate some Python magic called "generator comprehension"
 
no, that's how you're trying to solve it
 
the Q in LINQ stands for "Query". "Querying" objects does not involve side-effects. I'm thoroughly objecting .ForEach() and .RemoveAll().
 
4:50 PM
*braces for holy war*
 
well you have 5 more minutes for me to explain before I have to leave
so hurry if you're interested
 
So I suppose using a List<foo> is really just the wrong approach for something like this?
 
try this
 
@Phrancis I suppose you noticed you can't modify a collection while it's being iterated
 
Right
 
4:53 PM
public static List<int> Divisible(List<int> newDivisors)
{
	return newDivisors.Concat(Enumerable.Range(0, newDivisors.Count));
}
If I interpret your code correctly, that's equivalent to what you have
 
Okay. It is supposed to at some point have some operation(s) in that method/function, I was just trying to make the concept work first
 
well bottomline: you can't modify the collection you're interating
 
Would a IEnumerable make more sense then?
 
// something like this?
var copy = source.Where(x => x % 2 != 0).ToList();
foreach (var item in copy)
{
    source.Remove(item);
}
 
@Phrancis Thanks for the code formatting tip.
 

« first day (1161 days earlier)      last day (2847 days later) »