Streamlining Measurement Representations in APIs Using UnisNet Library for .NET - .NET 182

Haim Kastner is a Senior Software Developer. They delve into the world of .NET and development, as they share their experiences and insights. They discuss the complexities of working with units of measurement, sparking a conversation about the need for proper solutions to represent units effectively in software development. They also explore the implementation of a library to seamlessly handle unit representation and calculations, making it easier for developers to work with units directly. Additionally, they touch on updates in the tech world, including software releases, hardware recommendations, and entertainment suggestions.

Special Guests: Haim Kastner

Show Notes

Haim Kastner is a Senior Software Developer. They delve into the world of .NET and development, as they share their experiences and insights. They discuss the complexities of working with units of measurement, sparking a conversation about the need for proper solutions to represent units effectively in software development. They also explore the implementation of a library to seamlessly handle unit representation and calculations, making it easier for developers to work with units directly. Additionally, they touch on updates in the tech world, including software releases, hardware recommendations, and entertainment suggestions.

Sponsors


Socials


Links


Picks

Transcript


Hello, and welcome to another episode of adventuresin.net. I'm Sean Klayby, hosting with me today, your co host, Adam Vermonic. Hey, Adam. Folks. Hey.

Nice to see you. And Christian wins. Hi, everyone. Hey. Good to see you, mate.

To see you too. You guys been busy? Been doing some traveling? Moving? As always, yes.

And the worst part is the more traveling, the easier to come. So you will miss probably a little bit more in the upcoming episodes. Oh, no. We gotta give you a traveling station to do this stuff on you. That sounds great.

We we we should redo that because, I mean, I I've got all my all my traveling behind me now, but I've got a very long vac or relatively long vacation coming up, in a couple of weeks. So I have to enjoy this, as long as I can. Yeah. You keep us from Europe. You get those long vacations.

You know? Alright. We have more than 4 holidays a year. But I was actually researching recently how to do, like, podcasts and other stuff while working remotely. And now I can do anything like post process videos, report stuff while traveling with no hassle at hassle at all.

It took a while to prepare that stuff. And the funniest thing is it's easier for me to post process video by no machining into my MacOS, which is remote somewhere in the US, rather than running things locally. This is crazy. Wow. Alright.

Well, let's welcome our guest today. For today, it's Chaim Costner. Yeah. Welcome. Yeah.

Thank you for the invitation. So, I'll just start. So, why don't why don't you start it off by just kinda give us, an introduction about yourself, you know, how you got into development, how you got into dot net, and what kind of things you you work on with with dot net. Yeah. Okay.

So, I'm, actually, started to develop, like, my twenties. I did it just, learn by myself, and I really like to to develop. It's, for me, it's something like art. You know? So I'm really enjoying to see something that, you know, you're thinking about something, you're writing down in your notebook, the infrastructure, and then it's it's a lot.

So it's, it's it's like a magic for me. So I really like to do that, and I'm doing it in the last 10 years. Currently, I'm the team leader and software developer, engineer at Checkpoint, which is a cybersecurity company based here in Israel. I'm a team leader of, full stack, that we are working on front end, back end, and services and APIs. So this is basically what I'm doing in my day job.

And, a few years ago, I I have worked heavily in my day to day, in my day work, in, dot net, in the GIS systems. And this is actually the topic of, what, what I'm guest to to to hear for, is basically to talk about, about this. So, how to work in units, specifically in dot net, but it's not only dot net. It's something that's related to whatever language or technologies that you are using. But it started from dot net and the dot net has the biggest library in support of the in that area.

So it started from that. You're not talking about unit test. You're talking about actually units, like units of measurement and things like that? Yeah. Yeah.

Yeah. Yeah. Units of measurement. So, if, in in case you you had, you know, if you worked or working, in in system that it's, heavily used measurements, like, if you're working on a GIS system, for example. So every function almost that you call is something like, length or angle or or distance between something or or or time.

So time is not only GIS. It's actually any system always. Always there is something that it's about the time, milliseconds or something. But if you're working in GIS, this is actually most of what you are what are you are doing in your day to day. And, and and what I had is that, we are we are we are we worked on the JS system, and we got, like, kind of a nightmare of working.

So, you know how it's going when you develop a software. Like, if you yeah. Everyone is writing its own units or measurements, how we, how it wants, you know, like, not even if we are talking about if we're consuming or producing APIs, but also within your own system, every function that you call. Okay. So like, if you have a function to, to do the basic, you know, JIS calculation, like measure the distance between 2 between 2 points, okay, in the world.

