« first day (2523 days earlier)      last day (2408 days later) » 
02:00 - 14:0014:00 - 21:00

mr5
2:24 AM
o/
 
yo
 
 
2 hours later…
4:02 AM
Little Red wearing a red cloak that keeps her from turning into a wolf in riverside of the iridescent river with winds through fairy town that tainted by the wildness of magic.
 
mr5
4:19 AM
Young Playful Children Wearing Yellow Rain Coat Deceived By A Crazy Wide Forehead Red-Nosed Clown To Float And Dragged Under The Sewer
does C# have a feature to automatically deduce the return type declaration of a function just from the return statement of its body?
 
?
dont you declare the return type in the function signature
 
mr5
yes. I have just encountered a very long return type syntax so I wonder if there's any feature available to automatically infer its return type
 
im not quite sure what you mean, mind posting the code?
 
mr5
4:36 AM
something like T DoSomething<T>() { return new Some<Weird<Nested<Generics<Here<T>>>>>(); }
 
oh
wow
 
mr5
this is possible in JS though function() { return window.document.createElement('div'); }
 
 
2 hours later…
6:12 AM
Good morning.
 
\o
@rightfold Hey man! Not too much going on, how's life there? :D
 
6:28 AM
ohayou
 
Hellou
 
hello
If I'm initializing a static field of an instance class inside its static constructor, should I be sure that when I use that field, it will always be instantiated and the instantiation process happens only one time during the lifetime of the program?
 
That's what static constructors are for, yes.
They are guaranteed to run once and once only, before any access to the fields or instances.
 
mr5
6:44 AM
@MohamedAhmed actually, it's the principle of a singleton pattern
 
This is a good write-up of various ways to implement singletons in C#, both good and bad. My favorite is #4, which is simple and safe. #5 adds laziness but also complexity:
http://csharpindepth.com/Articles/General/Singleton.aspx#nested-cctor
I've referred to it, and referred people to it, dozens of times over the years.
Basically, it means static constructors are the simplest, safest and clearest way to implement a singleton.
 
mr5
@AvnerShahar-Kashtan are singletons in C# safe to be access on different threads?
 
@mr5 Not inherently.
I mean, they're "safe" in the sense that a singleton with a method that just does "return 5" will be safe. Nothing will explode simply because different threads access it.
But there's nothing about singletons that is inherently thread-safe. Singletons and thread safety are unrelated concepts.
 
mr5
do we need to use double-locking mechanism in order for it to be safe across different thread access?
I mean, the instantiation process
because in C++ this is not a problem. In Java, it is
 
@mr5 Read the link.
Double-locking is one of the patterns it describes, but it explicitly states that it's not necessary in C# with static constructors.
 
mr5
6:49 AM
public static Singleton Instance
{
    get
    {
        if (instance == null)
        {
            lock (padlock)
            {
                if (instance == null)
                {
                    instance = new Singleton();
                }
            }
        }
        return instance;
    }
}
 
Ah, regarding your earlier question - if you meant "thread safety" as in "thread-safe instantiation", meaning that you're guaranteed not to have two instances created if two threads try to access the singleton at once, then yes, it is thread-safe.
 
@mr5 Yes, that's necessary in the case of a property like this.
 
mr5
@AvnerShahar-Kashtan if there's a guarantee that it will not instantiate multiple times, will there be any chance that that the object instance will be null?
 
@mr5 Shouldn't be, no. The static constructor is guaranteed to complete and instantiate the static fields before the property is called.
 
mr5
oh fuck. I'm wrong about the double-check locking works in Java -- it isn't according to that link
 
6:56 AM
GoOoOoOoOoOoOoOoOoOoOoOd Mornin' neglecterinos!
 
mr5
well, according to this comment, it wasn't working before v1.5 but your link says it still doesn't work 'til now
 
Haven't tried it in Java.
 
7:40 AM
good morning
ohh. Double lock checking
 
It's not a double lock, it's a double check. :P
 
sweet thing. Just to kill any performance gain, that parallelization for.
 
What.
 
lock all the things
lock them double
 
