« first day (1445 days earlier)      last day (2704 days later) » 

5:58 AM
morning
 
 
2 hours later…
7:33 AM
morning
 
morning
 
8:24 AM
morning
I got a raise :D I'm so f***ing happy :D
 
I thought you were interviewing ?
nice though :)
 
yes, still interviewing :p
 
how much did you get ? (%)
 
I'm happy because they told me that there will be no raises this year
17%
 
wow
 
8:38 AM
good ?
 
it should feel good :)
 
16.85% exactly
yeah, I feel good, but I'm still searching for another job :3
 
 
3 hours later…
12:04 PM
Good morning
 
morning @Alex
 
Hope you had a good weekend, franssu
 
morning
 
very good :)
 
:)
 
12:13 PM
@JohanLarsson I like it but i can't see any context to this - what was this icon about?
 
Just played with a logo for the analyzer
 
oh ok
 
when I should have been writing code
 
yea it looks prety nice
 
I intentionally made it similar to the .net logo
 
12:14 PM
you're writing code all the time - have a break sometimes :)
 
Not sure it can be used
 
i dont see a lot of simlarity
to me it looked pretty original - sure it has VS color scheme - but color scheme isn't copy right
 
I made the magnifier similar to look .net
dunno anything about legal stuff
 
oh! ok i felt it was Q and i was thinking whats the Q about
neither do I but other than a vague idea similarity, I don't feel there's a trademark conflict
if memory serves: if your work is at least 30% different from work used as reference - its considered original
 
mmh
 
12:18 PM
(rule of thumb not legal babble ^)
 
in France we consider similarities
not differences
 
:) same thing franssu
if there's at least 30% difference, there's no more than 70% similarity
 
% of difference doesn't matter in France
or at least didn't a few decades ago
and that was different from legislation in the US
 
glass half full half empty franssu
where there's one - there's other as well - its just different wording - important thing is.. how do you have it quantified
(PS: all of this is irrelevant because Johan is Swedish :D )
 
my point is precisely that it's not
or was not
 
12:22 PM
you don't have any quantification?!
weird - i thought law was an objective thing - not a "this feels similar" thing O.O
 
differences are not considered by the law
 
sigh - similarity - lets work with that
 
only focus on similarities
 
since the word is so important
how much similarity is needed before its considered same
 
nope
 
12:38 PM
well, maybe :p
 
waves
 
waves back from cubicle
 
hi Lynn
 
Morning, Lynn
 
12:56 PM
Where's that tumbleweed gen?
 
Maverik actually wrote it up as a program
 
laugh
 
Needs a refactor to make the Generate() method static
 
@Maverik what if it is 30% of good enough?
wonder how they measure it 30% of pixels?
Gonna leave the issue open forever
 
Is there a way to reuse templates? Only the parts I've marked are actually different. It's a pain to update if I need to change how they all look.
 
1:12 PM
Don't think there is a BasedOn for templates
You can perhaps have the inner grid as a keyed resource
probably needs x:Shared="False"
 
food for thoughts
does not guarantee the reuse of existing VMs when updating the tree
could be done easily
 
1:31 PM
@WilliamMariager why dont you do
    <DataTemplate DataType="{x:Type xvm:StringVM}">
        <TextBlock ... />
    </DataTemplate>
<DataTemplate DataType="{x:Type xvm:BooleanVM}">
    <CheckBox ... />
</DataTemplate>
<HierarchicalDataTemplate>
    /* stuff */
        <ContentControl Content="{Binding}"/>
    /* ... */
</HierarchicalDataTemplate>
 
Hah
I was just changing to try that. :P
 
:)
 
I was looking at ContentPresenter though. What's the difference?
 
ContentPresenter presents
ContentControl controls
did that help ? :D
 
1:37 PM
I don't really know, I'd have to look on the interwebs again to check that
 
Looks like I should just be using ContentPresenter
121
A: What's the difference between ContentControl and ContentPresenter?

NirContentControl is a base class for controls that contain other elements and have a Content-property (for example, Button). ContentPresenter is used inside control templates to display content. ContentControl, when used directly (it's supposed to be used as a base class), has a control template ...

 
yep
 
Hmph
Stack overflows :P
 
eheh
 
Since some items are just XElementVM, it'll keep nesting itself I guess. I wonder if I can prevent that.
If not, I'll just make XElementVM abstract and add a generic VM.
 
1:41 PM
I don't think that's the cause
or maybe it is :)
 
Seems likely. The ContentPresenter only finds a template which holds another ContentPresenter and so on.
 
XElementVM is recursive ?
 