So, what you need, you know, like a, formula. So you need to have, x y of one point, other point x y, and then you can calculate the distance between them. But you don't understand what actually the function is going to be in the parameters, which measurement. Okay. So you know it should be distance, like, lengths.

You know it should be, for 2 points, but you don't know. Okay. So does this function wants it, like, in in in meter, in kilometer, in in in what? You you don't know. Okay?

So you're trying to figure out in the documentation or asking the someone that actually, wrote it or, trying to test it and to understand what exactly is going there. Okay? So so all of the the code is like, a a lot of places when you need to to understand what is the the the the actual case. So you know you need you need lengths, but you need to figure out which lengths it is. K.

What is the present? And so the I I guess the most, normal solution for such, cases is okay. So always write down what is the length, like, position in matters if we are talking about Cartesian representation of a of a position, or, angle in, radians or in degrees or, time so in milliseconds or milliseconds. So all the all the code base became begun to be like a big mess of, you know, adding names to the variables, with the with the specific, specific measurement type that you you want to use. So we have started started to to work like this, but this is also have a lot of problems.

1st, it's it's very annoying to do so. It's like, think about you need to explain every variable, need to explain itself what is the measurement it is, while on the only thing that you want to do is just to pass lengths and pass angle or something like this. And the second biggest problem with it, that's all of the all of the code is filled with conversions because if you have, like, a old code that's using, yards, and then your code is with, methods. Okay? So you need to convert when you're sending to this formula function that does something and to convert back.

And you need to make sure that your conversion is correct. So, actually, all of the codes, even if you described very well what is the unit, what is the type of the unit, still, all of you got is a lot of these conversions. And if someone made some mistake and by mistake, didn't convert exactly how it should be, all you spaghetti code became to you just crushed and to debug and to understand where is the exactly point of where someone did some mistake in, you know, calculating some degrees, when it happened and and where it's stuck. So the solution for it, of course, is to create, like, a common, common file or common library that, that exists in all the all of the conversions. And then this file getting bigger and bigger with convert all metal to kilo.

From from from everything to everything, and it's getting huge, and it's very hard to to maintain. And at at this point, we we understand, that that we we have a problem. We we don't have a proper solution for it. K? So we want to represent unit, but we get just it's become a nightmare.

And this is before we are talking to to before we even starting to talk about that we have, you know, we're consuming and producing APIs. So it means that we need from every point to understand what is the unit that they are using, how to convert it to to to our system, and vice versa to to the other side. And then some some at this point, we pay, like, a few years that, that we work like that. And then some, colleague coworker, represent to me the unit's net library. And I have to say, okay, not changed my life, but it was something that I understand what exactly was our problem and why it's so good to to solve it.

So what's it this, great library does is to understand that, okay, we don't care about whatever it's metal or or kilometer or it's, angle to this, angle in in gradient or or on degree. We just want to represent something that will be like like a primitive. We want angle. K? And we want lens.

And this is all what we want. And in all of our system, like, all of the the parameters in the functions, in the return, in the objects and the interfaces, and whatever we are creating. We don't want to even talk about what is the value, how to represent the value of of the length. We just want length. The only place that we need to actually know the unit of measurement that we're actually using is when we getting out or into our system.

So all of our system within it using only degree or, the lensing in the or or whatever, type of unit it is. And only when we come in outside or inside, we design it. And when we come into inside and outside, it will be, very clear. It's it's it's crystal clear what is the unit. So so the style, if I I will be able to to to share a screen, I will show you in the the example.

It's it's it's the most simple way. It's, create angle form. Matter and then you have angle. And then you have the angle. You can you can, like, dot to matters or to something.

And you don't need to do it anywhere in your system only if it's when you're going out or into the system, like, when you're consuming some some data from somewhere or producing data to somewhere. And and because it's so simple and if you're also implementing, like, overriding the operational the the basic operational of the language in it, it means, like, you can go and multiple lengths, width lengths, and, divide it by by times at best. K? So the basic formula to calculate the, distance in a in a time. K?

So what is the the, the distance that you walk? If you're walking, like, from you started from one point, you walk, like, 2 minutes. Where are you standing? K. So so the formula is very clear.

Like, the representative of the formula is take your position, double it with the time, and you will get the results. And in all of this calculation, you don't need to understand whatever you are in matter or kilometer. You're just taking 2 objects of of length. We've taken object of length, calculating, doubling it to this time and getting a new a new position which represent by length. And it's all you you have never, starting to talk about if it's metal.

