Hyston blog
About • Archive • RSS

Visual Studio Codespaces

May 21, 2020

MsBuild 2020 is happening right now and I'm trying to catch and learn many interesting stuff from there. By now, the most exciting part was Visual Studio Codespaces, previously known as VS Online. I have already tried it about half a year ago and, as I remember, then it allowed only to create host machine in the cloud. But now it is possible to create free self-hosted environment and, basically, connect from anywhere to development machine. Well, there are some asterisks.
As usually, there are some good guidance on docs.microsoft, here is a good place to start. For cloud environment process is relatively trivial: create microsoft account, create azure account (at this step you need to add credit card credentials), open Visual Studio Online and create host. Of course, it take a lot of time between page redirection and entering account credentials. In Safari this page stuck in endless authorization loop, firefox also refused it to open, use Chrome. Then in desktop VS Code install "Remote Explorer" extension and (also after endless login in microsoft, azure and github account) it is possible to connect into cloud machine and use it as local. Well, almost. Here is list of things, that I have tried, but didn't work well:

visual studio codespace on ipad

BUT This is actual, real and powerful IDE, running in browser! And I didn't use Edge browser1, hopefully Safari support will come soon. On one of questions in VS codespaces Q&A videos, host called iPad support as one of their nearest priorities. That would be awesome🤩


  1. it will take a while until I will start trust to MS browser. I'm old enough to remember supporting IE6.


ELK

May 13, 2020

I was working on adding logs into elastic search from one of our micro API projects. I learned a little bit, that I'll probably forget when I'll deal with this next time. So, I'll write it here.

  1. ELK - Elastic Stack. How it works:
  1. It's very useful to run ELK Stack local. Of course, installing everything will take too much time (I still remember painy days spent installing lamp). Of course, these days everything is in container and there is one good repository, that will help running everything in minutes. All you need to do is:
git clone https://github.com/deviantony/docker-elk.git
cd .\docker-elk\
docker-compose up

And read ReadMe.md for further details.

  1. In my case, we have configured sentry and adding additional logging system, without removing old one. In this case better to remove "Logging" section in appsettings, otherwise it will affect both system. Most tutorials recommend start logging in Program.cs before actual werver will start, but I find it too cumbersome. If server didn't started, we will figure it out by not seing swagger page or by errors from other service, that consume this api.
  2. Also, most tutopials did not mention, that serilog can be configured not in code, but in appsettings. Probably, additional libraries needs to be installed, but then startup code itself is not polutted with config lines.
  3. When kibana resist to show logs, it means that, probably, indecies were not setted up correctly. And keep in mind, that it takes some time for log to appear, even if everything is running locally.
  4. Some usefull links:

This is probably too much info for such easy topic, but I might find it usefull some day later and - hey - I'm blogging again!😊


Biteshift

January 11, 2020

I started to participate in Advent of code 2020. First couple tasks were easy, but after a while it keep getting harder and took more time, that I can manage on average december day. Today is 8 day and I done only 14 of them and want to share one bug, that I did found solving last one. I am pretty familiar with bitwise operators, espacially shift:

1 << 1; //result it 2 (bin: 10)
1 << 3; //result it 8 (bin: 1000)

However, in day 14 bitmask is 36 bit length. If you shift too much, it should be cut. Alright, I thought, lets use unsined 64-bit integers.
ulong a = 1 << 32;
Because currently I dont have a debugger1, and it worked flawlessly with smaller values, I havent noticed an error here. Documentation said

Because the shift operators are defined only for the int, uint, long, and ulong types, the result of an operation always contains at least 32 bits and I naturally assumed, that if I define left hand operand as 64bit, then result would be also 64. That was correct, but before it


  1. VS Code support for M1 macs is incomplete, as I'm afraid, until .net 6 😣


lsof

January 9, 2020

sudo lsof /Volumes/2cent/ this shows disk activity. Today external disk drive refused to be ejected, Finder showed error that disk is still in use. lsof shows that many mds_store processes occupied it. kill and then turning off spotlight fixed this issue.


What I have learned about git today

December 30, 2019

I knew about git hooks, but never actually used them. The first and obvious thing, that I could imagine — add branch name to git commit message. .git\hooks\ contain nice examples to start, but I was taken aback by amount of bash scripting, that is required. And, more importantly, it seems that it never works properly — neither Sourcetree or fork.git client were showing changes. However, after commit pre_commit_message hook was actually executed and branch name was inserted correctly. Examples like this should work flawlessly to my purpose. And I need to learn bash too 😶
Apparently, branching workflow, that we use at work, has a name. It's called gitflow (insert link), and it is used in many projects and even in our teams is proved as very convenient and easy solution. It is well described here and I can only describe one difference in how we use it: usually we do not merge release branch back to development (as well as hotfixes). All changes for current release accumulates in release branch, then we merge to master and only after deployment merge it back. 1 There is no harm to not merge release back into dev (as well as every hotfix), but it can be overlook and forgotten, but during deployment process it's just one step in list of instructions.


  1. The only exception — when release contain new migration, then it should be merged asap. Then I would be better to add migration to feature branch (even is feature is already merged to development and release) and, merge feature branch to development and release branch accordingly


← Next Previous →