<HierarchicalDataTemplate DataType="{x:Type xvm:XElementVM}" ItemsSource="{Binding Properties}">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="{DynamicResource GridLength1}" />
      <ColumnDefinition Width="{DynamicResource GridLength2}" />
    </Grid.ColumnDefinitions>
    <TextBlock Grid.Column="0" Grid.Row="0" HorizontalAlignment="Left" VerticalAlignment="Center" Text="{Binding Name, Converter={StaticResource StringResourceConverter}}" />
    <ContentPresenter Grid.Column="1" Content="{Binding}" />
 
I have no idea what WPF Is but..
Happy birthday WPF?
 
It is here. The ContentPresenter will look for a way to present it and find the HierarchicalDataTemplate with DataType="{x:Type xvm:XElementVM}".
I made it work!
Just had to add the "subtemplates" to the HierarchicalDataTemplate.Resources. I guess it looks at it's own resources before the parent.
 
1:50 PM
great
maybe you're right @Dsafds
later this month maybe
 
Oh okay C:
 
oi
 
its 14 days away :) but the wishes are welcome anytime of the year :)
 
did I miss the franssu X-dress?
 
not yet - I feel gutted - i paid my lifes savings to get a front seat to that show
 
1:56 PM
the world is not ready for this
 
we were born ready
 
you don't give the world enough credit!
 
FRANSSU! FRANSSU! FRANSSU!
 
@LynnCrumbling I guess you were talking about this: gist.github.com/Venomed/6f55eaa6feb63e79833141011838d806
 
2:26 PM
Maverik, forked it and made it static: https://gist.github.com/arc95/9ae4d43a8771b01d9bfafd7fe143f47f
Is the syntax correct on the `Append()`?
 
grin yep
 
pull request to gist? xD
seems fine Alex
 
2:53 PM
0
Q: Access denied to network printer in PrintDialog

Arm0geddonI am trying to print to a network printer from code, but the network printer status in the print dialog box says Access denied, unable to connect and the print button is disabled. But I can print to that printer just fine if I print from another application. And, if I select Print to PDF from the...

 
i saw it. clearly you put some thought into it
it it way more code then mine. lol. i have to do some other shit but i will try it
 
it's updated
 
Maverik, noticed you'd made the class sealed. That got me wondering, when should a class be sealed? It prevents other classes from inheriting from it
 
you should always make your class sealed because you should never inherit
 
3:04 PM
Thanks, franssu. If nothing inherits from a class, then make it sealed? There's stuff about performance improvement when you do that
 
I was being sarcastic (a little)
 
Ahh, sorry. Thought you were talking about that specific class :)
 
one reason to make a class sealed is when it has code that would break the liskov substitution principle if overridden
 
Alex I default to having sealed classes because that implies I haven't thought it through for inheritance
why would you want to inherit the farmer :D
LSP is one reason, multi-threading is another reason, disposables can be yet another (essentially access to internals of class that you don't trust other people with)
 
That makes sense. Another explanation on LSP
 
3:11 PM
but this is pretty much my default working mentality - nothing can be taken for granted .. everything should explicitly opt-in to whatever functionality it desires
 
Nice. So, start with sealed unless inheritance comes into picture
 
well thats what i do
 
Thanks, guys, for the explanation
 
my rule of thumb: everything is opt-in
^ this drives from my understanding of YAGNI
 
That's kind of the same way security is approached. Give least access and see if it works. Don't start with it wide open
 
3:13 PM
so everything has minimal scope unless i know of a scenario that requires more lax scope
exactly (mm this may have something to do with my work in iptable days!)
 
:)
Yeah, did work in app security years ago. Wrote a huge doc on securing web apps
 
so three things i've made a habit of:

1. Sealed classes are *my* default
2. Readonly fields are *my* default
3. Use implicit access of whatever i'm doing (which is pretty restrictive by default)
 
Hmm. I've used readonly rarely
 
(by implicit i mean don't specify private or internal)
once you get in the habit you'd be surprised how rarely do you actually need mutating fields
also I love the gif in that linked LSP answer
 
Now trying to remember diff b/w const and readonly fields.
 
3:18 PM
If it looks like a duck, quacks like a duck but you need batteries - you probably have the wrong abstraction
^ gotta remember that!
 
that doesn't work for me
 
sealed is such a difficult concept. I personally think sealing is a bad practice, but I definitely see arguments for both cases.
 
I like the rectangle / square example better
 
hah!
it shuold have been possible to use the duck example in place of square example
guess LSP failed!
 
3:20 PM
:)
 