You don't need to go to this part. Like, like, you have a negative lens. So so this this solution, is is is, is so good because it solves the issue from the fundamental of the of the problem. The problem is that you have the lengths, and you have the the representation of the lengths. So you represent the lengths in matter.

So in whatever it is, but in in the real world, it's it's just the distance. You know? Just trying to describe the distance with some units that someone invented some 100 years ago. So it doesn't you don't really care about it. So only if you need to to tell to someone else outside of your system what is the length, you need to specify some unit because this is how people or systems talk.

So so they expecting to to not tell me it's a dis distance 1. It's just expecting me to tell it's a distance 1 in some unit like in metal. So it's 1 metal, which is the same, like, same 10. Just the same. It's central for the same from the same lens.

So so while it's in the system, you're saying is is is just a mathematical calculation is all it has to do. It doesn't care what what the unit of measures there. When when you're doing exactly. When when you're writing your own formula, your mathematic formula, you don't talk about whatever you'd say. It's a it's a matter or or or or it's something else.

You don't care. You're just saying that the formula is that if you multiply lanes with, and and from one direction, like, if you take in the to to the right. Okay? And you adding the time. This is the place the new place that you will get.

You this is the formula. You don't you you will never write in formulas and saying this is in matter and this is in the in seconds. Just saying time. It's t for time. This is what you care about.

So this is also what you need to do in your call to represent the formula in the in the correct way. You don't need to to always go to to the specific unit. We we do it. We did it because we have to do it because, you know, how the programming languages work, you need to specify some number. And the number should be specific because, you know, the number of length of you have to specify length of matter, and then you all the mess is started.

But if you if you implementing, similar to primitive length, it just everything is vanished. So so the problem is not here yet. You you came back to do your calculations, only these lengths. So so you have this. Yeah.

Okay. So so so, in in in previously, you had encode a so just say I get this wrong. Alright. So you had a method and the method had, I don't know, an argument called distance, and this was of type, int, offload, or something. And there was, like, a consensus in in the whole development team.

Okay. So this is yards, meters, feet, what whatever. Right? And now, you still have the the argument called distance, but it's of type, capital b distance or something like that. Right?

Is is that so that's the fundamental change, essentially. Right? So that Exactly. So the same approach, but you interpret it in a specific way that it is a distance and not a number of meters or a number of, yards or whatever. Exactly.

So if one, one developer in the team is doing the, let's say, the the calculation of, of a moving, moving entity in the world. And another member of the team is working on consuming the the from somewhere in the world, this entity and sending it to it to there. They don't need to agree which, if they are talking matters or not talking matter. One member will will, you know, do his his work in lengths and time, and the other one will just consume it and move it for in lengths and time. So they don't need to agree about anything.

Just, like like like any you know, if you're working and you're expecting to some number, you're getting numbers. If you're expecting 2 lengths, you're getting lengths. You don't need to agree about what is the specific measurement unit you're using because you don't using specific measurement. So it simplify everything, and you don't need to convert because, always you need to convert because even if, 2 members are, of the team are talking about, okay, we will work in in only methods. But still you have legacy or not legacy code that's using yards.

So and you want to use it. So you need to take to convert to convert back and and and and convert vice versa when you're getting the response back. So so everything every time you need to convert. And if you all of the team, actually one of the system is moved to work only with the with the with the new type of the unit, which is length or angle, you don't need to convert it anymore. So how hard was it to introduce such a library in your code base?

Because it sounds like, quite a big refactoring. Right? Yeah. Yeah. Yeah.

It's it's a big refactoring, but, actually, it was easy. Why it was easy? Because you can do it gradually. So every time that, so for a long time, we have a convention that always you need to specify the unit type and specific unit in your variable. And then as well, it's just impossible to develop.

So every time that you you're taking one function, okay, so you still you don't change the the signature of the function. Okay. But you do create your within this function, you're consuming okay. So you're getting the yards, so you create, my lens from yards, creating legs, and continue to work. So you don't have to change your old system, one day.

Okay? It's impossible to do it. But it's very easy to start removing the call. I think about, like, a year later or so, we we almost have no specified, units in the system, and the system was big. Because every time we we we have problems with it, so it was easier to just move to use this and instead of continue to try some someone to to somehow to avoid it.