public static Singleton Instance
{
    get
    {
        if (instance == null)
        {
            lock (padlock)
            {
               instance = instace ?? new Singleton();
            }
        }
        return instance;
    }
}
yeahy, i've "eliminated" the second if(),
 
7:48 AM
Good job.
 
Remind me again why you're double-check-locking?
 
@AvnerShahar-Kashtan incase the a thread stops just bevor the lock and after the if (can happen, non atomic operation)
 
No, why you're not just using the static constructor technique.
 
Aswell to prevent the "Get" method from locking the instance if
static constructors are the devils work!

Aswell I for one just read about them yesterday^^
 
8:03 AM
public sealed class Singleton
{
    private static readonly Singleton instance = new Singleton();

    // Explicit static constructor to tell C# compiler
    // not to mark type as beforefieldinit
    static Singleton()
    {
    }

    private Singleton()
    {
    }

    public static Singleton Instance
    {
        get
        {
            return instance;
        }
    }
}
The instance is instantiated in the static field initializer, meaning it's guaranteed to happen once, thread-safe, and before use.
 
Ahh, but wat if we don't want to use ob the 8 bytes of Ram that the Singleton would consume.
In that case isn't it better not to instantiate the field?
 
It won't instantiate the field unless you access the Instance property.
(Or any other field, for that matter)
 
Why prohibit to multi-instance on object? GC friendly?
 
Because logic.
Let's say you have a local cache of some server data. You only want one copy of that cache, not more.
 
mr5
static constructors are evil. nerd is right
 
8:10 AM
then I will having the Section:Session:Cacheable:Content.. parent class
 
Double-check locking is eviler.
 
Hi
Does anyone have knowledge about umbraco?
 
@ArjunPrakash do you know how I could make custom urls in Umbraco? See also this question: stackoverflow.com/questions/46158391/…
 
@mr5 burn the statics
 
8:32 AM
ahoy o/
 
If you burn the statics, you're now stuck with burnt statics, because you have an explicit reference to them.
Best thing is to avoid static classes and methods. But if you do have them, use static ctors.
 
^^
what is really so bad with static classes?
 
8:48 AM
They're inflexible. They're hard to unit-test. Instead of coding to a contract, an interface, you're coding directly to a specific implementation.
 
@H.Pauwelyn umbracoUrlAlias ?
 
Usually, with static classes, you either have a set of utility methods grouped together, which is usually fine, but can lead to hard to test scenarios (see libraries like System.IO.Abstractions which wrap static classes like System.IO.File with testable abstractions).
 
Maby I'll try this.
 
Or you have real singletons containing data and business logic, which can be a pain to manage. Let's say you have a static ConnectionManager class which contains cached connections to web services. Now, you want to be able to run a process under different user credentials, you suddenly can't use the ConnectionManager, because it's the same one used by other threads.
If your ConnectionManager was actually a non-static implementation of IConnectionManager, you could have several of them for different scenarios, at once, without being locked into a single static instance.
If you're using a DI framework, it's easy to implement singletons without static classes, simply by having the DI container manage the lifetime of an object as a singleton, always returning the same instance. Need a non-singleton instance? Let the DI container manage that for you.
 
2 messages escaped form Area 51
 
9:02 AM
nice try
not today
 
why am i taken to my profile when i click on area 51?
ET Proxy
 
sp00ky
 
~~~
Why you no play pubg with us yesterday @Kieran?
 
I didn't get to play until like just before i went to sleep
Plus I finally got the womans to play Pubg
and she actually enjoyed it which im suprised about
 
]urban pubg
@nyconing pubg Player Unknown's Battlegrounds. A battle royale game made by Player Unknown who also created the battle royale mod for arma 3 and H1Z1 (now split to King of the Kill)
 
9:16 AM
@Kieran ^^
]kieran
 
uwot
 
Soooo nyan doesn't know shit!
 
9 messages moved to Trash can
 
im an idiot
spent last hour looking why my update is not working, guess what i have no internet connection
 
9:22 AM
le kek
 
not to mention every time i update i get a pop up "check your internet connection"
 
You fool of a took.
 