a sealed example could have saved you from that!
@Alex with that I simply think to myself: whatever I'm about to do - is it really a constant? generally the answer is no and I default to readonly
man i so hate this nuget rename hell
while i get why they did it - but nobody else is willing to follow it along and now the user is stuck in middle of nowhere
 
I have a Constants.cs class which contains a bunch of strings that are public const string SomeMessage = "This is a message.";
 
System.Reactive.Interfaces conflicts with Rx-Interfaces - you can satisfy one or the other but not both at the same time
(they have the same assembly inside - its only nuget rename)
 
If I need to set the strings at runtime, I guess readonly comes into play
Then I can pass in a value into the c'stor
 
set strings at runtime? no
well thats one reason to have it readonly but usually thats not the main reason for this change
the assembly linking has bigger bearing on this decision (from your linked answer)
in the case of the const value, it is like a find-replace, the value 2 is 'baked into' the AssemblyB's IL. This means that if tomorrow I'll update I_CONST_VALUE to 20 in the future. AssemblyB would still have 2 till I recompile it.
 
3:30 PM
That's good to know
 
3:52 PM
:) Good afternoon everyone
 
4:19 PM
Hi Andre
 
Had a good weekend?
 
kayaking a mile and a half against the wind and rain in white caps was fun. how about you Andre?
 
Yeah, busy but good weekend
 
Went to a show and started watching Mr Robot with the GF
 
nice!
 
4:28 PM
Just the concept of the show seems so good
From Wikipedia, Alderson is recruited by an insurrectionary anarchist known as "Mr. Robot", played by Christian Slater, to join a group of hacktivists. The group aims to erase all debts by attacking the large corporation, E Corp.
 
Mr Robot is awesome :X at least from the two episodes I've watched
 
The trick is to remain good. So far so good. One show that had a great start and totally fizzled: Sleepy Hollow
 
I loved "Hemlock Grove" - i don't know why it didn't manage to fare well with critics
its ending was awesome - i kept thinking, how in the world will they do a season 3 after this - turns out they weren't planning to
 
@Maverik I watched it. The ending was great, although the main antagonist of the third season was just "drain".
 
:)
still I kept hoping may be they story will continue with the one who got saved at the end perhaps
 
4:44 PM
@Julien I added a comment to my gist to explain
 
and may be they'll find a way to reverse the other persons state
 
maybe some other guys in the room might be interested
it's about functionnal programming vs imperative
I hesitated about posting because I really don't like / want to show off and I'm afraid my code sucks.
 
it looks nice generic solution
 
but I think it might help Julien and other to grasp advantages of functionnal programming
 
unfortunately i haven't got the time right now to go through it in depth
functional rocks in a lot of scenarios indeed
 
4:46 PM
so I just post, it's friendly criticism and I'd take friendly criticism on my code as well
:)
 
You're picture can't be as bad as your code... post it! WE ARE READY ;)
 
(still fills like C# is a burden sometimes, F# code would be much cleaner)
maybe when I'll get home ;)
cu @AndréSilva
 
Not sure why, but when I hear functional programming, I think of Li*p
And I want to run the other way
 
No swearing in here, please
 
:)
 
4:49 PM
:)
 
Is that Language That Shall Not Be Named functional?
 
@franssu Leaving already? :o
Bye bye :) Have a good rest.
After tabbing through Chrome and checking the cu ( which translates to assh*le in Brazil as I said before ) I've realized that the acronym to my full name is Ass...
André Silva de Seixas... "de" translated to "of" so, ignored.
 
lol
how ironic
;)
 
5:10 PM
Haha
 
5:47 PM
probably yes
but you can go to smarterthanbill.slack.com and ping rudi
 
:p
 
possibly check with bill too
 
4 messages moved to Trash can
 
@Maverik yes to what?
 
Kevin, that was yes to my question, which I deleted -- job interview question
about ASP.NET
 
5:56 PM
@Julien i'm sort of stuck on filter expression - any chance I could pick your brain?
 
6:27 PM
sure
 
@Roxy'Pro Come to chat
 
Here I am bro
 
@Roxy'Pro Tell ur second problem
 
I'm working on small wpf application, which has only one window/screen - MainWindow.xaml and I'm using dataGrid to show my data which are
loading from database.

When my dataGrid is filled with data for first time i.e on Windows_Load it's pretty slow to scroll down/up to check what I've loaded into dataGrid,
until I reach top/bottom (cross all data [items from database] ), than scrolling is fast, but that is not solution because my grid is
refreshing every 60 seconds so every 60 seconds if I want to scroll down or up, its working but very slow, so I can that's not good for performance of t
 