So it was easier to to do it. The the the concept of it is is is very simple. It's not like introducing a new framework and then everyone need to, I don't know, if someone hate it and don't like the way that the framework is, approach how to work. So it's like, there are people that don't want it and don't contribute to the moving of it. But this one is is is not a framework.

It's a library that it's very easy to use and very intuitive, actually. It's it's really intuitive. So you're starting to work with units as they should be. So it's it's was very easy to introduce it to the rest of the team and to start, the moving all the function, all the functions too. And, also, if you don't if you remember, we had a huge really huge file with a lot of form 2 form 2, like so we we took one day, and and we just converted all to the new one.

So we didn't change the the still, the the signature. So you you, looking off all the calls to this, to this function, which is quite easy with a modern IDE. And you're just replacing all to use the the the new the new way of how unit is represented. And then you replace almost half of your code with quite safety that you didn't break the system, and you get rid of this common, this common file. So very, very quickly.

So so it worked well. And what about doing some calculations on the unit? Let's say that I want to add 2 distances or 2, I don't know, angles or whatever. Does the library handle that or do I need Yeah. Okay.

So so let's dig down a bit of how it's, how it's implemented inside. So, actually, what this, library does is that it specified for every for every unit, it specified the the the basic measurement type, which is the most common in in the industry or whatever type of, unit it is. So so, basically, you have base type for all of them. So in the over overriding of, let's say, the the the plus signal, the, of c sharp. Okay.

So, actually, it's inside is overriding this symbol. So it's doing, plus between the base type and creating the new lens. So, yes, you can take 2 lens objects and add them. And as a response, you will get a new lens, which is the right lens that you're expecting to. So in behind the in the background, what it does convert it con it's converted the 2 lens that you give.

You converted both of them to the base unit, which is, in lengths, I think it's matters. So both of them are matters, then doing, the primitive truce between both of them, which is if is one is 1 and the second is 2, so it will be like 3. Creating a new names from matters. So you have method 3, and then you have a new names. So for you as a as as the developer, it's just transparent and you don't care what is going there.

But you're getting you you do plus and you get the response. So you can do, whatever formula that you want to to do with all the primitives. Everything there, you can divide, you can add, you can check, and present, do power of you you can do everything that, the language is, supported with. So, yeah, it's very easy to work because you don't need to to specify your, your type of measurement when you're trying to do some, some operations on both of them. Yep.

That sounds great. And what about crazy naming conventions? Because just like we have miles, multiple miles, and probably 10 different types of miles, just like we have different kind in the US and the United Kingdom, just like we have kilometers, centimeters, millimeters, we could have megameters or centimeters or whatever. Yeah. That's the library.

Sean is laughing. Do you even know those units by in the US? Forget fathoms. You forget about the the the Navy Yard units, you know, like nautical miles and, yeah, it's a it's a nightmare. So yes.

Because it you know, this is open source, and this is a community. And the answer is yes. Sure. You can go and see. If you want, I will I I will show it, and show it by This is primarily a podcast, so if you can have to describe it and things like that.

So we've Oh, okay. Okay. Okay. So you have to tell it, you know, when you're passing values in that these are in different units of systems. Like, if one one value is miles and another value is kilometers, you have to somehow indicate that is the case.

Right? And it'll do a conversion? Before without using this library, yes. But with with this library, no. You don't care what was the region of of of the the the lengths that you started with?

Once you created let's say that you, created the lengths from multiple miles and you created another lengths from methods. Okay? And once you created the lengths objects, 2 lengths objects, it's just you don't care what was the region. K? The library is doing everything for you.

So from now and on, you can multiply both of them. So it means that in the name of the variable, you don't need to specify in the name, what is the measurement that it came from. Okay? So you can just say what is represent you know, in the world, like, it's represent, position of a of a sheep or it's a represent the position of some person. K.

So this is like, you will have a point, which is each point is a lengths and lengths. Let's say we're talking about Cartesian name, the places. So so all you need to describe is point with 2 e x and and and y, which each one of them is just length. And you can call it like, my friend position. K?

You don't need to specify nothing more than this. You don't need my friend's, positioning matters. It's not a matter, just the position. And the position have x and y, which is length. That's all.

But but like 1 mile plus 1 kilometer is not 2 kilometers. Yeah. But you are not talking about not kilometers and not not the kilometers. You are talking about lanes. Once you created this object, you're talking about lanes.