:(
 
gg
 
Oh dear
I'm trying to make CORS work in my asp.net core web api app
 
9:25 AM
Oh dear
 
I've added it in ConfigureServices and Configure and in both I've added it before the MVC middleware as requested
But it still doesn't add the Allow-Control-... header :(
What do
Wait
wat
GET on /api/values works?
but POST doesn't?
the heck?
 
Hmm. Google's pushing the Oreo update to my phone.
Consistently fails to download it, but whatever.
Ah. Not enough free space.
 
Oh dear
It has nothing to do with CORS
nvm, thank you all anyway
 
9:43 AM
http://media.wallgif.com/gifs/9d353bd98640425e2c8db56c3a1edb29c7d6c5b8.gif
 
9:58 AM
lol
 
hi Team
 
team hi
 
Windows system mac address is uniq. any other things are there?
 
sorry what
 
SORRY FOR EVERYTHING
 
10:11 AM
kek
 
@Saravanakumar MAC addresses can be spoofed. And occasionally, cheaply made NICs will have duplicate MACs.
But it's usually ok if you want to use it to uniquely identify a machine.
You want something comparable to a mobile device's IMEI?
 
Your retardation is disadvantageous. I propound you all vamoose with great importunity.
 
Good day, sharperinos! Did I miss anything important?
 
@Metallkiller Yes, everything. You missed every important thing that ever was.
 
10:23 AM
So nothing new, nice!
 
Also, couldn't one spoof an IMEI?
 
Probably.
The question is how hard you're going to try to unique identify a machine. In other words, are you trying to give an average user a good "we known who you are" experience, or prevent malicious hackers from impersonating a machine.
 
10:42 AM
Is it possible to use LINQ dynamically, without knowing the table name, but the query is the same for all the tables?
 
11:02 AM
@AvnerShahar-Kashtan thanks, any other is there Windows operating system
 
@MohamedAhmed Just run a query to get table names
 
Hi Guys
I need some opinion
I need a templating mechanism for generating html for emails
It's a legacy Winforms app that currently relies on SSRS to generate the html from datatables
but now the client has asked for reponsive mails that can be viewed in Mobile devices as well
Now the first option I thought was converting the datatables into XML (there are no enitites), and use XSLT on them
 
@SamyS.Rathore you should build your template with this in mind: campaignmonitor.com/css
 
which works very well
But I was wondering if it would be better to go with a Razor or AngularJS engine to render the html
 
@KamilSolecki I like this.
@SamyS.Rathore Razor fo sueh
 
11:16 AM
@KamilSolecki Geez Thanks, that's gonna be handy :)
 
No problem, morty.
 
@SamyS.Rathore Better yet, use an existing framework for Html for mail, which is a pain to work with.
@SamyS.Rathore Chances are 99% of client-side JS won't run inside most mail clients.
 
That reminds me. I gotta fix my e-mail templates since sometimes when clients send me a response with them incouded They come out shattered af
 
I worked on a project that did its own HTML mail templates. It was hell, and that's when they only supported Outlook, Gmail and Yahoo. Add mobile and it quadruples your testing surface.
 
There Also is a nifty tool (but Paid) that Lets you live-preview in all versions of all browsers and e-mail clients up to this day
 
11:21 AM
I like these mail things. Saving them for later when the need arises.
 
@AvnerShahar-Kashtan What if we generate the code on server side and send it as static html in the mail??
 
@SamyS.Rathore Yeah, that's the only way to go. Razor can do it. Angular probably isn't really built for it.
 
@RoelvanUden sure do :D
 
Generally speaking, don't expect dynamic UI elements in email templates. Go for simple static pages that respond well to different sizes, not client-side logic.
 
schwifty
@AvnerShahar-Kashtan Yeah, it's mostly just expressions and tabular data
 
11:23 AM
@RoelvanUden I did use the free version of browserling, which covers the most popular browsers (with some of them few versions back ) IIRC
gotta give it to the mobile clients, they sure have great support.
 
11:36 AM
"Value cannot be null"
WHAT FUCKING VALUE
WHICH ONE
THERE'S LIKE 50
 
yeah, makes me wonder how less efficient would be including the name of the variable/field/property in the exception
 
@milleniumbug Extremely, since in many cases the name isn't even persisted to the compiled code.
 
Or it doesn't even have a name
 
right
lol.f().g().buahahahaha() doesn't
 
11:39 AM
Exactly
 
I guess line number is as close as we can get
 
string myVeryExpressiveAndClearVariable = GetString();
myVeryExpressiveAndClearVariable.ToUpper(); // throws!
 
@Kieran Why do you have 50 arguments for one method?
 
Even here, the variable name will not be stored in the compiled assembly.
 
Not even in a pdb?
 
11:40 AM
@KendallFrey its the way one of our forms is done
 
Which you have when debugging.
 
BUT WHY
 
BECAUSE FUCK YOU THATS WHY
 
mucho columns in db insert?
 
Now now Kendall, maybe they have a ...
I guess not.
 
11:40 AM
Also js wizard
 
a shame the debugger isn't helpful in complex expressions
 
@WilliamMariager The compiled code won't be using it though
 
Plus we don't have time to optimize it right now
 
@milleniumbug OzCode is a debugger assistant that can help in breaking down complex expressions. (Disclaimer: I work for the company that makes it. I don't work on it)
 
@Kieran Could that be because you waste too much time on suboptimal code?
 
11:41 AM
It works for what its needed for
 
technical deeeeeeeeeeeeebt
 
And we actually spent less time on it
 
@Kieran Until a value is null, of course.
 
Was just thinking that :P
 
To be fair, i normally fill the form out a bit more
I'm rushing right now
 
11:44 AM
non-nullable types ftw
 
Also this is the first time its ever come up
 
@KendallFrey Oh, I wondered when this will come up. :)
 
Do you use "this" in constructors or prefer prefixing fields with an underscore or something else?
 
this
 
@TimurSharapov Prefix fields with underscores.
 
11:44 AM
^^ this
 
I prefer this everywhere
 
this
Always this
 
@KendallFrey I don't. Which makes python's mandatory self a pain.
 
Actually, its more than 50
Doesn't help the spec has been evolving the entire time we've been working on this project
 
@AvnerShahar-Kashtan Other languages are part of the reason why I prefer that
@Kieran evolution is a fairy tale for grownups
 
11:46 AM
You're a fairytale for grownups
Whisper "Haskell" into a cold summer night's breeze and Kendall Frey will appear from the shadows
 
user image
3
in JavaScript, Sep 5 at 13:07, by Kendall Frey
(.) (.) (.) (.) (.) (.) = (.) (.) (.) (.) (.) (.) (.) (.) (.) (.)
 
Y THIS NO WORK
 
ironically C++ has less issues with null pointers thanks to defaulting to value types (and also allowing for types with no default value)
 
@KendallFrey
 
because it demands a higher salary?
idk
 
11:49 AM
<interactive>:3:5: error:
    • Conflicting definitions for ‘.’
      Bound at: <interactive>:3:5-7
                <interactive>:3:9-11
                <interactive>:3:13-15
                <interactive>:3:17-19
                <interactive>:3:21-23
    • In an equation for ‘.’
:(
 
What are you trying to do
Kieran y
 
@milleniumbug What? Can you elaborate on this? I remember pointers all over the place, and they could all be NULL.
 
i tri to use yer thing
(.) that thing
 
you don't "use" it
 
Haskell is alien to me
I do not know what do
 
11:51 AM
it's just a principle
those two expressions are equivalent
 
...I'm going to pretend that i understand that
I understand what you just said.
 
on the same level as 1+2=3
 
@RoelvanUden yes, that's if you use pointers. Collections are all value types and you don't need to use pointers with them: void f(const std::vector<int>& input); /* ... */ f(myVector); // myVector can be empty, can have multiple elements, but can't be null
(also no copying here because we take by ref)
 
Ah, right. But, classes, for example? You must pass them by pointer, or not?
 
classes are value types too
 
11:54 AM
if you want to use inheritance, you're forced to use a pointer (to store instances of different types in collections), but otherwise no
 
Huh. Interesting. C++ just started to sound a little better.
 
@ntohl I wish i was joking, but we literally have no time
 
Don't believe their lies!
C# is all you need!
 
C# can't run in kernel mode.
 
11:55 AM
Sure it can!
 
It can't?
 
C++ has a many different problems which don't exist in C# and vice versa, but such is life :)
 
What mode does COSMOS run in, then?
 
It can? Please, tell me how. I am interested in writing kernel drivers in C# then.
 
11:57 AM
Oh yes, great. But on Windows?
 
One thing I'm missing in C# is a way to update the target of a ThisCall delegate so I can use it with virtual function tables in interop. Super obscure but I really miss it.
Having to emit an entire method every time I want to call a different address is a bit annoying.
 
Methods shouldn't use an implicit this parameter
 
Just ranting
 
12:03 PM
As soon as an OOP language wants to use FP concepts, a this parameter becomes awkward.
 
emulate it with a monad
 
@Kieran how did they extort You?
 
@ntohl by giving a deadline
lmao
 
hi
can anyone help me with something? (not sure about the logic of approaching it)
 
don't ask to ask, just ask
if we don't like your question, you'll just get ignored and that's it
 
12:14 PM
I am trying to create a chatroom in C# that works like the old days on a LAN. (think old style like counter strike where one person would create the room and the rest can see it without any of them being a full server)
but i am not sure how to make the other people detect the created room
 
lol, I was thinking about designing P2P chat just the other day
@user6019827 Is everyone on the same LAN?
 
yeah
 
if not, then it's gonna suck
fuck NAT
 
Then broadcasting should be feasible
 
@KendallFrey can you please change this 5 years old picture with your latest one.
 
12:16 PM
oh, it's ok then
 
@ARr0w why
 
@KendallFrey cos its old now man
we want to see how the current you look like
 
yeah
 
so i have to broadcast it to their broadcast address?
 
@KendallFrey tbh you look like a 14 y/o on that pic
 
12:17 PM
@user6019827 maybe
 
@user6019827 the broadcast address of the local LAN
 
@milleniumbug Yeah well you look 10
 
now he is hurt and he will ignore us to death :/
 
okay
 
12:18 PM
oh he's your friend, @milleniumbug. it means I'll bare the ignorance alone
 
is it done the usual socket way? (socket connection to that address then sending the related stuff)
 
that makes me the luckiest person on this earth
 
@KendallFrey wat but why
 
but why not
 
12:24 PM
@KendallFrey That's an impressive photo of a potato that looks like you.
 
it's not a potato, it's a thumb
 
@WilliamMariager @KendallFrey I find it ironic you're not coming back on the whole 'C# in Windows kernel' thing.
 
Whoa, I was just messing with you. Isn't that what we do in here?
 
@RoelvanUden cause that's not my field of expertise. problem?
 
Alright.
 
12:26 PM
translated: idfk
 
@Kieran have You skipped on Your job? You have depth in work time?
 
I skip all the time
Walking is too slow
 
tbh with user-mode driver framework, using .NET for drivers doesn't seem to be completely impossible; it's just the matter of whether MS would provide support for this
 
I'm curious how did they convince You, that it's Your liability to be done by a given time in a legacy code base with a task. With the risk of working overtime. Why did You put it on Yourself?
 
hahahaha @KendallFrey and it came in like a wrecking ball
 
12:37 PM
@ARr0w You made me start singing that awful song...
 
12:49 PM
Does anyone have any recommendations to get better at code designs (in particular MVC applications)? I've been reading a lot about design patterns and it seems like everyone has a differing opinion.
 
Everyone has a different opinion. That's a fact of life.
So long as you pick certain ways of separating concerns and remain consistent along the way, thus everyone follows the same kind of logic, there is no good or bad way to fill in the details/style/etc.
 
1:01 PM
So, what you guys think about Bower?
Asking, since the hosting provider, where I'm at, doesn't support it
 
Jack Bower is pretty cool
 
@Taurib Obsolete now imo.
 
why Obsolete?
 
Most front-end packages are now on npm as well. You can just webpack them.
 
@Taurib it hit 1.0
/s
 
1:06 PM
uff
 
@ntohl n🍦
 
@Failsafe Agreed.
 
02:00 - 14:0014:00 - 21:00

« first day (2523 days earlier)      last day (2408 days later) »