Previous page

Pet Project February ’18

Finally some time passed since I had finished my 2nd degree college, and now it’s time to go back to writing some private projects. Back to ASP.NET Core we go!

As first one I decided to review once again ASP.NET Core, with SignalR Core and Azure hosting platform, to be more ‘up to date’ with latest Microsoft solutions.

Code is available on GitHub, and currently(this commit) is based on version that I had used during deployment of this project — as it was used in real-world use case during last weekend Kawaii Time event in Wrocław. Hopefully I will find some more time to refactor it, as it definitelly is not a nicest code that I could write (well, the clock was ticking so I had to skip few steps).

In “continue reading” you can find my remarks about technologied used, issues that I had to overcome (or not) during implementation and some plans for future.

Basic assumptions

As I was responsible for technical-related things during that event (which mostly were just A/V and electricity stuff), I wanted to make life as simple as possible for my whole technical crew (after all I was their leader, and good leader tries to make his team job as easy as he can, right?) — and so the application concept was born.

Most basic description:

  1. Event had about 6 rooms where lectures were taking places. We wanted to receive reports about technical issues as soon as possible and with details, so we can grab whatever stuff we would need to fix it before going there.
  2. During previous events most of the issues were reported to me by phone, and afterwards I would call someone from the crew to fix that issue or go there myself. This application would allow us to share information about issues between each other without any problems.
  3. When nothing was happening, we were mostly chilling in our Tech-Crew room, and nobody was looking as his phone waiting for call, but there was always at least one notebook turned on then. So one additional requirement would be to make application send notification after some update to the list of issues has occured.
  4. As most of other people that we were working with are pranksters, I had expected for them to make some ‘fun reports’ just to trick us into going somewhere for pointless reason. That’s why users shouldn’t be able to to anything about their identity, they would have it set during deployment by me.
  5. I tried to minimise dependencies on other projects and libraries wherever possible.
  6. It was supposed to go live on 9th of February 2018, and work until end of event on 11th of February 2018.

First concept

I wanted to create ASP.NET WebAPI application on server-side, and deploy WPF application on computers that were in each of the rooms.

How to contain identity information?

I wanted to hardcore information about identity in code, and just deploy in each room .exe with different identity string deployed. Then I remembered that sometimes during the event we tend to replace computers that were in rooms with our laptops, and then I would have to find the proper version of application for that room once again.

My second idea was to pass it as some MD5-hashed value as parameter to the .exe file. As most of users were not-IT, that could possibly pass. But some of people from event organization team are, and that would allow for break of #4 of basic assumptions above.

In the end I decided to held everything on the web, and just create ‘Room’ role in ASP.NET Identity, and disallow logging out of the application for them (well, it wasn’t as secure — I just didn’t include form — if someone knew what to write to make standard log-out action from ASP.NET template he would log out either way). Also to use application you must log-in (you won’t even see index page). Registration was available only for Admin role (that would be only me), and I could just create any new account with one of the roles ad-hoc during event by simply filling the form.

Where to host it? Azure!

On the beginning I was planning to host it on my OVH server or on one of our crew members server using Docker container. As I decided that I don’t want to bother with configuration, I decided to go another way — Azure. I never did anything using Azure before, and just started learning about it during preparations for 70–486 Microsoft ASP.NET exam that I took in January. So I though — why not, this is a good chance to test it in practice!

And I was surprised how easy to configure it was. As I knew that deployment from Visual Studio 2017 (well, I still didn’t bring myself to buy Rider license) was easy, I was expecting some issues on the portal itself. Except for some weird refreshes during selection of the services that I wanted to manage and some issues during requesting free trial account my experience was very good, and I will probably

As for deployment — as I said I expected it to be easy. Still I had faced some issues with not being able to deploy code when application was running a few times, and I had to turn application off for deployment. I still don’t know what was an issue, as I mostly did deployments of the last day of the project with some small bug-fixes.

I also tried to integrate deployments with my GitHub account to make Continuous Integration for the project, but it created additional website on my trial account and sucked some found of my account before I figured that out, so I didn’t bother to try anymore. Maybe next time.

Hello ASP.NET Core, we haven’t seen each other in some time!

As I wasn’t working with ASP.NET Core for the last one and half year, I decided to finally finish some project in it. Most of the things changed from time I tested beta/RC versions, but it wasn’t so hard to catch-up.

