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

5:00 PM
@Mat'sMug I see what you're doing, so you are using LINQ Where to query the source with an operation and put the results into a copy, then iterating the copy and modifying the source separately, right?
 
yes
 
8
A: What are C# Iterators and Generators, and how could I utilize them

Thomas LevesqueIterators are an easy way to generate a sequence of items, without having to implement IEnumerable<T>/IEnumerator<T> yourself. An iterator is a method that returns an IEnumerable<T> that you can enumerate in a foreach loop. Here's a simple example: public IEnumerable<string> GetNames() { yi...

That actually sounds a lot like what I'm trying to do^^
 
if you're not implementing IEnumerable<T>, then LINQ isn't extending your type.
 
I thought IEnumerable was just another type of collection, which would explain why it made no sense to me, now I think I get it
> When the compiler encounters an iterator block, it actually rewrites it to a state machine in a class that implements IEnumerable<T> and IEnumerator<T>. Each yield return statement in the iterator corresponds to a state in that state machine.
 
yep, that's the compiler magic behind yield
 
5:09 PM
Can you write something function-like with this? (I know this will be a dumb example and could be done more easily some other ways)
public static IEnumerable<int> Squared(int N) { yield return N * N; }
 
sure... except yeah, that's a dumb example :)
 
@Phrancis How would yield return help you there? Don't you need a loop.
 
Or something that gets the next value, I should say.
 
@user2296177 Right, it's a dumb example like I said
 
5:10 PM
As a general warning, sometimes I read the last few comments and I start talking without being in the full context, sorry everyone.
 
no worries, we all do that :)
 
@user2296177 Happens to the best of us. One trick to make this easier is to use the "reply" function to link your message to the message you are addressing
 
it's not like there was any serious site/moderation chat going on
 
So, in theory (and practice?) I could pass a collection to the iterator method, do "X" with the collection and yield return, right?
foreach(var x in GetPrimes(listOfNumbers) { ... }
 
yep
 
5:15 PM
Nice
I'm starting to really like C#
 
here, GetPrimes can yield return its results, and then they'll "stream" into the foreach loop
 
it would be nice if it also had yield! for collections
like F# has
 
it would be nice if yield return played nicely with COM interop.. had to remove all that in Rubberduck, the state machine was causing all kinds of bad things to unmanaged pointers
but yeah
 
I kinda like the FP-like style of that, any other FP-like pearls I should know about? (nothing against OOP, but sometimes functions are simpler/more adequate)
 
well, C#6 gives you expression-bodied members already
TFL/BBL
 
5:18 PM
L8er M8
 
C# is probably one of the nicest high level languages.
Definitely like it more than Java.
#nodissing
 
It Depends (TM)
 
On what?
 
Largely on what you need to do
 
Yup.
 
5:22 PM
Can I get an example guys, outside of portability.
 
Client-side I'd take C# as long as that runs on all intended platforms (which it nowadays usually does).
 
C# (and Java) can be totally overkill for things that other languages like Python can do much more simply
 
Server-side I'd probably go for Java though.
Grails.
And yes, if it can be done in Python, I'd take Python over pretty much anything.
 
Python is awesome for scripting
 
Unless it has to be stable in a production environment and running for a long while.
C++ is usually a better fit then.
And for most microcontrollers you're still stuck to C/C++ anyway, they don't Java.
They'll only Java if they run an OS already.
 
5:23 PM
Embedded development doesn't like the heap.
 
Doesn't like what heap?
 
Dynamic allocation, I mean.
 
Meh, it's simply not feasible performance wise.
But it can be done.
 
I'm not sure if C / C++ could be called "high level" languages
 
C++ is an all-round language.
 
5:25 PM
One positive thing about GC languages is that it makes atomic code much more manageable.
That's the thing about C++, it can be pretty high level.
std::vector<T> is no less high level than List<T>, I don't think.
 
@user2296177 Yes, and also scalable to tiny embedded systems.
 
Is anyone aware of DNS issues with SE right now? Asking because I can't browse the sites.
 
@Matt Seems to be working fine for me.
 
possible answer invalidation by Sam Pearson on question by Sam Pearson: codereview.stackexchange.com/posts/134124/revisions
 
sigh NuGet V3 API... Accept:application/atom+xml,application/xml does not mean return JSON
 
5:33 PM
@user2296177 Likewise working from here.
 
possible answer invalidation by CodeYogi on question by CodeYogi: codereview.stackexchange.com/posts/132727/revisions
 
yay!
Broken
void Main()
{
    int[] numbers = new int[5]{1,2,3,4,5};
    foreach(var x in Even(numbers))
    {
        Console.Write(x.ToString() + " "); // 2 4
    }
}

public static IEnumerable<int> Even(int[] numbers)
{
    foreach(var n in numbers)
    {
        if(n % 2 == 0)
            yield return n;
    }
}
 
@Phrancis That looks about right.
 
Except for the goto fail bug
 
@Mat'sMug ?
 
5:42 PM
missing braces around the if scope ;-)
 
