« first day (2985 days earlier)      last day (2189 days later) » 
00:00 - 12:0012:00 - 23:00

12:00
I think someone more clever than me could think up a 1 to 1 mapping for a number to another so that you could use autoincrement and still get your unused random number
Put current year beside Guid did make GUID more unique?
No, it isnt GUID anymore
it must be unique and a number.. if you're using GUID, it's not a number, and if you use only 64 bits of the GUID, it's not necessarily unique either
Convert it to bit, you get number.
@ntohl guid is enough, but its an overkill
Wait, GUID already in bits
12:02
@Neil A guid is a 128-bit number.
The fact that it has a common hexadecimal representation is irrelevant.
@AvnerShahar-Kashtan convince Wietlol of that fact then
it's not really a number anymore than an arbitrary string is a number
@Neil i was convinced of that from the start
(but i often do mistake in the number of bits)
@Neil Yes, except that a guid is always exactly 128 bits and has a standard representation as a number, whereas a string is variable-length and there are many ways to represent it as a number.
36 mins ago, by Wietlol
I understand a guid is also just a ... 256-bit? number
BitConverter.ToInt64(Guid.NewGuid().ToByteArray(),0)
12:06
^ but is that unique?
No, I think long isnt enough
if it is reversible, I can easily check if the results are unique
It isn't unique, by definition - you're truncating 128bits to 64bits.
using the 1/n to int (using floats) makes the first 10 million reversible
around 11M to 12M it starts to show inaccuracies
128 bits is significantly more unique than 64 bits
it's exponential growth afterall
12:08
ByteArray are number BTW
This is a Guid.NewGuid as a number: 155,999,042,758,769,336,633,263,085,705,830,843,425
but 64 bits is still very very improbable
@Neil again, a guid is quite unique, but it is too long
how about this then.. how many numbers will you need over the course of a day and how long will the program need to be operational?
I can do with 10 million values though
the numbers will be 9 digits long
exactly 9 or can they be larger?
if they must be exactly 9 digits long, then that's significantly less than 2^64 space
none of the results exceed 9 digits
im not sure why though
at least... from 212 onwards
above that, they have 10 digit numbers
i guess it makes sense in some way, but not one that I know
Don't be tempted to take a guid and only use the first/last 64bits from it. It's not collision-safe.
A GUID is not collision safe either, it's just unlikely to collide. It's best to handle collisions if possible.
12:22
ANyone asked the important xy question yet?
Why not auto-incrmented numbers?
I just saw "no auto-increment", but why?
If your databases is big enough to make collision in unique number, doing collision pre-checking will locking your databases.
Use running number instead, like auto increment function provided in most database.
Technically, there can be no collision with unique numbers
the "go-to" solution for this type of problem is to use auto-incremented numbers
really no reason why it would be random
Also I was hoping ofr an answer from @Wietlol, because maybe there is indeed a valid reason?
Remember it's entirely possible there are things we don't know.
A multi-master database is a common example where GUIDs are necessary.
12:27
Whats a lemme just google that
Your tables and columns in database used GUID without collision pre-checking
But in multi-master DBs, you can have the same concurrency problems, right?
well there of course situations where you do need guid
what if two programs try to create the same GUID into different masters at the same time?
hi. does this make any sense or is there a better way? pastebin.com/Dx3F4H7n
12:29
statistically impossible
Guid in Primary key collumn
But I suppose if that ever occurred, one would fail
Is that redundant?
@nyconing No, not unless you had a second identifier for the row
But your function are designed to be failed or success.
12:31
@qd0r Just start two tasks?
var t1 = Task.Run( () => new Service1() );
var t2 = Task.Run( () => new Service2() );
// now you can even await or kill the tasks if you want!
Lets inventing 512-bit unique number
@Squirrelkiller omg thank you. i check it out :p
Any time. Tasks are great.
Global Unique ID Galaxy Unique ID
Suid - Space wide Unique Id
12:34
if you're repesenting the galaxy, you're going to need more bits than that, son
Are you sure?
just having a unique identifier for every star system would seriously test that
Aren't there, like, more Guids than there are particles in the galaxy or something?
But Earth are alone in Galaxy
and then imagine each star system having several planets, several continents, several companies who all use your galaxy unique id
12:36
@Squirrelkiller not quite that many
our four byte IP system can potentially have 4294967296 different addresses and yet we would have run out a long time ago if not for NATs and whatnot
admittedly, many of them are "special" addresses and therefore reserved
We still ran out
> And since there are about 7×10^22 stars in the universe, and just under 2^128 GUIDs, then there are approximately 4.86×10^15—almost five quadrillion—GUIDs for every single star. If every one of those stars had a world with a thriving population like ours, then around each and every star, every human or alien who had ever lived would be entitled to over forty-five thousand GUIDs. For every person in history at every star in the universe.
From here
That doesn't take light cones into account
Only timelike guid collisions can happen. Spacelike duplicates are fine.
I'm sorry to ask this, but I think I'd get told off on the main site if I asked this
I have a syntax error but I can't see why :(

