« first day (3522 days earlier)      last day (1420 days later) » 

mr5
2:21 AM
@cubesnyc structs are "value types", classes are "reference types", that ValueType you mentioned are either of the two. It's just a class named after a concept.
> Although ValueType is the implicit base class for value types, you cannot create a class that inherits from ValueType directly. Instead, individual compilers provide a language keyword or construct (such as struct in C# and Structure…End Structure in Visual Basic) to support the creation of value types.
Excuse my ignorance. There's an implicit inheritance from ValueType for every value types assigned by compiler.
 
 
5 hours later…
7:36 AM
@mr5 what was that?
 
 
1 hour later…
mr5
8:38 AM
I'm not sure what it's called but it's another variation of shawarma from Turkey
 
 
1 hour later…
9:48 AM
Hi from Iran
We want to write an application for Android, but I am totally new in Android. So It worth starting our project with Xamarin or Flutter? Base on the fact that I am C# developer.
 
Hi from the UK
What C# /.net technologies are you already familiar with? And are you expecting to be working on other mobile platforms like iOS?
@AliKianoor
 
Hi from Malaysia
Android Studio is still must have even you starts at Xamarin. Take note that Xamarin.Forms and Xamarin.Android are completely different thing.
 
I haven't touched Android Studio
And I've got a Xamarin app which has been in production for over 2 years
 
mr5
10:13 AM
Hi from the Philippines
I'd say go with Flutter.
coming from Xamarin dev with 3 years background
 
Yeah Flutter is cool
 
Go with Xamarin. Either Xamarin.Android if you want to use a platform which is essentially just the standard android development but with C# instead of Java, or Xamarin.Forms if you want something a little more like other .net frameworks, with the option for also developing for other platforms too
Also soming from a Xamarin dev with about 3 years background
@ChristophBühler You can't just give your opinion without saying "Hi from <country>" in a seperate message first
Time to make a cup of tea
 
Hi from Austria, Flutter is cool and Xamarin stinks because of reasons.
 
10:18 AM
You can come over, I have tea
 
Yeah but that would involve going to Austria
Your airports are weird and wrong
(by airports I only have Vienna to go on but still)
 
We have airports?
We can meet in the middle. Paris maybe? I'm sure they have coffee..
 
Coffee is garbage
 
Woho don't start a fight here big guy
 
I've also never been anywhere in france aside from transiting through it
Hmm. That makes me want to do like a C# chat passport
 
10:26 AM
My C# App receives messages in JSON format eg.
{ "type": "LOGIN", "user": "xx", "pw": "xx" }
How can I convert these messages to Classes (eg. LoginMessage)?

I'd like to be able to do sth like:
messages.on<LoginMessage>(
(msg) => print(msg.user)
);
 
Oh that's an easy one, just use a json library. The most common being Newtonsoft.Json
 
Nope it's not as easy as you might think
 
It's probably already in your project. You can feed the json message in like this:
 
There are n different message types
I am using Newtonsoft
 
10:27 AM
I want to dynamically parse these messages
 
OH GOD
NONONONO
I mean yeah you can do it but it's not a fun time to funnel all of your differently typed messages to one andpoint
uhhh
 
Um
Well it's a socket connection that receives messages.
As JSON
 
So what you're going to want to do
And this is before you try to deserialise
 
yep
I just receive { "type": "LOGIN", "user": "xx", "pw": "xx" }
 
Pparse your Json string into a JObject with JObject.Parse(jsonString)
 
10:31 AM
ok but then it's without type safety, right?
 
hold on
 
Then you can get the type of the message by doing var objectType = myParsedJobject["type"]
(this is the nasty bit)
 
yepyep I like it so far
 
Then you can switch on the type, and then fire into different methods depending on it
Like this:
 
10:33 AM
hmh that's the part I don't love
 
Can't I use generics to parse these messages?
like this:
messages.on<LoginMessage>(
(msg) => print(msg.user)
);
 
Not for this purpose because with generics you have to know what you're doing beforehand
 
oh wait
 
There is one thing you can do but it's really really nasty and potentially dangerous
 
10:35 AM
public void on<T>() {
return JsonConvert.DeserializeObject<T>(data);
}
Does this work? :O
I'd do this after your first part
 
I guess it could
 
ok I'll try var objectType = myParsedJobject["type"]... and that
 
switch (objectType){
	case "LOGIN"
		LoginMethod(JsonConvert.DeserialiseObject<LoginMessage>(jsonString));
		break;
	case "LOGOUT"
		LogoutMethod(JsonConvert.DeserialiseObject<LogoutMessage>(jsonString));
		brealk;
}
But you're gonna have to do something like that for every message type
There's an easier option though, which while a bit more fancy allows for much easier extensibility without going completely aids
Which can be done either safely or unsafely
 
ok
This almost works:
public IDisposable On<T>(Action<T> callback) where T : IBInMsg
{
string msgType = T.GetMsgType();
return inMessages
.Where(obj => obj.type == msgType)
.Select(obj => JsonConvert.DeserializeObject<T>(obj))
.Do(msg => callback(msg))
.Subscribe();
}
Except this line "string msgType = T.GetMsgType();"
Alrighty this will do
Thank you for your help, @CaptainObvious
 
Oh yeah that's not far off what the better option is anyway
You never said you already had that
Are you intending to have multiple subscribers of the same message type?
 
10:51 AM
conn.On<Connect>(

// msg is type safe
(msg) => ibClient.Connect(msg.host, msg.port, msg.clientId)
);
yes, inMessages is a Subject
Thanks again, see ya around!
 
mr5
just pass the entire msg
 
11:07 AM
True, it's better. Didn't have that class yet. Ty for pointing out
 
 
1 hour later…
12:16 PM
double? var1 = 110
double? var2 = 110
var1 - var2 = 1.4210854715202E-14
can anyone explain?
@everyone
 
@CaptainObvious No it's just for android PDAs
Thanks, I will discuss the topics you all mentioned in the meeting. I do appreciate it.
 
mr5
12:32 PM
!~>{double? var1 = 110;double? var2 = 110;return var1 - var2};
 
<!>Invalid token '(' in class, struct, or interface member declaration
!=>"{void}"
<!>Invalid token 'return' in class, struct, or interface member declaration
 
@mr5 i tried it on fiddle as well
my program is returning 1.4210854715202E-14
 
mr5
are you sure you are using C#?
I can't reproduce it with Roslyn, .netframework, and .netcore
 
12:53 PM
@mr5 quiet sure im using c# 8.0
 
1:08 PM
Can you post a screen shot of the error?
Sounds more like you have a processor logic problem
Something is doing math wrong
 
!~>()=>{
double? var1 = 110;
double? var2 = 110;
return var1 - var2;
}
!=>0.0
 
@AwaisShaikh welcome to floats
tldr 0 cannot be represented properly as a floating point number
Most implementations when rendering the value out as a string round it to 0
But it's not zero. Just really really really really really close to zero
Floats are great because you can have a truly gigantic range of values compared to other types with a specified amount of memory/bytes. However, they're terrible because no matter how big you make the range of values, the amount of values you can have remains the same.
 
@CaptainObvious got it, but how do i fix it and get 0?
 
Bsically don't use floats
I personally would use decimal
If you want to know more about why floats can't properly represent 0, I can tell you
 
1:20 PM
@CaptainObvious you are scaring me
 
That's all there is to it
Unless you have some bizarre dire need to conserve resources to the point where decimal vs floats actually matters, just use decimal instead of floats
Somehoe I have a feeling the value range isn't that bad, unless you need values bigger than 79,228,162,514,264,337,593,543,950,335, in which case maybe a double is good. Doubles put you up to roughly 1.8E+308
Definitely don't use floats becuase they're only accurate to ~7 digits. doubles are accurate to ~16 digits, and decimals are accurate to ~29 digits
 
you are right, converting it to decimal fixed it but still weird :/
 
It's not weird, it's a "feature" of floating points
 
thats why decimal exists
 
Read this section of the docs about floats and it might help you to understand it
 
2:30 PM
It feels so odd raising github issues on my own code
 
I don't think so. I do the same on my gitlab to keep track of stuff.
Also hi
 
should be sad, and happy you know better now
 
Yeha but I usually just fix issues instead of taking note of them
Or write them down in my magic pad
Neither of which I can do because 1) I don't feel like fixing the bugs right now and 2) My magic pad is locked in someone elses office
 