However, why don't you remove that if() by simply generating a collection that is already multiples of 2 or divisible by 2?
 
you could use numbers.Where(n => n%2 == 0) in main rather than calling Even ;o
 
@Mat'sMug I knew someone was going to say something about that ;P
 
@user2296177 because it's a yield return learning exercise? ;-)
 
^
 
5:44 PM
Ah I see.
@Edward Have you heard about something similar to yield return in C++?
 
I wonder if coming from a SQL background, looking more into LINQ and less into core C# would be better... @Mat'sMug thoughts?
 
AFAIK you make the state machine yourself in C++
@Phrancis nope. LINQ isn't SQL
 
@user2296177 It's just "return" in C++.
 
@Mat'sMug Well, some queries look a lot like SQL, that's why I was asking
 
there's a SQL-like syntax you can use for LINQ, though usually people move to use the fluent syntax as they do more with it
 
5:46 PM
I see
 
the only time I use the query syntax (from x in foo select x.bar) is when I need an intermediate variable (e.g. let bar = x.bar) that the rest of the query needs to reuse.
query syntax compiles to method calls anyway
 
Interesting, to say the least
 
besides, understanding LINQ means understanding delegates, anonymous types, expression trees, ...there's a wealth of "core C#" knowledge wrapped up in there
 
@Mat'sMug Any good books for C#? I've heard CLR via C# from Jeffrey Richter is really good.
 
C# in Depth (Jon Skeet's) is thoroughly awesome
yet I learned my C# and .net off "Pro C# 2010 and the .NET Framework"
 
5:56 PM
An interesting discussion, on Friday? No Rebecca Black? Am I in the correct room? ^^
 
I'm doing my best to dumb down the room, but I can't do it alone!
4
 
lol
 
hur durr PHP is a good language
@Edward there i helped
the last 4 comments do make me realise it's friday though
 
@DanPantry "Is this PHP code secure?"
 
6:01 PM
I don't know nothing about no JavaScript and I don't want to, they're untrustworthy, I don't want any of my daughters using it.
6
 
quadruple negative is for 4.. what's the word for 5-uple negative?
 
pentuple
 
ah, right
 
@skiwi What? Did I miss it over lunch?
 
a pentuple negative is also known as my League of Legends teams
 
6:03 PM
@user2296177 And don't even get me started on "minifying" -- it's almost as if they're trying to be difficult to understand.
 
@Phrancis C redefined "high level"
 
C itself is "high level" compared to assembly, but definitely lower level than C#/JS et al
 
We're forgetting a lot of langues in between assembly and C: en.wikipedia.org/wiki/…
The first "high level" programming language: en.wikipedia.org/wiki/Plankalk%C3%BCl
Not even close to our definition of high level today
 
I wrote code in PL/1 back in the day.
 
There are more colons in that code sample than there are in me.
2
 
6:07 PM
It was pretty lame, indeed
 
"In a lecture in 1957 Zuse mentioned his hope that the Plankalkül "after some time as a Sleeping Beauty, will yet come to life."
Any day now, guys.
 
bwahahaha
 
0
Q: JavaScript error when deleting all Kindle highlights