And if you multiply both of them, you will get the multiply of of the lanes. So you don't care if behind the scenes, it's one of them converted from nautical miles to meters and the other is meters, so we don't need to convert it from anything. And then the the, the doubling was between the two meters and you get, and if you were interested with, some other, measurement, you you will just will be able to get it from the new lens. You don't care about it. You only have lengths, and this is what is present.

And this is what you are doing the arithmetic, operations on them. You don't care about the region. And this is the the as as simple as it is, is also genius because it's, it's genius because you're working on n lengths, and this is what you're doing the arithmetic function on. And still, if you need to somehow go and to understand the real measurement of ZAC, you have ORFID. And if you send whatever the supported the units, that they have, you can go and see it.

It's on GitHub. It's open source, and you will see, I think there is a 30 or 40 types of, something that you can, see there, so type of measurement. And And I'm not talking about, the or the Mico, Mega, Nano, and Min and and all of this. Okay? So this is also something that you can say, that you support like, a YARL, and then you can describe that you also support like a a mico yard.

I don't know if someone's using it, but, anyway, it's supported. So so you have all the types of, like, nautical miles and with all of the, like, a kilo, mega, and and rest of it. So, yeah, it's important. Like, I I for myself, I didn't see any type of, unit that doesn't support. And we are talking about, you know, lengths and units, which is quite obvious.

But there there are, like, everything is something that I I don't even know what it means. Like, mass and rate of, I don't know, radioactivity of something, everything. K? It's because, you know, it's a community and it's open. There is, I think everything.

And if you somehow, I don't, understand how it could be, but if you see some units that it's not, yet supported, you can edit. Like, recently, I saw that someone has opened an issue that he wants to present, like, a timing mark. So there was a discussion and, apparently, it's going to be, sooner or later. So also, time in Mars, I don't know how exactly to convert it, but, there is a formula that apparently NASA is using it. So they are going to edit.

You are like anything there, regarding time and regarding mass and and and I don't know. Go and see it. It's it's crazy. It's it's just crazy. It's endless list.

Yeah. It's endless list of all all all all of thing that all of thing that you can acceleration accelerations, everything. And how hard is it to to use this library, for instance, when I do persistence? Let's say I have entity framework core. I'd like to save values to database, read them back.

How hard is it to just link with that and all the queryables, etcetera, etcetera? Yeah. It's it's, so so there's the, you know, the naive solution is that you can and, you know, choose what will be, your default, your default value of units that you will use. And, like, you can extend the library, like, to DB new value, something like this or c sharp supported. And, and then you you will do it in the in the DB.

So every time that you are, you will add, like, an extension to the entity framework, for example, you will add that every time that gets this type, you will convert it from and to, like, you're adding this kind of a middleware. That you will add from to and let's say that you decide that the metal is your, your the value that you want to use. So you will convert every time form and 2. And, when you fetch in from the DB, you will convert it to lengths from metal. And when you save it to DB, you will save it to, 2 meter.

And then the dB you have to use, of course, you have to use some specific value. In the end, it's just the number that should represent something. So when you're working in your code base, it's always be, like length. And in the database, you have to use by the end to to save it to some specific value. Like, like, let's say in your APIs, you need to choose something.

You don't pass, like, lengths in the API, which is also something that I want to to to talk about. Okay. So so I I understand, how how the unit's net library is built. It's like you have, the directory of a lot of JSONs, which each JSON file represent some type of unit, like, one is Angular JSON, length JSON, and math JSON, and a lot a lot of JSONs. And in this jason is describe the base value and every new, measurement of unit, how to convert from base and to base.

And this is all of this, jason is a lot of conversions, form and 2. And and a way of how to write your, your formula is like x is always the base value. And then do your math. Like, if you try to convert from, from metal to yarn, it will be x double, I think, something around 22 and and the bit. Don't remember exactly the formula, but something about this.

And so so this is how those, files look like. And then when I've, I've moved to checkpoint and I started to work more on a JavaScript ecosystem and Python ecosystem, so it was not GIS system, but still I was very missed this library. Okay. So I feel that it's, I'm missing her. So I I thought okay.

So if we have JSON files to represent those, those units, why not to create the same for JavaScript? It's, for actually TypeScript, not supported in JavaScript. So why not to do that? And I did it. It's it it was quite easy.

So you generate, I generated, like a package published on NPM, which does the exactly and with the very similar infrastructure to what the original UnixNet does. Just for TypeScript, of course, with a bit different on conversion because it's of the same technology and there are different con conversion, but but but the overall look and feel is just the same. And then when I started to work in Python, I did the same for Python. And then I realized, and this is something that, that I think it's it's very could be very interesting that, actually, I want to to to be to be able to move mostly between all of them. Okay.