Whats a magic pad?
Also I feel like what you're doing with your magic pad is exactly what the github issue tracker is for
 
It's just a fancy ntoepad which I robbed from an airport lounge last year when it was abandoned
 
2:35 PM
lol
 
Seems to have been owned by some russian/middle eastern oil person
But who also writes their notes in english
 
So you could easily get their bank account information and are now so rich you don't know whether to charter SpaceX to fly to space or just build your own rocket?
 
Nah there wasn't anything that interesting I don't think
I never actually read through it because it's really boring and also the guy's handwriting was terrible
But it's all still there, in the ntoepad
 
3:06 PM
Whats the brand of notebook?
 
3:19 PM
No idea
I'd be able to tell you if I had it
 
Have a boogie board, use for notes sketching
then print out and use on the whiteboard or make a book of
 
AAA
Having a difference of opinion with a friend, would you call a database table profile_posts_media or profile_post_media ?
Curious to see what others think
 
I'm conflicted about that myself lol
 
usually it's singular, this is a strange one
 
AAA
The topic came up since the framework we are using tries to guess the table name based on model class name and failed on profile_posts_media lol
 
3:22 PM
Plural would make more sense as a table holds multiple of that kind.
Singular makes it more fluently to read/write code.
 
but it likes profile_post_media?
 
