« first day (1726 days earlier)      last day (2423 days later) » 
06:00 - 19:0019:00 - 00:00

06:11
Hi! I'm experiencing a lot of UnmanagedMemoryStream objects and found this stackoverflow.com/questions/31452443/…
Anyone else having experienced issue with UnmanagedMemoryStream related to FontFamily attributes and relative paths? The link in the question is dead so I have no way of trying the project that would reproduce the bug. The question seems to be using an absolute path to a font in the FontFamily attribute, but that is the suggested workaround. I'm confused.
 
1 hour later…
07:30
Morning
Avner is the expert on the WPF memory leaks.
On producing them, anyway.
That's what Magnus is looking for a way to reproduce the fonts leak :)
Let me see if I can remember the specifics of our leak, @MagnusLindhe, and see if you can use that reproduce your own.
> focus bugs with higher impact
07:38
We had a TextBlock with a Style. The Style had a binding to its own Inlines collection to check when it was empty, and a trigger on that property:
<Setter Property="Tag" Value="{Binding Inlines.Count, RelativeSource={RelativeSource Mode=Self}}" />
 <MultiTrigger>
        <MultiTrigger.Conditions>
          <Condition Property="Tag" Value="0" />
          <Condition Property="Text" Value="" />
        </MultiTrigger.Conditions>
        <Setter Property="Visibility" Value="Collapsed" />
      </MultiTrigger>
And apparently, this binding to Self from the global Style object (set with StaticResource) caused the Style instance to keep a reference to every single TextBlock instance that was linked to it.
I'm not sure I am actually seeing the FontFamily leek in my application. I do however see lots of UnmanagedMemoryStream objects being created. 40K objects in 40 min
Are you setting the PackUrl for the font directly in your property setter?
Or are you setting it once in a resource dictionary somewhere, and just having a TextBlock refer to the STaticResource?
StaticResource on Window.FontFamily and TextElement.FontFamily (on Window)
From VS mem profiler I can se that the root is HybridDictionary <0x3427788> [Static variable MS.Internal.IO.Packaging.PreloadedPackages._packagePairs] which in turn has references to all loaded resource dictionaries.
One or more PackagePart has huge lists of UnmanagedMemoryStream objects. Probably streams to the embedded resources.
I found the StackOverflow question about UnmanagedMemoryStream and FontFamily but I have not confirmed this is the cause for the leak i'm seeing. There can be other root causes to not closing those streams.
I'm not as concerned about the streams not being closed (which is still a problem, of course) and more about the problem of there being many of them in the first place. The font should only be loaded once. Maybe you need to set x:Shared or something on the original resource dictionary? Maybe the resource dictionary it's in is loaded multiple types? We had that a while ago.
Views merging ResourceDictionaries, which in turn merged more ResourceDictionaries. We ended up with some of the core style XAMLs being loaded >150 times.
08:01
Found a useful shortcut in VS: Ctrl + Shift + Enter = goes to a new line without breaking the current one. Anyone using it? I love it.
 
1 hour later…
09:18
I think I will go over all 181 resource parts and look at the requestedStreams field to find which part is hold reference to all the allocated streams.
 
2 hours later…
11:26
I want to do the opposite of TemplateBinding, bind a property on the control to elements of the template
@JohanLarsson Can you do TemlateBinding with OneWayToSource?
don't think TemplateBinding supports it
How about control triggers?
Can you trigger on a property changed inside the control template, and set a value on the control?
11:41
I'll flesh out my issue a bit, hold on
Hacking on the gauges
    <ControlTemplate x:Key="VerticalTemplate"
                        TargetType="{x:Type gauges:LinearGauge}">
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <gauges:LinearTextBar Margin="2,0"
                                    Padding="0,0.5"