So let's say that, usual system, like, the back end is in c sharp and the front end is some, some new new edge framework with types, like, React or whatever it's used. Okay? So what what you need to do and how is that? So you created, like, you're working with your Unity in the back end, converting it to, let's say, matter just to be part of your API, consuming it in the front end, and then converting it to unit in in task, which is again feel like, okay, so we have to go through the API, which is by the end, HTTP text. If we are using the HTTP, which is basically mostly what everyone is using.

So so you need to specify the type, but, actually, it will be wonderful if we will be able to somehow make it also transparent. Okay? So the same as we are doing our own, system, k, which is a monolith. Okay? The monolith that everything within it is the same language with the all of them is, functions that cover each other.

If we will be able to somehow represent this unit between systems and between, not not also back end and front end, but also between, 2, 2 services in the in the system. Let's say that you are working on an anomaly, which is normally what we are doing now in the modern, cloud native. So we have a lot of, small processes that everyone is doing this job. Microservices, how it's called. So so, basically, you need to choose, you need every time between one of them, between your system, you need, you need to convert it from and to.

And this is not also to be annoying, which is system gets it with its type. Okay. So like, like every developer feels like he's writing his API and then, duration in seconds, milliseconds, what how to represent time in milliseconds or in seconds. Every system has its own. So actually, milliseconds and seconds, it's quite easy to detect because the length of the numbers.

So it's very easy to see whatever it's second or or or or a micro or a nanoseconds. But, but but still it's very annoying to decide. You need to to decide in your API what specific unit you are going to represent, which is very annoying. It's it's still it's still wrong. You're writing very beautiful API, and then you need to to write there, let's say, currently, we are working on a certificate, how much time every certificate has is valid.

K? So for each time, from the time that it's, signed. K? So it's like, 2 days. So how to represent these 2 days in API?

To tell 2 days to write in in in seconds of 2 days, how to represent it? It's it's very annoying every time, and it's still very bad to to to do so. So, currently, the the approach that I think is going to be very cool is if there will be a way to, you know, the DTOs and how to represent units or everything in in API. Okay. So I have used the open API, which is the very common way how to represent, the operate represent your API, the the standard that I'm familiar with.

And and then to create the type, like, if all the flavors of units, all the languages and technologies will do the same, it will be very easy. So you're creating, a DTO model, which is the models that represent, lengths. K. So we call it a length DTO. And then within it, you have value and you the specified unit that it's represent.

K. So let's say if it's a metals, so it will be value 1, matter, and and and the unit will be matter. And then every system will know how to consume and how to read it. K. So you can decide to represent your lens with whatever type that you want.

Okay? So you can keep it like 1 meter or 10 decimeter or, or or 100 centimeters. Okay? But but in the API, it's very, very clear. You have you have length DTO within its value and and unit.

Okay? And then if you have this, like, a standard of how to represent it, it will it will be seamless to all the microservices or or the services that you're using, how to consume and to get it. So everyone sees it. If there is, a length with the length DTO. Okay.

So the the library itself know how to consume it and to create lengths from it. And also someone that's going to read this API, it will be very easy to him to understand it. Okay? So it's not like, you are doing some, some magic within the API and only, the 2 endpoints of of your library knows how to to produce and consume it. It's very clear.

You have there one matter, which is everyone can understand, or or 2 that's in, 10 that's in matter. It's it's it will be very clear to someone that it's outside of the, you know, the not using unit net. Still, it will be very clear, and the API will explain itself without any extra need to document whatever you are trying to do there. But still, if you are using unit net, it will be, like, fully transparent for you. If you're working between, between technologies.

So you one developer is working with the with c sharp, and one developer is consuming it in TypeScript. And both of them don't need to agree about anything about how to represent the timing of expiration of certificate. They don't need to to to agree between them. The the consumer doesn't care about what is the type that, that's the the the they can choose to to represent. Okay?

If they choose to represent it in meta, okay, whatever. The the the type sheet will consume it. We'll see that it's meta, convert it only to convert because this is the base, but we'll convert it if it's not meta 2, metal within it and create lengths for it for him. So, and this time, it will be a duage. So so it's very easy and seamless between, technologies, between different, systems.

And I think it's very cool because it's also answering the same problem that we have in the first place. You just want to to tell the consumer. You just try to tell him, this is the duration of the explanation. This is what you're trying to say. You don't care about whatever it's minutes or seconds.