Except for NPM/Bower. Bower is a default option in Visual Studio 2017, and from what I’ve read NPM is currently the main JS library manager. Well, I would gladly take some VS update which would make it a default one so I didn’t have to change it everytime I am starting a new project. Maybe that’s a small issue, but still an issue.

I had faced some issues with restoring libraries across three computers on which I did development, so in the end I included .min.js files in the repository to make life simpler for me. That’s not the best decision, but I didn’t want to waste time configuring everything each time I had to work on different computer.

I also wanted to use some light CSS library for the project, instead of default Bootstrap — and I sticked with PureCSS. My app wasn’t offering too much mobile support, but it worked, and I was happy with result.

I also used SignalR Core version Alpha using this blog entry — it took some more time to make it work that I expected, but I am satisfied with results and looking forward to use it in future. For me making SignalR independent from jQuery is a great step forward (#5 of my basic assumptions).

For database management I decided to use Entity Framework Core, with Code-first approach. While creating entities and everything was really easy, I forgot to include information that “Id” column for my only custom entity is Identity column and should be auto-incremented. As I couldn’t use migration to fix it (you need to drop column and recreate it — blah blah blah, Entity Framework you could do it for me!) I found out that only options for EF command line is “database update”(apply all migrations) and “database drop” — which of course dropped my Database, and I had to request it once again using Azure Portal. I expected some option to just clear database and recreate it based on the migrations, but that would be too easy, right?

Notification issues

There were also problems with notifications. As my approach for notifying my crew was to play audio sound after refreshing list of issues (which would happen using SignalR after change of issue status or creation of new issue by users), it worked on notebook without any problems. Every time someone from our crew refreshed page (or had it refreshed by SignalR) we heard “Hey Listen!” from Legend of Zelda: Ocarina of Time. I was very glad when after first day of using it first reaction for hearing that sentence for everyone from crew was to look at the application. Just what I wanted!

But it wasn’t working on our Android devices. My first implementation was simple JS new Audio(‘Navi.mp3’) , and I decided to replace it with HTML:

<audio controls autoplay>
    <source src=”~/Navi.mp3" type=”audio/mp3"> 
<audio controls autoplay>
<source src=”~/Navi.mp3" type=”audio/mp3">

I read on internet that that should work on the internet. Well — it didn’t.

Third attempt was to send push notifications to the phone that something happened — I tried to use Google Cloud Messaging to do it, but after about 20 minutes of investigation I learned that Google recommends to replace GCM with their new service — Firebase Cloud Messaging, and most tutorials were for GCM and ASP.NET MVC (not Core). Then I found PushSharp 4.0 library on GitHub supporting ASP.NET Core, but gave up after realizing that I would have to implement retrieving user tokens as well — and I didn’t had time for it, as we were already during event preparation, and I had to take care of my other tasks.

What else went wrong?

One thing that I didn’t take into consideration — some users replaced computers that were set-up in room with their own notebooks, and suddenly they couldn’t use issue raporter, as they didn’t had address/credentials to access correct account. This is something that I have to somehow manage before next usage of this app.

One another thing is my GitHub project connected with VS 2017 (especially in Polish) — by accident I added two solutions that I still didn’t figured out how to remove (probably I will have to clone repo using CLI git and fix it). Also while adding last commit I noticed after commiting that I added one bower repository that I didn’t want to include. Instead of amending commit I accidentally Reverted all changes. And then I had to do it again to make it back to the first commit version. That wasn’t exactly what I wanted to achieve with it. What went right?

I deployed it, it worked, both my crew and users used it. It took me three evenings after work to finish it. I also setup my development environments on all almost all of my devices which allows to do so, so I will probably have it easy to implement some new solutions in a future if I would only have access to some of it.

Plans for the nearest future:

I plan to write another blog post about my thoughts on passing Microsoft 70–483 and 70–486 exams. And go back to posting more often that once a year.

I also plan to rewrite my page using Bootstrap 4.0 (and this time without using some bought template like I did it last time — I have much more Front-end experience since that last version after all!), and do some other project — currently thinking about QR-Code based storage management system for NiuCon — bigger event that crew from this event is organising in August. During writing of this post website is not available, but probably will be a few months before August.


Previous page