Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
HoboMan
Nov 4, 2010

Bloody in another thread posted:

select, where, aggregate are map, filter, fold

btw, thanks for the linq rosetta stone. i couldn't see past the weird sql-like names and i actually am using it now that i understand what it is.

also got to actually write some c# logic today and it feels so good. (gently caress javascript)

Adbot
ADBOT LOVES YOU

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

HoboMan posted:

btw, thanks for the linq rosetta stone. i couldn't see past the weird sql-like names and i actually am using it now that i understand what it is.

also got to actually write some c# logic today and it feels so good. (gently caress javascript)

protip: remember to use the aggregate overload that takes an initial value or it'll runtime exception on your rear end at the first empty sequence

protip2: as soon as you go "drat none of the standard methods do exactly what I want", go write it yourself, it's really easy. 90% chance it'll be FirstOrElse or DoForAll

Bloody
Mar 3, 2013

what is doforall and how does FirstOrElse differ from firstordefault

Chamook
Nov 17, 2006

wheeeeeeeeeeeeee
FirstorElse would let you specify a value instead of the default one.

DoForAll would call an action for each item in the list.

I presume, at least.

Breakfast All Day
Oct 21, 2004

Valeyard posted:

On a call with a business user, we were showing him our JIRA. First thing he asks; can I export this (the backlog) to excel

lol

(you can)

"can i export this to excel" means "im going to type things into excel and expect it to cause things to happen in the outside world, because im a fucker who thinks its acceptable to have no idea how the tools crucial to getting my jobs done work, like if i thought cars ran on happy thoughts so felt justified in chewing out the dealer every time i ran out of gas on the side of the road"

Breakfast All Day
Oct 21, 2004

excel exports: not even once

Breakfast All Day
Oct 21, 2004

the only acceptable response to "can i export this to excel" is "yes, in the sense you can also advocate for the genocide of minorities. it is an option available to you as a sentient being"

HoboMan
Nov 4, 2010

Breakfast All Day posted:

i'm a fucker who thinks its acceptable to have no idea how the tools crucial to getting my jobs done work

same

Finster Dexter
Oct 20, 2014

Beyond is Finster's mad vision of Earth transformed.

Chamook posted:

FirstorElse would let you specify a value instead of the default one.

DoForAll would call an action for each item in the list.

I presume, at least.

LINQ already has DoForAll in the form of the ForEach extension method.

Bloody
Mar 3, 2013

just gotta go with AsParallel().ForAll()

HoboMan
Nov 4, 2010

ok
imagine typing out
C# code:
dataSet.Tables[0].Rows[0]["X"] 
literally 100+ times for different X without instead first doing
C# code:
var data = dataSet.Tables[0].Rows[0];
that is what whoever wrote this file did

HoboMan fucked around with this message at 23:02 on May 25, 2016

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

HoboMan posted:

ok
imagine typing out
C# code:
dataSet.Tables[0].Rows[0]["X"] 
literally 100+ times for different X without instead first doing
C# code:
var data = dataSet.Tables[0].Rows[0];
that is what whoever wrote this file did

i am more concerned that they choose to write it 100 times instead of putting it in a loop

raminasi
Jan 25, 2005

a last drink with no ice

Finster Dexter posted:

LINQ already has DoForAll in the form of the ForEach extension method.

only works on List<T>, not IEnumerable<T>

Bloody
Mar 3, 2013

garbage-nn is now definitely capable of learning it just is either really slow at it or i had a piece of my training set generation hosed up or something idk. with some liberal reinterpretation of the book i've gotten a 65% success rate on digit recognition and rising as i type. go lil garbage-nn go!

70%! its going!

HoboMan
Nov 4, 2010

MALE SHOEGAZE posted:

i am more concerned that they choose to write it 100 times instead of putting it in a loop

it's a bunch of this
C# code:
var someObject = (<objectType>)dataSet.Tables[0].Rows[0]["X"];
with differing object types for different X.

HoboMan
Nov 4, 2010

wait, how is this theoretical DoForAll you guys have been talking about different from Select()?

Bloody
Mar 3, 2013

Select is pure, DoForAll is probably intended to have side effects

Asymmetrikon
Oct 30, 2009

I believe you're a big dork!
What's the use case for "DoForAll" over consuming the enumerable in a foreach?

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

HoboMan posted:

wait, how is this theoretical DoForAll you guys have been talking about different from Select()?

i dont know linq but id guess select returns the list and forall does not return anything

gonadic io
Feb 16, 2011

>>=
you are really really not supposed to have side-effects in a Select

this is why ForEach doesn't actually exist. it's not an oversight by the devs, it's "lol lazy side-effects. let's at least try to keep them away from people"

use a for each loop because it is strict. lazy side effects are almost certainly not what you want.

gonadic io
Feb 16, 2011

>>=
just the smallest point: any exceptions thrown in a lazy list will probably escape a try/catch block

they throw when they get evaluated and if that's not inside the block then whoooooops gently caress you

and that's just language semantics and doesnt even touch on confusing behaviour when you try to actually do things with them. don't use ForEach people.

raminasi
Jan 25, 2005

a last drink with no ice

gonadic io posted:

just the smallest point: any exceptions thrown in a lazy list will probably escape a try/catch block

they throw when they get evaluated and if that's not inside the block then whoooooops gently caress you

and that's just language semantics and doesnt even touch on confusing behaviour when you try to actually do things with them. don't use ForEach people.

that's actually not a problem with ForEach, because again, it's an extension of List<T>, not IEnumerable<T>

but yeah don't put side effects in anything lazy, debugging that is a nightmare

gonadic io
Feb 16, 2011

>>=
oh i forgot that Lists are not lazy but IEnumerables are. my bad. everything i said doesn't apply to strict collections (but then chaining map and filter etc together are worse on strict collections soooo)

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
logback and slf4j both seem really cool. does that mean I'm correctly doing the java?

Shaggar
Apr 26, 2006
yeah they're kind of the current standard for java logging and there are slf4j bridges you can use to replace stuff like jcl or log4j if other dependencies were using them.

JewKiller 3000
Nov 28, 2006

by Lowtax

pokeyman posted:

logback and slf4j both seem really cool. does that mean I'm correctly doing the java?

yes

MrMoo
Sep 14, 2000

log4j2 even better, do stupid poo poo like colour highlighting.
code:
<PatternLayout pattern="%highlight{%d %-5p [%t] %c{1}(%F:%L): 
%m%n%throwable}{FATAL=magenta, ERROR=red, WARN=yellow, INFO=green, DEBUG=cyan, TRACE=blue}"/>

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

MrMoo posted:

log4j2 even better, do stupid poo poo like colour highlighting.
code:

<PatternLayout pattern="%highlight{%d %-5p [%t] %c{1}(%F:%L): 
%m%n%throwable}{FATAL=magenta, ERROR=red, WARN=yellow, INFO=green, DEBUG=cyan, TRACE=blue}"/>

yikes

raminasi
Jan 25, 2005

a last drink with no ice
oh gently caress i need a job

poo poo i dunno how to get a real job

Progressive JPEG
Feb 19, 2003

Breakfast All Day posted:

the only acceptable response to "can i export this to excel" is "yes, in the sense you can also advocate for the genocide of minorities. it is an option available to you as a sentient being"

this is also a good go-to response for interview questions

distortion park
Apr 25, 2011


Breakfast All Day posted:

"can i export this to excel" means "im going to type things into excel and expect it to cause things to happen in the outside world, because im a fucker who thinks its acceptable to have no idea how the tools crucial to getting my jobs done work, like if i thought cars ran on happy thoughts so felt justified in chewing out the dealer every time i ran out of gas on the side of the road"

distortion park
Apr 25, 2011


I helped export all our help files to word for someone so that he could "review" them and woops! now all the edits are in word and we're just delivering a big fat word file instead of the old contextual help

GameCube
Nov 21, 2006

resharper seems neat but there sure is a lot of overlap between its features and vs2015's. all i want is the drat code coverage and now i've got this thing offering to fix every god drat line in my solution

GameCube
Nov 21, 2006

also for some loving reason i can't type semicolons now :pwn: that is a problem

cinci zoo sniper
Mar 15, 2013




GameCube posted:

also for some loving reason i can't type semicolons now :pwn: that is a problem
time to switch to python :smug:

DONT THREAD ON ME
Oct 1, 2002

by Nyc_Tattoo
Floss Finder

GameCube posted:

also for some loving reason i can't type semicolons now :pwn: that is a problem

time for your semicolonoscopy

Stringent
Dec 22, 2004


image text goes here

MALE SHOEGAZE posted:

time for your semicolonoscopy

seek counselling

quiggy
Aug 7, 2010

[in Russian] Oof.


GameCube posted:

also for some loving reason i can't type semicolons now :pwn: that is a problem

here you go

;

just copy/paste that as needed :v:

cinci zoo sniper
Mar 15, 2013




Notorious QIG posted:

here you go

;

just copy/paste that as needed :v:

Adbot
ADBOT LOVES YOU

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

GameCube posted:

resharper seems neat but there sure is a lot of overlap between its features and vs2015's. all i want is the drat code coverage and now i've got this thing offering to fix every god drat line in my solution

resharper is massively overhyped and this gets even worse as vs integrates the genuinely useful pieces

  • Locked thread