var bw = new BackgroundWorker();
bw.DoWork += new Action((s, e) => { });


Why can't I use new Action
12:39
Are photons unique?
What's the error?
Delegate Action does not take 2 arguments
@Squirrelkiller does this take into consideration that the year is tacked on?
@nyconing How do you define unique for a photon?
but Action can do?
12:40
@nyconing All photons are indistinguishable (like all elementary particles, I think)
I also tried bw.DoWork += new Action<object,DoWorkEventArgs>((s, e) => { });
@MyDaftQuestions Action takes no arguments
also, pretty sure every solar system will have their own calendar, so there's that
@MyDaftQuestions I think it wants you to use Action<T, U>
Sorry, Action<T> is what I mean
12:40
DoWork needs to get an Actiondelegate, not Action<T, T2>
But just use the lambda directly, don't wrap it in an Action
@Squirrelkiller Im just tangling the topic as far as I could
Oh yeah good catch squirrel
You can't pass event args to DoWork
Also, you shouldn't even be using BackgroundWorker
Use Task
12:41
Oh really? Hmmmm OK
Thank you
It's the currently standard way of doing parallelism
@Squirrelkiller works exactly like i want. thank you again :) i was looking for "Parallel" all the time :)
And like that it works...
var task = new Task(new Action(()=> { } );
don't use Task constructor
Thank you all
12:43
The thing is, Task isnt just parallel. It's asynchronous - probably paralel, if needed.
no, don't!
Task.Run(() => { });
@MyDaftQuestions use Task.Run or something like that
@Squirrelkiller Well, yes, but I skipped that minor detail :P
@MyDaftQuestions read a book, or some articles on the subject before you start churning code
It's easy to get lost in the TPL swamp
12:45
just use async/await for everything IO - boom done you're as paralel as possible without complicated analysis.
Parallel.
@Squirrelkiller the reason for not auto incrementing is because these are ids that customers can use to access their data
customers dont have accounts or anything like that
i'm using the Parallel.ForEach pattern always when i have something to download or db operations in combination with a ConcurrentBag. really useful :)

Parallel.ForEach(tasks, parallelOptions, task =>
{
while(!bag.IsEmpty)
bag.TryTake(out item);
DoSomething(item);
});
@qd0r Please use Ctrl-K to format your code.
12:51
so, if you have auto increment numbers, you could easily subtract or increment your number and get the information of another person
@AvnerShahar-Kashtan thanks for the hint! :) i didn't know that it works :o
@Wietlol It's true that sequential numbers add a new attack surface for enumeration attacks, but using GUIDs shouldn't be the only mitigation.
googles mitigation
@Wietlol I clarified my wording.
ah, makes more sense
but how would you make it more secure then?
12:53
Then the problem is : What user can do if they get another user ID.
traditionally, people would log in... but that is basically undoable for what we do
@nyconing get information of other people
No, I cant login my Boss account even I know infos about him
information includes address information, contact information, bank numbers, etc
@Wietlol If you're only supposed to see your own data, there should be authorization in place. Not just assuming no-one will guess someone else's GUID.
that would be called security by obscurity
12:57
@Wietlol What do you do?
weird stuff
Security is a multi-layered onion of defense mechanisms.
discord does it for images, but it's "hidden" behind two large ids. but it's all public nonetheless
Increment + 4digits random number.
Using guids to reference data prohibits enumeration attacks, and authorization should also be used, but if one layer fails (forgot to add security checks), others (guids) should add a layer as well.
12:59
comes back after an hour 15 minutes to find you're still talking about guids
@Neil but I had a lunch break just now, so we were silent for half an hour
There's always new guids to discuss, you're never done!
2
I like this one: e1919e42-77e4-4c58-ac9c-707c1e4bd31c
what was that website again?
Lets invent PUID, Photon Unique ID
@LasseVågsætherKarlsen No way! My favorite is e1919e42-77e4-4c58-ac9c-797c1e4bd31c! We're guid neighbors!
13:02
Whoa! Far out!
Flawed Light-based Unique IDentifier.
my favorite guid is 00000000-0000-0000-0000-000000000000
It isnt a valid GUID thoo
Ah the infamous v0
its 0
this is a perfectly valid guid
The term "valid GUID" is full of contradictions anyway
13:04
@AvnerShahar-Kashtan pff, amateur guids
Like, documents state there are 2^128 of them, yet marks only some of them as valid.
imo all 2^128 guids are valid
"only some", sounds like there are only a couple :D
no discrimination
xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
This is valid GUID format rfc4122
13:05
is there even a check that prevents a 00000000-0000-0000-0000-000000000000 from being created?
is it even necessary?
if I saw a 00000000-0000-0000-0000-000000000000, I'd be sure I did something wrong (and in all likelihood it would be true)
@Neil 00000000-0000-0000-0000-000000000000 never created
Since it is not a valid GUID
Guid guid;
do
{
    guid = Guid.NewGuid();
} while (guid.ToString() != "00000000-0000-0000-0000-000000000000");
here we go
@Wietlol but like that you risk to loop forever..
@Neil Technically forever?
and ever.. and ever..
13:08
@nyconing Which is the best kind of forever.
@Neil i do
Guid guid;
do
{
    guid = Guid.NewGuid();
} while (guid.ToString() != "00000000-0000-0000-0000-000000000000" && !universe.isHeatDeath());
FTFY
Universe death by over heat?
no, heat died
no more heat
13:09
@Neil are you accessing a private field?
I have seen this kind of code:

do { ... } while (!IsPowerOff());

And `IsPowerOff` tried to figure out if some disks had lost power (internal disks, in the same computer), to deduce that the machine had lost power.
@Default universe is very much public, man
bool IsUniverseAlive => true;
bool IsUniverseDying => true;
reminds me of For a brief period, the kernel tried to deal with gamma rays corrupting the processor cache blogs.msdn.microsoft.com/oldnewthing/20181120-00/?p=100275
13:11
@Wietlol If you have a customer facing system, you have a whole other problem than generating unique IDs that are not auto incrementing and also not as big as a Guid
"Heat death of the universe" == entropy went to maximum, meaning all energy is now heat
@Default universebrain.jpg
that's a large brain
@Wietlol If you have data customers can access, you need authorization as well as authentication in front of it.
I just saw a file called "NativeBufferFactory.cpp" and accidentally read it as "NativeButterFactory.cpp" and perhaps I really should be doing something else today.
Native? Sniff, sniff
13:27
Ooooh, Rider 2018.3 released today! Nice!
I'd like a bit of native butter. Spread over fresh, warm bread. Mmmm...
ChocoProviderFactoryBuilder.build().make().putChoccococ()
native butter is the best butter
13:42
@Default So you're saying this is discouraged? dotnetfiddle.net/XOMSoc
@AvnerShahar-Kashtan yes :D
funny though
Someone really use Rider for normal work?
Nah, jetbrains are just developing it for fun
Not really for fun
They have greater ambition
@J.Doe I use Rider so that Rider does the work... I dont work.
13:53
Microsoft are going slow down
(I also use IntelliJ, DotPeek and DataGrip)
(And CLion, PHPStorm and PyCharm)
Jetbrains releasing tons of products and some of them are abandoned after first release. I do not trust them, but i use someties dotTrace when polishing project
After all i dont us ReSharper from 2013 and never regret this
VS + Roslnator - Its all
Before used CodeMaid but from VS 2019 its uneccesary
14:33
The tools like DotTrace and Dotmemory are super handy
DotPeek is also quite useful ;)
Meh, only DotTrace and DotMemory is really usefull
IntelliJ is also really useful
15:00
> Why: consistent with the Microsoft's .NET Framework.
I like how MS tries to give reasons for doing things, but actually forget to put up a reason
consistency is a bad reason?
"I like to write my code in mEmEcAsE because it is then consistent with my code."
if that is consistent with your code then go for it
consistency is not a reason
It's a great reason. It means that other C# developers will easily read your code, because it's consistent with the broader C# developer community.
Of course, to realize that you have to think slightly beyond yourself and the code file you're currently writing.
15:02
consistency is the result of accepting a convention because of particular reasons
I NOW OWN A HOUSE
I'm so happy I thought I'd share the good news
your house will fight for its freedom, be prepared
@LeeButler yay! congratulations!
@LeeButler Hey, congrats!
mr5
mr5
15:27
@LeeButler congrats
how old are you?
22
And thanks guys <3
mr5
mr5
you just reminded me how failure I am with life
Nah it's fine I got the ez inheritance money
can you do multiple inheritance?
I practically cheated. But it's fine because it's basically the only way you can buy a house these days
15:29
Congrats @LeeButler
@LeeButler Be careful, houses can be easily burned or destroyed in other way by accident. Buy good insurance
mr5
mr5
roel owns a house, butler owns a house, wiet owns too. I'm the only homeless here
I own a house?
oh, you mean my cave
A man-cave?
a king's cave
am bigcat
bigcat lives in cave
15:31
@mr5 You dont have parents or you came from slums? Most popular way to get own house without any effort is to wait until they die
That was extremely dark, holy shit.
@RoelvanUden use the light theme
issue solved
Its just real life
mr5
mr5
15:46
does chat.so allow blocking of users?
@J.Doe whoa boi
@mr5 no
@mr5 yes
Ohh there is an ignore
mr5
mr5
which one is telling the truth?
15:48
figured no messages, who would add a block
@KendallFrey is
Click on the name, and it will allow you to ignore everywhere
I would take that to mean, all slack sites
unfortunately it doesn't extend to slack
It applies to all rooms on the site (not the network, I think)
Block the user from join the room
RO can do that
We actually can't. We can kick, and on continued kicks, a temporary ban is given.
But that's the limit of the powers.
but you can ban for like... 2 years
(im not sure it has a limit)
That's a moderator. Names in blue, powers across all of SO.
15:52
hmm...
All we can do is kicko kicko until mr angry boi comes and does a big kicko
speaking of
ohai kamil
16:15
Oh boy. What did I miss?
J.Doe
J, Doh*
16:45
Corrected
posted on December 18, 2018 by Reed

