« first day (2866 days earlier)      last day (2084 days later) » 
02:00 - 13:0013:00 - 23:00

1:00 PM
And dont want to be readed even by AI
MS will dont agree with me, but after I saw in Diagnostic Data Viewer parts of my private notes sent do MS i can trust no more OneNote
 
Lol duh, OneNote is a cloud notes application
 
Page notes will we in HTML, backend in C# etc.
@LeeButler No, I use local files
Its available for O365 sub
 
Why not just notepad?
Or another equivalent text editor
 
HTML is independent. Don't want make mistake again. Want connect all my notes with open and transparent document type. OneNote is great with structure and will try to recreate most important features
 
The document format is documented, so there's no reason why you couldn't make an application that can actually open OneNote notebooks
 
1:13 PM
Cuz want clean and fast solution
OneNote format isnt clean and simple
 
It's XML, I'm not sure how much cleaner you can get
 
Easy: less features
 
But then you lose features
 
@LeeButler Most importnat features will try recreate
 
That's simpler than I was expecting
 
1:24 PM
Anyone use System.Reactive and can give me a quick sanity check to make sure I'm doing what I think I'm doing, namely waiting for the value to become true?
   await  viewmodel
            .ObserveProperty(nameof(ViewModelClass.Completed))
            .Where(_ => viewmodel.Completed)
            .FirstAsync();
(ObserveProperty is a utility method we have, which simply listens to NotifyPropertyChangedEvents for the given property)
 
1:36 PM
in the Where you ignore the ObserveProperty's return value. Anyway I would do it with Subscribe.
 
That's because the PropertyChanged event args only contain the property name, not its value.
Limitation of the framework.
 
ok. I understand now. Because of this > stackoverflow.com/a/44484884/1859959 I think it will work. Tho I don't know why observables are awaitable
 
@AvnerShahar-Kashtan i feel like the decorator pattern is always a bit... lacking
 
For precisely this. If I don't want an ongoing stream of observable events but the first time that I get a match, I can await for it.
 
it adds to the hard understanding when I manually handle subscriptions, and await
 
1:41 PM
and the factory pattern is always a bit... verbose or not really well designed
 
No subscription, just a one-off wait-for-event-that-matches.
ugh.
 
nice. Now you have 1 last thing to decide, what should happen if the value is not in the toObserve. I don't know how does the framework decide, no more item coming from the INotifyPropertyChanged as source
 
Need to add a timeout.
 
after timeout FirstAsync will throw exception, I don't know if catching the TimeoutException it still throwed anyway
.Take(1) is a little bit safer if you use timeout anyway
 
I just checked in 454 items...I'm scared of what happens on the next deploy.
 
Bob
1:58 PM
 
Hi,
In an wpf application that is installed with setup project, when opening i'm get an full black screen(just windows menu with windows icon and shortcuts down the screen is shown)
The same appears when i copy the build files.
I have this on exact 1 machine which runs windows server 2008 R2.
On all other machines the same setup, code works fine.
Temporarily workaround for the problem:
1) double on click on top of the black area (toolbar area for minimize)
2) manually resize the window then the black is gone and get colours, but when i then maximize the application does'nt maximize but the
 
if the background is not set, and there is no control there, after deployment it become black for me. Before that it was grey in debug. You have to check if at least something with width=* and height=*
 
The width and height is set for the window.
It's with control <Fluent:RibbonWindow
 
if I call a web service (through http) using async and await it, does that mean that the code after it might not be executed immediately when it returns, but rather after some delay because the thread is busy doing other stuff?
 
2:24 PM
Yes. Assume the following scenario
- you have a WPF application (therefore, single threaded synchronization context)
- you have a task that takes like 10s, and you do something afterwards
- the application has a button of which click handler does an infinite loop
- you press the button
- the continuation never gets run, because the event queue never progresses, as the program is stuck in infinite loop
QED
it's not typically a problem, as people tend to not do that stuff, so the continuation will eventually run
 
I have a different thing though
I call a web service, which returns me a guid, which is a valid login token for like... 1 second or something
after which, I redirect the user of the web application to the main page with that login token
ofcourse the token must not be expired, the redirect should be immediately after the web call
is there a way to still use the async stuff or nah?
 
1s is like an eternity. If you have enough load that it takes 1s to run a continuation, you have bigger problems
 
Why would it only be valid for that short time anyway?
It should be valid for at least a few minutes if you expect the user to use it
 
@milleniumbug keep in mind that this is from Server 3 (3rd party) to Server 1 (us) to Client to Server 3
 
But depending on if you have any other operations going on while teh async operation runs, it might not come back immediately
For example
 
2:33 PM
In fact, this isn't specific to async/await. Desktop and server OSes aren't real-time, so in general you don't have guarantees that given 1s of server time, at least N microseconds are dedicated to your program
 
latency kicks in 3 times
 
