Skip to main content

Posts

Showing posts from 2019

C# F# - different tones of .NET

I like good programming languages and C# is definetely one of them. It is my main tool at work. But it is not the only language in the world. When I've got a chance to make one of our next services in F# i was more than just happy about it. Some parts (.csprojects) were already done and needed to be replaced by their F# implementation. I thought F# is just another language with "strange" syntax which does the same stuff the same way. Boy, was I wrong. I had trouble to write interface method, then to implement it. Then to properly use other method. This is so much different. For example, in C# you declare everything about method in first line: string method( string param1, int param2) while in F# it will look more like this: let method param1 param2 : string See there is no parameter type? You don't have to add that. You can of course: let method param1:string param2:string : string But the thing is you don't have to. F# is static language just l...

Xamarin Forms Binary Size

Apps on iOS are nice, Xcode is fine development environment and working in it is fun. I have and app on iOS which I would like to port also to Android. I thought about rewriting it in Xamarin.Forms. It turned out Xamarin apps (now as a part of Visual Studio) are also nice to write. I choose Xamarin.Forms to minimize code needed per platform. App is available on github: https://github.com/jaropawlak/MyExpenses.Xamarin and has almost all functionality my original app had. There is, however, one issue. BIG issue. It's the binary size. While my original iOS app takes less than 2MB on device, Xamarin version is around 100MB. That is not acceptable for so simple app. I don't mind apps being big for a reason. I would also accept that if it wouldn't make the app slow. But it makes it slow. Have a look: Cool ha? Native is so fast! So, what are the sizes exactly? Native app is 1.1 MB   Xamarin.Forms app is 101.2 MB The question is: can I shr...

Let's GO

    C# is a great language. Each new version takes the best solutions from other languages and keeps it very modern. However writing C# all the time both at work and at home feels boring sometimes. I like learning new languages as this provides good exercise. I've decided to write a simple go program. And because I didn't have a better idea I took an app that I had already written in .NET Core and created it again in Go. The app should download history of average daily cryptocurrency value from exchange Binance. I want it to get all crypto pairs from beginning of time until now. I’ve started with simplest thing ever: package main const hostUrl = "https://binance.com" const apiResourceUri = "/api/v1/klines" const apiGetSymbolUri = "/api/v1/exchangeInfo" const downloadLocation = "data" // here I’ll save data So far so good Opening url http://binance.com/api/v1/exchangeInfo will get us among other things list of all symbols that...

Coredata With Cloudkit

With iOS 13 we'll get new cool feature - coredata db with cloudkit backup. Exactly what I need.  Bad news is that my old device will not get the update. My doctor said that I should track food I eat. What I should do is divide my day into 2-3 hour windows and eat a small meal in every one of them. And write it down and then show it to the doctor so we can talk about what I should and what I should not eat.  I did the tracking for few weeks in excel sheet but an app would be so much convenient! I thought about simple logger in iOS and a website to generate reports. This is the place where merged cloudkit and coredata would help a lot. It turns out manually adding cloud backup is really easy. Here is the quick doc of the changes required: // before... usual stuff class Repository { func createLogItem() -> LogItem { return LogItem( context: context!) } func deleteItem(_ item: LogItem) { context?.delete(item) } func saveChanges() {...