that's a loaded question!
generally I'd say you should start looking at the problem with lazy evaluations
your data is virtualized at some level - you need to get rid of that
also reloading the entire data every 60 seconds isn't a good idea - use change sets
 
6:35 PM
@Roxy'Pro You said scrolling is fast after my suggestion, now what next i am asking.
 
Yes scrolling is fast after I set width and height to some fixed value for example 400 x 400 but as you know that is not solution because I want to use application on different screens
@ Anjum I asked you what's next, because I can't keep my screen fixed :/
 
@Roxy'Pro Good point is you can set Width and Height to anything you desire. Setting is important, and value isn't. Try Width="*" and tell how it performs.
 
When I try to set Width="" to my DataGrid I'm gettin message "" string cannot be converted to Length.
'"*"' <- cannot be converted to Length.
 
@Roxy'Pro Please set some MinWidth and MaxWidth , also you can change Width of DataGrid after checking resolution. See which approach u want.
 
Wrestling with a DataGrid here too. It's the first one in my app, before I learned the beauty of ListViews :)
Can an enum have multiple values per item? Something like this...
public enum EmployeeStatus
{
	LeaveOfAbsence, "Leave of Absence", LOA = 1,
	Inactive, "Inactive", INA = 2
}
 
6:58 PM
you can use attributes [Description("Leave of absence")]
also why LOA?
 
^
probably some record keeping representation
 
Trying to maintain compatibility with their old data. They had the abbreviation
 
So can attributes represent all those values per item? I've never seen that
Dang, from the looks of it, enum types only have the Description attribute
No room for "LOA" or "INA"
 
	public enum EmployeeStatus
	{
		[Description("Leave of Absence")]
		LeaveOfAbsence = 1,
		[Description("Leave of Absence")]
		LOA = 1,
	}
if you really wanted to
 
7:03 PM
Yeesh. That'll work, but ugly
 
I would kick the acronyms, bad naming convention
 
So two elements can point to the same int value (1)?
Or are those considered one element?
 
two enums can be represented by the same int
 
Wow. Didn't know that!
Yeah, going to kick the abbreviation. The user doesn't even see it
Thanks, Kevin :)
 
I help when I can :)
 
7:05 PM
Well, this was perfect!
 
There's a caveat there
if you use EmployeeStatus.LOA.ToString(), it'll pick the "first" one
so it'll turn it into "LeaveOfAbsense"
etc
 
7:47 PM
Thanks, Reed. Going to use only one and remove the other. No need for the abbreviation
From here‌​, a handy method to fetch the description attribute, if any:
public static string GetEnumDescription(Enum value)
{
    FieldInfo fi = value.GetType().GetField(value.ToString());

    DescriptionAttribute[] attributes =
        (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);

    if (attributes != null && attributes.Length > 0)
        return attributes[0].Description;
    else
        return value.ToString();
}
The author there also has a way to enumerate enums (for dropdowns, etc.)
 
I would write that as a TryGet
    public static class EnumExt
    {
        public static bool TryGetDescription(Enum value, out string description)
        {
            description = null;
            var attribute = value.GetType()
                          .GetField(value.ToString())
                          ?.GetCustomAttribute<DescriptionAttribute>();
            if (attribute == null)
            {
                return false;
            }

            description = attribute.Description;
            return true;
        }
untested
 
8:07 PM
should be able to simplify
 
Looks good, Johan
 
public static bool TryGetDescription(Enum value, out string description)
{
    desciption = value.GetType()
                  .GetField(value.ToString())
                  ?.GetCustomAttribute<DescriptionAttribute>()
                  ?.Description;
    return description != null;
}
(also untested)
 
Is it good practice to return a bool? Why not just return the value if description is null?
 
@ReedCopsey better
 
@alex This lets you see if it was set without using exceptions
 
8:11 PM
I guess this way you know for certain if there's a description and it's your choice to use the Enum value
 
@Alex I don't like that much, nicer to return the bool telling if there was a value imo
 
you can always wrap it into a helper that uses the results of this and a fallback, etc
but this is pretty "standard" for parsing
 
Ahh. OK
 
for a private method it would be ok I guess
 
I'd prefer Functional.Maybe for that
 
8:11 PM
I'm a n00b, just realizing standards :)
 
still prefer TryGet, more explicit
 
but I guess you can't really make a dependency for that
 
@milleniumbug Well, I just write these to return string option - but that doesn't work in C# ;)
 
you can :)
 
I've seen TryGet methods before. Now it makes sense
 