For the last couple of years, my FsAdvent posts have focused around a simple, fun little Christmas Trees application illustrating the usage of Gjallarhorn.Bindable – and for this year, I thought I’d keep the streak going – with a twist. I’m happy to announce the availability of Gjallarhorn.Bindable.Avalonia, which allows Gjallarhorn to be used with […]

I have a web api with controllers -> domainservices -> persistence basically. Although the persistence is more like a layer between me and the actual persistence.
Who does the authentication and authorization? The controller? The service?
I have one method going
if(this.loginService.AuthorizeUser(context.Headers[TokenKey])
return teamService.GetTeam(id);
else return Unauthorized();
and I have another method going
return teamService.GetTeams();

The first one does the auth and then gets the teams.
mr5
mr5
17:12
hey
any Spaniards here?
No Señior
Porque Héctor no es aqui
mr5
mr5
@Squirrelkiller it's the Service that does the AuthService, no?
porque porque barbeque
eww I just noticed you named your AccountService loginService
Right now, my LoginService does both registration, login, and authentification
mr5
mr5
Then it's not a LoginService
Also how do I say both for three things? All? All of?
Good point, it's like...a user service?
mr5
mr5
17:17
Rename it to AccountService
ugh
AccountService, nice
mr5
mr5
And why is Authentication is separate from Login?
That's basically the same thing right?
butler returned to his house I saw it
Login goes "Hey this is me, here's my password" -> "ok here's your token"
Authentication goes "hey I want to see some data (that another service will specify and take care about), here's my token" -> "Token says you're Jules, *otherService* can decide if he may see the requested data"
mr5
mr5
fair enough
Don't you think login belongs to AuthService?
also the register
And you left nothing with account service hehe
but das fine. You can store the current user there
In this case I'm not sure if the controller goes "if(accountService.IsThisGuyAuthenticated(token)) return teamService.GetTeams() else return Unauthorized();" or if the controller just calls the teamservice, and the teamservice asks the accounservice if thats ok.
Oh good point I could store the current user in the service :D
mr5
mr5
17:25
so the AccountController is returning a data from a TeamService?
AccountController just does login and registration.
mr5
mr5
ah
TeamController goes "if(accountService.IsThisGuyAuthenticated(token)) return teamService.GetTeams() else return Unauthorized();"
mr5
mr5
I see no problem with it as long as it returns data related to it
And I'm thinking of changign it to just calling the teamService, and that would then call the accountService.
mr5
mr5
17:27
so you want to delete this teamcontroller?
nah, just move the authentication into the teamService
or I'm thinking about it
dont know yet
mr5
mr5
wat
it's my first webApi ever M'Kay
mr5
mr5
I thought you will just pass the token to the teamcontroller
yeah possibly
ah wait
mr5
mr5
17:31
no authentication in teamcontroller
teamcontroller gets the token anyway
mr5
mr5
it's webservices. stop empowering ms's words
yeah its a webservice, but more specifically its a webApi
meaning the start point is a controller inheriting from Controller and that has the HttpContext
I don't know how other webservices work, so I use these words
mr5
mr5
you're right
I just don't want to fully embrace MS tech
 
2 hours later…
19:30
Is there a way to see what caused an assembly to be loaded into the appdomain? I'm seeing some client-side code in the server process, and I want to know why.
19:43
Have you tried the fusion logs?
the...what?
It used to be, you had to set a registry key to enable the logs. I dunno if that's still the case.
> 'fuslogvw' is not recognized as an internal or external command...
Did you use the Developer Command Prompt (or the Visual Studio Command Prompt in Windows 7) with administrator credentials?
It's not on the regular path
yep
It just opens to system32 though vOv
Tried the VS directory, same results
19:55
Huh. It works for me.
oh weird I don't get that header either
I just get "\Common was unexpected at this time."
Sounds like something's messed up with your installation.
Or you're launching something other than "Developer Command Prompt for VS 2017"
If you don't want to mess around with it, you can find the registry key that turns on fusion logs and open up the text file it creates somewhere on your hard drive
Trust me, it's not the latter
I don't exactly want to mess around with registry stuff either
It's been a few years since I had to do it, but something like this worked
20:35
How common is it for MS to deprecate something and recommend a 3rd-party replacement? docs.microsoft.com/en-us/dotnet/api/…
 
1 hour later…
21:43
Looking for a c# html parser, I've been using jSoup in Java and was wondering what people here would recommend based on their experience :-)
I think HtmlAgilityPack is the popular one
Aha, I've seen that name popping up many times in google, thank you for the confirmation :-)
22:22
posted on December 18, 2018 by Phil Haack

It used to be a tradition at GitHub to announce new hires with a blog post with the pattern, “So and so is a GitHubber.” Each post would be accompanied by an image.

So you decided to do the thing I told you to do three times after someone else told you to?
You didn't suggest putting it into resources... You said read the file once on startup, store it as a string, and replace. Figured you might want to know there's a way to have it do that for you. shrug
Also, two times* and the reason I even brought it up twice was to try to get other opinions. I don't care if Jon Skeet himself descends from the heavens and tells me the answer -- if it's not corroborated by others, I won't feel very safe using it. I appreciate you helping me more than once, by the way. ;)
00:00 - 12:0012:00 - 23:00

« first day (2985 days earlier)      last day (2189 days later) »