KhashirI found this code online that helps users batch delete kindle highlights from the Kindle Highlights Page: (function () { var buttons = document.getElementsByName("delete&quot;); var n = buttons.length; for (var i = 0; i < n; i++) { console.log("Deleting " + i + " of " + n); buttons[i].click(); }...

-1
Q: Merge Sort, Two Languages, Same Algorithm

SamiDenaI have written a merge sort in Python and C#. Algorithm, which I also have provided, is the same, but codes are slightly different. You can find them in my repository. Explanation: we have a fixed array of int[n] that can't be mutated. We also have an array of int[k] that can be sorted, and muta...

0
Q: Integer number to word for CodeEval

Samuel.sI am trying to write a solution for a CodeEval problem that converts an integer to words. However, my solution is only 97.5% correct and I cannot figure out why. I've run many of my own test cases and I've always gotten the correct output. class TextDollarConverter { private static String...

 
6:12 PM
@user2296177 By then LISP (and a few other good ones I suppose) was out so Plankalkül must have become lost in the shuffle
 
@DanPantry those and XKCD can suck in hours and hours of your time lol
 
@Phrancis Meh, it's Friday and it's not like I was doing work anyways
 
Zak
@DanPantry I'm ahead of you ^^
user image
6
 
6:15 PM
@Zak Oh god, it's so true it hurts
I don't know much about interface design either, but:
1. I can admit I don't
2. I can tell when design is *bad*
 
Since it's a working code it might belong to codereview.stackexchange.com but then again, it's such a small piece that does it really need to be shortened? At least you could with specific start values remove the special case of 1. The title also is quite inaccurate. — Sami Kuhmonen 40 secs ago
 
@DanPantry we need to start a project where I design the interface and you code it ;P
 
I just go with my guts. if it looks right, it probably is.
 
@Zak I just sent this to the person who designs most of the interfaces in my project.¯\_(ツ)_/¯
 
Shall I assume that most of you actually enjoy having programming jobs since you are here?
 
6:21 PM
I love programming. It's just the parts of the job which aren't programming (40-50%?) that aren't so great
 
Fortunately (both for me and the unsuspecting public) most of my projects don't have any UI.
 
Meetings? CCRs?
 
@Edward That's the way to go
 
UIs are a PITA
 
@Matt Meetings suck, but the main gripe is that the business is basically a magpie
it really likes shiny things but won't let you focus on making old shiny things better because they want a new shiny thing
when they don't let you focus on old shiny things, those old shiny things rust - and that's why 50% of programming in a job sucks ^^
 
6:23 PM
what is this, UIs are !
 
I hate that.. It applies with a bunch of the stuff I do. How does that apply to a magpie?
 
@DanPantry Or as bad -- every knife turns into a Swiss Army knife.
 
Zak
@Matt I like my current job. Which happens to involve programming some of the time.
 
Only time I use UI's is with web interfaces
 
@Matt It's an urban legend that magpies steal shiny things.
 
6:24 PM
In that case, you're kinda forced to use them
 
Zak
 
maybe I like UI work only because I don't do JavaScript do it in WPF/XAML and learn a ton everytime I make a new UI.
 
@Matt If you have the time, this video also summs it up quite succinctly (and hilariously)
@Mat'sMug I like UI work, what can I say ^^
 
@Mat'sMug I don't like UI work because I have discovered that I'm much too good at producing bad ones.
 
@Mat'sMug I'll bet you never tried to make a UI with Java
 
6:26 PM
make a mock-up first, tweak the mock-up until it looks too good to be true - then implement it
@Phrancis nope. from what I've seen it's like making an all-dynamic UI in VBA. #funstuff
 
I make too much as a sysadmin to consider changing to a programming job. I also work on too many shiny things to have time to make old shiny things work better
 
@Matt Yeah, they're also really different types of job IMO. In one you play with smart slaves. in the other you are the smart slave. /s
 
@Mat'sMug: Thanks for help with the code—you didn't have to, so, much appreciated.
 
tsss.. all IT staff are smart slaves
 
I went to school for it but there was never any jobs so I started with Call Center stuff and somehow ended up here. I miss programming. I do what I can though. Scripting keeps me going.
@Mat'sMug Yep
 
6:28 PM
@Khashir hey, no problem!
 
=)
 
lol
 
Will save a huge amount of time writing my final paper =)
 
56 more rep till 15k...
I should find another question to answer
 
LOL
 
6:30 PM
Wow, a little off-topic: Microsoft have announced XBOX games will be playable through W10
That's... a big deal (xbox.com/en-GB/windows-10)
 
XB1?
 
@DanPantry I need you to draw 7 red lines.... some with green ink ....lol
 
Are they going to be limited to 30 FPS and bad resolution?
 
@Mat'sMug xbone
 
wait, so I could play Killer Instinct on my desktop?!!
 
6:31 PM
Im staying a Steam and Blizzard gamer
 
(I don't have an XB1)
 
@Mat'sMug Apparently
 
Guys, if you have the chance to, use GOG.com. They have DRM free games.
 
Slightly less than legal DRM free games..?
 
@Mat'sMug this code makes this screen, pretty verbose even after extracting some frequent GUI components
 
6:32 PM
100% legal
 
@DanPantry Meh, it's just games written via UWP that are playable on both XB1 and crappy support on Windows
Aka only 1% of all XB1 games?
 
@Phrancis be fair, at least 10% of that code (30 lines) is dedicated to reading info from a file.
 
@DanPantry They started off by being a company that added support for old games for the newer OS'.
 
@Phrancis yep. looks like WinForms generated code...
 
@JoeWallis You broke your code again on the answer lol
 
6:33 PM
this likely belongs on Code ReviewDaniel A. White 30 secs ago
 
Now they do newer games too, when possible.
 
@syb0rg facepalm
 
@DanPantry True, I should probably shove that in a FormCredentialsHelpers utility class or something
 
It's from the same company as The Witcher 3.
 
@JoeWallis I fixed it, you just have some misplaced commas and missing colons
Now to see if the parser likes it
Golden
 
6:35 PM
Really I done 'source_text' 'Y', I need to find a rock to hide under, D:<
Did I have any missing commas?
All I done was change the dicts and miss a : on all of them.
 
@JoeWallis No, no missing ones
Just extra
 
Oh ok, I'll edit it now
Thankyou
 
No no, thank you ;)
 
@Phrancis TIL how to use 's unpivot to normalize yearly fiscal budgets stored in 12 columns
it's much easier than pivot.. and gosh I wish I had known about unpivot before
 
So, @Phrancis @Zak @syb0rg and @Mast are all in for a Monopoly game after I get my version of the challenge complete?
 
6:43 PM
@EBrown you're going to destroy friendships.
lol
 
@EBrown How close are you to being done?
 
you have a UI?
 
@EBrown Bonus points for finding in-game exploits?
 
@syb0rg After I get home from work and work on it all weekend? I'll get it done. ;)
 
@Mat'sMug really... I've never used unpivot (never knew what it was for), can you show an example?
 
6:43 PM
@syb0rg I'm putting easter eggs in there.
 
// All this C# talk makes me want to do this in C++:
for( auto elem : where( container, e_predicate ) )
{
    // ...
}
 
with data as (
	select
		 ACCTID AccountId
		,FSCSYR FiscalYear
		,FSCSCURN CurrencyCode
		,FSCSDSG Designator
		,Period
		,Amount
	from [HF-FINANCE].[SMLDAT].[dbo].GLAFS
	unpivot (Amount for Period in (NETPERD1, NETPERD2, NETPERD3, NETPERD4, NETPERD5, NETPERD6,
			NETPERD7, NETPERD8, NETPERD9, NETPERD10, NETPERD11, NETPERD12,
								   NETPERD13, NETPERD14, NETPERD15)) sub
)
 
@DanPantry You can't destroy internet friendships. They're forever. :)
 
@Mat'sMug FSCSDSG?
 
yeah
I know
 
6:44 PM
@user2296177 You know that you can do that with lambdas,right?
 
NOT MY FRAKKIN SCHEMA LEAVE ME ALONE
6
 
@Edward I know it's possible, what kind of implementation are you thinking of? I haven't thought it out yet.
 
GUYS WAT DO
LADY FRIEND INVITED ME ON DATE
Stay calm
And say "yes"
Got it.
Problem solved.
 
@Mat'sMug Not yet, working on it now.
 
6:46 PM
@EBrown "Sorry babe, hanging out with the kool kids at The 2nd Monitor; it's not a bar, it's a chatroom for programmers. See you later, toots."
3
 
@user2296177 NO CANNOT DO
 
@EBrown Just "yes"? You gotta sound more excited
"Yeah!"
 
less caps?
 
@syb0rg I might have stuttered "wait, what?"
 
6:46 PM
@EBrown Didn't you already...?
 
lol
 
@skiwi Sorta, Skype date doesn't count, really.
This is in person date
I'm not ready
 
@Vogel612 ᴴᵒʷ ᵃᵇᵒᵘᵗ ᵗⁱⁿʸ ᵗᵃˡᵏ?
 
First you're being all sky for one date, now you want two? :D
 
She can sense my fear
Oh god
I'm doomed
Blocks number
 
6:48 PM
@EBrown I recommend scotch for this
 
You know the saying, if there's nothing to lose, you cannot lose nothing?
 
@syb0rg Yes, but I'm fresh out.
And the store is too far away, I'd never make it to work in time. Not to mention work has rules about having alcohol on premises (even in your car).
 
@EBrown vodka works too, in a pinch
 
I'll drink the scotch -- you enjoy your date. Problem solved!
6
 
@Phrancis I only have gin. And no tonic to go with.
 
6:49 PM
Pfft, straight gin is plenty fine
 
@EBrown Sure, just give us a warning in advance so we know whether we'll be there.
 
Agreed ^^^
I imagine gameplay might be slow too
 
@Mast Definitely. We'll all have to agree on a set day/time to do it.
Much excite.
 
@Edward That changes the original sequence though, right?
 
I'd definately recommend a player dropout option, just in case
 
6:50 PM
Will it be like, console-based Monopoly?
 
@EBrown That's madness. Most jobs I've been on have alcohol on the premises, just strict rules about when they can and can't be consumed.
 
"All work perfect" - if you need feedback on code - Code Review may be better place (check they guidance first). Otherwise SO question requires some concrete problem to be on-topic. — Alexei Levenkov 19 secs ago
 
@Mast I'm not even allowed to have it in my trunk. (Not saying that stops me, but it's technically the rules.)
@Phrancis Nah, actual GUI.
 