8:12 PM
...so I'll forever complain about it not being in standard library :)
 
@milleniumbug fake option types in C# kind of suck to use :p
 
So you return false if there was an exception?
 
@alex there will never be an exception from that
 
@Alex TryMethods should never throw
throwing is expensive
 
I guess not an exception, but rather just you didn't find the description
 
Where did you all learn these standard ways to define methods?
 
from reading framework sources
nice to keep things consistent
 
@Alex TryWhatever is a convention originating from the standard library, like TryParse
 
Ahh, yes. I've used those all over the place
I'm going to try your TryGetDesc and let you know :)
 
8:33 PM
How's this for a wrapper for the method?
private static bool TryGetDescription(Enum value, out string description)
{
	description = value.GetType()
				  .GetField(value.ToString())
				  ?.GetCustomAttribute<DescriptionAttribute>()
				  ?.Description;
	return (description != null);
}

public static string GetEnumDescription(Enum value)
{
	string description;
	return TryGetDescription(value,out description) ? description : value.ToString();
}
 
it works but kind of defeats the purpose
 
I know, I know
:)
 
I'd rather have the two lines where you use it
makes it clear what is going on
 
Problem is, I'm trying to use it in an object initialization
 
a bit of meh really
 
8:36 PM
@milleniumbug Yes, very familliar with it - but it sucks from a usability standpoint IMO
 
you could make it private
or have it like you want it
 
SomeObject = new VM
{
    Description = GetEnumDescription(...)
};
 
but if public I would at least document it, not that anyone ever reads it :)
 
I don't see much value in such forwarding
unless you also use TryGetDescription elsewhere privately
 
Nope. It's used by this one method
So it's private. With the wrapper public
 
8:39 PM
GetDescriptionOrName
at least the name then tells what it does
 
Ahh, better method name
 
@ReedCopsey C# 7 is supposed to get some kind of pattern matching, maybe it will get better then
 
if it is only for one type you could use specific type instead of Enum and introduce caching
probably no need for caching if it isn't called much
but the reflection is not gonna be awesome for perf
 
Only one user for this app (at most two, if the user has a backup) so performance on this shouldn't be too bad, even with reflection
 
maybe that's a dumb question, but how expensive is such reflection? I'd assume this would be equivalent to several dictionary lookups based on the hash on .GetType(), which doesn't seem to be a big performance hit, but I don't know much about how does the runtime handle it, so there.
 
8:46 PM
not sure but I can run a benchmark, hold on
 
@milleniumbug Nah - it's not getting full pattern matching - just limited ones (type testing, etc)
and there sill won't be clean compiler support
it's almost impossible to make it clean while keeping statements in a language, IMO
will get better over time, but never be "natural"
 
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Reflection;
    using BenchmarkDotNet.Attributes;

    public class EnumDescription
    {
        private static readonly Dictionary<Foo, string> Cache = new Dictionary<Foo, string> { { Foo.Bar, "meh" } };

        [Benchmark(Baseline = true)]
        public string DictionaryLookup()
        {
            return Cache[Foo.Bar];
        }

        [Benchmark()]
        public string Reflection()
           Method |        Median |      StdDev | Scaled | Scaled-SD |
----------------- |-------------- |------------ |------- |---------- |
 DictionaryLookup |    11.6272 ns |   0.5796 ns |   1.00 |      0.00 |
       Reflection | 5,245.7925 ns | 245.2217 ns | 455.08 |     27.46 |
@milleniumbug ^
 
Wow, huge diff
 
still not an issue almost ever
just if you plan to loop it like crazy, also it allocates a bit
 
@JohanLarsson ...wow
 
8:58 PM
    using System.ComponentModel;

    public enum Foo
    {
        Bar,
        [Description("meh")]
        Baz
    }
^ the enum I used
BDN is nice for benchmarking
 
Thanks for running that, Johan :)
And I'm outta here
Good night
 
9:11 PM
@Alex no way, you aint leaving before I do
go back to your cubicle
 
@JohanLarsson now I wonder what operations are done here that are so expensive, but maybe that's already answered on SO somewhere
honestly I expected maybe 20x more slow
 
Reed probably knows
 
not 500x
 
GetField is not very expensive iirc, dictionary lookup
you can step the framework source
 
reflection is, in general, somewhere between 100x->1000x a normal method call
which is still reasonably fast
but you have to do a lot of work - get the runtime type, fetch the type information, then all of the unboxing, etc
 
9:50 PM
interesting stuff
 

« first day (1445 days earlier)      last day (2704 days later) »