You're just trying to say, this is the duration of it. And the consumer also don't care about what you're trying to say in in in in whatever time that you choose. You you just say, okay. This is the duration. I will show the customer.

Okay. I am doing why I will show it in letters. I will show it in whatever I want. Right? Just worry if the time passed, I will do whatever I need to do with it.

But I don't I don't want to know how the back end is worked and what exactly the the types that is going to to be. And if we will go crazy, and I'm not sure exactly how to do that, but I'm sure that it's possible. I need to research more in order to understand, but probably there is a way, if you are talking about, I'm using mostly for, rational database postures. So I'm I will not be surprised that there is a way to extend and to create a new type in the DB, which also will be the same. So we'll we'll follow the same fundamentals of keeping a unit and then consuming it.

So you don't need to hack, with a middleware. You just can install some plug in or something, and you have new type new types in your database. And the types is just the presentation of units, and you can take whatever you want with it. You you just get it, and you can represent how to do it. I think it's it's okay.

I I this specific one, I don't didn't yet deal. K? So I'm not gonna present it's possible. It's just best guess. But if so, it could be could be really cool.

K? So everything is representing what you are trying to represent and not what the world is forcing you to do and to represent. So it's changing the behavior from trying you're trying to adopt to how to represent something to this the the system is adopted to how you're trying to represent something, which is, what we are trying to do in the day to day development. Okay? So we are trying to go away from assembly and trying to be more intuitive to humans.

So we're trying to do our way and now with the with AI, we are trying it's started to be crazy. But this is what we are trying to do is not to align ourself to computers, but to align the computers to us. Like, we don't yet yeah. So is this, UnisNet library, is it fairly complete, or is there things you're adding to it all the time? Okay.

Nothing is complete in the in the. Oh, yeah. No. No. You know, we are not engineers.

It's a we are not just, building a bridge and say, okay. So how beautiful it is. And everyone is, going home. In the software industry, it's, nothing like this. Always there is a bug and something to improve.

But I think that currently, yes, the the UnisNet is ready for, for many years in the c sharp, and it's very stable, and a lot of people using it. Also the JavaScript and the and the Python, which I'm maintaining is, is here for home. It's not something new and you can use it. What I'm talking now about advanced regarding APIs is currently, I'm testing it. Also, I'm trying to, also communicate with the UnisNet, c shop owner.

Also to see their part of it, what they think about it, how to make sure how to implement it so it will be transparent in all the the technologies, which some of them are not maintaining. But but it's also regarding the APIs and how to present. But actually to use it with your own, with your own project is easy as if we are talking about c sharpness in nugget. If it's a JavaScript and TypeScript, it's on NPM. And if it's, Python, it's on, on PyPI and supported, and I think it's really cool, collaborate, very lightweight, and really cool.

This seems like something that, John Skeet would be very interested in, especially the the time stuff that that's in there and and maybe comparing that to what he's doing for no to time. So, is there any last things we you you wanna cover? We don't have much time left. I've got a a another appointment here in about 10 minutes. So is there anything left that that you wanted to mention before we move on to PIX?

Not much. Just that, I'm I'm very excited about it. And, I also working on, standard, standard rate as part of, you know, API. So how to represent them on open API, which is something that I'm working on. Very hopeful that it will be soon ready on production.

And regardless of it, I think that the those of this approach is awesome, and I really recommend from my experience. I really recommend everyone that using these units to to use, with this specific library or, which maybe I'm not familiar with. I think it's really cool, and very, really simplify will simplify your code base and even your approach to, you know, how to handle such problems. Okay. Yeah.

Yeah. We'll be sure to put, links to the project, in the show notes for everybody to check out. So, yeah, with that said, let's, go ahead and move on to PIX. Christian, you wanna go first? Absolutely.

My pleasure. So I had something else planned, but I changed course, because, my pick today is an an evergreen, a a free bear, evergreen. That's a 7 Zip. I mean, I think with the last Windows 11 update, Microsoft even added a 7 z support to to Windows, so, Windows can now, open up a 7 Zip archives. Still, 7 SIP, the software, still free, still going strong.

New beta came out today, the day we are recording this. So this is March 22, 2024. The the source code was not released. So sometimes when new release comes out, Igor Pavlov, the the the person behind the project, first releases the binaries, and then the source code, comes a few days later. Definitely wait for the source code so that someone is betting it and sees whether the, compiled version, matches the source code, which absolutely makes sense, but still, going going strong.

