October 2, 2019
It is possible to debug several projects from one solution simultaneously.
Solution Explorer -> solution properties -> Common -> Startup Project, select multiple to start. It takes more time to start, but worth it, if needed.
To convert dto into json, put into immediate window:
Newtonsoft.Json.JsonConvert.SerializeObject(offerRequest)
To install old .net core sdk/runtime, simply copy unpacked zip content folders (not dotnet.exe) to C:\Program Files\dotnet
Windows + Pause
Shortcut to system settings. And environment variables settings is hidden behind Advanced settings button. I always forgetting, where it is.
September 30, 2019
Shortcuts is nothing but a frustration to use as programmer tool. I spent two hours writing simple script:
I can write this logic in c# in two minutes. Ten or fifteen, if include creating new project, adding references for reading files and parsing json, reading stackoverflow and making coffee. May be I should have used Scriptable for this, but I was slightly affraid to write a lot of code using just two hurting fingers. And shortcuts integration with scriptable is too slow, it takes at least a couple seconds to call script and get value back.
Another issue with shortcuts for me: it just never has what I really need currently. I got clever idea to set down time when i get home until 20, when i put my son to sleep. Guess what? Downtime cannot be controlled by shortcuts.
Another example: overcast have action: Smart skip to next chapter. I wanted to check current time, dumb skip to next chapter, check current time again. If difference is more than 5 minutes, go back. Sounds simple, but, as I guess, callbacks to overcast are cached within one run and every time I call get current running time, I got same result regardless moved I to next chapter or not.
Today I have tried to use NFC tags: same issue, sometimes they are working, sometimes iphone shows exception. As I understood, this is 13.1 error, but still this unreliability is annoying. It's like using linux.
Conclusion: never use shortcuts for something conditional, something that use numeric variables. Best way is just quickly tweak some system settings, one or two steps, like skipping next chapter on overcast, turning do not disturb or start timer. For these problems Shortcuts are perfect.
upd: at least, in one thing I was wrong: if scriptable return too slow, add Script.complete();
at the end. This makes it way faster!
April 23, 2019
I always praised VS debugger, because it allowed move execution pointer back and forth as well as implement some code in intermediate window. I just didn't know, that xcode also allows do that. Moving execution can be done easily by dragging green line (or which color highlighted currently executed line). Actually, this is just nice frontend for lldb j
.
And executing code is possible also in debugger window: lldb p
. Would be nice to have separate window for that, but actually more useful would be to read about other lldb options someday.
April 17, 2019
On entity framework on deletion one-to-many it is possible to cascade delete entities. However, if foreignKey is nullable, this relation should be set to null, and EF does it automatically with one small catch: only if entity is in memory.
If it is doesnt loaded, then it will throw ugly error The DELETE statement conflicted with the REFERENCE constraint
.
To avoid that, load entity implicitly by any possible method like Include()
or using Queryable.Load
like that:
Context.Entry(parentEntry).Collection(p => p.SubItems).Load();
here We load all SubItems, that have a foreign key to ParentEntry and, when we delete it later, all those keys sets to null automatically.
More about this here
February 25, 2019
When I have bought new iPhone with preinstalled ios 12 and new Shortcuts app, it was naturally for me to start automate everything, that I'm doing on a phone. But, there were not so many:
I have created morning shortcut (turn off sleep mode, show weather & todo list), and evening routine (even simpler: set do not disturb mode, open alarm app).
All automation solutions, that I see in macstories or hear in numerous podcasts did not clicked for me. But the more I'm playing with this, the more I realize, that I can do more with a phone and implement new ways of interaction. Creating new shortcuts or scripts in Scriptable or actions in Drafts is not very easy, or even possible sometimes. The hardest part is to actually find new things to automate and find what can be actually usefully, and not just produce whistles, that were made for fun and neglected on next day. I'll try to make posts time to time to describe what I'm doing and what I got from these scripts.
As quick example, I have added several actions to Drafts. Each of them consist from one step: call callback url to Things to create new todo.
things:///add?titles=[[draft]]
things:add?title=[[title]]¬es=[[body]]
things:add?title=[[title]]&checklist-items=[[body]]
things:add?title=[[title]]¬es=[[body]]&when=saturday&list-id=ED7BB6BD-7F6C-466B-84AD-B9C5E580D51F
Since I have added these actions, I hardly ever add new tasks directly in Things app. By and large, Drafts app become my input method in phone and I hope to write more about it later.
100% JS-free