@EBrown Wait, so your girlfriend now only lives in Skype, and this one is real?
 
@user2296177 "changes the sequence" -- er, which thing? Drinking scotch or std::transform?
 
6:51 PM
You guys make me thirsty.
 
@skiwi No, she's real, just lives ~1 hour drive away. And our schedules make things difficult.
 
By the sounds of this that Monopoly game will be more DUI than GUI, or rather MUI
 
Good old childhood days of Monopoly on NES
 
But, both of us are free every morning next week, so things.
 
6:52 PM
@Phrancis who the F was Gertrude???
 
@Edward Hard alcohol makes me dream, I might have been a shaman in a past life.... std::transform, as its name implies. I was thinking of simply going through a sequence without making any copies where the iterators used internally don't return elements that don't fit a predicate.
 
@Mat'sMug One of the selectable characters. It was the 80's, things were strange back then
 
my gramma didn't play NES
 
@JoeWallis Is set_parent_count() ever used?
 
@EBrown Make sure you have a fat stack of 20$ bills that you pull out (they need to be folded and held by a clip) when you need to pay.
 
6:53 PM
BTW.QueryOffSchemaFromHell
 
@syb0rg No, I thought I removed that...
 
@user2296177 I carry $1500 in 13 $100 bills, and 10 $20 bills with me everywhere. Lol
 
