« first day (1831 days earlier)      last day (2318 days later) » 
09:00 - 22:0022:00 - 23:00

9:32 AM
morning all :-)
 
morning
 
How are you Proxy? :-)
 
 
1 hour later…
10:46 AM
Morning
 
good morning
 
Hey, milleniumbug
 
been trying to compile a simple ASP.NET Core 2.0 application yesterday
failed miserably
now I tried doing this on another machine and it seems to work flawlessly
 
Had similar issue last week... program fails on one PC, works on all others
 
I've reinstalled the SDK for 2.0 and removed all the previous versions, but MSVS2017 still can't see it, so it can't open the hello world project
building it from command line seems to work fine
 
11:03 AM
Dang. When this stuff works, it's great; when it breaks, it's an astounding pain
 
11:20 AM
hey
So I have a action connected to a Command in my VM, this action takes quite a while to run. Should I use the async await pattern, or some kind of backgroundworker / thread or similar?
it is IO that takes time (not processor)
 
If it's IO then async/await is a good choice
 
is it the full Action that should be async, or should I in the Action call a async function?
 
Making a function async changes nothing except allowing you to use await keyword inside the function
 
does that mean that in the end I will have to create my own thread or similar since the IO functions are not async?
 
well, if you are calling synchronous IO functions then yes
a lot of IO functions have their async equivalents in the .NET framework
 
11:29 AM
ok
is there any good examples?
 
so you'll be likely to be calling them instead
common convention is to have a synchronous function named Whatever and an asynchronous one named WhateverAsync
 
I'm using some kind of 3rd party stuff that lacks async stuff
 
hmmm, if it has no async, then you have no choice but to use the "old school" methods AFAIK
oh, I suppose you could use Task.Run, but that's basically an async wrapper over launching a thread
 
@milleniumbug Nothing wrong with an async wrapper over launching a thread.
 
11:44 AM
it's most likely to be simpler than using BackgroundWorker, so I'd go with that
 
Yeah, use Task.Run to fire off a thread
It's easy and clean
 
12:23 PM
Good morning :)
 
Hey, Lynn
waves from cube
 
12:42 PM
How are ya, Alex?
 
Doing all right.
Just spent an hour tracking down a problem where a string compare was failing... one of the strings had trailing space
Impossible to see in SSMS. Copied value out and saw the space
SMH
How are you, Lynn?
 
Sitting here trying to prioritize my workload.
In the process of deciding on an algorithm... perhaps the "squeakiest wheel" one?
FIFO certainly has no place here.
 
Be back shortly
 
i tend to do SJF - upper management likes high throughput
if i say oh i'm doing some big project.. they'll trail off with "and.... ?"
also my longer projects take usually much longer than sorting out things in between and delaying the longer project (which usually isn't a big problem)
 
1:08 PM
Threading never was something I grasped very easily
I just know that I my DataReceivedHandler from my serial port made it's own thread separate from the UI thread automagically
 
Doing SJF here too
Mgmt seems to notice the smaller projects more than the big ones
 
@biggidvs Are you using async event handlers?
 
I think so? That was at my old job, so I don't have the source to go back and look. @LynnCrumbling I grabbed part of that code from yours...was it async event handlers?
 
1:54 PM
For those who want a global dark theme for the web: userstyles.org/styles/31267/…
 
@biggidvs Doesn't sound terribly familiar...
 
2:12 PM
hmm i'll have to see what i have
 
Global Dark is nice but pages are semi broken i think in style:D
like this stackoverflow chat box is on a weird brown on brown kinda thing
but it certainly delivers on being dark!
 
2:32 PM
Yup, just noticed it, Maverik
Silly question... how do you remove this one theme from Chrome?
The only option seems to be reset all: support.google.com/chrome_webstore/answer/148695?hl=en
 
umm you mean global dark?
 
hmm, q: in my little application I have only one ViewModel, in the VM I have a list with objects, these objects represents a node in a network. Now I have made the nod into a Model, but should it actually be a ViewModel?
 
Yes
 
depends.. does this Node have view related stuff in it?
if yes - then it should be a viewmodel - if not.. then it sounds more like a model
 
that depends... properties in the View is bound to properties in the node
 
2:42 PM
I'm assuming you have something like this: VM.Nodes where Nodes is ObservableCollection<Node>
purists would say you need to have a NodeVM shadow Node and bind to that
I'd say do what you prefer - binding directly to model or viewmodel isn't too important - the only important bit is knowing what you're connecting with
 
as soon as you have to format data or interact with an item (aka it is not pure raw data anymore), you need a vm
 
yes - thats what I meant by view specific stuff but Julien is clearer :)
 
mm, the more I think of it I think it should be VM's..
 
but if your node only has problem domain data in it and view just happens to be binding to that directly - it's still a model.. you've merely bypassed VM layer and annoyed some purists
 
but then I have "no" model
 
2:45 PM
your vm can present the same information as your model
it usually does in some fashion
the model is the vm's source of info
 
again.. all of that is purists problem Markus - it's ok not to have model :)
(though I'd say technically you do have model.. you're just not splitting hair for the sake of pattern)
(and i'm agreeing with Julien in the event you feel confused by my statements)
i'll brb - Julien's got this anyway :)
 
:)
 
@Markus Yes you do. You can always expose a Node property on your NodeVM :-)
 
Is it ok with you guys if I don't rename my class from Node to NodeViewModel? :)
 
I remember having this discussion back in 2015 when I first started with WPF.
Same sentiment then: purists say you need a vm; you don't. Do whatever feels better and works.
 
2:54 PM
btw, is there a way to make a git mv when I rename a file in my project?
now it just renames the file, which makes it look like a new file in git
 
it should look like a rename, and keep file change history
 
If you were to expose Node as a property then you could keep all the interaction in the ViewModel just manipulating the Node. No need to rename, which in my experience has caused some issues as there are places which will still reference the "old" object name.
 
ok, next question.. now that my node is a VM, should I in it have a link to the creating VM?
for example, in my MainWindowViewModel I have some properties that can be changed during the execution of the program, like say a userName, and I want to use this in my nodes
it feels like I'm breaking a child should not know about parent rule there...
 
typically not, but if it works for the design.. then why not?
also, you can use a delegate or event or something to signal
 
You don't need to rename anything to "ViewModel" unless it is the DataContext for a view IMO
Seems like username info is part of a model class that both the main VM and the node VM consume to me
 
3:09 PM
That's a thought Bradley
 
i usually make my main window vm a singleton
that way it is easy to access from anywhere
 
mm
 
I would personally never do that
 
i think in the case of credentials..you should have some sort of application-wide credential store
your view models would access and display that info
but not hold it directly
 
but it goes back to you have to be the architect
that I would do
the credential store is basically a "model" class at that point
 
3:12 PM
also another case where singleton works well
 
but then you have to set the datacontext of the view in code?
 
Or use a service locator or DI framework
 
i always set my data contexts in code
 
Not sure why that comes into play on this one
but there's nothing wrong with doing it in code
 
While I used to follow the child shouldn't know about parent thing duplicating info.. recent move seems to go in the other direction: One source of truth
 
3:13 PM
it's just that the intelliSence stops working then
 
the truth should be at the deepest scope possible - but with credentials it could very well be at the root
 
you mean for setting up your bindings in xaml?
you can set the data type
 
everybody else accesses it through some way - be it request to be notified via event - pass a delegate in .. use a singleton / static.. whatever you choose.. but the source of truth is a single spot
(and yes DI is another good alternate which is internally doing same as long as you've configured it correctly)
 
@Julien how?
 
i'm gonna guess he's referring to d:DesignInstance / d:DataContext stuff
 
3:16 PM
tbh i dont use it that much, isn't such a big deal to me
dont remember syntax
 
though like Bradley said, i dont know how is setting datacontext in code relevant to this particular discussion
 
anyways.. gotto go for today. see ya
 
see ya
 
@Markus <DataTemplate DataType="local:MyVm"></DataTemplate>
i was thinking of DataTemplate
 
@Markus In that case use DesignData it is a blessing :-)
 
3:41 PM
With WPF, can you have a background image that's blank in some cases? I have the following; need to only set the background when a condition is met -- otherwise leave it blank
<UserControl.Background>
	<ImageBrush ImageSource="{Binding BackgroundImage}" />
</UserControl.Background>
I think I got it.... just need to change the opacity
 
use a data trigger maybe
or just have a null BackgroundImage, i think that works too
 
Yeah was worried about null
 
3:59 PM
I'd use a DataTrigger
leave background as it is and just assign it in a style via datatrigger
 
Tried setting background to null... it turns black!
 
no just leave it alone
setting background to null breaks certain things especially in themed apps
you're better off setting it to Transparent if you must - though i'd simply leave it alone
 
4:15 PM
null also breaks click events being trapped by the object if the background is clicked
 
oh yes indeed
you'll create a hole in surface with null background
 
4:29 PM
Fixed it
No background at all. Just display text at top if build var exists -- so user knows s/he is on QC
 
Added support for Stylet to PropertyChangedAnalyzers
Some mvvm framework
 
 
1 hour later…
5:42 PM
Interesting visual of different sorts for anyone interested imgur.com/gallery/voutF
 
6:29 PM
very nice geeky "image" :)
that kinda thing should be shared in a class room
 
use it as a replacement for your aquarium
 
interesting - he's doing stuff in go
 
6:45 PM
@biggidvs I approve of this message
 
My prof showed us a video from the 80s or something that looked like those visualizations. Not quite as pretty
 
7:07 PM
Can you guys look at this query and suggest improvements? It's a bit slow right now... gist.github.com/arc95/bac784c2700b49a79f11e901c651bcd4
 
omg yeah. write some damn sql
 
Hehehe!
 
that is just gross
 
The first query is fast; second a bit slow
 
argh 2-space indents :/
not used to these
 
7:09 PM
Holy fuck
 
Alex: I can't read that form :(
 
I haven't seen query syntax in about 200 years
 
use r# to make a duplicate in method chain form
Rudi is one of those directors that require 20+ years experience in WPF :)
 
im getting there lol
 
but yes - please don't write in query form.. if you want to go down that road, you're better off doing sql
 
7:11 PM
well, if there's no C#, there's no LINQ query syntax either :D
 
Cleaned up the spacing
 
return q.ToList() would be beter as return q.AsEnumerable()
 
umm no I dunno about others, but thats in comprehensible code for most part
query syntax forces you to buffer a lot of shit in your head
 
Sorry, but I did the query form for the joins I needed
 
why not just A.Join(B, x => x.AId, x => x.BId, (a, b) => new{ a.StuffFromA, b.StuffFromB})
in any case, you have r# - use it to convert the syntax
 
7:15 PM
code like that makes me appreciate not using an ORM more 😋
 
@Maverik Damn straight
I mean if you don't have 20+ year's experience in .NET Standard 2.0 too can you really call yourself a developer?
 
> makes me appreciate not using an ORM more
 
its in the name even! the . is merely a smudge
 
are you writing SQL directly or...?
 
TypeProvider in f# :)
 
7:16 PM
Also for the record I have literally never used .Join() when working with EF
 
oh wait, functional programming
 
how the hell do you join? I'm assuming you don't resort to query syntax?
 
so object-relational mapping won't be :D
 
Lazy (or .Load()'d) FK mapping works best* for our dataset / I've never found a scenario that it doesn't / If we're doing complex stuff we use Dapper
 
for a second there I got confused - I thought that was Reed's response
 
7:20 PM
Stupid question: how do you use R# to convert query syntax?
 
I tried Dapper - felt too low level and i can't justify the effort vs performance gain
Alex -> put cursor on query and it should give you suggestion?
its part of normal r# intellisense like creating member-backed properties
 
It did... just not the lightbulb
 
@Maverik wat
 
var q =
	db.Images.GroupJoin(db.ImageTags, i => i.imageId, it => it.imageId, (i, its) => new {i, its})
		.SelectMany(@t => @t.its.DefaultIfEmpty(), (@t, it) => new {@t, it})
		.GroupJoin(db.ValidTags, @t => @t.it.validTagId, vt => vt.validTagID, (@t, vts) => new {@t, vts})
		.SelectMany(@t => @t.vts.DefaultIfEmpty(),
			(@t, vt) => new {image = @t.@t.@t.i, imageTags = @t.@t.it, validTags = vt});
 
ok that i can read!
 
7:21 PM
@@@@@@@@@@@@@@@@ :O
 
Let me update the gist
 
auto vars :D
 
What in the f is GroupJoin srsly
 
Left Join
GroupJoin + SelectMany -> Left outer join
Join is inner
 
Pretty sure what I sent yesterday is still sexier & easier to understand
 
dunno what you sent yesterday but without reading i can tell he's doing two left joins
 
i really cant see myself preferring that syntax over sql
bleh~!!!
 
its more ugly right now cos of the @ spam in auto gen
(though left joins are never really pretty in linq to begin with)
 
@t.it lol
db.Images.Select(i => new { Image = i, Tags = i.ImageTags.SelectMany<ImageTag, ValidTag>(it => it.Tag) });
 
a normal human being would flatten @t.@t.@t.it before it gets that deep
 
7:24 PM
That is what I said yesterday
 
I rarely did ever anything with databases because I considered SQL to be unreadable
 
hahahaha
 
I've done my fair share of sql - mostly to know how to craft queries when i don't have linq or worse when i have to read other peoples' sql
Alex: why are you forcing evaluation with q.List() @ L20 ?
 
Ran into the error where linq seems to get confused, asks for a default c'tor: stackoverflow.com/questions/3571084/…
 
also that horrendous query needs cleaning up >.<
 
7:27 PM
hello all.
 
hello you.
 
So split the queries. But if I can get it working with the first query, it would be cleaner
 
I still don't get why this doesn't work
var allTags = db.ValidTags.AsEnumerable();
var q = db.Images.Select(i => new { image = i, tags = i.ImageTags.SelectMany(it => it.Tag), validtags = allTags });
pls 2 enlighten
Assuming .ImageTags = virtual ICollection<ImageTags> on the Image
 
My guess is you're assuming he has navigation properties which I'm assuming he doesn't
 
We may need therapy after fixing this
 
7:31 PM
Indeed, but what sort of crazy person doesn't have nav props
 
I've got nav props on this
 
no you just need to learn how to write code first models
 
So why does not wooooork
 
rudis query makes sense if you have the right model
 
7:31 PM
show us the actual models involved
this is codefirst db context right?
we obviously dont need property spam - but the PK/FK + Navigation property on model
 
Coming up...
 
while you're doing that.. i'll attempt to clean up r# generated code
 
I already did it!
 
:39594453, your example was great. Helped me a lot! Thanks again...
 
Rudi - that isn't clean up
 
Change entirely, clean up, what's the difference really?
 
oops. I guess reply to an ancient message is not working the way I supposed
 
Alex you've ruined my evening
@AnılYalçın you're fine you just put a comma straight after it - does not work
 
Sorry, Rudi :(
 
@Julien your example was great. Helped me a lot! Thanks again...
 
7:36 PM
I have that effect on people
 
@RudiVisser, thanks :)
 
@Alex I'm still not clear as to why this doesn't work with my query then
and no it's just your strange casingIsFreakingMeOut
 
Going to try yours right now...
 
yea you have the nav properties - should be able to use them
as for casing: I'm guessing he's matching sql side (reverse engineered perhaps?)
(though you don't need to - sql i case insensitive unless you made it case sensitive)
Also it's pretty late so I better move my rear
catch you guys tomorrow - hopefully simply using navigation properties will be enough :)
 
Go ahead guys. Sorry to ruin your evenings with this mess
 
7:40 PM
Bbbbyyyyyyyyyeeee Mavvy
Wait why are they partial? Are these really code first?
 
Works!
 
Yayyyy
See now we're getting somewhere
 
Second query still slow
 
sec
 
Had to make this change for one line to compile: var q = db.Images.Select(i => new { image = i, tags = i.ImageTags.SelectMany(it => it.ValidTag.ImageTags), validtags = allTags });
 
7:45 PM
That's wrong
But anyway sec
 
Don't doubt it at all!
 
Linq.cs
(Obviously I'm writing blind don't have Intellisense or whatever)
Also yea in my original code it shouldn't be .SelectMany() just .Select()
 
No worries. Fixed a few items...
Now it gives earlier error: Only parameterless constructors and initializers are supported in LINQ to Entities.
 
Ah cos of the OS
 
Trying something
This works... db.Images.AsEnumerable()....
 
7:53 PM
Yes because you're evaluating the set so it's not trying to compile it to a query, don't do that
 
Okay, removed it
 
sec
 
Got it!!!!
return db.Images
	.Include(x => x.ImageTags)
	.ToArray()
	.Select(...)
The include makes it eager fetch and fast as lightning
 
Still evaluating, but yeah, that makes a lot more sense
 
The ToArray is forcing eval
 
7:58 PM
Yes but it needs to do it at least once anyway
 
And it's fast too
 
My latest iteration wasn't much better: gist.github.com/rudiv/0451ef029085c0747cfca30b810ff39d
To get the OC it needs to get the DBset back
 
Thanks, Rudi! And sorry to ruin your evening again
 
ToList is faster than ToArray
since you're doing something that throws away the "arrayness" anyways
(one fewer copy)
 
8:00 PM
I should benchmark it, not expecting a huge difference
 
One of my problems (among many!) was, I forgot I have the nav props, so no join is needed -- that's what nav props do
 
    public class EnumerableBenchmarks
    {
        private static readonly IEnumerable<int> Source = Enumerable.Range(0, 10).ToArray();

        [Benchmark(Baseline = true)]
        public object ToList()
        {
            return Source.ToList();
        }

        [Benchmark]
        public object ToArray()
        {
            return Source.ToArray();
        }
    }
Maybe it checks for ICollection as an optimization
 
Rudi, where do I send the gift card? :)
 
Hope with your code fixing my issue, your evening goes better
I'm outta here guys
G'night
 
8:08 PM
Well it's 9pm, my all-day meeting finished an hour ago and I'm just starting my day's work so :D
G'night
 
:)
 
Yes, night is still young
We have 10-20 commits left in us in Europe.
 |  Method |      Mean |    Error |   StdDev |    Median | Scaled | ScaledSD |  Gen 0 | Allocated |
 |-------- |----------:|---------:|---------:|----------:|-------:|---------:|-------:|----------:|
 |  ToList |  98.74 ns | 1.432 ns | 1.340 ns |  98.93 ns |   1.00 |     0.00 | 0.0495 |     104 B |
 | ToArray | 112.59 ns | 2.788 ns | 6.236 ns | 110.20 ns |   1.14 |     0.06 | 0.0304 |      64 B |
 
14 nanoseconds more :o
 
ToList allocates more
 
sure, List<T> uses a backing array, and itself is an object
 
8:12 PM
yes
 
but to be faster, I haven't expected that
 
maybe the sync root?
 
no
ToArray just does the same thing as tolist
then does another copy into the array of the right size
because it doesn't know the size in advance (normally)
 
Can I swtich between display data or editable textbox in a grid style itemscontrol?
I want to make some cells editable if the value is missing
 
if you're using something that's ICollection as input, they're both effectively the same
ToList allocates more because it isn't trimming the internal arrays (which requires the extra copy, slowing it down)
in the original case, the list/array is getting thrown away anyways - so using AsEnumerable() would be better in every way (no extra allocations) - but ToList() is still better than ToArray, as you're making one less thing to GC, etc
 
8:16 PM
oh right
 
I do ToArray most of the time.
 
ToArray is really only the right option if you need an array
 
I'm not sure I ever need an array
 
or, if it's "big" and you want to trade CPU speed for the guarantee that you're not using extra memory after it's done
 
I almost never need List<T>
 
8:17 PM
but that comes at the cost of GC churn + CPU
 
IEnumerable<T>
 
Oct 20 at 16:47, by milleniumbug
also I like to pretend built-in arrays don't exist and use List<T> exclusively, but that's mostly me
 
IReadOnlyList<T>
Use IEnumerable<T> to signal lazy.
 
enumerables aren't necessarily lazy
 
We tend to use ICollection<T> and IEnumerable<T> in APIs
 
8:20 PM
@ReedCopseybut they can be, IEnumerable<T> leaves the door open to really slow code.
I like using the types to signal the difference
 
That's an interesting perspective
 
yeah - I wish there was a typed way to signal that
 
[Fast]
IEnumerable<T>
 
IReadOnlyList<T> is nice for that ime
 
On this subject, why do you think WCF generation defaults to System.Array over System.Collections.Generic.List
A case for performance, or just a bad default?
 
8:24 PM
I don't know any wcf.
 
Well pretend it's not WCF but anything else returning T[] rather than List<T>
 
Both are nasty
Unless they are meant to be mutable
Generation as in code gen?
 
Yes
 
8:49 PM
@RudiVisser I think it's more because adding elements in WCF collections is something you should think about
and arrays being "fixed length" eliminates that potential user error
 
Perhaps
 
WCF has a lot of weird crap, though -so who knows?
things like disposable not being safe to dispose
ugh
 
that is awesome!
I was bit by it
had to call close before dispose iirc
 
9:35 PM
hrmmm. seriously?
 
9:48 PM
public (string Token, string SecurityKey) Login(string username, string password);
Please throw up at your leisure
 
var up = new WTFException(); throw up;
 
Oh dear lord
star
 
speaking of auth, I'm writing ASP.NET Core for the very first time (fortunately not production code), and I'm reading up on how should I do auth
 
1.0 or 2.0?
 
9:52 PM
2.0
 
Please not 1.0
Let's just pretend it never existed
 
Deal.
 
spent two days fighting MSVS2017 to make 2.0 work
it seems there are auth frameworks which should integrate with the application, but I'm not sure which one I want to do if I want to store usernames/password hashes in a database
 
Identity?
IdentityServer? What's your end goal
 
my end goal is writing a simple backend with a REST API for a mobile app
 
9:58 PM
IdentityServer would help manage the OAuth aspect should you wish to expand in future
Or basic Identity and your own token management (but is there really a point?) would work
Other than that, I have no experience in Core. But IdSrv is nice
 
09:00 - 22:0022:00 - 23:00

« first day (1831 days earlier)      last day (2318 days later) »