var StartAsyncOp() //Returns Task<T> after 100ms
DoLongOp //Takes 2000ms
var Response = await StartAsyncOp
RemoteServerRequest(Response)
 
@milleniumbug but without async, it would run immediately after it comes back
but it would just reserve a thread for it
 
In that, although the async operation completes after 100ms, the result won't be used for 1900ms because something else is blocking it
That's obviously an extreme example because that long op shouldn't really be there, but it's a good enough example
 
in my case, there isnt any log op between it though
 
2:36 PM
Teh first line of that is wrong but you get whta I mean
 
but the thread could still be in use by a different task
 
In that case you should be fine. But you should still have a reasonable grace period
 
@Wietlol IO operation is a context switch. In a pathological example, you could have so many threads running on the server, it won't switch back to your thread in time
 
The client could lose connection between the response coming back and making the call, delaying the call
 
@milleniumbug what happened to "1s is like an eternity"?
 
2:38 PM
@Wietlol It is. Just like you won't run so many threads on the server, you don't run long running, blocking operations on the synchronization context
 
hmm
 
IOW, it's a matter of "don't aim your gun at the foot and you'll be fine"
 
but we have a special gun though
one that aims in every direction
its a... grenade
when we release, we pull out the pin
we dont know when it will blow up, but in theory, it would blow up (because, meth and infinity and shit)
i like to know all possible ways for it to blow up before I deploy them
so I carefully think about what I write
(except in SO chat, here I just mindlessly write stuff)
 
3:05 PM
This is so weird
I'm creating a WPF data grid which is bound to a Winforms data grid
 
Why the hell would you do that
Also .NET has like a hundred feet so it's a bit complicated to not aim at one.
 
I'm making a new column chooser to replace an old Winforms one which doesn't actually tell your the real column headers
 
3:23 PM
what is the opposite of IEnumerable.Zip called?
aka, [A1, B2, C3] -> pair([A, B, C], [1, 2, 3])
 
.Select ?
I'm not sure that's so easy, since you gotta do two loops actually
 
Select can do [pair(A, 1), pair(B, 2), pair(C, 3)] at best
 
Since you can only return [A, B, C] once you're completely through
 
why can you only return [A, B, C]?
you should be able to return a tuple of two IEnumerables
 
Yeah but then you'll have to enumerate two enumerables at once, which isnt really possible
althoguh...
could manually iterate the second one within the lambda of the first one
 
3:29 PM
you dont have to enumerate at once
 
good point, it's only one enumerable
damn
 
in simplistic terms, make them return a Tuple<IList<T1>, IList<T2>>
 
oh right
 
@Wietlol no such thing built-in to C#, in functional languages it's called unzip
 