A template can look like ^
I'm rewriting things so that the different tickbars renders outside bounds and have a public Thickness Overflow { get } DP with how much they rendered outside
Got really messy aligning stuff when measuring so that the ticks fit inside bounds
Now I want to aggregate the overflows into a ContentOverflow property for the gauge
That would be the max of thge overflows and idea is to use it as a margin in the control template for the gauge so that the gauge itself does not render outside
Dunno if the above can be parsed
I'm prototyping with bubbling events now, set a temp to zero first thing in MeasureOverrideand update ContentOverflow after ArrangeOverride
Hi all
Can someone access a web site through a spoofed URL?
What do you mean by spoofed?
If I take your IP address, add it to my own DNS server, and then access your site through www.myurl.com instead of www.yoururl.com?
Here's the scenario: we need to determine if a user is coming from internal network or from outside. We can't use the IP address because of a load balancer that gives everyone an internal IP
Is there another way to check where the user is coming from? Such as the user's domain?
12:12
@JohanLarsson do you have a picture of a gauge?
There are two pieces of data that HTTP provides. The client's IP address (unreliable, as you say, as it can at most tell you his company/location), and the Referer(sic), which is the site that redirected him to you (also easily spoofable).
@NovitchiS There is the default style, intentionally kept boring
here is the commit adding the ContentOverflow property, gonna keep it like this until something better comes up.
It gets messy aligning things when ticks have widths and stroke thicknesses etc. And texts have orientation.
@biggidvs this will most likely be wrong (i'm catching up so don't know if somebody pointed it out) -- the endian bits are reversed per group (DWORD QWORD) and even within that group they're not serial
@AvnerShahar-Kashtan Thanks, Avner
12:23
If you have a firewall set up for external connections, you could perhaps have it add a header to each request.
Interestingly enough, the load balancer sends external requests to one internal IP while internal requests to a different one. That can help in this situation. Need to test and see what happens
mav, not sure what you meant by that...but i think i got it taken care of
there are only certain parts of the messages i'm pulling out, so i'm just grabbing the second first, then the first part second and going with that.
keeps from having to use bitconverters and what not
ok
well endianess has been confusing me for a while too - i have to read up on it each time
yea i don't 100% understand it. all i know is my stuff is being sent big endian and my computer interprets little endian
(as do most pcs)
we can thank intel for that
12:37
yup
so now that i'm working with byte arrays, having a small issue
for my tempbuffer that keeps the messages if there is a partial, how do you append a byte array to another byte array?
increasing addresses →
… 0Bh 0Ah 0Dh 0Ch … <-- this is what i was thinking
i got it
tmpBuffer = tmpBuffer.Concat(buffer).ToArray();
but thats not little or big.. thats middle endian :)
yup
0Ch 0Dh 0Ah 0Bh is what ours is
and it should be 0Ah 0Bh 0Ch 0Dh
well you're using mixed too
12:39
so i'm just grabbing the back 2 first, then the front 2 and filtering through a switch statement (would have to anyways)
i figured that was faster
just grabbing bytes and switch statement vs bitconvters and appending bytes then switching anyways
you could just XOR 2nd & 4th around
to swap them
true. but thing is, the 1st and 2nd byte have different meanings (if that makes sense) so for example i have a 2 byte part of the message that indicates thermal throttling
the first byte is current temp, the second is a bit that's set if throttling occurs
so i need both those pieces to figure out if it's happening, but i can pull them apart anyways
nod
well like you said, you've got this sorted already :) so I'll leave the fanciness aside :D
so for me to combine them is ok, but i have to switch off the first byte, then the second anyways
12:45
so for my engineering mind, the thing that makes most sense is just to grab them into 2 separate bytes and switch them separatly?
its your mind.. if that makes sense.. go for it :)
thats exactly how i did my GUID translation
stackoverflow.com/questions/8064648/net-native-guid-conversion/… <- thats where i had the same issue of endianess
yup, that's what i'm doing. seems most efficient since i'll have to combine then essentially split anywyas
also, check skype
:) this windows doesn't load skype on its own
13:06
is there a way to check the byte array for a start marker followed by an end marker instead of just checking to see if both exist?
umm there's always a way
you can always just run through array and set flags
SkipWhile/TakeWhile combo will do exactly that kinda thing -- it'll return empty array if there's no start marker
i know there's usually a way
;)
it'll return last element if there was no finish marker
so if my start is 01 and my end is 09 do a skipwhile != 01 then do a takewhile != 09?
13:10
then what happens if the takewhile doesn't hit 09?
it'll keep going until the end -- as i said it'll return last element of source if there's no end marker :)
you can counter that by adding a threshold to mix
but i'd like to know if there is no end marker
.SkipWhile().TakeWhile().Take(MaxElements)
you have to have some logic to figure that out
i dont know what that is for you
by law, america has no required vacation for employees?
true
13:17
As far as I know there's no federal law, but there might be laws in specific states, counties or cities.
wow
that kind of sucks
there's really not avner
my company isn't required to give me paid time off
i don't know that they're required for paid maternity leave or anythign like that either
that kind of sucks
also my company
can fire anyone at anytime without reason
or telling you the reason
but that also flips for the employees. we can quit at any second without notice or reason and just walk out the door
This I know is different in some states:
At-will employment is a term used in U.S. labor law for contractual relationships in which an employee can be dismissed by an employer for any reason (that is, without having to establish "just cause" for termination), and without warning. When an employee is acknowledged as being hired "at will", courts deny the employee any claim for loss resulting from the dismissal. The rule is justified by its proponents on the basis that an employee may be similarly entitled to leave his or her job without reason or warning. In contrast, the practice is seen as unjust by those who view the employment ...
13:25
yeah that is good and bad... here you have a period, usually around a month after you quit, or are give a resignation
13:40
@Proxy True, but we've never known anything else. "You can't miss what you've never had?"
Most private employers provide 2-4 weeks of vacation time a year, depending on tenure.
The public sector often does more.
So i hooked one of these up last night...oh man they're awesome
will relink
Huh. Packets over power lines.
well hope you guys dont find jobs in the UK then.. you might get sick!
25 holdays (20days base +1 for each year of service up to 5 max) + public holidays + other kinds of paid leaves that i'm not allowed to avail >.>
(i find that a remanent of the old world where you were expected to have kids to get leaves and benefits)
(as far as i know - employers aren't required to offer paid leaves on public holidays - but i don't know any employer who has deducted it from my annual leaves)
the only time i've had christmas deducted was in one stingy company where taking a day off before or after public holiday meant you had it all booked as annual leave
fortunately my current employer is friggin awesome about it
its 25.. working days of holidays.. weekends / public holidays aren't counted
one of the many reasons i don't feel like moving to another company :)
</holiday-monologue>
13:59
uk seems to be fine then :D
<Insert half-assed joke about Brexit coming to save Englishmen from EU-mandated vacation days>
14:13
^
i can't tell you the number of "Happy Original Brexit" memes I saw on the 4th of July
14:24
@Maverik on the takewhile, is there a way to have it place that byte in the output as well? seems like it's chopping it off right now
14:51
anyone here an RX pro?
crickets chirp
yay for severe thunderstorms. everyone save their work!!!!!
Not I, says I, Julien
..they're not even supposed to hit for a while haha
Stupid load balancer. Gives all web traffic the same IP
Lynn, I bought a discounted Chromecast
Connected it to TV. Hoped I could see iPad/iPhone screen on TV... nope. Only for Android devices
So not sure whether to hold on to it or return it
15:00
bahhhh
i have code that i barely understand that works
but now i need to change it. lol
@biggidvs Run for your lives! It's the end of the world
:)
@Julien Time to learn it. Had to do that with the mixed auth library I used
So much customization
Julien...story of my life!
...literally
            var searchControlChanged = searchControlVm.WhenAnyPropertyChanged();
            var searchFilter = searchControlChanged
                                .Throttle(TimeSpan.FromMilliseconds(150))
                                .StartWith(searchControlVm)
                                .Select(SearchControlFilter);
Yeesh, Julien.
That looks gnarly
Any documentation on this?
its dynamic data but it's using RX
searchControlVm is my view model for a little search panel
15:03
Wish I'd used RX last year with WPF
it triggers the SearchControlFilter method whenever a property changes in my searchControlVm
however, my search control vm has some observablecollections, and i want to trigger a filter when the collection changes
Nice
unfortunately the collection change event isnt a property change event
Hmm. Remember running into that, trying to detect when a collection changed
Can you have a property that gets set when collection changes?
lol, sure, i could put in an int, and just do int++ whenever i want to trigger something
15:05
Ugly
Kludgy but if it works...
Julien, is this similar to what you're trying to do? stackoverflow.com/questions/4725179/…
um. i have no idea
easy way to do #define in c#? ;)
15:24
so i have my DataReceivedHandler call my manipulation function. However (this may be what Kevin was hinting at yesterday) it gets part, then calls the parse function, but breaks the parse function if it gets more after the buffer updates again and cases some havoc in the parsing process...is there a way to stop that?
is there a way to unsub from the datareceived handler while parsing then resub at the end?
i'm ok losing data. i'm getting updates fast enough that i'll be able to just pick up later. it's a continuous stream and i'll be multiple messages/second so the user won't notice at all
When you guys want to display a PDF from c# and also allow download/printing/emailing, what library do you use? Seeing this library: github.com/pvginkel/PdfViewer
16:33
err.... #define?
oh, apparently you need to let the compiler do it
SATA III = Serial ATA-600, right?
16:58
if you are trying to #define for Macros... just don't
Can't you only call the Parse function after a full packet?
was going to do it for constants
as for the parse function, i know my header size and i'm calculating checksum, if it comes back weird, i'm dumping and just getting a new packet for now
but even then, if it gets called while parsing, it upsets the data a bit
so i didn't knwo if there's a way to unsub to leave the parse function alone until it's done?
You can always -= but it seems like the wrong answer
And constants are usually just const members of a class
how would you handle it then? the code seems to jump around a bit if the datahandler fires while manipulating the data around
<RadioButton Content="BACK" Style="{StaticResource {x:Type ToggleButton}}" />
if you are using MaterialDesign, the toggle button gets styled
how can i make it ignore MaterialDesign and give me stock toggle button ?
17:15
@Alex i gotta say: the whole idea of treating differently based off IPs is stupid - this is a disaster waiting to happen via spoofed IPs
sorry for the #nofilter there
i like no filter mav
@Julien change it to SourceList and roll from there?
@BradleyDotNET i would only unsub if i got a full message.
@Kevin yes
@biggidvs you can learn lock :)
i could
how works?
17:19
@Maverik ok if i make them SourceList, i can do
var collectionChanged = searchControlVm.MyCollection.CountChanged;
lock is a construct in c# that ensures only one thread at a time can do the stuff inside lock
how do i merge searchControlChanged and collectionChanged ?
You could Julien - but considering you're doing filters.. why bother with count changed
just expose a filtered list off the SourceList
it'll autoupdate as the list updates
they're both IObservables i'm guessing .. so .Merge them ? :)
i understand like 5% of what you just said
`just expose a filtered list off the SourceList`
you're the one who sent me into dynamic data world properly.. and now you're not understanding what i'm saying? :D
17:21
expose it to what
what would the filtered list contain
expose to View
whatever you've filtered it to?
this has nothign to do with the view
i need my dd filter method to trigger
so how would i go about locking that thread?
biggi - read
this isn't a chat topic.. too big.. multithreading in c# <- look that up
Julien: i don't have enough code to suggest something concrete
going off your code:

var searchControlChanged = searchControlVm.WhenAnyPropertyChanged();
            var searchFilter = searchControlChanged
                                .Throttle(TimeSpan.FromMilliseconds(150))
                                .StartWith(searchControlVm)
                                .Select(SearchControlFilter);
how do you merge IObservables?
right. so now we also have var collectionChanged = searchControlVm.MyCollection.CountChanged;
17:24
i'd throw searchControlChanged.Concat(ObservableCollection/SourceList changelist). rest of the stuff
i'm slightly confused if this should be .Concat or .Merge -- but one or the other should do it
@Maverik Agree! No arguments here
And no need for a filter, Maverik :)
Julien: Merge sounds right here
         var merge = searchControlChanged.Merge(collectionChanged);
type arguments cannot be inferred from usage
one is IObservable<int> and the other is IObservable<TSearchControlVm>
you can do Observable.Merge<object>(first, other)
the int guy might need .Select(x => (object)x) for it to compile
cant convert from IObservable<TSearchControlVm> to IObservable<object>
17:29
take it for a select (object) dance then
if you don't need the values you can do .Select(_ => Unit.Default) on both
ok that works and resharper does this
var merge = searchControlChanged.Select(x => (object)x).Merge(collectionChanged.Select(x => (object)x));
indeed Unit.Default will fix your ailments
lol that just breaks my .Select now
lovely
this stuff is so far beyond me ><
ok ignore the merge
just duplicate the logic
Rx stuff is generally like any other linq.. highly contextual and only the developer in front of code can give the best answer
yeah i have no idea what i'm doing. this is the signature for my filter method
protected virtual Func<TPgItem, bool> SearchControlFilter(TSearchControlVm searchControlVm)
but now it wants me to change the arg to an object
to match the IObservable type
17:33
of course :D
but i need that vm ><
@Alex You got one of the $25 units?
I prefer merge as not extension invocation most of the time, think it reads better
can't help - theres just too much missing contextual information unfortunately
but same thing
17:34
@LynnCrumbling Yup
It's okay. But I could already connect Youtube to my TV without this
but i'd say if you're not comfortable with Rx - take the longer route
duplicate your logic
And I don't have Netflix or HBO, so what's the use?
you can always refactor later and improve
i have no idea how to write this without RX
its all tied so heavily into DD
i'm not saying avoid Rx - I'm saying write more code that chains of the SourceList and feeds you the item you need
most of it will be duplicate code from your existing one
17:37
the vm is the only item i need
@LynnCrumbling What do you do with your Chromecast?
i just need collection changes to trigger this code path
sigh..
i wish we could swap places
1) Our tv isn't a smart tv (so I can't stream youtube without it), and 2) I watched s1 e1 of game of thrones on hbo last night, and it was beautiful
like "here take my spot and let me see the screen while you sort my work" xD
17:38
@LynnCrumbling Yeah, that would make it worthwhile. But I don't have any streaming services
plus we use Plex :)
Nice!
Dang. You guys are so far ahead of me on tech!
Lynn, you have an HTPC that you store your Plex server on?
poke at something until it works, i always say
var merge = searchControlChanged.CombineLatest(searchControlVm.SelectedCategories.CountChanged, (arg1, arg2) => searchControlVm);
so i guess the idea is you can provide any number of observables, and combine the data behind them into a custom class that you feed your filter
17:55
@biggidvs If you are having timing issues there I would strongly consider going down the producer/consumer route I mentioned earlier
@biggidvs I have a NAS that hosts the content, and my workstation runs Plex
i just had an issue with the datareceived firing again. i've locked the thread while i'm manipulating data and i think that might help
Lynn, nice! I have a small Pentium Anniversary PC with an RX460 in it for my HTPC that runs my server with a bunch of WD Green HDDs
its not a bad plan; but you want to avoid locking when possible (deadlock, general performance degredation, etc)
yea, with the serial stuff being on a separate thread from the UI, it doesn't feel too bad
@biggidvs There's a 4tb wd red in my very near future
17:57
Why red
?
greens are cheaper
red are for nas tho
so depends what you want to do
Might want to google that
Looks like Reds are cheaper to me
Lemme know if you find data that disagrees
ok i swaer this question has been asked before, and there are tons of hits on google, but nothing seems to work
how the f do you clear a combobox selection with mvvm ?
17:59
I'm looking at 4gb red = 140 (newegg)
I know, i just pulled up the 2tb, they should be fairly linear
amazon echo for 50% off, got me.
jeez.. they're practically giving away fire tablets
idk that they make 4tb greens tho...
18:01
yup i bought a fire tablet kid edition for the kiddo and i got one of the fire 8's to replace my nexus 7
;)
Julien; a bound selected item set to null doesn't work?
Granted... I can't say I've actually had to do that...
it's not working for me, but it is probably because i am passing the bound selected item through a DP
everything else is working, just not clearing
<searchCells:SearchCellItemControl SelectedItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
Thinking about picking up one of these prime deals purely for the breadboard and connecting wires
Ah, the nexus 7.... g1 or g2?
<ComboBox SelectedItem="{Binding RelativeSource={RelativeSource AncestorType=searchCells:SearchCellItemControl}, Path=SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
G2 Lynn
and yes, that would be a very good set for your RPi
would have helped that shorting issue probably ;)
18:17
@Julien jeez ... it's work work work with you
It's not like you're in the wpf chat room or something
not gonna get rich sitting around doing nothing :D
how to code like a pro:
        private void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Task.Factory.StartNew(() =>
            {
                Thread.Sleep(250);

                Application.Current.Dispatcher.Invoke(() =>
                {
                    var combobox = (ComboBox) sender;
                    combobox.SelectedIndex = -1;
                });
            });
        }