AAA
Yeah I voted for plural, and yes it does but that's irrelevant.
I mean, I would say plural because its not media for just one profile (post)
 
I hate taking notes on my PC is the issue
 
ya I do too, this sits in front of me
hooks to my bt on the pc and saves them as pdf when I'm done
 
AAA
@CaptainObvious how come?
 
3:27 PM
I would go with the singular
Don't know, I just prefer writing with a pen
 
yep old school
 
Which is odd because I don't like writing with a pen
 
I can't type and take notes doesn't connect
 
But I hate it less than havign to switch context on my PC to type notes
And there's not many applications which can take notes like I tend to anyway
 
AAA
yeah speed and context switching are my reasons but overall I prefer pc probably
 
3:29 PM
I don't do notes linearly, which is why when I have to make notes on a PC I use onenote
But even when using onennote I usually use my tablet and write with a pen anyway
 
AAA
I use evernote, pretty neat
 
And my notes are hard to read when put into a typed form anyway
Like I had a meeting the other day, and made some notes before hand, which somebody else typed up for the others (correctly) but I couldn't get my head around it
 
AAA
yeah much easier when its personal not many people understanding my rambling tbf
 
omg nvidia drivers can go suck a dick too
 
mr5
@CaptainObvious how did you write through it?
 
3:38 PM
Using a pen?
 
mr5
device?
I mean, which digital device
 
Do you want to take notes like that? Because if so
Jul 16 '18 at 13:39, by Lee Butler
Maybe I could interest you in The New Microsoft Surface Book 2 with nVidia GTX 1050 discrete gpu
tfw it's not new anymore
 
mr5
for real? 2.4k USD
 
But all of my handwritten notes have either been taken on that or my older Surface Pro 3 or my older older Surface RT back when I was in college
lol wat
Actually, not entirely true. The brief period when I had a Galaxy Note 8 (terrible phone) I used onenote on that. The note pen wasn't actually that bad, just the rest of the phone was
Only had it about 2 months before getting rid of it
 
mr5
too expensive
I'd rather buy MacBook Pro 2019 model
 
3:43 PM
Doesn't have a touch screen tho
Tbh for notes, the surface go is actually pretty decent, as well as other fiarly lightweight stuff
But the surfaces replaced my ancient dell laptop
This is the laptop I was using until 2013
 
4:13 PM
Touch screen a deal breaker
 
Hi, what are topics related to identity management in .NET, as a job position?
 
Hard to say. At our 150ppl company it's just what the normal devs do too.
Backend I guess
Or security
 
I guessed so too, will see tomorrow
 
4:39 PM
any one knows this?
I wish I have known it when I started Xamarin to set alarm when build finishs
 
Woah. Didn't know you could customize that lol.
 
4:54 PM
use to be in VS way back when
 
 
1 hour later…
mr5
6:07 PM
AS has that. It annoys me.
 
6:35 PM
what is the advantage of using multiple projects in a solution, vs multiple folders in a project?
 
By default all projects are in the same folder if you use solution folders
You need to set them during project creation for them to match on the file system
As for advantage, if you're trying to monkey around with namespaces it will come to bite you or you'll just end up using FQN because of how broken it got.
 
 
2 hours later…
8:55 PM
@cubesnyc some says folders better from performance wise, I didn't see measures, but it's interesting question actually, I worked on a Xamarin project that is devided into modules (assemblies), it was slow at build, and I think that number of assemblies per sollution affect the build time.
 

« first day (3522 days earlier)      last day (1420 days later) »