I especially like the, the performance improvements when using on ARM, when decompressing archives, which I already tried out today. And, also like the the the Windows integration of of the tool, and, I'm I'm a happy user since for quite some time now. Alright. So, over to to you, Evan. Thank you.

So my pick for today is has a very bad name from the marketing perspective because it's called Bluetooth adapter for keyboard and mouse BT 500. And while the name doesn't tell you anything, this is actually a great hardware, a piece of hardware, which can turn any of your keyboard or mouse, wired keyboard and wired mouse into a wireless one. So you basically plug your keyboard into this tiny thingy, then it exposes a Bluetooth that you just can connect to your computer laptop, VR headset, whatever, and bang, your wired keyboard is now wireless. Why would you use that? 1st, because those wireless Bluetooth keyboards, they tend to suck in terms of what key layouts they have.

Right? Why don't they make just a full sized Bluetooth keyboard with all the regular keys I love with no FM, no short space, and I could go on and on. You just Google the Internet. You don't want to take it off. 2nd thingy.

This, this little, little thingy can do remapping of your keys on the fly. Meaning that if you want to switch letters, caps lock, whatever else, you can just do that on a hardware level, thanks to this one. So when you press a key, it sends a different key over Bluetooth for you. Why would that be useful? 1st, if you like tuning your keyboards, but second, if you try to connect that to your Android device, which misinterprets the keys you have on your keyboard.

So that's what I'm actually doing. If you recall my pick from couple weeks back, I was doing like remote desktop over VR and Windows Key does not work well with VRs because they are based on Android, at least minus. With this thing, I can remap Windows Key to something else and then use Power Toys, which could be another week for some other week. I can use Power Toys to map it back to something this. So this is how you can hack the world, actually.

So I highly recommend this piece of software. It's sorry. This piece of hardware, super hard to Google it, thanks to this lovely name, Bluetooth adapter for keyboard and mouse, which is only slightly better than your c programming language. Try to be c. It's a it's a very strange.

But, anyway, I do recommend that. And now, over to to you, Sean. I I I just have answered that this is just your excuse to be able to use the the the Dvorak simplified keyboard, on your machine. That's, I just You could do that as well? I couldn't possibly recommend.

Absolutely. Yeah. So, my pick this week is another Netflix show that I watched and I kinda enjoyed. It was Damsel. So you kinda think of it as, like, damsel in distress.

There's a princess that's been set up to be married, this prince, and the family, you know, says the prince is a rich rich kingdom or whatever and the family with the princess is a poor family. So they said, you know, the rich kingdom says, we'll give you lots of money if you let your daughter marry our prince or whatever. And so little did they know is that part of this setup is that the princess would be sacrificed, shortly after the wedding to to, I I guess I can say, a dragon, to to, you know, appease the dragon and things like that. And then that's kinda that's kinda the premise of the rest of the show, so I won't give it all away. But, the star of the show, the princess is Millie Bobby Brown.

So everybody knows her from Stranger Things. So check out Damsel on Netflix if you have Netflix. Alright, Naim. Do you have a pick? Okay.

It's a surprise for me. Something that's come to my mind is something that, it's an open source, a project based in Germany, I think. Photo freedom is kind of an alternative to Google Photos. Very cool. I worked with these guys to to localize it to right to left languages, Hebrew and Arabic.

It's and they're very responsive, very cool team, working on my open source. You can run it on premise in your home, which is something that I'm doing. And you can run it, say, on some, some cloud if you, if you like. They have a very highly, very good support if you need. It's basically a good way to represent your images and videos instead of just storing it in the, in the NAS or something.

But you, you want like a look and feel of Google photos, which is to see history, to see places, to see, you know, a very, interactive user experience and not just keeping images somewhere. I think it's very, very good, team of developers, that's very passionate about their work, and so on. So it's all good. So I would this is the first one that come to my mind to pick. That's all.

Really thank you and appreciate for, inviting me. Thank you. Yeah. Well, thank you, Chaim. All yours.

Thank you, Haim. Yep. If our listeners wanna get in touch with us at the show, they can reach out to me. I'm on all the platforms. I am at dotnetsuperhero.

Thanks, everybody, and we'll catch our listeners on the next episode of Adventures in dot net.
Album Art
Streamlining Measurement Representations in APIs Using UnisNet Library for .NET - .NET 182
0:00
55:47
Playback Speed: