Hyston blog
About • Archive • RSS

Pgsql timezones

November 3, 2023

It’s been 0️⃣ days since last time I was confused about timezones. Recently I noticed that we store local timezone in our db as timestamp with time zone: 2023-11-03T14:20:00+01:00 instead of UTC time.
When I used switch “Npgsql.EnableLegacyTimestampBehaviour” it seemed, that it saved UTC value into database, but on reading DateTime kind was Local, which was incorrect.
Long story short: I didn’t notice big red warning in Npgsql documentation. When we save UTC to db, it uses local timezone to represent values.
For example, if I change local timezone: SET TIMEZONE ‘Asia/Brunei’ it would show time as 2023-11-03T21:20:00+08:00, but data wouldn’t have changed, only how it displayed on the screen. And it transfers into C# layer properly.
More than that, RFC3339 allows it and states that it is a correct format to display UTC.


Window management

August 18, 2023

On recent episode of Mac Power Users David and Stephen talked about possible solutions for window management on a mac. I have tried many apps for that before and especially last fall, when I switched to using a mac as main working computer. So I want to describe my setup here, not because it would be interesting and/or usefull to anyone, but as reminder for myself for the next time I would need to set up a new macbook.
My main requirements for window management software:

  1. it should be controlled completely from keyboard
  2. it should be available outside app store (because on working machine I don't have access to that)

Rectangle

This is the main utility. I configured these shortcuts to move windows:
⌃ ⌥ ← left half
⌃ ⌥ → right half
⌃ ⌥ ↑ center half
⌃ ⌥ ⏎ maximize

Best of all, by clicking several times, it switches between windows sizes. For example, clicking ⌃ ⌥ ← first time would move window to the left half of the screen, second time it would resize window, so it still be on the left, but take ⅔ of the screen and third click would resize to ⅓ of the screen. This is extreemly helpful, when I'm using external ultrawide monitor and allows me to arrange windows in just several keyboard clicks. I also set up shortcuts to resize and move windows to sixth parts of the screen, but I use it much less often, usually if I need small terminal panel somewhere on the side. For multimonitor setups there are shortcuts to swap window to next monitor - which is very convenient.

Rectangle

Alt-tab

Another problem in macos after switching from using windows machine is app switcher. I use mac for last decade as personal machine, but usually I dont open many windows or, especially, windows of same application: it's only one browser, one IDE and one terminal. During working hours, I usually have at least three browser windows: one for company apps/tools (jira/github/circleCi etc), one for developed application (different instances of localhost and might be different environment) and third window with google search results. Not because I tend to keep things clean and separated - quite the opposite, every browser has 20-30 tabs open and I would lose everything using one window.
Another example is VS Code - ideally, I work at one project at the time, but quite often I need to run backend and frontend and may be other services in debug mode. Macos default app switcher displays only one icon, selecting exact window can be done with arrow keys. Also, it doesn't show all windows (as example, if there is prerefence window open - it wouldn't be in list of application). Alt-tab app solves this issues, basically bringing windows style app switcher to apple platform.

Using these two apps I can do everything in just couple of keyboard shortcuts, without touching a trackpad (or mouse): Alt-tab

Bonus round

In addition I found many more small utilities.
Sleeve Very customizable UI for currently playing music. I always want to see album cover as well as artist, song title and media controls. Can be placed over other windows, but in this case it's blocking click of big portion of the screen, so I quite often keep it under other windows (left bottom hot corner -> display desktop)
Desktop Hyperkey I almost never use capslock. Instead or typing screaming, it can be rebound to ⌃ ⌥ ⌘ ⇧ (aka hyperkey). And then it can be used for global shortcuts. As examle, for me hyperkey + B opens new Bear window and hyperkey + T opens Things
Hidden bar Free and simple alternative to Bartender
Hand mirror Quick check how I look before making any presentation
Hidden menu flags Display country flag in language settings instead of locale.

After moving to mac professionally (second time in my career) I found that any operating sistem is not perfect enough. But there are many mac enthusiasts who are very enthusiastic about making it comfortable for any taste.


WWDC 2023

June 5, 2023

I have revived my blog a couple months ago already, but still have no time or desire to make new posts. Well, just closed wwdc keynode is a good opportunity to finally start typing.
This was a longest  presentation, that I saw and I have no desire to list all products that they preseted, just a couple thoughts:


Micro frontend

February 12, 2023

Currently on my main job we started working on new big project with three separate teams. And even we decided from the beginning to split backend parts, it took some time to discuss how we are going to work together on frontend part. Someone suggested to use microfrontends and it was a brilliant idea, except just one detail.
No one from us knows, what it is mean.
I would tell upfront, that I still don’t know what is it, but I have seen (and tried) some frameworks, that could be used for that.

bit.dev

This is not a framework, but more like set of tools to setup web components repository.

A component is a reusable, independently source-controlled module, that is stored in scopes and maintained in workspaces

It really reminded me of using git. Developer set up bit workspace (init or clone git repository), created new component, snapped (git committed) changes and them exported or imported (push/pull) into external scope (git repository).
Component can be anything, from smallest tag to complete web application. Good thing is that components could use different web frameworks and the in master application they can be all used together. Actually, there is no master application in this case - any application can connect to scope and reuse its components. This is a very nice way for code reusal and horizontal splitting , but not the one that we needed.

Luigi

This library provide some components, that can be shared among micro front-ends. Typically, those components are navigation bar, authorisation, user settings and some context switchers. All micro frontends are just separate applications and “main” application contain Luigi-core framework that just show iframes with each micro frontend. Very good for vertical splitting, when all micro frontends doesn’t share any internal components, but still should be accessible on one page. Everything is configurable from just one json file. Besides core, there is also client library, that each sub-application can include and use it to communicate with master app and other frontends.

Qiankun

At the end of our meeting nearly half of developers can pronounce name of this framework almost correctly. This is very similar to previous option, but even simpler: there is no setup for navigation bar or anything else. Just a master application, that contain links to other apps and display iframe into them. Other apps loaded as bundles and only on first open (unlike Luigi, where it needs to be properly configured). This is very simple and extremely easy to use (I’m saying that because I haven’t tried it yet by myself 😋). There are hooks to interact between applications and they can take arguments from parent app on mounting. Best of it - all sub applications can be used separately and then this “master” app with Qiankun added later in development process.

Not sure is any of this can be considered as proper micro-frontend. Of course, it would be nice and fancy to use something shiny like bit.dev, but I guess, benefits from this would only appear once developers amount would be much more than we have currently and once components can be really reused between apps. This way new micro-frontend would be build togegher like a lego from different bricks. But by now I see quantum or Luigi as simple, robust and reliable solution for teams that doesn’t want to share codebase.


Hello World for D3JS + SignalR + MobX (+ react?)

June 29, 2022

As I mentioned previously, I was thinking about creating series of posts about different technologies, that I use currently at work. I even created small home project, that contains them all, but as it turned out, it was much more funnier to write code than to write blog post about code. And my explanation was not complete enough, even inaccurate, I guess, because it was already a month since I wrote that proof of concept.
So I decided just to share a link into it here, as an example of simple use of:

Hope this examples would be usefull for someone. At least, it would be for me, when a couple years later I would try to recall, what have I done.
Link to repo: github


Previous →