I only ever carry plastic
 
D:
 
6:55 PM
lol
 
@JoeWallis I think it's still there haha
 
@EBrown Be careful with what you reveal, @Mat'sMug didn't get his name from a piece of pottery, his old name was Mugger Mat.
 
@user2296177 Oh snap.
 
Maude is kind of hot for an 8-bit character
11
 
@syb0rg Check again my dear friend, ;p
 
6:56 PM
@Phrancis It's the fiery eyes, isn't it?
 
@JoeWallis You ninja-editor you
 
@Mast Something like that
 
@syb0rg 7th times the charm, ;P
 
takes a look at the starwall
Yup, definitely Friday.
 
Definitely Friday.
 
6:57 PM
@Mast Girls and alcohol
 
I really don't want to go to work today.
 
And Dilbert
 
Someone convince me to not go.
 
@EBrown Don't go
 
@EBrown Don't go. Finish your Monopoly first.
 
6:58 PM
Did I convince you?
 
@EBrown There's plenty of homeless shelters.
 
None of those are convincing.
 
@EBrown Really don't go.
 
You guys are terrible at this.
3
 
You could die on your way to work
 
6:58 PM
I'm just calling lady friend.
 
Then you won't be able to go on this date of yours
 
She'll convince me.
@syb0rg DON'T SAY THAT
 
She'll convince you to go.
 
@Mast Probably.
 
So that sounds like a lousy idea, calling her.
 
6:59 PM
I think he's already convinced, he's just playing hard to get with himself.
 
"Come hang out with me instead! We can go to the concert together!" "Who's playing?" "Zedd." "Work called, they need me now."
 
You could also die when programming
Like programming & driving or something like that
 
That's a bad combination.
Programming is less dangerous than driving though.
 

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