March 5, 2018
I have finally removed admin page from this blog. I have tried several times to add .Net Core Identity , but each time it seemed to me as a overkill option to add a lot of things just to block access to admin page. So, I have just kept it open (since nobody read this blog, after all), which is not a good solution after all.
Recently I have found FileSystemWatcher class, that allows detect changes on directory. Now I’m using it to keep track on posts, which are simply heap of .md files, that I can get access over ssh.
Strange thing, that I have found: on Startup
class method Configure
can take limited list of possible arguments and if you want to resolve your dependencies there, you have to pass IServiceProvider
as a parameter and then resolve your classes from that container.
var fileParser = serviceProvider.GetService<IFileParserService>();
February 27, 2018
I have three pet projects. One of them is simple game for ios, another is bluetooth devices battery tracker, third one is this blog. I also participating now in .net core courses on microsoft academy and recently started free trial german course from babel. On my kindle I have in progress enthralling "Sapiens: A Brief History of Humankind" and enormous Steven King's "the Stand". I'm doing workouts and running at least 2 times a week. Also I'm trying to finish Civ V game party, keep track in Prey and, when I have time, watch "Brooklyn 9-9" and listen a dozen podcasts. Besides that, I have full time job, wife and kid, that requires full my attention , when they are nearby.
How did I cope with all this things? I'm not.
This hobby diversification lead to chaos and, really, I cant finish anything. I'm only at the beginning of trying to sort things up, but already have some thoughts.
This is overwhelming, definitely first world problem, but it's one of my biggest problem currently. Get things done, even if this thing is to finish blog post, that nobody will read or consume another game.
And I should cancel my netflix subscribtion, too.
January 11, 2018
It’s mid of jan and it definetelly a time find some last year results.
Gadget of the year? Airpods. And apple watch! They become the main way I’m interacting with my phone for the last time. Their simplicity (esp. airpods) and easy to use made them best apple product, that I have own since ipod shuffle.
Game of the year? The last station. Because of this game I have started to read Strugackij brothers again. And, despite it was Zelda and Switch release and hype year, The last station was the only one new game, that I have played in 2017.
Person of the year? My son. From nice small peace of meat, that can barelly hold his head, he upgraded to small cute human, which can run, tries to talk and explore the world around.
Technology of the year? .net core. I didnt know, that such thing even exist, I got rough idea, what is dot net one year ago and now I’m server developer and have blog, that is based on this. It’s rapidly evolving platform, although I’m not sure, that it is what I want to use as day to day tool until my retirement.
December 10, 2017
What’s the difference between interface and abstract class? I have heard this question on almost every interview, when last time I have looked for a job. In Swift, protocols are very close to Java/C# interfaces, and the can’t contain implementations.
protocol IListener {
var id : Int { get set }
mutating func setId(newId : Int) {
self.id = newId
}
}
Here Xcode throws a error:
error: protocol methods may not have bodies
But, as it turns out, it is possible to make protocol extensions, and that extension can have implementation:
protocol IListener {
var id : Int { get set }
}
extension IListener {
mutating func setId(newId : Int) {
self.id = newId
}
}
I have no idea, why it is so.
Another strange protocol limitation is that, if it use self
reference, it can be used only as a generic constraint. I.e., compilator deniedto compile this code:
protocol IListener : Hashable {
}
/* here some IListener implementation */
_ = Set<IListener> // error!
This is some strange things, that clearly demonstrated, that Swift is still in development mode. If extension protocol hack can be explained as some philosophy/architecture principle, but why protocol, that supposed to support hashing function, cannot be used as a container templat, is not clear for me.
November 24, 2017
I have started this blog in the beginning of June. Mostly it was not about content, but about making something quick and complete, using technologies, that I’m not very aware. The most unknown thing for me was docker, and how to mount external volumes into it. For sqlite it worked well, and first version appeared very quickly.
But then, I have tried to use Migrations, very powerful entity framework feature, that allows db versioning and making modifications to it relatively easy (if you are not working in 10+ branches among 6 developers in separate teams, but that night alerts story is different).
Turns out, that sqlite does not allow ALTER TABLE
and this makes continuous changes very hard (in context of proper usage .net core). Another alternatives were SQL Server, with es waaay too overkill for small blog engine (based on vm linux with 1 gb ram) and MySql, that didn’t have proper adapter to core 2.0 by that time. Also, the way, how I pack everything into container, seems to be broken and I cannot restore new packages on vm.
I spent a lot of time, figuring, how to make it proper and how to avoid these problems. Instead of adding features and improve code architecture, I was thinking about deployment process. This is especially difficult, when you have regular job, wife, son and, besides, you are addicted gamer. Last code update, that goes to production, was three months ago.
Conclusion? KISS.
Keep it simple, stupid.
One day on work I have nothing to do (well, I supposed to test some features for the third time, but no, thanks). Two evenings and base thing was ready. Nothings special, no Identity features, no entity framework (well, on in-memory database), no npm dependencies.
On start, engine search for *.md files, read some metadata (title & date) and create html and push them to memory db. Only one page, that take optional page number, query 10 posts from db and show it. No admin pages, no logins, no version history or any other fancy features. Of course, I have roadmap (notepad entry) with staff, that I want implement, but for now it’s more than enough. Let’s call it v 0.1. Several hours and you got the result.
Thats why we are making side projects, right?
100% JS-free