can you yield return a value tuple?
input.Select(combo => (combo[0], combo[1])
Boom one enumerable becomes two in a tuple
Actually IEnumerable<(char, char)>
still not two enuemrables, but you can iterate now
 
3:31 PM
if I were to make such a thing, I'd probably make it eager and not lazy
 
does <> like tha value tuple notation?
 
@milleniumbug I would make it lazy with a cache for the other data
 
mine's lazy, if it owrks
 
hmm, memoization could work
 
the cache would be a sequence of the items that have been enumerated, but not consumed
which at worst would be the first list or the second list
there is also a much nicer approach to have it lazy, but extension methods cannot support such an approach
also, since C# doesnt allow more detailed or broader types on overridden methods, that would be horrible to deal with
 
4:12 PM
Winforms DataGridView takes so long to redraw
On our low spec test pc it takes like 2 seconds to redraw the grid
 
Need some LINQ help (or sql, it's related)
EF6 scenario.
Table Person with PersonId, Name
Table PersonModel with PersonId, ModelId, ValidFrom
How do I get the ModelId for a specific person with the highest ValidFrom?
I got something like

from model in db.PersonModel
(where model.Person.Name == SelectedName
select model.ModelId).Max()

but that'll just take the biggest ModelId. WHat if the models where inserted in random order. How do I tell it "give me hte one with the biggest ValidFrom" ?
Do I have to do two selected, one for the biggest ValidFrom and another one hwre I filter by that?
(or a subselect in the filter)
 
I'd do something like (not in the same form but you can adapt) db.PersonModel.Where(model => model.Person.Name == SelectedName).OrderBy(model => Model.ValidFrom, SortDirection.Descending).First() or something
 
oh good point, just order by the date, lol
I jsut used the from x in y select z form because I couldnt think of anything in the other form
 
Yeah I hate using that form so I always use the (extension methods?) form
 
I prefer that one too. SQL isnt supposed to be in C#.
 
4:31 PM
Damn. ok how do I translate a string into a column name?
(without reflection)
 
Uh you could try deserialising to it?
 
4:48 PM
Not sure what you mean
EF entity has column as property
I got column as string
(or I'll construct it)
or...I make a switch case with those 7 columns hardcoded...
 
I think the switch is probably the best
WPF Column chooser for a Winforms DataGridView
And yes, the text on the Winforms one is just the Column Name
 
5:04 PM
1) Why tho
2) Why not just show the columns to choose in order? Way easier than looking at the damn numbers and figuring out which one is just below the one I'm looking at.
 
Yeah they were meant to be in order but the sorting thigns didn't work properly but I'm going home now
 
Good idea, I should go home too. Bye.
 
And some of the column names were just shite, and mostly meaningless. Also the UI was ugly
And I'm just trying to shoehorn as much WPF into the winforms as I can, and gradually turn the whole thing into WPF
 
5:20 PM
Can anyone give me some arguments that argue for removing DI in code? I've always learned that DI is one of the good principles, highly coupled to IoC, but I admit that I can always learn more.
Someone at work is advocating for removing DI from our asp.net core Controllers and replacing them with opaque dependencies, instead of transparent dependencies but this seems counter-intuitive to me.
 
5:42 PM
if they're advocating for, surely they gave reasons for why they want that?
otherwise no, sounds counterintuitive too
 
The arguments given are readability, clarity, and (not completely understanding this one): knowing what type you get. With DI you don't know if it's a Singleton, Transient, or Scoped class.
I don't really get why this matters though
The problem is that the people doing it don't know why, except that the architect said so. The architect is only on-site on tuesdays and fridays unfortunately.
 
Not sure what "opaque dependencies vs transparent dependencies" mean, but if it means replacing passing parameters to the constructor with... I don't know, global variables? then it's probably garbage
 
transparent is injected in constructor, opaque is created in constructor
 
hmmm, I could imagine a circumstance when I'd want to go from one to the other, but not for the arguments listed above
 
6:00 PM
I could be wrong, but why would it matter to the consumer of your dependency which "type" (singleton, scoped, transient) it is? Isn't that best determined by 1) your configuration for your application, 2) the dependency itself?
 
that circumstance would be if your current implementation on a class relies on a specific implementation, allowing the user to inject a different one adds room for error (now, whether a design that relies on a specific implementation is a good idea is another matter - but such situations happen IRL)
 
Yeah, but we got bigger issues on this project. We're deserializing classes as other classes by accident, and nobody's really noticed until now because all properties matched.
"yeah, i didn't write that so i don't know" ad infinitum.
 
mr5
6:17 PM
I just love how Gaben said, "lakad matatag"
 
 
2 hours later…
7:53 PM
Anyone doing codding this late? How can I catch navigation in UWP app? (so I could validate global param before navigation is done)
This should be something like middleware, so this is checked globally on every navigation
 
why a project has some using statements inside namespace, others not
using System.Collections.Generic;
using System.IO;

namespace SomeNameSpace
{
using System;
using System.Linq;
using System.Windows.Documents;
 
8:22 PM
I'm trying to figure out if storing user data in the cache in MVC is a good idea. Regular user data I'm storing in the session, but in addition there are big blocks of data associated with the user that I don't want to always be hitting the database for. Is the cache better for that or is there a different solution?
 
 
1 hour later…
9:23 PM
<TextBox Name="UserNameTb">
                <TextBox.Template>
                    <ControlTemplate TargetType="{x:Bind UserNameTb}">
                        <Grid>
                            <TextBox Text="{TemplateBinding TextBox.Text}" VerticalAlignment="Center" Padding="30,3,6,5"/>
                            <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE715;"
                                      Margin="10,0,0,0"
                                      HorizontalAlignment="Left"/>
                        </Grid>
When I start typing to textbox, then cursor stays in the beginning and I can only append text
can anyone tell, what is wrong here?
 
9:40 PM
tried also with VM binding
    <TextBox Name="UserNameTb" Text="{Binding Username, Mode=TwoWay}">
        <TextBox.Template>
            <ControlTemplate >
                <Grid>
                    <TextBox Text="{Binding Username}" VerticalAlignment="Center" Padding="30,3,6,5"/>
                    <FontIcon FontFamily="Segoe MDL2 Assets" Glyph="&#xE715;"
                              Margin="10,0,0,0"
                              HorizontalAlignment="Left"/>
                </Grid>
            </ControlTemplate>
        </TextBox.Template>
 
anyone knows a programming puzzles website that is not about making the smallest or fastest code?
both are horrible criteria
 
So, just puzzles?
@Wietlol Codewars is pretty nice. It has mostly user-created puzzles tho
You do need to have your code fast enough because they don't give you too much time on their servers for computing a solution
and there are a few problems that have to do with making the code fast enough for large inputs
 
9:58 PM
it shouldnt be really slow, but they should not favour messy code because it runs faster
 
They don't favour messy code.
in fact solutions are ranked by users
with two different metrics
 
02:00 - 13:0013:00 - 23:00

« first day (2866 days earlier)      last day (2084 days later) »