i am basically Jon Skeet
If something gets selected, clear the other combo?
check this baby out
        public static Task ForEachAsync<T>(this IEnumerable<T> source, int dop, Func<T, Task> body)
        {
            return Task.WhenAll(
                from partition in Partitioner.Create(source).GetPartitions(dop)
                select Task.Run(async delegate {
                    using (partition)
                        while (partition.MoveNext())
                            await body(partition.Current).ContinueWith(t =>
                            {
                        //observe exceptions
i wanted a foreach loop where each loop gets its own thread, and waits for the foreach to finish
google led me to this
dop lets you control how many threads it runs max
is good for reading lots of rows from a database and populating VM's
@LynnCrumbling it just clears a combobx after something has been selected. i can't seem to clear the combobox via MVVM
18:39
@Julien null the selected item? that doesn't work?
no, not in my case anyways. it might be because i am passing the bound item property through a dp
but even if look on google that doesnt seem to always work
@Julien this doesn't feel like TPL?
why not just Parallel.ForEach ?
thats what i tried at first
that doesn't work if each each is meant to run async
surprising
it doesn't do any thread limitting, and the foreach completes before its async tasks do
18:42
Parallel.ForEach is supposed to a Fork-Join pattern
forks shuold be able to work async within their async threads
it does Julien
you can try it easy, spawn 1k async tasks, and the foreach will finish before the 1k tasks
you need to use proper overload
double checking
sure
i guess you only need 1 task to test that :D
i should have saved the SO thread, trying to find it
ok i see it
weird.. i've never noticed that before
i was trying to read 15K rows from a database and create a VM for each
18:47
its not even asycn dependent
was taking 1min30sec
with this loop it went down to like 15 seconds
i can get it to quit even with Thread.Sleep
i don't remember having this issue before
can't find the SO thread :/
its ok, you've got the answer at least
18:49
and i'm curious about why its doing that
ah i knew it was from DataFlow! i just couldn't remember the "Flow" part of it
i never even heard the term until yesterday. lol
> Thread.Sleep(250)
Try:
    private async void void Selector_OnSelectionChanged(object sender, SelectionChangedEventArgs e)
    {
        await Task.Delay(250);
        var combobox = (ComboBox) sender;
        combobox.SelectedIndex = -1;
    }
ah. yes. that is much nicer
also much less blocking
even if it is blocking in a task
lol great
I SAW IT
18:57
yeah
deleted it to be safe, don't want the meta mob with pitchforks
06:00 - 19:0019:00 - 00:00

« first day (1726 days earlier)      last day (2423 days later) »